#help-development

1 messages · Page 84 of 1

grim ice
#

check for yourself

flint coyote
#

I mean it does save code but it would also give away that you aren't very experienced with java 💀

frosty tinsel
#

Random implements RandomGenerator

flint coyote
#

I see 😂 But that's what SecureRandom is made for aswell

grim ice
#

ahhh

#

yeah

#

you still should use ThreadLocalRandom

#

if u dont have a custom seed

frosty tinsel
#

Probably yea

grim ice
#

it's not probable, it's pretty much a fact

azure hawk
#

why is it like that and now "Sand" / "Stone"!?

flint coyote
#

I mean it doesn't hurt to use it. + you don't have to create an instance of random. So go for it

median trench
#

Hello! Is there any way to get the source location (or entity if possible) of ClientboundSoundEntityPacket (PacketPlayOutSoundEntity)? I don't want to use protocollib

tardy delta
#

hmm would implementing this syntax with acf work, i dont want to check string manually but rather use a subcommand

#

altho it assumes here that the syntax is /vanish <target>

#

and passing in "on" in the subcommand annotation would let it think the syntax is /vanish on <player>

flint coyote
#

without knowing anything about acf I just wanna mention that I love annotations

tardy delta
#

ill hope acf will create an impl based on my syntax annotation

grim ice
tardy delta
#

rather annotations than alot of if else statements

flint coyote
agile anvil
#

See javadoc

flint coyote
median trench
tardy delta
#

i dont understand spring

#

it looks horrible

flint coyote
#

It's great if you value readability over a little performance. Especially when it only runs at startup

grim ice
flint coyote
#

spring is quite complex but once you understand their way of DI, some annotations and the Model, Repository, Controller structure it's a very nice framework

grim ice
#

thats one of the reasons people hate on lombok

#

though, lombok functionality is extremely straight forward

tardy delta
#

lombok has nice stuff

grim ice
#

so my personal opinion is that lombok is fine

#

but in acf tbh

#

stuff doesnt really explain what they do

#

and there are a shit ton of annotations it gets confusing

#

someone who doesnt know acf

#

will give up reading ur code

azure hawk
#

ok

#

ill try

agile anvil
# azure hawk

?jd-s refers to that to find the right method. Search in Material

undone axleBOT
grim ice
#

me spending weeks with no one being able to solve my problem because practically no one knows how:

flint coyote
#

I only use simple lombok annotations. Getter, Setter and AllArgsConstructor aswell as NoArgsConstructor

tardy delta
#

ah acf doesnt give a shit about syntax annotations

#

its just to inform the user

azure hawk
#

xd

agile anvil
#

Item#getItemStack#getType

ancient plank
#

name()

agile anvil
#

Or something like that

tardy delta
#

blc 🤡

azure hawk
azure hawk
dusk flicker
#

javadocs formattings

tulip nimbus
#

You don't use # in your code, that's just for JavaDocs

#

Still use . haha

onyx fjord
#

and has a feature!

#

doesnt trigger any anti IP/domain discord filters

#

smart

azure hawk
#

yeah

#

smart boiiii

onyx fjord
#

yes i made java

tardy delta
#

:: is cooler

onyx fjord
azure hawk
#

ok better but its not the name so like "Grass Block" instead of "GRASS_BLOCK"

onyx fjord
#

also # is usually used for command line

#

like root on gnu/linux

tardy delta
#

smh gotta edit my command syntax cuz acf doesnt want to work with me

azure hawk
#

i was trying to fixx that with dropping the item and getting the name

#

in 1.18.2 its working

agile anvil
azure hawk
#

but not 1.8 for some reson

agile anvil
ancient plank
#

1.8 more like kekw

onyx fjord
#

developing on 1.8 is harder because of the poor nature

azure hawk
#

im coding a gamemode

onyx fjord
#

you have to do dumb workarounds

azure hawk
#

for a server

tulip nimbus
#

Although this will change depending on the server language!!!

onyx fjord
#

what does OP want to do

#

something with material names from version to version?

azure hawk
#

theres no item#getLocalizedName()

tardy delta
#

theres no item class either

tulip nimbus
#

ItemStack#getItemMeta()#getLocalizedName()

agile anvil
#

Adelemphi i thought it was already the case 👀

onyx fjord
#

@azure hawk what do you want to do

azure hawk
ancient plank
onyx fjord
#

lmao

agile anvil
#

Item is an Entity

azure hawk
onyx fjord
#

yes do that

azure hawk
#

k

onyx fjord
#

then get meta

azure hawk
#

still no localized name

#

:(

tardy delta
#

1.8?

azure hawk
#

yes still

agile anvil
#

Yes :)

ancient plank
#

1.8 moment

small current
#

wait i have a code for it

azure hawk
agile anvil
#

You'll earn some time trying to convince your client switching to last versions 🐌

#

End of 1.8 topic

small current
#
        String itemName;

        ItemMeta meta = item.getItemMeta();
        if (meta.hasDisplayName()) {
            itemName = meta.getDisplayName();
        } else {

            String[] split = item.getType().toString().split("_");
            StringBuilder builder = new StringBuilder();

            for (String part : split) {
                builder.append(String.valueOf(part.charAt(0)).toUpperCase()).append(part.substring(1).toLowerCase());
            }

            itemName = builder.toString();
        }
azure hawk
#

its only for the pvp based section

azure hawk
#

thats a long boi

ashen quest
median trench
#

Can I mute a firework explosion? Or is it completly clientside?

agile anvil
iron glade
#

What I've been using for a while now at least

onyx fjord
#

can i make player run command as OP or i need to give player OP and then remove it?

#

i need a safe way

iron glade
#

let console sender run it or smth like that

onyx fjord
#

the command needs player to execute it

iron glade
#

the player executes it

agile anvil
iron glade
#

and you make whatever he executed run by console

onyx fjord
#

actually ill just move command logic to util class

azure hawk
iron glade
azure hawk
#

oh

#

ok

boreal seal
#

did i do it correctly?

#

like it does some error

#

the stacktrance is not understandble

agile anvil
#

