#help-development

1 messages Β· Page 2208 of 1

tender shard
#

no you gotta run that in IntelliJ

#

in the maven tab, click the "m" button

stoic vigil
#

how to get a players target block, and look direction, and place an itemframe with the same direction there?

woeful crescent
#

why does playNote() say that it requires a note block when it seems to play regardless of a note block being there or not

chrome beacon
#

Probably outdated javadoc

slate mortar
#

click on the marked m up there

#

and enter the command

#

the terminal can be quite weird sometimes

dusk flicker
#

be patient

slate mortar
#

nvm for some reason it's a v, not an m

woeful crescent
#

nvm

#

mvn

#

mvn nvm mvn

#

mvnmnvmmmnmvmvnmnvmn

slate mortar
dusk flicker
#

^

stoic vigil
dusk flicker
#

then make a thread

visual tide
#

^

ornate patio
#

I'm having an issue where data in PDC is not saving after a reload

#

or the plugin fails to read the data

#

I've set this data using PDC on a horse, and you can even see it in the NBT data:

#

however when I try to read the data after a plugin reload using container.get(new NamespacedKey(plugin, "trust"), PersistentDataType.DOUBLE);, it returns null

stoic vigil
#

TargetBlock location & look direction

#

anyhow, if i send a command, it sends me the command, i executed, but also correctly run it o.0 someone has an idea?

tender shard
#

does someone know how to write a doclet for javadocs? e.g. like @FunctionalInterface adds this at the top of a class

#

I'd like to do the same with a custom annotation

dusk flicker
tender shard
dusk flicker
tender shard
dusk flicker
#

ah I was right

#

ty

stoic vigil
#

how can i make an itemstack with items with nbt data?

stoic vigil
tender shard
#

are you on 1.13 or lower?

stoic vigil
#

nope, 1.19

tender shard
#

you can directly turn this into an itemstack with Bukkit.getUnsafe() IIRC

stoic vigil
tender shard
#

no no

#

so first you'D have to split it up

#

into {"map":3}

#

then create an ItemStack with a FILLED_MAP

#

and then you can do ```java
Bukkit.getUnsafe().modifyItemStack(myStack,"{"map":3}");

#

do you ONLY need this for maps?

stoic vigil
#

jap

tender shard
#

ooh

#

then just create a FILLED_MAP, cast the ItemMeta to MapMeta and set the ID

#

definitely everything is better than raw NBT parsing

sacred mountain
#

guys its june

#

wtf

#

its not may

tender shard
#

guess I'm looking for custom tags / taglets instead of doclets

misty current
#

is there an intellij shortcut to automatically create an instanceof check and a class cast?

tardy delta
#

no lol

#

wait 'inst'

misty current
#

oh yea i've just found it

#

thanks

dapper harness
#

Is there a way of resetting the hasBeenPreviouslyKilled method of a world for the ender dragon ?

chrome beacon
#

Sounds like you might have to dig around in NMS

misty current
#

can you check if a BukkitTask is cancelled/has stopped running?

tardy delta
#

dont you mean a BukkitRunnable?

#

nvm

dapper harness
#

😩

misty current
#

why not

#

nms fun

chrome beacon
#

You're trying to access stuff that isn't meant to be accessed

#

So that's why you need NMS

shy shadow
#

Hey guys ! I made a plugin that make goats immortal :

public class Immortal implements Listener {

    @EventHandler
    public void onDamage(EntityDamageEvent e){
        Entity entity = e.getEntity();

        if (entity.getType() == EntityType.GOAT){
            e.setCancelled(true);
            entity.setInvulnerable(true);
                        
        }
    }
}```

Now I would like to make so if it's a player who damaged the goat, we send him a message, but idkn how to  verify who did damage to the goat πŸ€”
tardy delta
#

listen for the EntityDamageByEntityEvent

#

and get the damager

shy shadow
#

Yea I tried, but since they're invulnerable they don't take damage

#

I did this :