Send the stacktrace

boreal seal
#

java.sql.SQLException: Operand should contain 1 column(s)

#

thats the only thing is nessacary from stacktrace

#

the rest is the event that uses it

#

so

#

GROUP_CONCAT isnt a column

#

how to retrive the string that it creates?

agile anvil
#

You try to fetch a players from a request right ?

boreal seal
#

fetch == ???

#

PLAYERNAME is an column in the database

#

its a binanry UUID

#

its fine it works

misty ingot
#

hey so I have a string with the name of a type of mode (for ex. ZOMBIE)
and I need to turn that string into an EntityType value
how do I do that

agile anvil
#

I'd remove the GROUP_CONCAT, and concatenate java side

misty ingot
#
            CreatureSpawner spawner = (CreatureSpawner) e.getBlockPlaced().getState();
            try{
                spawner.setSpawnedType( (EntityType) e.getItemInHand().getItemMeta().getLore().get(0));
            }catch (Exception err){}
            spawner.update();

Im dumb
help me

boreal seal
#

Entity.StringValueOf(TheEntity)...

agile anvil
#

So Select PLAYERNAME and loop through results

boreal seal
#

use stringvalue method

misty ingot
#

im dumb.

boreal seal
misty ingot
#

I forgot valueof existed

boreal seal
#

but i used flatfile

#

looping would be way too many requests to database isnt soluation

agile anvil
#

Oh yeah

boreal seal
#

in the past i did a stringbuilder and looped thru it

#

how do i retrive the the group_concat

boreal seal
agile anvil
#

Try naming it (add "AS coolname")

ashen quest
#

does .setOp inform the console?

agile anvil
#

And I never used GROUP_CONCAT so I won't help you with that

agile anvil
boreal seal
ashen quest
#

why?

boreal seal
#

because its not an event like /op

ashen quest
#

um

#

then

boreal seal
#

you cloud make a listener for it

ashen quest
#

ty

boreal seal
#

to inform the console

#

its oftenly used by backdoors. plugins

ashen quest
#

i m making a security plugin and i wanted to avoid malwares from oping without the owner knowing

boreal seal
#

loop thru op list

#

every 5 min

ashen quest
#

oo thats smort

boreal seal
#

or make OP ussless make only users that are in list able to use commands

ashen quest
#
  • i use discord channel as a logging thing, so i can send an embed which would confirm if that player should be opied
boreal seal
#

true webhooks are great thing

azure hawk
boreal seal
agile anvil
#

You forgot the getType

boreal seal
ashen quest
#

Whats Item

agile anvil
#

Entity representing dropped item

boreal seal
#

How to return GROUP_CONCAT from sql command.?>

azure hawk
#

well

#

xd

#

cringe moment

boreal seal
#

lmao

vivid skiff
#

How can i add multi version support to my plugin?

iron glade
#

which versions you wanna support?

misty ingot
#

is there a way to store some data in a placed block? (ex. the name of the person who placed it)

iron glade
#

if blocks have a pdc, in the pdc

vivid skiff
iron glade
#

can't remember whether they have

agile anvil
iron glade
flint coyote
#

what if he uses new functions that don't exist in older version tho

vivid skiff
blissful forge
#