@EventHandler
    public void onPlayerAttackGoat(EntityDamageByEntityEvent event) {
        if(event.getEntity() instanceof Player p && event.getDamager() instanceof Goat) {
            p.sendMessage(ChatColor.RED + "Les chèvres sont immortelles sur le serveur !");
        }
   }```
tardy delta
#

wdym invulnerable?

#

it will detect the hit and cancel it

#

and send a message

#

ah

shy shadow
#

Mh, maybe a problem in my code then haha

tender shard
tardy delta
#

why listening to damage event if youre casting it anyways?

#

wait i think i get it

tender shard
tardy delta
#

so two separate listeners would work too

tender shard
#

sure but why not put it into one

tardy delta
#

cuz ugly idk πŸ˜‚

tender shard
#

I'd do it like this


    @EventHandler
    public void onGoatDamage(EntityDamageEvent event) {

        // Do not do anything if the victim is not a goat
        if(event.getEntityType() != EntityType.GOAT) {
            return;
        }

        // Cancel damaging the goat
        event.setCancelled(true);

        // If it's a player, send a message
        if(event instanceof EntityDamageByEntityEvent) {
            EntityDamageByEntityEvent damageByEntityEvent = (EntityDamageByEntityEvent) event; 
            Entity damager = damageByEntityEvent.getDamager();
            if(damager instanceof Player) {
                Player theJerk = (Player) damager;
                theJerk.sendMessage("Don't hurt goats you imbecile.");
            }
        }
    }
#

and I don't think it's ugly, also it requires one less reflection call on every damage event πŸ˜›

shadow gazelle
#

How can I get the wool that a sheep should drop from the color?

shy shadow
#

Oooh okay I see, thanks for the tip, i'm quite noob and didn't know the event instanceof EntityDamageByEntityEvent was a thing !

shadow gazelle
#

wait, switch

#

πŸ€¦β€β™‚οΈ

shy shadow
#

I'll try all that, thanks a lot for your help guys !!

tender shard
# shy shadow Oooh okay I see, thanks for the tip, i'm quite noob and didn't know the event in...

of course you can also use two listeners

    @EventHandler
    public void onGoatDamage(EntityDamageEvent event) {

        // Do not do anything if the victim is not a goat
        if(event.getEntityType() != EntityType.GOAT) {
            return;
        }

        // Cancel damaging the goat
        event.setCancelled(true);
    }
    
    @EventHandler
    public void onGoatDamageByPlayer(EntityDamageByEntityEvent event) {
        
        if(event.getEntityType() != EntityType.GOAT) {
            return;
        }
        
        if(event.getDamager() instanceof Player) {
            Player player = (Player) event.getDamager();
            player.sendMessage("Do not hurt the goat, you imbecile!");
        }
    }
shy shadow
tardy delta
#

you are a goat yourself smh

golden kelp
#

Do not hurt the goat, you imbecile!

slate mortar
#

what do i have to read again

#

i'm the only goat in here

shy shadow
#

I like goats haha

#

Thank you very much for ur help guys ❀️

tardy delta
slate mortar
#

it's true

#

that's me, took it after reading this chat

tardy delta
#

cute

slate mortar
#

thanks 🐐

tardy delta
#

lol

tender shard
tardy delta
#

ahahah

shy shadow
#

Looks great

vast raven
#

How to make a delay of 1 tick using tasks?

olive valve
#

like delaying code by one game tick?

vast raven
#

Y.

tardy delta
#

bot still dead gimme sec

vast raven
#

I need to play a sound more times.

vast raven
tardy delta
slate mortar
#

Bukkit.getScheduler().runTaskLater(plugin, () -> yourTask(), 1L) one tick

tardy delta
#

or just runTask is 1 tick too

vast raven
slate mortar
#

discord is so weird

tardy delta
#

did i show you the dark theme thingie?

slate mortar
#

why does it show "one blocked message", but at the same time offer a show message button

#

yea

#

looks nice

tardy delta
#

some more darkness in our lonely existence smh

#

πŸ˜‚

slate mortar
#

discord can get darker

#

can never be dark enough

vast raven
tardy delta
#

lets make the font dark so you cant see anything

slate mortar
#

it's not dark enough

#

it'll never be dark enough

#

oh btw fourteen

#

can you send me that thing in dm's?

vast raven
#

dark web stuff

slate mortar
#

so i can't forget it

tardy delta
#

sure

slate mortar
#

how are these done anyway, is it css?

tardy delta
#

you cant really say as its developed by discord itself

slate mortar
#

wait, so you didn't create that yourself?

tardy delta
#

it sets some kind of flag to either use preexisting code or download code to use

#

nah

slate mortar
#

i'm confused

tardy delta
#

dunno if its easy to inject stuff into discord

ivory sleet
#

the client?

slate mortar
#

afaik it is, but monkaTOS

ivory sleet
#

it is very easy if we talk about the mere client

ivory sleet
#

"glorified web browser"

#

whatever you wanna call it

slate mortar
#

lmfao

tardy delta
#

oh

slate mortar
#

someone needs to create something that is like discord, but doesn't suck dick

ivory sleet
#

people have done it

ivory sleet
#

just that their accounts get bamboozled

tardy delta
#

anyways for the people that think they are stuck with this, right click the gear icon right of your name scroll down and disable :)

slate mortar
#

i dont talk about shit that looks like irc 2012 bs

ivory sleet
#

better disc...

slate mortar
#

that's not what i meant

ivory sleet
#

completely from scratch

slate mortar
#

i meant an own standalone app

ivory sleet
#

?

#

ah

slate mortar
#

basically

ivory sleet
#

so not using 1 million bloated dependencies

slate mortar
#

bd is against tos, so i will probably never use it on this acc

ivory sleet
#

mye

#

sadly it is

slate mortar
#

discord doesnt give a shit tho

#

they even said so lol

ivory sleet
#

tho tbf, default discord isnt that bad all things considered

slate mortar
#

well

#

people want simple skin features for years now

#

and they dont even add it to nitro users

tardy delta
#

dunno why better discord would better apart from the themes

slate mortar
ivory sleet
#

you can see hidden channels

slate mortar
#

features that go deep into "enjoy getting banned"

ivory sleet
#

optimizations and other cool ignorable stuff

tardy delta
#

hmm fun

#

ok its too dark to see lol

slate mortar
#

afaik it can even log messages, which is probably the main reason discord even says it's against tos

ivory sleet
#

ye

tardy delta
#

discord bots ccan log messages too :)

slate mortar
#

yea, but bd can log like EVERYTHING

ivory sleet
#

which is dumb cuz like its so easy to log messages

slate mortar
#

be it dm's

#

or everything else

#

which is kinda big thing in terms of privacy

tardy delta
#

understandable

ivory sleet
#

mye, probably 1 reason why self bots arent allowed apart from being overly "harmful"

tardy delta
#

is discord now owned by microsoft or not?

ivory sleet
#

nope?

slate mortar
#

i dont think so

tardy delta
#

ah then they didnt finish the deal i guess

vocal cloud
#

Discord has yet to be bought out

tardy delta
#

heard smth about it

slate mortar
#

microsoft will probably buy activision tho, which i am kinda happy to hear

vocal cloud
#

That was like 2 years ago lol

ivory sleet
#

they just changed font or whatever it was, the colors

tardy delta
#

which still sucks tbh

ivory sleet
#

yeah lol

tender shard
#

ooooh I changed exactly 100 files in this commit

tardy delta
#

they have been doing so much stuff for nitro users

slate mortar
#

666 files committed

ivory sleet
#

its kinda nice

#

(for nitro users)

slate mortar
#

it's mostly just bullshit features

ivory sleet
#

200 servers

#

that one is enjoyable

slate mortar
#

yea treu

iron glade
#

Why is spigot fiat multipla and paper lambo hurracan when starting server?

tardy delta
#

well the profile banner thing is kinda fancy

slate mortar
#

because people will be on so many servers lmfao

ivory sleet
#

fr fr lol

slate mortar
#

discord begins to lag your entire pc if youre on more than 10 servers

#

no normal person is on more than like 20 servers

ivory sleet
#

hehe

vocal cloud
#

Depends on your PC

tardy delta
#

ye when i change to another server, my cpu usage goes up with 15% πŸ˜‚

ivory sleet
#

Im in like 173 iirc

slate mortar
#

ryzen 5 3600 overclocked to 4.2ghz too slow for discord lmfao

tardy delta
#

im in 25 lol

ivory sleet
#

rookie number x)

tender shard
#

how can I check how many servers I am on?

tardy delta
#

ryzen 5 4000 πŸ₯Ί

iron glade
#

15 here

iron glade
tardy delta
#

kekw

tender shard
#

52 currently

slate mortar
#

yeeeee i'm on 5 items in this account

#

5 serverss*

iron glade
#

poor 5 servers

tardy delta
#

lets see on my aly

ivory sleet
#

lol

tardy delta
#

ah two servers lol

#

i made it for testing stuff on my server

ivory sleet
#

😌

tardy delta
#

no friends :(

slate mortar
#

yea it's the account which i use for verified servers

vocal cloud
#

40 or so servers I think

slate mortar
#

on my other account it's probably 20 servers or smt

tender shard
#

why the heck does intellij count 43 errors but maven counts 0?!

slate mortar
#

intellij moment

ivory sleet
#

might be intellij specific inspections

iron glade
#

most of the errors intellij counts on me is grammar on variable names lmfao

tender shard
#

it was stuff like "package not found" etc

ivory sleet
#

strange

tender shard
#

yeah maven compiled it just fine

tender shard
#

custom javadoc tags are awesome

slate mortar
#

god i'm bored, got nothing to do

vocal cloud
#

Make a plugin to tell you how bored you are.

tender shard
slate mortar
#

no thanks

tardy delta
#

you can make my xams

#

exams

slate mortar
#

no thanks

hybrid spoke
#

you can help with our mmorpg server

tender shard
#

no wonder you're bored if you don't wanna do anything

slate mortar
#

god, no, not thanks

vocal cloud
#

Play some league and int botlane

tender shard
#

you can play chess with me

slate mortar
#

i'm bad at chess

#

like really bad lol

hybrid spoke
tender shard
#

good, then I'll win

slate mortar
#

i barely know how it works

hybrid spoke
ivory sleet
#

yes

vocal cloud
#

Go on YouTube find some 13 year olds smp server and ruin it kek

tender shard
#

I meant in half an hour or so

tardy delta
#

install a hacked client and go hypixel

#

then get an unban

slate mortar
#

i guess i'm gonna play genshin and enjoy the dm's, that call me weeb lmfao

hybrid spoke
slate mortar
#

see ya

tender shard
#

bb

iron glade
#

why does triumph only support paper?

tender shard
#

just try it and see when you get a NoSuchMethodException

vast raven
tardy delta
#

kinda made my day

tardy delta
tender shard
#

runTask is the same as runTaskLater(1)

vast raven
tender shard
tender shard
tardy delta
#

fun

iron glade
tardy delta
#

mismatched api/ server version?

tender shard
#

oh wait

#

what version?

#

yeah

iron glade
#

1.18.2

tender shard
#

PDC definitely has .has(NamespcaedKey)

#

ooh no wait

#

it only has has(NamespacedKey,PersistentDataType)

iron glade
#

I think it's cause of triump guis using components for the guis

tardy delta
#

compiler should say that

ocean sierra
#

anyone looking for a job?

tender shard
#

doesnt work means what exactly?

ivory sleet
tardy delta
tender shard
ocean sierra
#

I can find

tardy delta
#

bot dead

ivory sleet
#

Commands still not fixed :/

ocean sierra
#

Just a potential lead dev for our networks

tardy delta
#

is the bot actually down or what

hybrid spoke
tender shard
#

wait wait wait

ocean sierra
#

no site

ivory sleet
#

Think it probably crashed due to discord bumping their api every fucking second

tender shard
#

can staff still kick people?

hybrid spoke
#

website

ocean sierra
#

I'm just a manager bro, owner will hire

ivory sleet
#

Yes Alex

tardy delta
#

fun

hybrid spoke
tender shard
#

ok lol

#

would be funny if that wouldnt working

tardy delta
#

like optic does all the time lol

hybrid spoke
#

optic is a man of culture

river oracle
#

I don't understand a ?kick command why don't you just manually do it its so easy

hybrid spoke
#

who needs a bot to kick

tender shard
river oracle
#

all ?kick does is make you look like a fool if you do it wrong

ivory sleet
hybrid spoke
tardy delta
#

ok lets go to bed

#

goodnight

tender shard
#

what does getEnchants() return?

#

doesn't look like it returns Keyed

#

but rather a collection

hybrid spoke
tender shard
#

Collections obviously are not Keyed

#

yeah of course getKey doesnt work on that

#

I mean not for a namespacedkey

#

idk what you are even trying to do

hybrid spoke
#

map doesnt have a getKey function

ocean sierra
#

it's confidential bro

tender shard
#

then check if the map contains Enchantment.UNBREAKING

#

or do getOrDefault(Enchantment.UNBREAKING, 0) and see if it's 3

hybrid spoke
tender shard
#

it's not allowed to ask here for jobs etc anyway

#

go to the forums

ocean sierra
#

Bro it's a long story

river oracle
#

so I need to hire a dev, but I can't tell you what your making good luck

ivory sleet
#

containsKey

ocean sierra
#

lol

tender shard
#

learn java bruh

ocean sierra
#

That's why I'm good at my job bro, I provide the impossible

tender shard
#

it's a normal map

#

you should know how that works

#

google "java collections tutorial"

#

sure you can but you should have sorted it BEFORE you get a resultset

hybrid spoke
tender shard
#

you should sort in the query itself

#

SELECT * FROM whatever WHERE condition SORT BY key ASC

ocean sierra
#

it's not πŸ˜„

tender shard
#

for example

ocean sierra
#

but I can do anything

ivory sleet
tender shard
#

google "mysql sort by two columns"

vocal pine
#

just wondering - is there a way to move in taxicab way or move twice a tick

#

with minecarts at high speed they become kind of shitty because to corner you'd have to just cut it and fly across, wondering if theres a way to instead do X, then Z or vice versa

#

not asking for solution to be written just wondering if a fn for that exists and/or if i can call move twice and it will work how i imagine

ivory sleet
#

enchantments are not

tender shard
#

damn that's ugly

ivory sleet
#

just like, getEnchantments().get(blah) == level

tender shard
#
int knockbackLevel = meta.getEnchantLevel(Enchantment.KNOCKBACK);
#

no idea why you're doing it so extremely complicated

#

does your IDE not have any auto completion?

ivory sleet
#

in principle not

ocean sierra
#

no

#

😒

#

I need to learn development

#

any tips like I'm fr

hybrid spoke
#

same

ocean sierra
#

paying too much to you guys

#

could buy a lambo if I did it all by myself

vocal pine
#

learn from ripping apart other things

#

is always best way

grim ice
#

im bored

hybrid spoke
#

?learnjava

#

oh right

#

its down

ocean sierra
#

I do that time to time

grim ice
#

imagine bot dying

ocean sierra
#

in a dev discord

hybrid spoke
#

spa

#

m

grim ice
#

oopsie

ocean sierra
#

bro I wanted to read that

grim ice
#

for anyone who wants to send this while bot is down copy this

#
  - <https://www.codecademy.com/learn/learn-java>
  - <https://www.sololearn.com/learning/1068>
  - <https://www.learnjavaonline.org/>
  - <https://programmingbydoing.com/>
  - <https://docs.oracle.com/javase/tutorial/java/index.html>

The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
tender shard
#

lets create a github repo with all those bot commands

grim ice
#

lol

#

what would it have tho

hybrid spoke
#

a selfbot

#

with all those commands

grim ice
#

HMMMM

#

that would be cool if discord allowed it

hybrid spoke
#

yes

grim ice
#

whats the best indentation style in ur opinion yall

#

i vote for haskell!

ivory sleet
#

haskell's fine

#

tho c langs got it all figured out

grim ice
#

lol

grim ice
#

that thing looks awful

ivory sleet
#

you sure?

grim ice
#

100%

ivory sleet
#

alr tho wouldnt surprise me if you got all into fp

#

oop becomes boring after a while

grim ice
#

i still prefer oop

#

lel

eternal oxide
#

Haskel looks fine. uses a lot of formatting standards of Pascal

ivory sleet
grim ice
#

i mean i got kinda into fp

#

with Lua

#

but tables are still nothing compared to objects

#

lua legit works only on hashmaps btw lol

ivory sleet
#

x)

grim ice
#

an array is just a hashmap with a number as the key

#

and an object

#

is a hashmap

#

with each function name being the key

#

and the value is its function

#

same for variables

#

and people try so hard to mimic oop with it

waxen plinth
#

As if it's hard

#

Metatables are powerful

grim ice
#

lol

#

lua is nice tho

#

one of the few languages i can enjoy

river oracle
#

but the indexing in lua is disgusting

vocal pine
#
        int blocksZ = realSpeed.z > 0 ? Mth.ceil(realSpeed.z) : Mth.floor(realSpeed.z);
        int blocksCheck = Math.abs(blocksX) + Math.abs(blocksZ);```
More of a logic question than a development one - Is there a smarter/more efficient way to do this kind of calculation? Racking my brain and not finding anything but it seems slow
humble tulip
#

what is realspeed

supple carbon
#

Hello everyone, I want to make a configurable command system for example the player does not want the command /moderation but wants instead /staff or /admin, how I can do (and make sure that in the plugin.yml the command is detected in all cases?)

humble tulip
#

Entitybowshootevent

eternal oxide
tender shard
#

in ProjectileLaunchEvent, apply a PDC tag or metadata on the projectile if the shooter had your bow. Then in EntityDamageByEntityEvent check if the damager is a projectile and if it has the custom metadata or PDC tag

humble tulip
#

Check bow, add stuff to pdc, check arrow pdc on some damage event

eternal oxide
vocal pine
#

mmm doing absolute then ceiling would give same result actually and cut a check out, think that's the best ill get

humble tulip
#

Yeah

#

Was abt to say that

vocal pine
#

ye sorry lol couldn't figure it out at the time but best solution of any problem is walk away for 5 minutes :D

tender shard
vocal pine
#

yeah i have a huge notes list of ideas i had that i'll probably never make cus of that

eternal oxide
tall dragon
#

bruh i only sleep when i sleep...

eternal oxide
#

I've designed and written complete projects in my sleep. The mind is the clearest then