Hello! One question, is this the correct way to query "If there is a player's head in a player's helmet slot"?

               for (Player p : Bukkit.getServer().getOnlinePlayers()) {
                   if (p.getInventory().getHelmet() == p.getInventory().getHelmet().getType() == Material.PLAYER_HEAD) {
                       
                   }```
tardy delta
#

helmet might be null ig

blissful forge
#

should be != null ?

boreal seal
#

what version are you running it in?

iron glade
boreal seal
#

in newer version you can literally store data in blocks

#

in older using files

iron glade
#

What's the problem?

boreal seal
#

spoon feed me too now

iron glade
#

okay what problem are you facing rn

boreal seal
#
 PreparedStatement ps = conn.prepareStatement("SELECT " +
                "GROUP_CONCAT(DISTINCT PLAYERNAME SEPARATOR ',') AS NBOL" +
                "FROM blocks WHERE (X,Y,Z) BETWEEN (?,?,?) AND (?,?,?)")) {
#

what the syntax error here

#

for god sake

iron glade
#

oh mysql?

boreal seal
#

yeah

#

its a bit different from java

#

lol

iron glade
#

bah been forever since I used it the last time

boreal seal
#

bruh

#

the stacktrace be like

#

syntax error sends me towards the whole command

quaint mantle
#

missing space before FROM

misty ingot
boreal seal
#

use presist data

#

it GET wiped on restarts as wel

#

important to mention

#

otherwise maybe stick to MySQL/MongoDB

onyx fjord
#

can i give bukkit scheduler ID and stop it later using that?

boreal seal
#

or flatfiles

onyx fjord
#

oh i can make it an int

boreal seal
#

like not real real ID yeah

#

well it run on ticks

#

so you can check if time == time for example and cancel it

#

time == config...

#

just think out of box honestly i'm in love with schedulers lol

boreal seal
#

make a hashmap contaning key (scheudlers) and boolean

#

and everytime before executing what the runnable should

#

check if boolean is true or false

#

@onyx fjord you get my logic???

#

Key == ID , boolean

onyx fjord
#

all good man

boreal seal
#

so its good?

onyx fjord
#

i made it a static variable that i later cancelled

boreal seal
#

or i didnt understand you correctly?

#

i think the hashmap is pretty good way to handle it

#

would be really easy

onyx fjord
#

ye it was even easier than you said

boreal seal
#

;D

iron glade
tardy delta
#

whats the problem?

#

you shouldnt be storing taskid but rather the bukkittask itself

#

?scheduling

undone axleBOT
tardy delta
onyx fjord
#

yes i use top one

tardy delta
#

wondering why they havent deprecated them tho

onyx fjord
#

my code has no warnings 🥵

tardy delta
#

wondering when the damn acf is going to make docs on its gh page

#

current docs kinda suck

boreal seal
#

how good are you with sql?

tardy delta
#

good enough

onyx fjord
#

okay am i tripping

#

or there is method to remove only on of item in slot

tardy delta
#

could you rephrase that

boreal seal
#

PreparedStatement ps = conn.prepareStatement("SELECT " +
"GROUP_CONCAT(DISTINCT PLAYERNAME SEPARATOR ',') AS NBOL" +
"FROM blocks WHERE (X,Y,Z) BETWEEN (?,?,?) AND (?,?,?)")) {

#

what is my syntax problem here?

iron glade
#

missing space before FROM

tardy delta
#

^^

grim ice
#

so um, I had this bug with minecraft where any versions 1.18 and above would freeze every 1 second, meaning the graph would be some thing like this:
300 -> 1 - 250 -> 1..etc
so well i used some jvm args i got recommended which ill send later,
and that fixed it, however after 3 days the bug is back, but i realized something, when the bug was fixed i had 2gb allocated and it was using 2.7gb, but when the bug still existed it was using 2gb flat, so i thought maybe that was the problem, i just tried allocating 3gb or 4gb and no luck.
the jvm args are here: https://pastebin.com/3mK9yZFf

#

still unsolved

tardy delta
#

also add an ; after your statement

boreal seal
#

; exists

#

its just not the full code

#

lol

#

thanks

grim ice
#

i tried restarting my pc

boreal seal
#

didnt notice the space gonna test it quickly

onyx fjord
tardy delta
#

i switched to my other gpu and restarted my pc a few times

grim ice
#

nothing happened

tardy delta
#

hmm itemstack api kinda sucks

iron glade
onyx fjord
#

i swear there was some method

#

what if its 1 and i remove 1

#

it gets removed?

#

or some weird shit happens

tardy delta
#

weird shit i believe

boreal seal
#

cant get it

#

wtf

iron glade
#

idk honestly

boreal seal
#

but i said it as

iron glade
#

try it out and if weird shit happens check it in code and just remove the item

tardy delta
boreal seal
#

EXPERTTT HELP ME

#

what docs

#

i used AS NBOL

#

which is operetion method as

tardy delta
#

sql impl speciffic docs

boreal seal
#

how do i retun an group_concat

#

thanks for the answer man the docs didnt help me in general

onyx fjord
#

edit: i was tripping

boreal seal
#

to understand how to retrive it

#

i need spoon feed here.

#

imma read docs one again later

#

and do a small research

#

but i dont think docs gonna help me with syntax problems

#

fucking mysql looks like python

tardy delta
#

whast this shit DISTINCT PLAYERNAME SEPARATOR ','

#

well i know distinct

#

wondering if that separator is valid there

boreal seal
#

check docs

#

to understand what it means

#

same as your answer

#

its from the docs

#

basically

#

it sperates the coloumns

#

so it will be A,B,C

#

like that

tardy delta
#

you might wanto to remove the space you have between separator and ' '

boreal seal
#

i need to keep ',' since this is the char

#

that will appear between PLAYERNAME columons output

#

FourteenBrush ill be back later im gonnna hit the gym

#

WE ARE GOING TO THE GYM!!@O#$J!)$)*U$@$&)

#

❤️

tardy delta
#

i said remove space between separator and ','

#

hope that works

boreal seal
#

i hope too

#

not gonna be stuck with it for more then 10 hours

#

not sure

#

SELECT SOME_OPERATION AS columnName

#

columnName is a dummy to represent the output

#

anyway bro not sure why it doesnt works

#

ill be back later

#

i fucking hate mysqll

#

but > yaml as storage

#

lmao

#

and still some how more powerful then flatfiles

#

WE GO TO THE GYMMMMMMMMMMMMMMMM

sterile token
boreal seal
#

hi alex

#

i have to go bro i got 1:26h

#

till i have to sleep

#

ill be back in 50 min

sharp heart
#

hello guys, I have a problem, the event InventoryClickEvent isn't called when player place item in an inventory and move mouse really faster after, do someone know why ?

grim ice
#

@tardy delta also it gets worse after letting the gaame run for a few minutes

#

it becomes pretty much like your video

tardy delta
#

hows your gpu usage?

midnight patrol
#

if i make a plugin with /enchant will it override the vanilla command or do i have to do something like PlayerCommandPreprocessEvent

quaint mantle
#

it will unless you type /minecraft:enchant

azure hawk
#

why is this cut of tf

gaunt pendant
#

how to make colored space?

zealous osprey
azure hawk
#

ok

agile anvil
gaunt pendant
#

But that's a phrase in Czech :D

onyx fjord
#

but back in the day there was 0 slot size

azure hawk
#

what the heck its still sending the join message BUT ITS NULL/""

zealous osprey
#

instead of doing event.setJoinMessage("") do event.setJoinMessage(null)

tardy delta
#

^^

quaint mantle
#

yeah null is not an empty string

azure hawk
#

but it didnt work too

zealous osprey
tardy delta
#

null will remove it

zealous osprey
agile anvil
#

Another plugin overrides it

vivid skiff
#

How can i make right click event work if player has two item instead of one, for example now if i have 1 of gunpowder in hand and right click with it i wear it, but if i have two of gunpowder nothing happends

grim ice
vivid skiff
# iron glade What's your current code?
    public void MaskEvent(PlayerInteractEvent event) {
        Player p = event.getPlayer();
        if (event.getHand() == EquipmentSlot.HAND) {
            ItemStack itemInHand = p.getItemInHand();
            if (event.getPlayer().getInventory().getItemInMainHand().equals(Utils.getMask())) {
                if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK) {
                    if (p.getInventory().getHelmet() != null) {
                        p.sendMessage(ConfigUtils.PREFIX.getFormattedString() + ConfigUtils.ALREADY_WEARING.getFormattedString());


                    } else {
                        if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK) {


                            p.getInventory().setHelmet(Utils.getMask());
                            p.getInventory().removeItem(Utils.getMask());
                            p.sendMessage(ConfigUtils.PREFIX.getFormattedString() + ConfigUtils.WORE.getFormattedString());
                            p.playSound(p.getLocation(), Sound.ITEM_ARMOR_EQUIP_LEATHER, 1.0F, 1.0F);
                            TabAPI.getInstance().getTeamManager().hideNametag(TabAPI.getInstance().getPlayer(p.getName()));
                        }
                    }

                }
            }
        }
    }```
iron glade
#

maybe using #isSimilar instead of #equals does the job

#
if (event.getPlayer().getInventory()``` also just use the player variable here you declared earlier on
vivid skiff
zealous osprey
#

I'd also recommend using guard clauses.
They are something like this: if (event.getHand() != EquipmentSlot.HAND) return;.
So instead of checking if something is true, you check if it's false and then just skipp the rest of the code.
Makes it easier to read, as all of those brackets at the end disappear

iron glade
#

also called a guard condition

zealous osprey
azure hawk
#

nah

#

i am dumb

#

i forgot something

zealous osprey
#

That's nice to hear :D

unborn kiln
onyx fjord
#

i can spawn fake but collectable dropped items only thru packets right?

#

aka when you collect it dissapears

agile anvil
tardy delta
#

smh people should learn naming conventions

onyx fjord
tardy delta
#

que?

#

are we french now

agile anvil
agile anvil
onyx fjord
#

ah

#

too much work

tardy delta
#

que is french

onyx fjord
#

idk

#

i think it means what

#

anywayws

iron glade
#

yep

onyx fjord
#

can i replace itemstack in PlayerFishEvent?

iron glade
#

my 6 years of being forced to learn french can confirm

agile anvil
onyx fjord
#

without changing all the meta in every line

#

i only get these

agile anvil
round finch
#

all meta?

why not just replace it with new meta?

hazy parrot
iron glade
#

quoi is what

agile anvil
#

Quoi 😂

onyx fjord
agile anvil
#

Ça manque de français ici

onyx fjord
#

i msut somehow get itemstack

iron glade
onyx fjord
#

OR

#

i can cast

round finch
iron glade
#

I hate all those apostrophes

onyx fjord
#

bruh it was so simple

agile anvil
onyx fjord
#

i just had to cast

round finch
#

is it a item entity?

onyx fjord
#

to Item entity

#

i almost fell for bad advice trap

#

someone said "remove item and spawn new one with the same velocity"

#

💀

#

always read entire posts

sonic sky
#

Does anyone here have experience with XPath expressions?

onyx fjord
#

?ask

undone axleBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!

sonic sky
#

Okay, is this a valid XPath expression?

//div[@id='content-container-single-col']/*/section[@id='combo-display']/*//li/a
#

I'm not sure how I can share the webpage though

sharp heart
sterile token
#

?notworking

undone axleBOT
#

"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.

sterile token
#

☝️

sharp heart
#

InventoryDragEvent isn't called when we do what I showed on the gif

patent fox
#

how can i make an entity follow a player with path finders remapped?

grim ice
#

dont work is a perfectly valid sentence

#

!!

sterile token
patent fox
#

yes

sly surge
somber hull
#
    public PremiumDataManager(BetterSpawners plugin) {
        configFile = new File(plugin.getDataFolder(), "premiumdata.json");
        initializeConfig();
    }
    
    /**
     * Should only be used by this class to grab/create the config
     */
    private void initializeConfig() {
        try {
            if (!configFile.exists()) {
                FileWriter fileWriter = new FileWriter(configFile);
                gson.toJson(new PremiumData(), fileWriter);
                fileWriter.close();
            }
            
            config = gson.fromJson(new FileReader(configFile), PremiumData.class);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
#
[11:27:02] [Server thread/WARN]: java.io.IOException: The system cannot find the path specified
[11:27:02] [Server thread/WARN]:        at java.base/java.io.WinNTFileSystem.createFileExclusively(Native Method)
[11:27:02] [Server thread/WARN]:        at java.base/java.io.File.createNewFile(File.java:1043)
[11:27:02] [Server thread/WARN]:        at me.silentprogram.betterspawnerspremium.config.PremiumDataManager.initializeConfig(PremiumDataManager.java:32)
[11:27:02] [Server thread/WARN]:        at me.silentprogram.betterspawnerspremium.config.PremiumDataManager.<init>(PremiumDataManager.java:23)
[11:27:02] [Server thread/WARN]:        at me.silentprogram.betterspawnerspremium.BetterSpawners.onEnable(BetterSpawners.java:19)
[11:27:02] [Server thread/WARN]:        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264)
[11:27:02] [Server thread/WARN]:        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:342)
[11:27:02] [Server thread/WARN]:        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:479)
[11:27:02] [Server thread/WARN]:        at org.bukkit.craftbukkit.v1_19_R1.CraftServer.enablePlugin(CraftServer.java:523)
[11:27:02] [Server thread/WARN]:        at org.bukkit.craftbukkit.v1_19_R1.CraftServer.enablePlugins(CraftServer.java:437)
[11:27:02] [Server thread/WARN]:        at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:582)
[11:27:02] [Server thread/WARN]:        at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:401)
[11:27:02] [Server thread/WARN]:        at net.minecraft.server.dedicated.DedicatedServer.e(DedicatedServer.java:255)
[11:27:02] [Server thread/WARN]:        at net.minecraft.server.MinecraftServer.v(MinecraftServer.java:966)
[11:27:02] [Server thread/WARN]:        at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:291)
[11:27:02] [Server thread/WARN]:        at java.base/java.lang.Thread.run(Thread.java:833)
#

Idk whats wrong

#

But i have another class that is exactly like it for a different purpose

sharp heart
somber hull
#

Same exact code

somber hull
# somber hull But i have another class that is exactly like it for a different purpose

heres the other class that works

    public DataManager(StartupClass plugin) {
        configFile = new File(plugin.getPlugin().getDataFolder(), "data.json");
        initializeConfig();
    }
    
    /**
     * Should only be used by this class to grab/create the config
     */
    private void initializeConfig() {
        try {
            if (!configFile.exists()) {
                FileWriter fileWriter = new FileWriter(configFile);
                gson.toJson(new Data(), fileWriter);
                fileWriter.close();
            }
            
            config = gson.fromJson(new FileReader(configFile), Data.class);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
azure hawk
#

but i wanna use it in other classed duh

iron glade
hazy parrot
somber hull
#

The plugin.getPlugin returns the regular main class

#

Its due to me switching project structure halfway through making the plugin

#

Im gonna go through and fix some of it later

azure hawk
#

i have a brain lag rn

hazy parrot
azure hawk
#

D:

hazy parrot
iron glade
somber hull
hazy parrot
#

You should check that

iron glade
somber hull
#

I put the datamanager instantiation above my main startup method

azure hawk
somber hull
iron glade
azure hawk
#

i did

somber hull
azure hawk
#

and!?

iron glade
#

at least refactor it to "Main"

#

if you really wanna use main

hazy parrot
somber hull
# azure hawk i did

Class names should always be Capitalised methods should always be likeThis with the first word lowercase and proceeding words capitalised, and theres a lot mroe you will get yelled at for

azure hawk
#

but i like it

#

so i leave it that way

somber hull
#

💀

iron glade
#

oh god

azure hawk
#

xd

hazy parrot
#

?learnjava

undone axleBOT
somber hull
#

lmao

azure hawk
#

that has nothing to do with ?learnjava

hazy parrot
#

It has

azure hawk
#

i can decide how i name my files

somber hull
#

everything

#

NO

azure hawk
#

and you guys can cry about it

somber hull
#

naming conventions are everything

hazy parrot
#

Not just naming convention

somber hull
#

readability

hazy parrot
#

You show 0 knowledge in your code

azure hawk
#

hi

hazy parrot
#

Hello

somber hull
#

us rn (especially me)

boreal python
#

Anyway to get the strength of an enchantment? Like if i wanted to get the value of the items sharpness?

hazy parrot
#

That doesn't mean I'm new to java :3

#

Anyway back to topic

somber hull
#

leme find it

#

ItemStack#getEnchantmentLevel

#

@boreal python

boreal python
#

Tysm

somber hull
#

np

somber hull
# boreal python Tysm

I would recomend looking in the documentation before asking, cause its a great skill to not depend on others and it took me like a minute to find it

#

To find the documentation i litterally just look up spigot docs on google

boreal python
#

Yeah. Im at school rn and the doc is blocked

somber hull
#

OOF

#

Yea my school does that too

boreal python
#

HUGE L

iron glade
#

I bet phub is not blocked

#

but stuff like java docs

hazy parrot
#

Why would school block docs

boreal python
#

Some random ass java compiler was blocked too

quaint mantle
hazy parrot
#

I mean if they want you to have every method on top of your head idk

iron glade
quaint mantle
#

lol

onyx fjord
#

ok umm i have problem

String json = gson.toJson(((Player) sender).getInventory().getItemInMainHand().serialize());

this works fine when the item is normal item with nothing else

but when i add enchants or lore or anything to it it breaks,
https://paste.md-5.net/bureroquni.bash

somber hull
grim ice
#

i just died

somber hull
#

And the spigot site is labeled as "gaming"

grim ice
#

literally i just died

iron glade
quaint mantle
#

oh yeah, I cringed when I read that.

#

I name my main classes like "<PluginName>Plugin"

#

That way it isn't confusing to server owners when they have to try and figure out what the issue is

somber hull
#

Are you saving it as a material or smthng

iron glade
onyx fjord
#

thats it

iron glade
#

Is dis a prublem?

grim ice
#

that's good

iron glade
#

cause I like it that way

quaint mantle
#

"Naming conventions are suggestions right?"

  • People when they wonder why nobody will help them because their code is unreadable.
grim ice
#

my new pfp is awesome

iron glade
#

naming conventions are like the easiest thing you can do right and some people still don't get it or don't wanna

somber hull
onyx fjord
quaint mantle
grim ice
somber hull
#

ok

grim ice
#

even though i refused to learn java at first

#

it was just because i was learning from a very boring website

iron glade
grim ice
#

by default i think of someone as a better dev than me

#

unless they prove me wrong

iron glade
#

ikr

#

like creating strings named some_string

quaint mantle
#

My snobby and narcissistic behavior when I was young is the main driver for why I try to be as helpful as I can nowadays. It's something I look at and deeply regret.

iron glade
#

well, at least ur making the best out of your "mistakes"

quaint mantle
#

Some people just don't learn though. I've had to deal with a few people like that over the years.

iron glade
#

Some people just be like that, "I dOnT nEeD yOuR hElP"

quaint mantle
iron glade
#

yea

#

I remember back in the day when I was googling my issue and creating a thread in the spigot forums

iron glade
#

Well I'm still googling :d

quaint mantle
#

Those were the days

sonic sky
#

Same here, 4 years deep

iron glade
#

But since there's a discord you'll probably get an answer here way faster

quaint mantle
#

I didn't start with java though, I learned how to write GML which is proprietary language originating in a tool called GameMaker

#

I branched out to java and C# after

sonic sky
#

Worst thing an aspiring developer can do is to stay developing for Minecraft

#

Biggest shock when a lot of the stuff I've learned from Spigot can't be widely applied

iron glade
#

I bet

quaint mantle
#

it turns out developing plugins for an existing and entrenched api doesn't really apply to other things lol

sonic sky
#

Springs pretty fun

quaint mantle
#

Sometimes I use PascalCase for my function names in java if I've been writing C# recently

#

By accident of course

sonic sky
#

Could be worse

quaint mantle
#

Yep

sonic sky
#

THIS_WOULD_BE_WORSE()

quaint mantle
#

Ah yes, the C++ macro

sonic sky
#

Error?

iron glade
#

and what's in your super class?

sonic sky
#

Never really delved into NMS

#

But make sure everything you're importing is from the craftbukkit library

#

That always got me

#

Send the packet to the player to display it

#

Fairly sure it works like that

hasty prawn
#

Because you have to spawn it yourself. ((CraftWorld) loc.getWorld()).addEntity(this, CreatureSpawnEvent.SpawnReason.CUSTOM);

zenith lichen
#

Hi, i'm trying to make a bungeecord version of the grimAC using bungee channels and grimAPI. the channels worked until i tryied to send a message to all of the staffers when there is a PluginMessageEvent. Now, when i try to connect with my client using hack, whenever there is a flag event, i get kicked for "EOFException : null @ java.io.DataInputStream:321". Down here i leave the main file, the PluginMessageListener and the FlagEvent.

onyx fjord
#
    public static ItemStack itemStackArrayFromBase64(String data) throws IOException {
        try {
            ByteArrayInputStream inputStream = new ByteArrayInputStream(Base64Coder.decodeLines(data));
            BukkitObjectInputStream dataInput = new BukkitObjectInputStream(inputStream);
            ItemStack[] items = new ItemStack[dataInput.readInt()];
            items[0] = (ItemStack) dataInput.readObject();
            dataInput.close();
            return items[0];
        } catch (ClassNotFoundException ex) {
            throw new IOException(ex);
        }
    }

any idea why this throws https://paste.md-5.net/ekedinaruh.sql error?

the data is equal to rO0ABXNyABpvcmcuYnVra2l0LnV0aWwuaW8uV3JhcHBlcvJQR+zxEm8FAgABTAADbWFwdAAPTGph dmEvdXRpbC9NYXA7eHBzcgA1Y29tLmdvb2dsZS5jb21tb24uY29sbGVjdC5JbW11dGFibGVNYXAk U2VyaWFsaXplZEZvcm0AAAAAAAAAAAIAAkwABGtleXN0ABJMamF2YS9sYW5nL09iamVjdDtMAAZ2 YWx1ZXNxAH4ABHhwdXIAE1tMamF2YS5sYW5nLk9iamVjdDuQzlifEHMpbAIAAHhwAAAABHQAAj09 dAABdnQABHR5cGV0AARtZXRhdXEAfgAGAAAABHQAHm9yZy5idWtraXQuaW52ZW50b3J5Lkl0ZW1T dGFja3NyABFqYXZhLmxhbmcuSW50ZWdlchLioKT3gYc4AgABSQAFdmFsdWV4cgAQamF2YS5sYW5n Lk51bWJlcoaslR0LlOCLAgAAeHAAAAwwdAALRklTSElOR19ST0RzcQB+AABzcQB+AAN1cQB+AAYA AAAEcQB+AAh0AAltZXRhLXR5cGV0AAhlbmNoYW50c3QABkRhbWFnZXVxAH4ABgAAAAR0AAhJdGVt TWV0YXQAClVOU1BFQ0lGSUNzcgA3Y29tLmdvb2dsZS5jb21tb24uY29sbGVjdC5JbW11dGFibGVC aU1hcCRTZXJpYWxpemVkRm9ybQAAAAAAAAAAAgAAeHEAfgADdXEAfgAGAAAAAXQABExVUkV1cQB+ AAYAAAABc3EAfgAOAAAAA3NxAH4ADgAAAAI=

hasty prawn
#

You probably have to set it? Not really sure what that is

#

Show

crisp steeple
#

you just do (ItemStack[]) input.readObject()

hasty prawn
#

readObject returns a single ItemStack I believe

#

let me try with my Base64 decoder and see if it works

crisp steeple
#

i always just serialize an itemstack array, and then read it as an itemstack array

hasty prawn
#

Player must be null then

#

Send the canUse method

hasty prawn
#

?paste the entire PetGoal

undone axleBOT
hasty prawn
#

Paste the error also

torn badge
#

Why are you using distance() and then squaring the radius?

hasty prawn
#

Then how do you know its null

#

The only way it can be null is if the Player you're passing is null

#

Did your compiler say this or the server?

#

Put it back, try again, and send the code with that there. ?paste it all into one thing

onyx fjord
#

okay

#

google def trolled me

#

so Gson wasnt working for me right?

#

and just after i remove gson, i got logged out of youtube and gmail

#

I SWEAR its like first time in 2 years

#

and now i readded gson and it works

honest echo
#

how do i set enchantment level of item

onyx fjord
#

do you guys know any utility that can deserialize ItemStack from json?

honest echo
#

i see a method for ItemStack#getEnchantmentLevel but not for setting it

onyx fjord
#

which method

#

actually ill show code first

#

maybe something is wrong

#
                    Gson gson = new Gson();
                    Map<String, Object> map = gson.fromJson(
                            config.getString("items." + item + ".item"),
                            new TypeToken<Map<String, Object>>() {
                            }.getType());
                    fishedItemStack = ItemStack.deserialize(map);
#

i get the item but with no enchants, lore, name

#

just plain material

#

the config string is equal to

#
    item: '{"v":3120,"type":"FISHING_ROD","meta":{"enchantments":{"Enchantment[minecraft:lure, LURE]":3},"attributeModifiers":{},"repairCost":0,"hideFlag":0,"unbreakable":false,"damage":7,"placeableKeys":[],"destroyableKeys":[],"unhandledTags":{},"persistentDataContainer":{"customDataTags":{},"registry":{"CREATE_ADAPTER":{},"adapters":{}},"adapterContext":{"registry":{"CREATE_ADAPTER":{},"adapters":{}}}},"version":3120}}'
lost matrix
# onyx fjord maybe something is wrong

This breaks for skulls because spigot serialisation is bad

  private static final Gson gson = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting().create();

  public static String toJson(ItemStack itemStack) {
    return gson.toJson(itemStack.serialize());
  }

  public static ItemStack fromJson(String json) {
    return ItemStack.deserialize(gson.fromJson(json, new TypeToken<Map<String, Object>>(){}.getType()));
  }
#

BukkitObjectOutputStream is more reliable

grim ice
#

anyone has an idea of a library i can make?

onyx fjord
#

Can't test cuz on mobile rn

lost matrix
#

Sure. This will work with everything but skulls

onyx fjord
#

Any reason why my previous one breaks lol

#

I don't think that should happen

#

Bug in spigot deserialization?

lost matrix
#

You know that you can just throw an ItemStack in a config file, right?

#

No json needed

onyx fjord
#

Could you drop me an example how it looks in yanl?

#

Yaml

#

What I do is make items from hand, but configuration that can be done manually might also be handy

lost matrix
#
    ItemStack itemStack = ...;
    FileConfiguration configuration = ...;
    configuration.set("some.path", itemStack);

And getting it

    FileConfiguration configuration = ...;
    ItemStack itemStack = configuration.getItemStack("some.path");
onyx fjord
#

I meant like in the yml file it's made

#

Oh wait ik what you mean

hasty prawn
#

Looks like this I'm pretty sure

onyx fjord
#

I'm wondering if it'll work in boostedyaml

#

I guess so?

lost matrix
#

It only works for spigots yml configuration api because it uses the ConfigurationSerializable interface.

onyx fjord
#

What if I load boostedyaml config and edit it in spigot api

#

It's still just yaml file

#

I'll test tomorrow and see, thanks

azure hawk
#

why is this not cancelling the sheduler

hasty prawn
#

How are you getting scID

azure hawk
agile anvil
#

?scheduling

undone axleBOT
agile anvil
hasty prawn
#

Use runTaskTimerAsynchronously and call BukkitTask#cancel on what that returns.

agile anvil
hazy parrot
agile anvil
undone axleBOT
hazy parrot
#

also BukkitTask is interface, it cant have static method

azure hawk
#

ok

azure hawk
#

and how do i cancel it?

hazy parrot
#

Pretty sure DessieYT and Rolyn already told you

agile anvil
agile anvil
agile anvil
agile anvil
#

There is a category named Cancelling a Task

#

How didn't you find the anwser ??

agile anvil
zenith lichen
#

no

#

the problem is that every body gets kicked

agile anvil
#

Ohhh

zenith lichen
#

and the anti cheat sometimes has false-flags

azure hawk
#

task.cancel

#

i dongt get it

#

its too late

#

11 pm

undone axleBOT
azure hawk
#

jup

#

nice one

#

?brainpleaseworkagain

glossy venture
#

not a Runnable

#

and doing Runnable. will only list static methods

azure hawk
glossy venture
#

wont work

#

^

glossy venture
#

the task is a parameter from the lambda function passed to BukkitScheduler#runTask

#

of type BukkitTask

azure hawk
hazy parrot
glossy venture
#

bro

grim ice
hazy parrot
#

use only one

glossy venture
grim ice
#

i knew u were gonna say that

#

BUT

#

i have a good reply made for that

grim ice
glossy venture
grim ice
#

whos drinking booze while watching a static tv?

#

im so funny

glossy venture
glossy venture
#

shit

marble copper
#

Hey

#

What's the difference bet ween itemsadder and model engine

glossy venture
#
grim ice
#

public enum Sex {
MALE, FEMALE
}

#

bro...

#

oracle is homophobic

glossy venture
#

Sex not gender

grim ice
#

where are the other 900 genders!!!

glossy venture
#

wheres dreamsexual????/?/////???

grim ice
#

named gender

#

of type sex

#

Sex gender;

marble copper
glossy venture
#

exposed

marble copper
#

Trans

#

Now tell

#

What's the difference bet ween itemsadder and model engine

grim ice
#

so fucking gross uhhh imagine homohpboic

marble copper
#

Cuz I helpedbu

marble copper
#

I'm gay

glossy venture
glossy venture
grim ice
#

ur mother is fucking gay

#

ok

glossy venture
#

but research it yourself

#

i dont know

marble copper
#

I'm here researching

glossy venture
#

in the wrong channels asking devs

marble copper
#

🔎

glossy venture
#

go to the plugin page and read the desc

marble copper
#

Cuz models r like developer stuff

marble copper
#

Btw ur status have rong grammer

#

It's you're not your lol

#

It's fucked you're mom

glossy venture
#

stop

#

anyways model engine only lists entities as feature

#

while itemsadder lists a whole variety

#

but no model generation shit

#

so i think its pretty clear

marble copper
#

Ok so itemsadder can do everything model engine can

glossy venture
#

no

marble copper
glossy venture
#

model engine can convert models made in applications to a list of entities like armor stands to make custom models in vanilla minecraft

#

and it packages the required textures in a resource pack automatically

#

thats the selling point of model engine

marble copper
#

Items adder also can transfer to pack

#

I think

glossy venture
#

itemsadder allows you to add items, blocks, chat emotes

#

etc

marble copper
#

20 x 5000

#

100k

glossy venture
#

what

marble copper
#

20 x 500

grim ice
#

Um

marble copper
#

5k?

glossy venture
#

bro

marble copper
#

10k

glossy venture
#

what

#

are you talking about

marble copper
#

So 100k + 10k

grim ice
#

is an integer object that holds a number "90000" the same size in ram as an object that holds a number "2,000,000,000"?

marble copper
#

10k that's how much items adder made

marble copper
#

110k*

#

🤑

glossy venture
#

damnnnnnn

dull whale
#

So how do I make custom guis with itemsadder again

sinful rapids
#
        Player player = (Player) sender;
        char[] alpha = "abcdopefnm".toCharArray();
        Random r = new Random();
        String random = "";
        for (int i = 0; i < 9; i++) {
            random += alpha[r.nextInt(alpha.length)];
        }
player.setDisplayName(random);

Doesn't change the player's nickname, what did I do wrong?

agile anvil
agile anvil
vernal minnow
#

Hey guys, how do i access the GameProfile? because it cant found and or import that class. If it helps i use maven

agile anvil
agile anvil
grim ice
#

so um, I had this bug with minecraft where any versions 1.18 and above would freeze every 1 second, meaning the graph would be some thing like this:
300 -> 1 - 250 -> 1..etc
so well i used some jvm args i got recommended which ill send later,
and that fixed it, however after 3 days the bug is back, but i realized something, when the bug was fixed i had 2gb allocated and it was using 2.7gb, but when the bug still existed it was using 2gb flat, so i thought maybe that was the problem, i just tried allocating 3gb or 4gb and no luck.
the jvm args are here: https://pastebin.com/3mK9yZFf

#

though i doubt i can fix this

#

without people like frostalf and mfnalex online

vernal minnow
agile anvil
agile anvil
grim ice
#

no, only on my pc

#

also this is client side

#

just for ur information

chrome beacon
#

Spark time

agile anvil
grim ice
#

whats that

agile anvil
grim ice
#

i closed all my apps

#

and any app that isnt related to java or mc

#

and my java ver works for any version 1.17 or lower

#

lol

#

what even is spark time

agile anvil
grim ice
craggy plover
#

how would I code a shop that uses vault?

#

I'm very stuck xD

wary harness
#

anyone knows

#

where is registerEnchantment

#

called?

#

in which class

#

because I can't figure it out

vocal cloud
#

Are you trying to register your own enchantments?

wary harness
#

no I am curious

#

when vanilla ecnahnts

#

are registered

hard socket
#

anyone help?

#

this happen when i click an item

wary harness
#

from where does registerEnchantment get's called?

hard socket
#

code

#

other things work only leave doesnt

opal juniper
# hard socket anyone help?

@eternal night (sorry for ping but i saw you were online and you often know stuff about internals) you know anything about this? i have seen it before but the whole stacktrace is just nms, not plugin

hard socket
vocal cloud
#

It's because a backend assert fails

opal juniper
#

mm, yeah but idk why

#

you could probs find the assert easy enough, i’m not at my pc

deep escarp
#

Is there a specific reason (or jira issue) why the library loader doesn't have the option to specify repositories but only pulls from central?

waxen plinth
#

checkEmpty

#

I can guess what that does

opal juniper
#

yeah, i thought i saw it before with negative itemstack amounts but he doesn’t seem to be doing that

hard socket
#

its 1

#

like the others

vocal cloud
#

Just cancel the interact event and still run your code

#

see if that fixes it

waxen plinth
#

The repo is just a fileserver

#

You could easily alter the jar that's sent over

hard socket
waxen plinth
#

Maven central is a trusted repo

hard socket
#

cancel it and intract with it?

waxen plinth
#

Generally it's safe to assume code you get from it isn't malware

#

At the very least, it's moderated

#

Arbitrary repos could be owned by an attacker

vocal cloud
#

What is being interacted with

opal juniper
waxen plinth
#

Detection

opal juniper
#

hmm, yeah i suppose

hard socket
deep escarp
waxen plinth
#

If you had your own repo you could make it return a legit jar at first

vocal cloud
opal juniper
#

you wouldn’t think that JDA would be malware

waxen plinth
hard socket
opal juniper
#

what item

waxen plinth
#

Or other resource staff

opal juniper
#

how do they get the item

hard socket
#

leave

#

item leave

opal juniper
vocal cloud
#

what is item leave

#

you mean leaves?

hard socket
#

yes

deep escarp
waxen plinth
#

So the reason you can't specify another repo is the same reason they would take down your resource if it's downloading and executing arbitrary code

opal juniper
# hard socket yes

is it a specific slimeball, or just one that you get from the creative inventory for example

#

like is there pdc to it

waxen plinth
#

Ideally we would just have a plugin package manager

#

But nope

opal juniper
#

paste builditem please

hard socket
opal juniper
#

whole class

vocal cloud
#

Is it possible that the material isn't parsed properly and that's throwing the assert trap

deep escarp
opal juniper
deep escarp
waxen plinth
#

¯_(ツ)_/¯

opal juniper
waxen plinth
#

Yeah

waxen plinth
#

And ideally it would be able to resolve non-plugin deps too

#

Probably still maven central only though

opal juniper
#

you ignore the amount

hard socket
#

ahhh happy days

opal juniper
#

also, with these builder patterns, the itemstack is normally created on the parse() call, not just returned

hard socket
#

frick me

opal juniper
hard socket
#

alr thx i will try

vocal cloud
waxen plinth
#

I've seen that error before when setting the item used in the event to null without cancelling the event

hard socket
vocal cloud
#

Like I said

vocal cloud
#

Cancel the event

hard socket
#

for all items?

vocal cloud
#

For the items you want to cancel it on

#

When item you want clicked, cancel

hard socket
vocal cloud
#

Sure

hard socket
#

aight i will test

#

damn it works

#

but can you explain why please?

vocal cloud
#

Are you modifying what's in he players hand at any point?

#

Cause that error usually stems from that

hard socket
#

em no

hard socket
#

thats it

#

to slot 8 (9)

vocal cloud
#

Point being, if the event isn't canceled and you mess with something before the event ends, chances are you made a valid event invalid and that's what caused the error

hard socket
#

tyvr < 3

snow lava
#

hi, i wanna know which is the best way create a custom recipe that involves a certain amount of items per slot.

grim ice
#

there are some smart ppl online now

#

so reposting

#

so um, I had this bug with minecraft where any versions 1.18 and above would freeze every 1 second, meaning the graph would be some thing like this:
300 -> 1 - 250 -> 1..etc
so well i used some jvm args i got recommended which ill send later,
and that fixed it, however after 3 days the bug is back, but i realized something, when the bug was fixed i had 2gb allocated and it was using 2.7gb, but when the bug still existed it was using 2gb flat, so i thought maybe that was the problem, i just tried allocating 3gb or 4gb and no luck.
the jvm args are here: https://pastebin.com/3mK9yZFf

tulip nimbus
snow lava
#

yeah, i tried with that but the problem is that the recipe is not register and for some reason when i pick the result the recipe items dupplicate

tulip nimbus
#

Can you show your code for your custom recipe and for the event?

snow lava
#

yes, where can i share it?

tulip nimbus
#

Either send it here and format it as code by highlighting over it and selecting the "<>" icon, or:

#

?paste

undone axleBOT
snow lava
snow lava
#

did you find something?

tulip nimbus
quaint mantle
#

Small question, I've made a shop plugin and now the issue is that if I buy an unstackable like pickaxe they are stacked.. now was thinking would this be a bug or a feature? Idk the downsides of them being stacked

drowsy helm
#

Lmao

#

Downside is if it’s used while in a stacjk, all the items take durability at the same time

quaint mantle
snow lava
#

but i don't understand how to solve it