hexed rover
#

when I do that I wake up next morning and just look at the bs I did

echo basalt
sage patio
#

Hi, I've a config.yml contains smth like this

upgrades:
  Diamond_Sword:
    A: 2
    B: 4
  Iron_Sword:
    A: 3
    B: 5

And I want to check if item in players hand contains in this list to do something, any idea?

echo basalt
#

like optimizing Math.abs at the bit level

#

or rewriting String#split

#

to not support regex, but like 0.13% faster

tall dragon
#

insane performance gain!

echo basalt
#

worth it

sage patio
echo basalt
#

because they're neither lowercase or uppercase

#

or you could format your strings

#

but then someone types in lowercase and it messes with the checks

sage patio
echo basalt
#

getConfigurationSection("upgrades").getKeys(false)

kind hatch
echo basalt
#

you have sections, not a stringlist

sage patio
#

so how to convert them to a string?

kind hatch
#

Either change your config to the proper type or change how you access your data.

sage patio
#

or this is selection too

#

because its red

kind hatch
#

That's a section too.

sage patio
#

can u help me in easier way

kind hatch
#

If you want a string list, you need something like this:

mysection:
  - "String 1"
  - "String 2"
  - "String 3"
sage patio
kind hatch
#

Then you need to loop through your configuration sections.

#

You'll need to use a loop and iterate over #getConfigurationSection("path.to.your.value")#getKeys(false)
Then use that value to build the proper path in your config section.

sage patio
#

like this?

fossil lily
#

Should this stop Obsidian from being formed? (1.8.8)

#

Its not

sage patio
tall dragon
fossil lily
fickle helm
#

are historical javadocs available somewhere for spigot? specifically 1.18?

hexed rover
#

oh actually

#

miss read

#

its "BlockSpreadEvent"

fossil lily
#

oh

#

pain

#

thanks

molten turtle
river oracle
#

wha why would you obfuscate script :/ that sounds 300x more useless than obfuscating java and thats saying something

fossil lily
hexed rover
#

πŸ₯²

dusk flicker
#

what a joke

hexed rover
ivory sleet
alpine coral
#

Is there any way to modify / remove a players message in chat, after they've already sent it?
I'm trying to make a DiscordxInGame chat plugin for my server, and I'd like it to modify / remove a message thats, well, modified or removed in the textchannel.

#

I've seen in a youtube video before someones chat being censored out after it already showed up in chat

hexed rover
alpine coral
#

eh

#

well scrap that idea then

hexed rover
#

πŸ˜‚

dusk flicker
#

just set the players health

eternal oxide
#

^ Fire that event. If its not cancelled, set the players health

#

plugin.yml is invalid or missing

slate mortar
#

something in your yml is invalid

#

show us your plugin.yml

#

no they dont

#

you don't use / inside the yml either

#

agree

tender shard
#

lol someone on my discord made a funny plugin

slate mortar
#

yea

#

wait

#

you need to extract all jda libs into your jar

#

you use maven i suppose?

#

well, idk how to do it in maven tho

tender shard
slate mortar
#

i personally always use the artifact way

dusk flicker
#

you shading it?

slate mortar
#

because i run an integrated server in intellij

tender shard
dusk flicker
tender shard
#

the <plugin> with maven-shade-plugin is the important part

dusk flicker
#

alex's pom will help the most probably

tender shard
#

basically all you need is to add this

<plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.3.0</version>
                <configuration>
                    <minimizeJar>true</minimizeJar>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <phase>package</phase>
                    </execution>
                </executions>
            </plugin>
#

now when you do "mvn package" it includes JDA in your .jar

#

yeah

#

well the important parts are there

dusk flicker
#

make sure you have <plugins> and </plugins> (and obv the build one)

tender shard
#

what's the problem though?

#

you MUST use maven to compile

#

how did you compile?

#

and what jar are you using?

#

the one that's called "original-YourPlugin.jar"

#

or the "YourPlugin.jar"?

slate mortar
#

you can also just go this way btw

tender shard
#

no

#

you have to use the one WITHOUT original

#

and WITHOUT -shaded

#

just YourPlugin-1.0.0.jar

#

that's the correct one

#

is it also the "biggest" .jar in your folder?

slate mortar
#

it'll be big

tender shard
#

yeah it should be at least 5mb

slate mortar
#

12mb minimum if all jda libs are included

tender shard
#

so I got it down to 5mb

slate mortar
#

i just include everything to be safe

#

idk

#

if its 5 or 12 mb, i dont really care

tender shard
#

that only shades the classes that you need

#

well

#

not exactly

#

lets say it tries to not shade classes you dont need

#

yes

dire marsh
#

🚨 Reload is dangerous 🚨

slate mortar
#

never ever ever use plugman

#

please

#

it's the worst thing you can do

#

dont do that

dire marsh
#

still dangerous

dusk flicker
#

funny enough

#

were having this exact same convo in help server right now

crude estuary
#

why is Everyone Talking About Plugman Suddenly

tender shard
#

are you using jda.shutdown() or jda.shutdownNow() ?

slate mortar
#

why do such plugins exist

#

it gives me a headache

tender shard
crude estuary
tender shard
#

use shutdownNow()

dusk flicker
#

the one in help server was cause someone was complaining about it or smth like that

tender shard
#

shutdown() is async IIRC and shutdownNow() is blocking

crude estuary
dusk flicker
#

oh well close enough

crude estuary
#

Yeah

quaint mantle
#

i should make an auto updater plugin

dusk flicker
#

i will fucking find you

#

and I will fucking hurt you

quaint mantle
#

my code isnt bad bro

#

atleast not that bad

dusk flicker
#

much love, Rack

hybrid spoke
#

i should make a bedwars plugin

dire marsh
#

Reported for threat

crude estuary
#

Spiget Based?

dusk flicker
#

lol

quaint mantle
#

spiget cool

#

im actually making a spigot package manager in rust

dire marsh
dusk flicker
#

lmao

quaint mantle
#

thats easy

#
// use microsoft-provided allocator
#[cfg(target_os = "windows")]
#[global_allocator]
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
hybrid spoke
#

is it that hard?

#

im a beginner

quaint mantle
hybrid spoke
#

bedwars sounds doable in like 1-2 hours

crude estuary
#

Yeah, Bedwars is not that big of a Deal, a Small Bedwars at Least

dire marsh
#

well hypixel copied bedwars...

dusk flicker
#

with how shit hypixels software is

#

thats easy

crude estuary
#

with not too Much Features

quaint mantle
#

i was actually planning on making a bedwars plugin

dusk flicker
#

making it scalable would be the issue

quaint mantle
#

but i keep putting it off to work on this package manager

hybrid spoke
#

use IDEA

crude estuary
#

Intellij is Cool

dusk flicker
#

lol

dire marsh
#

ultimate bad

#

community gang

quaint mantle
#
[target.'cfg(target_os = "windows")'.dependencies]
mimalloc = { version = "0.1.17", default-features = false }

[target.'cfg(not(target_os = "windows"))'.dependencies]
jemalloc = { version = "0.3.0" }
hybrid spoke
dusk flicker
#

ultimate best

#

Thread.sleep(10000000)

#

for illegal reasons thats a joke

hybrid spoke
#

Thread.sleep(50)

#

?scheduling

eternal oxide
#

You can not wait on teh main thread

hybrid spoke
#

oh

tender shard
#

you mean you want to run something on every tick?

dusk flicker
#

bot is dead

#

sad

hybrid spoke
#

you could use a runTaskTimer

eternal oxide
#

Bukkit.getScheduler()

hybrid spoke
#

if you want to have it scheduled

#

so then either runTask or runTaskLater

dire marsh
#

ultimate is so expensive for features that I've never needed nor really know about

slate mortar
#

i think ultimate is mainly for commercial use

tender shard
#

I don't understand the problem you're having

#

then schedule a repeating task

#

no idea what you mean with "to the side"

slate mortar
#

uhh, just press enter?

#

lol

eternal oxide
#

The ONLY way to wait is with the scheduler

slate mortar
#

d.
d.d.d.
d.d.d
.d
.d.d.d.d.d.
d.d.d.d.d.d.d.d.d
.d.d.d.d.d
.d.d.d.d.
there you go

#

long code to the bottom

tender shard
#

no idea what you're talking about

#
        new BukkitRunnable() {
            int current = 0;
            @Override
            public void run() {
                
                // Run your code
                
                current++;
                if(current == 15) cancel();
            }
        }.runTaskTimer(this, 0, 1);
slate mortar
#

he means long lines basically

sly bay
#

hey there, how can i check if a item has been renamed by a anvil or if its display name has the display name because of a plugin?
e.g a anvil from my plugin has the name "super anvil", which will be needed for further interactions, but i dont want that a user renames his anvil to "super anvil" that he basically doesnt need the special item

tender shard
sly bay
tender shard
#

no

slate mortar
#

hope if have right syntax lol

#

i mean difference in a usecase-way, not just how it looks

tender shard
#

if you want to use the Consumer<BukkitTask>, then I can tell you what the difference is πŸ˜„

#

oh

#

huh

#

what you sent is the same

slate mortar
#

because ive read so many people rant at me when i use the one i sent

#

and i always wondered why

tender shard
#

well

#

your's wouldn't work at all

#

that's not a valid runnable

slate mortar
#

ah yea

#

remove the run in your head

#

editted

tender shard
#

you mean this I guess

        int current = 0;
        Bukkit.getScheduler().runTaskTimer(this, task -> {
            current++;
        }, 0,1);
#

?

slate mortar
#

i'm confused rn

quaint mantle
#

^ would need an AtomicInteger

tender shard
#

exactly

slate mortar
#

well

quaint mantle
#

google it

tender shard
#

mvn -T16 package

slate mortar
#

gimme time to write it in intellij with autocomplete lmfao

tender shard
#

oki

#

16 threads

#

with 1 thread my current project takes 1 minute 20 seconds. with 16 threads it takes 39 seconds

#

so yeah still long

slate mortar
#

edited

        Bukkit.getScheduler().runTaskTimer(plugin, new BukkitRunnable() {
            int current = 0;
            @Override
            public void run() {
                // Run your code
                current++;
                if (current == 15) cancel();
            }
        }, 0L, 1L);```
tender shard
dusk flicker
#

my huge ass project takes ~20 seconds on normal installs

#

I also run mvn clean install every time, no idea if there is a better way lol

slate mortar
#

yea, i wrote it in intellij directly

#

thats why i said i hope i had the syntax right

#

apparently i didnt lol

tender shard
#

that's deprecated and throws UNsupportedOperationException

tender shard
slate mortar
#

tf

tender shard
#

the first sets it to 10 hearts, the second sets it to their max health

#

depends what you consider "full"

#

well their maxHealth could be higher or lower than 10 hearts

eternal oxide
#

Attributes

humble tulip
#

cause sometimes u have ticks being 60ms, and another one to compensate is slightly faster at 40ms, thatd avg to 50, but if u set it to 50ms, then the avg would be like 55

#

Is that true^^

tender shard
#

if(message.contains(badWord))

#

I mean wth are you looking for

#

obviously

#

you can't

#

what if someone writes
oh shit. wtf is this and fogets the space, it would think shit.wtf is a domain

#

chat filters are almost always useless

hybrid spoke
#

you cant really filter a single word with regexs

hybrid spoke
#

a server ive worked for had a very strong one

tender shard
#

one can always get away with it

hybrid spoke
#

but they had to also manually maintain it

tender shard
#

wowowo.ogooooogoloeo.odoeo <- yo guys go to this website but remove every second letter

hybrid spoke
#

who would do this xD

tender shard
#

idk but it's possible to get around every chat filter

#

also it was just the stupidest example that came to my mind

#

the only proper chat filter is a staff member who is online

vocal cloud
#

Try to get around Robloxs chat Filter lol

humble tulip
#

Have a message queue and run the messages thru a a trained ai

tender shard
#

make people pay per message

humble tulip
#

New problem is now training ai

vocal cloud
#

Just use perspective API Kek

hybrid spoke
#

lets make a strong chatfilter

kind hatch
#

I'm having a weird issue with inventory names. I recently multi-language support to my plugin, which gives me the ability to translate the custom GUI names depending on which file is selected. I'm currently saving inventory instances in a map tied to a player UUID. The issue I'm facing is when the language setting is changed and the plugin is reloaded with the built in command, it grabs the proper value, but when the inventory is updated with one specific interaction, the name changes to the previous language name.

I'm currently reopening the GUI for the player so it can update that one item. (Probably not the best approach, but it's what I'm currently working with) I'm aware that some issues may occur if you open an inventory while another one is open, but I haven't had issues with this before. I also went ahead and made the player close the inventory before reopening it and the issue still occurred.

The part that baffles me is that the inventory instance doesn't change, but the inventory name does. The values grabbed from the language manager are also correct, so how could this happen?

#

My hands are cold.

tender shard
#
    private static String[] uselessWelcomeMessage = new String[] {
            "Hello dear server admin! You probably didn't know it,",
            "but this super awesome plugin is currently in the stage",
            "of enabling itself.",
            "",
            "Just wanted to let you know. Have a nice day!"
    };
humble tulip
#

Reload code to be specific

kind hatch
#

?paste

humble tulip
#

Bot no work

kind hatch
#

πŸ˜›

hybrid spoke
#

oh he's a magician

tender shard
#

I gotta send md5 and example for my custom string encryption but that requires that I first write an example plugin with lots of text... someone have any good ideas?

hybrid spoke
tender shard
#

naaah it should be at least a bit funny

humble tulip
humble tulip
#

Dead meme

kind hatch
#

Compilation of every meme essay. (What the fuck did you just say to me... Rawr x3 nuzzles, etc)

tender shard
#

good idea

kind hatch
#

Once the inventory opens, that specific instance is added to the map.

humble tulip
#

Have u tried manually setting tje inv text

#

And see if it changes

kind hatch
#

Wdym? You can only set the inventory name during creation with Bukkit#createInventory(). AFAIK, there is no method to rename the inventory once it has been created.

kind hatch
#

That's what confuses me about this. There is no reason the inventory name should change.

humble tulip
#

Yes

kind hatch
#

It's the same instance.

humble tulip
#

So are u sure u inv name is changing after its opened

hybrid spoke
#

it probably reopens the previous instance at some time

#

so either the cache is not cleared correctly

humble tulip
#

Or did u just open the wrong inv

#

Or set thw wrong name

hybrid spoke
#

or some other stuff is happening

kind hatch
#

Would that be a spigot cache?

hybrid spoke
#

there is no new inventory name without a new inventory

hybrid spoke
kind hatch
#

Hmm, well I add the inventory to the map every time it's created.
Map<UUID, Inventory> yourPreferencesGUIs = new HashMap<>();

Then I add the player to the map every time the openGUI() method is called. https://paste.md-5.net/gexeqivixi.cs
In theory this should keep an up to date instance. Maps can't have more than one value per key right?

sage patio
#

How I can search for a item stack in players inventory and for count and index of that item?

#

Like i want to know a player has 36 Dirt in slot 16 of inventory

kind hatch
humble tulip
#

Print the inv name

#

Title*

#

When it's being opened

#

You'll have an idea of what's going on

kind hatch
#

I'm not using InventoryViews so I don't have access to the #getTitle method.

#

Nvm, can access it in the event. Regardless, It's kinda useless as the title changes and it outputs what I see on the screen.

#

Just checked the hash codes of the inventories. They are the same.

#

I should also mention that if I change the item in the GUI, go back to a previous one or close it, then reopen it like I normally would, it has the proper title name. It's just for some reason that the name changes when using that one item, despite it being the same instance.

#

Also just confirmed that it's not a 1.19 issue either.

humble tulip
#

Then it's an issue with something you're doing

#

When you call ooenGui

#

Print the inventory name ur opening

sage patio
humble tulip
#

Line 30 is null

kind hatch
humble tulip
#

Well print the hash or something to identify the lang that's being opened

sage patio
ornate patio
#

how do i schedule a task to run every hour or so

sage patio
#
BukkitTask runnable = new BukkitRunnable() {
                    @Override
                    public void run() {
                        // code
                    }
                }.runTaskTimer(Main.getInstance(), delay, ticks);
humble tulip
#

Inventories don't return air

#

They retun null

sage patio
#

ow, lemme do another check

#

like player.getInventory().getItem(i) != null

dusk flicker
#

?main

humble tulip
#

Bot back

ornate patio
ornate patio
#

alright

#

thanks

humble tulip
#

Disabling plugin cancels all tasks

ornate patio
#

neat

kind hatch
sage patio
kind hatch
#

Ok, I think GodCipher was onto something. It looks like the inventory instances are somehow different, but seem to return the same one after about two or three clicks.

coarse elk
#

Does anyone know how to force update the inventory when using a packet to set a slot to an item? (i'm trying to have items in the players crafting slots)

quaint mantle
#

player.updateInventory

coarse elk
quaint mantle
#

try it

coarse elk
quaint mantle
#

ok

kind hatch
#

Now I'm really confused. Somehow the map gets an instance, then when I click in the inventory, it gets updated with the proper instance.

crisp steeple
coarse elk
kind hatch
#

Ok, I found out what I need to do to solve my issue. The problem is I don't fully understand what causes it. For some reason, the inventories that are created and the ones that are in my cache aren't matching up for the first two clicks. Maybe it has something with me creating the inventory in the constructor instead of the method.

quaint mantle
ornate patio
#

I'm trying to create a custom PersistentDataType with a primitive type of Byte to a complex type of Boolean

#

here's what I've got:

public class BooleanTagType implements PersistentDataType<Byte, Boolean> {
    @Override
    public Class<Byte> getPrimitiveType() {
        return Byte.class;
    }
    
    @Override
    public Class<Boolean> getComplexType() {
        return Boolean.class;
    }

    @Override
    public Byte toPrimitive(Boolean complex) {
        return complex ? (byte) 1 : (byte) 0;
    }

    @Override
    public Boolean fromPrimitive(Byte primitive) {
        return primitive == 1;
    }
}
#

the problem is

#

i have no idea what im doing lmao

#

im getting red underlines like this:

#

anyone know what I can do?

quaint mantle
#

not use vscode

ornate patio
#

shut

quaint mantle
#

try the quick fix

ornate patio
#

also I'm confused because both Byte and Boolean aren't primitives

ornate patio
river oracle
ornate patio
#

how do i use this custom type also

#

this clearly is in the same folder as the class definition

#

do i use new BooleanTagType() because that looks cursed

river oracle
#

if thats the type it takes

#

I'd assume though lo

sterile token
#

What dependencies do i have to shade from jackson library to use json and yaml?

quaint mantle
#

anyone here used redis before? It's my first time learning/using redis and I'm curious if you're meant to do stuff in redis asynchronously.

sterile token
#

Or if you are using Lettuce (Redis java client), its already contains sync, async and reactive things

#

20 ticks = 1 second

quaint mantle
#

1 tick = 50ms

sterile token
#

ticks are not ms, they are like a custom format

quaint mantle
#

ticks are indeed ms

#

every 50ms a tick is ran

sterile token
#

Oh ok

proper notch
#

The only thing you ever need to bear in mind is if a server lags and runs at less than 20TPS, something like a scheduled task will as a result run later.

That's only normally important if the tasks you are running are over a long duration.

sterile token
#

I dont know why they use it but meh

#

I would prefer everything based on ms

proper notch
#

Many game servers are tick based to provide a schedule where the server and client update each other.

#

It's then just a unit of measurement to represent how often this happens.

sterile token
#

Lol nice wiki

#

Inded its freaking fu** amazing the jackson library

#

Its has many sh***s

#

Im trying to discover what i need to shade for using yaml and json stuff but its so big that i cannot figure which i need to shade

#

Hahaha

crisp steeple
sterile token
#

dont worry please help me!!

#

Im really annoyed

crisp steeple
#

so are you making a plugin?

#

if so it should already just come with gson

sterile token
#

I know but i need Jackson

#

Its also not a plugin

#

Its a lib

proper notch
#

Why do u need jackson btw?

#

I used to use it and I've done all I can to use gson wherever possible.

sterile token
#

Because im doing a lib for parsing files in bungee and spigot plugins in the same way

proper notch
#

If it's causing you so many issues how come you don't use Gson and for example snakeyaml

humble tulip
#

how should i store logs for my plugin in a sql db?
there are diff types of logs, should each get it's own table?

sterile token
#

I dont know why most of people when find something diff to help just say "do it in another way"

#

ps

proper notch
#

Because you're clearly having a lot of problems with both the product and their documentation, and there are viable and much more popular alternatives.

#

I've also had a much nicer experience using Gson over Jackson

sterile token
#

I have all the code done, i just dont know what i need to shade

proper notch
#

wdym by u don't know what to shade?

#

If you're using the dependency and it's not provided by spigot or bungee, u need to shade it.

sterile token
#

Yeah that what im doing

#

So in shading the dependencies but then when i try the plugin it fallback because the shade dependency doesnt contain everything

#

That why im annoyed

river oracle
#

if your shading it correctly it should contain every module your using

proper notch
#

If you decompile the JAR, is what it says it's missing actually missing from that file?

Also make sure you're not accidentally using the methods from Spigot or Bungee, that might then be using the versions/libraries they shade separately.

sterile token
#

The only thing not being shaded is the ObjectMapper thing

solid sigil
sterile token
humble tulip
#

neither

#

i wanna log when purchases are made as well as items given to players

solid sigil
#

Are the purchases tied to the items given? Or are there also free items

undone axleBOT
proper notch
humble tulip
#

well u can purchase em or u can get em from a command

sterile token
proper notch
#

Oke I don't know maven so I probs won't be able to help any more, coz it seems like it's a maven issue, but if u send ur pom someone else can probs help.

humble tulip
#

so that's why i wanna log when they're given out, by who, if they paid, how much, who got it and how much

solid sigil
#

Yeah you could have them be separate tables with an null-optional foreign key to the purchase ID

sterile token
#
<build>
  <finalName>${file.artifact}</finalName>
  <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-shade-plugin</artifactId>
      <version>3.2.4</version>
      <executions>
        <execution>
          <phase>package</phase>
          <goals>
            <goal>shade</goal>
          </goals>
          <configuration>
            <relocations>
              <relocation>
              <pattern>com.fasterxml.jackson.core</pattern>                                             <shadedPattern>${parent.groupId}.${file.name}.com.fasterxml.jackson.core</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>com.fasterxml.jackson.dataformat</pattern>
                                    <shadedPattern>${parent.groupId}.${file.name}.com.fasterxml.jackson.dataformat</shadedPattern>
                                </relocation>
                            </relocations>
                            <createDependencyReducedPom>false</createDependencyReducedPom>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
#

I cannot fix the tab

#

Discord has horrible tabulation

earnest forum
#

?paste

undone axleBOT
earnest forum
#

oh its back

#

use this

sterile token
#

Ok

#

hey

#

bruh

#

Google doesnt respond

#

I cannot paste the code

#

Idk what happen to my shit pc, its has a ryzen 5 3600 and 32gb and runs worst than an old pc

#

Oh lmao, more than 5m to just copy-paste a ** code

quaint mantle
solid sigil
#

if meta not null return

quaint mantle
#

yep

#

i saw

#

as soon as i posted again

#

im so sad

solid sigil
#

lulz

#

rubber duck effect

quaint mantle
#

i looked for like an hour

#

couldnt find the issue

solid sigil
#

😭

upper vale
#

aside from that im not sure if checking if the toString of the lore contains a phrase is the best way to check for a custom item

solid sigil
#

agreed

quaint mantle
#

i tried just comparing item to item and it wouldnt work

#

same for display name etc

#

lore is what works for whatever reason

solid sigil
#

what about instance of your enchantment

quaint mantle
#

more weapons will be like that so it wouldnt work

solid sigil
#

i dont think i catch your meaning fully

earnest forum
#

use pdc

upper vale
#

NBT would probably the easiest

#

or that on newer versions

solid sigil
#

more weapons will have same enchant but iff effects?

earnest forum
#

give all your customs items a pdc tag that is the same

solid sigil
#

diff*

earnest forum
#

CUSTOM_ITEM_ID or something

sterile token
solid sigil
quaint mantle
#

this weapon will have more effects, another weapon will do the same as this one but thats it

solid sigil
#

oh im dumb, i though lore was tied to the enchant for some reason

quaint mantle
#

its a vanilla enchant

solid sigil
#

yeah i realized

quaint mantle
solid sigil
#

haha typos do be killin

#

idk theres prob some sort of custon item id, but that solution works

#

does the effect trigger now?

quaint mantle
#

ill look into pdc

#

ill try later, im not on the server that the plugin is in

sterile token
#

Scala is another sub-lang as Kotlin and Groovy right?

solid sigil
#

Im not sure exactly but Google says it runs on JVM & makes java bytecode

#

So it's in the java family

#

But it has more functional programming abilities

sterile token
#

Allright

#

Thanks

#

Because Kotlin and Groovy runs over the JVM

solid sigil
#

Nice

#

I've never used groovy, what's it good for

sterile token
#

I never used Kotlin neither Groovy

#

I know that Kotlin in most cases for plugins, 100 lines on java = 50 lines in kotlin (same logic)

solid sigil
#

Haha yeah I've written in kotlin it's a little more condensed

#

But I still like java tbh

sterile token
#

Also i want to take out an question

#

Spigot scoreboards are done in kotlin, because they can have more lines than doing it on java?

#

Or that its wrong

proper notch
#

The language is completely unrelated to the game's features.

solid sigil
#

Doesn't kotlin have less lines?

proper notch
#

It's just different code to get the same end result.

solid sigil
#

^

sterile token
proper notch
#

Yes

sterile token
#

So i dont know why a developer told me that kotlin scoreboards support more lines