#help-development

1 messages ยท Page 358 of 1

tardy delta
#

then just add it following the syntax

icy beacon
#

i did, but is it just magically gonna appear in my project code now

quiet ice
#

You need to declare them in the maven pom

wise pumice
#

I mean players nametag. How to add prefix above player skin. I try to create packet scoreboard team, but I don't know how to edit this.

eternal night
#

mysql is shipped with the server think

icy beacon
#

ohh wait

tardy delta
#

set scope to provided ig?

icy beacon
#

do i have to set them to provided

quiet ice
#

Or gradle

icy beacon
#

yeah

icy beacon
tardy delta
#

probably some outdated version

icy beacon
#

thx

trail lintel
#

Hey guys, I was interested in adding bstats to my plugin, but I notice when I give it scope compile in maven, it takes my jar size from 12kb to 9mb. The documentation says to use scope compile, but isn't bstats included with every spigot distribution?

icy beacon
#

no, bstats isn't

#

and it shouldn't be 9 mb

#

at most 1mb

#

something else does that i'm pretty sure

trail lintel
#

hmmmm, I wonder what is going on here

icy beacon
#

i use this:

<dependency>
            <groupId>org.bstats</groupId>
            <artifactId>bstats-bukkit</artifactId>
            <version>3.0.0</version>
            <scope>compile</scope>
        </dependency>
#

my plugin is only 1.8mb

tender shard
#

?paste your pom

undone axleBOT
icy beacon
#

and it has many other deps

trail lintel
#

hmmm, very strange I wonder why mine is getting up to 9mb

#

lemme try to rebuild it

#

what in the world ><

#

bstats y u do dis to me lol

vivid skiff
#

How can i make players stop interacting with blocks but without blocking the item interact?

#

Like using the shield

icy beacon
undone axleBOT
trail lintel
#

Ah, you know what I fixed it

#

But heres what I find strange

remote swallow
#

original is without shaded stuff

icy beacon
#

^

trail lintel
#

So the problem was I had lombok in there as a compile dependency. However, I was not using lombok at all in my code, I just had it in there as a holdover from a few years ago. I guess the regular compile was realizing it was unused and omimtting it

#

But for some reason the shaded version was still including it

#

just completely removing lombok fixed it =]

remote swallow
#

lombok is only like 2mb

trail lintel
#

It was definitely the problem though haha, no idea why

#

but yeah it is tiny

#

but now im back down to 20kb

tardy delta
icy beacon
#

๐Ÿ˜‰

tender shard
#

Lombok doesnt add anything

#

It just an annotation processor and is not shaded

trail lintel
#

That was my thought as well, but for whatever reason that did solve the problem lolol

#

It's surely because I was including it as <scope>compile</scope>

#

like a psychopath

lyric meteor
#

bad iea

trail lintel
#

without a doubt lol

#

can thank me from 2 years ago for that little mistake

icy beacon
#

lmaoo

#

have lombok included in your plugin just in case the compiler fails to read the annotations

#

nice foreshadowing from your past self

remote swallow
trail lintel
#

One final touch before I put this update out =] I want to make my console text light yellow like a lot of plugins do when it says "Update available"

#

do I just need to use color format codes as if I was sending an ingame message?

crimson terrace
#

You can use ChatColor, im pretty sure that works

trail lintel
#

will look into that, lets see here

vivid skiff
#

How can i make players stop interacting with blocks but without blocking the item interact?

tardy delta
#

๐Ÿค”

trail lintel
#

hmm ok so using chat color does seem to add the correct formatting code, but it does not change the color in the console

crimson terrace
#

how are you using it in the code?

torn shuttle
#

console coloring doesn't really work like that

vivid skiff
#

For example, right now if i cancel the interact event you can' t use the item in hand to, for example a shield or something like this

trail lintel
crimson terrace
#

Oh I see. If you use Bukkit.getConsoleSender().sendMessage() it works

trail lintel
#

Ahh gotcha, yeah I want only the server admin to see this one

#

I think that would work if you were sending it to an ingame sender

#

But I think I prob gotta do some weird shit with ANSI colors for console maybe?

crimson terrace
#

no that works and only puts the message in console afaik

trail lintel
#

Oh no kidding

#

lemme give it a shot

#

You are quite right =] however it doesn't include my plugin name in brackets automaticaly anymore, but thats no big deal at all I can add that =]

#

thank you!

crimson terrace
#

no problem, there is most likely a better way btw XD

trail lintel
#

haha there always is =] I'm just glad to see some things working

tardy delta
#

you shouldnt be using color codes in the terminal

trail lintel
#

how should I achieve the colored text in terminal? I often see plugins doing it to draw attention to updates being available

crimson terrace
#

Just make an "UpdateAvailableException" Kappa

small hawk
#

Hi, guys I have this problem, I am making plugin with elimination. So when the player gets eliminated, player gets kicked and cannot rejoin the server. When player is eliminated, file is created in specific folder. Here's part of code:

    @EventHandler
    public static void onJoinCheckIfEliminated(PlayerJoinEvent event) {
        Player player = event.getPlayer();
        File checkFile = new File("plugins/LifeStealCore/eliminated-players/" + player.getUniqueId() + ".yml");
        if (checkFile.exists()) {
            player.kick();
        }
    }
}

Everytime eliminated player tries to join, he is kicked but I get this error:

Couldn't place player in world
java.lang.IllegalArgumentException: arraySize cannot be negative but was: -1
etc.
old cloud
#

Otherwise you would probably need to delay the kick I think

crimson terrace
#

what about banning the player?

#

temp ban seems like the exact thing you need

undone axleBOT
small hawk
old cloud
#

Use PlayerLoginEvent then right

tardy delta
#

and your path isnt right either

#

new File() is in plugins/your plugin

small hawk
tardy delta
#

so new File("eliminiated-players")

old cloud
tardy delta
#

wait needs parent too

#

new File(plugin.getDataFolder(), "eliminiated-players")

old cloud
#

Then the above one works too

small hawk
remote swallow
#

pre join event looking like

tardy delta
#

playerlogin is deprecated

#

wait

#

my brain is out of date today

#

its prelogin

old cloud
#

yea whatever, im out of date in general, just PlayerJoinEvent is not right lol

terse ore
#

What could be the best way to store the mysql credentials?

#

just plain text in the config.yml?

remote swallow
#

yeah

tardy delta
#

id rather not have a separate file for each player

remote swallow
#

that does seem really pointless

#

creating a file for each player that gets eliminated

small hawk
#

files are empty, so i guess searching for file is better than looping for every record in one file (?)

remote swallow
#

eliminatedplayers.yml

#
players:
  - uuid
  - uuid 
#

etc etc

small hawk
#

ye, that makes sense as well

shadow night
#

So, I give myself a bucket with this command /give @s minecraft:water_bucket{CustomModelDala:1000000}
This is my if statement and it doesn't run if(Item.getItemMeta().hasCustomModelData() && Item.getItemMeta().getCustomModelData() == 1000000 && Item.getType() == Material.WATER_BUCKET)
Whats wrong?

remote swallow
#

CustomItemDala

shadow night
#

oh lol

#

epic typo

#

still doesn't give any output

small hawk
tardy delta
#
BukkitWiki

The Configuration API is a set of tools to help developers quickly parse and emit configuration files that are human readable and editable. Despite the name, the API can easily be used to store plugin data in addition to plugin configuration. Presently only YAML configurations can be used. The API however was designed to be extensible and allow ...

#

conclure writing chapter 2 of the bible

remote swallow
#

?configs

undone axleBOT
tardy delta
#

that site sucks

ivory sleet
#
//resolve the right path object
Path pathToDynamicFile = plugiun.getDataFolder().toPath()
  .toAbsolutePath()
  .resolve("dynamicfile.yml");
//check if the file does not exist
if (Files.notExists(pathToDynamicFile)) {
  //create it
  Files.createFile(pathToDynamicFile);
}

//new config object
FileConfiguration config = new YamlConfiguration();
try (var reader = Files.newBufferedReader(pathToDynamicFile)) {
  //loading the values from the file into our config objectr
  config.load(reader);
}

//config is now usable

@small hawk
iirc the spigot and bukkit wiki uses legacy file api but here's a quick, updated 1

remote swallow
#

smh

#

conclure is a var usier

ivory sleet
#

var is fine there

remote swallow
#

is new File(JavaPlugin.getDataFolder(), "file.yml") legacy now?

ivory sleet
#

File is a bit legacy, not deprecated but Java advocates to migrate to Path + Files

remote swallow
#

target

ivory sleet
#

for instance File#listFiles can cause dos, and File#rename did not work consistently across different os

tardy delta
ivory sleet
#

mye

#

I was gonna

#

but too lazy hehe

remote swallow
#

any build errors

tardy delta
#

average programmer

rough drift
#

lmao

pale bear
#

is it possible to create a Tab Completer that can not be auto completed
so it just suggests the next word but you cant press tab to write it?

small hawk
#

Is it possible to access target uniqueID, when player is offline, by running command in console?

upbeat hornet
#

How could I fix this? I want the text to be the same on the first image as the second image

#
hologram.setVisible(false);
        hologram.setCustomNameVisible(true);
        hologram.setCustomName(ChatColor.Green + "1 coal generator");
        hologram.setGravity(false);
        hologram.setInvulnerable(true);

This is what I currently have

rough drift
#

target/

upbeat hornet
#

in the "target" folder

#

are you sure you made it right?

#

what's your IDE?

remote swallow
#

that builds with intellij

#

on the right do you see a maven tab

#

open it

upbeat hornet
#

Try Shift + F10

remote swallow
#

open the top drop down

#

then package

#

open it

#

open the top drop down in that

#

that wasnt the top dropdown then

#

should look like this but with different tasks

#

show what it looks like

remote swallow
#

like minecrafts commands?

pale bear
#

yeah

remote swallow
#

bridgadier

#

bridgadier

#

fuc

#

god my pc

pseudo hazel
#

what are some good hologram plugins/api folks use here

#

for newest version

#

1.19+

#

okay

#

I guess I can take a peak at the source of other ones

remote swallow
#

decent holograms

pseudo hazel
#

I like how decent holograms looks

#

ill give that a try

#

thanks

vague swallow
#

ChatGPT is coding my plugins now

#

?paste

undone axleBOT
remote swallow
#

we will roast the fuck out of you

remote swallow
vague swallow
upbeat hornet
#

the black one is actually green is you look closely

upbeat hornet
vague swallow
#

and your code created the hologram in the first or in the second picture?

remote swallow
#

oh wait

#

that is so jank

#

the way that exists is because the armorstand is in a block

#

so the text is dimmed

upbeat hornet
#

is there a setting that can fix this?

vague swallow
#

put the armorstand above the block

lavish wing
#

Guys help me pls

#

how i can get user accessToken with bukkit or NMS?

twilit roost
#
mvn install:install-file -Dfile='CMI9.0.0.0API.jar' -DgroupId='com.zrips' -DartifactId='Zrips' -Dversion=9.0.0.0 -Dpackaging=jar
lavish wing
#

token that is specified in the parameters at startup

#

I have my own launcher and I want to make my own authorization

twilit roost
#

Also this is Spigot related.
Not MCP or this stuff

remote swallow
remote swallow
#

put the version in quotes too

twilit roost
#

mvn install:install-file -Dfile='CMI9.0.0.0API.jar' -DgroupId='com.zrips' -DartifactId='Zrips' -Dversion=9.0.0.0 -Dpackaging=jar

#

oh miss

#

oh my

quaint mantle
#

Guys

lavish wing
#

To avoid cheaters, griefers and etc.

twilit roost
#

just bcs I haven't put 9.0.0.0 into ' '

remote swallow
quaint mantle
#

Who write plugins for Minecraft?

terse ore
remote swallow
#

?services

undone axleBOT
quaint mantle
#

Who can write a plugin? Compound

remote swallow
#

ask on the link

lavish wing
#

But anyone can bypass the ban and ip ban

remote swallow
#

this is the wrong place to ask for commissions

quaint mantle
#

Everyone

#

Who?

remote swallow
undone axleBOT
remote swallow
#

read

#

the

#

damn

#

link

zealous osprey
#

Could someone give me a quick tip on my issue?
I'm using protocollib to listen for outgoing chat messages which I might want to delete. So I setup an intermediate cache for storing the messages that might be deleted, but I'm running into a concurrency issue with it. Could someone give me a tip on how I could either make the outgoing packets be synchrounos or rather, preferably, give me some advide on how to make a cache that can handle asynchrounous calls.
For record, I'm using a LinkedList as "cache".

lavish wing
#

Ordinary stupid griefers and cheaters will not be able to

zealous osprey
#

Cause I can't listen for server sent messages via the normal Event API

#

Or can I and was just blind?

#

I want to delete a "message block" sent by a plugin.
But I only want to do so if there is a certain message within this "block".

twilit roost
remote swallow
#

you shouldnt shade the api

#

the api is included in the plugin

twilit roost
#

aaah

#

ah frick
looks like I will need BungeeCord one

remote swallow
#

bungee is different api

twilit roost
#

yee, just installed one

#

didn't realize it has bungeecord one

remote swallow
#

bungee is on there

trail lintel
#

Hey guys, I am trying to convert some code that I wrote earlier from using protocol lib to just using base NMS. I have been able to implement the packet sending successfully, but I can't find any good examples for how to write a packet listener. Any reading material or examples you can suggest? Thanks in advance =]

rigid vault
#

how do i use luckperms with a treemap?

#

TreeMap<Group, Integer> sorted = new TreeMap<>(groupMap);

remote swallow
vague swallow
#

How can I check if a player has an inventory opened?

tardy delta
#

player.getOpenInventory() != null

trail lintel
#

god is sure is difficult to test multiple versions on windows lmao, how am I supposed to switch to lower java versions haha

#

im switchin over to linux for this good lord

remote swallow
#

just specify the path to java.exe

eternal oxide
#

just specify the path when you launch

remote swallow
trail lintel
#

fair enough lol but openjdk builds aren't provided for anything below 17 anymore ><

remote swallow
#

?java17

undone axleBOT
remote swallow
#

just change the version

#

8, 11, 16 are there

trail lintel
#

I'm just gonna switch over to linux and use archlinux-java script lol, its easier for me

#

good to know though

eternal oxide
#

they go all the way back to 8

remote swallow
trail lintel
#

now that im working with packets im super scared im going to break somebodies shit if they try to install on an older version lol

vague swallow
eternal oxide
#

Correct, it always returns an inventoryView

#

What do you acutally want to detect?

vague swallow
eternal oxide
#

You can't tell

vague swallow
#

wtf

#

I can't believe that

eternal oxide
#

You can tell if they have a specific inventory open, but nothing else

tardy delta
#

o.O

vague swallow
# tardy delta o.O

why is player.getOpenInventory() == null false even if the player has no inventory opened?

eternal oxide
#

read the javadoc

tardy delta
#

ah it returns a view

eternal oxide
#

it tells you

tardy delta
#

cant you check if the top inv is null, meaning the player doesnt have an inv open?

#

bruh its notnull too

eternal oxide
#

no, they could have their inventory open

vague swallow
#

Would it work if I would check if the size of the TopInventory is smaller than 1?

eternal oxide
#

no

vague swallow
eternal oxide
#

I already told you

#

You can't tell if the player has no inventory open

#

It will alwasy return a View wether they have an inventory open or not

trail lintel
#

Hey guys, is there a way to tell my maven to build multiple times, using a different java version each time? I need to build with java 11 for 1.16 and below, and would like to not have to switch back and forth manually

#

ah, I think I found something. I need to specify multiple toolchains

brisk thorn
#

hello, can anyone help about the Spawner plugin?

trail lintel
#

Ok guys, point me in the right direction please. I want to support older versions of minecraft. But when I try and use my jar file in older versions it complains about Unsupported class file major version. I am compiling using java 19 for 1.19, and I prob need to go back to around java 11 for older versions. How do you guys handle this?

eternal oxide
#

set source and target for the compile plugin

trail lintel
#

Will I need to do that manually for each build?

eternal oxide
#

you build for the oldest java you want to support

trail lintel
#

Ohh I see, so I set source to java 19, and target to java 11

eternal oxide
#

no

#

both to 11

trail lintel
#

Ahh gotcha, but newer versions say that 11 is deprecated

#

so I need to build two versions of the jar? I see some plugins that have a single file that supports from 1.13-modern

#

so I'm a bit confused haha

#

I think I need to get mc 1.13 on my local maven repo with build tools and target that

quiet ice
#

What exactly do you want to do @trail lintel ?

trail lintel
#

well, I am trying to get my plugin to support versions as far back as possible

#

although I do notice the packet structure has changed quite a bit as far back as 1.13

quiet ice
#

1.12 is a whole different world

kind hatch
#

You need to write your classes in the oldest version of java that the game will run for those older versions. I.E. Java 8.

quiet ice
#

That being said I don't recommend compiling your plugin with two different java versions

trail lintel
#

so then what about newer versions of the game? They won't run because it says you need at least java 11

quiet ice
#

Use one and if really needed use java 9's multi-release feature

kind hatch
quiet ice
#

Or well they do but the JVM can load classes from earlier java versions

trail lintel
#

Ohhhhh I see

#

ok that makes sense, thank you =]

#

ok one final question

#

I notice that net.minecraft.world.inventory.Containers does not exist until 1.18. How can I have it to where that import is only used if a certain version of the api is detected? I imagine this will have to be part of the build phase, not runtime.

#

But my maven-fu is pretty bad

kind hatch
#

You'll need to setup a multi module maven project if you need version specific code.

trail lintel
#

I will look into that now, ty!

hasty fog
#

Anyone here had an issue before with YAML and windows system languages? For some reason whenever someone with a turkish computer tries to use my plugin the code reads "i" in the configs as "รฝ" which breaks everything.

eternal oxide
#

save yaml as utf8

hasty fog
#

Will check thank you ๐Ÿ‘

trail lintel
#

hmm so if I use these submodules, will this build multiple versions of the same jar?

eternal oxide
#

no

trail lintel
#

I would like to have a single jar that can intelligently do the correct imports if possible

quiet ice
#

there is no such concept as imports at runtime

#

Hell they don't really need to exist at compile-time either

#

The correct term would be to load the correct classes, but that is rather straightforward: Only classes that are used are loaded. So if you never instantiate a class (or reference it in any other way ||there is an exception to that rule due to javac inlining||) it will never load the class thus not complain that it does not exist

kind hatch
eternal oxide
#

you hide all your version specific code behind an API

#

each module is version specific and implements the API

#

then in your main plugin class you instantiate whatever version class/API you need

trail lintel
#

Does anybody have an example pom I could look at? I am a bit overwhelmed by this concept, although I do get the idea you guys are talking about. So the jar WILL contain code relevant to all versions, but because its not being called it will not throw an error

quiet ice
trail lintel
#

yessss this is for NMS too, thats exactly what im dealing with as well

#

causing a huge pain haha

quiet ice
#

It's old NMS though

kind hatch
quiet ice
#

1.15.2 were very different days. Up-to-date versions of that plugin either dropped multi-version support or dropped NMS

trail lintel
#

I just need to get the concepts though =] I can adapt this I believe. Great resource to look at

#

I'm sure I will run into that shadow haha, one step at a time though!

#

yeah geol I notice the package structure is COMPLETELY different from 1.18-1.19

quiet ice
trail lintel
#

like shockingly different lol

trail lintel
#

I am using decompiled spigot from buildtools atm

#

I only need to send one very simple packet, so I don't need full mappings really I don't think

quiet ice
#

Beware, that is the hard way

#

At that point you might as well use reflection

kind hatch
#

It's not so hard nowadays due to the mappings and screaming sandals.

round elbow
#

my plugin does this when i try loading it even though in the IDE ive set language level to 1.8

kind hatch
kind hatch
quiet ice
#

I personally would use mass ASM (instead of reflection) if spigot was to support it, but it is a bit dangerous with the bundler and paperclip and all

round elbow
kind hatch
#

Oof. I don't use gradle. However I'd check your gradle compiler settings. It probably takes precedent over the IDE compiler.

quiet ice
#

Correct. Vice-versa can also be true

quiet ice
trail lintel
#

Man I have learned a lot today lol you guys rock

quiet ice
#

Mass ASM is the practice of reading and writing a larger amount of classes. If done wisely it can be much safer than reflection, but unfortunately it is so shunned that next to no modloader actively supports it without also having a witchhunt alongside it

trail lintel
#

I'm on my way to compatibility for older versions =]

quiet ice
#

Are you aware of the 1.13 Material refractor?

trail lintel
#

I am not ๐Ÿ˜ฎ

kind hatch
#

XMaterial can be used to mitigate that.

quiet ice
#

If you are using itemstacks you'll be up to a big surprise then

trail lintel
#

oh god I am lol

kind hatch
#

Yea, that alone is why I stuck with XSeries for my multi version projects. I didn't want to setup extra interfaces for items, sounds, and particles.

trail lintel
#

fortunately my plugin is tiny, it only adds a single item. But I will definitely look into this xseries thing

round elbow
quiet ice
#

that is an odd syntax

round elbow
#

kotlin gradle

remote swallow
#

yeah

kind hatch
quiet ice
#

Ah. In groovy gradle it'd be

sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '11'

for Java 11

remote swallow
#

normally i just use JavaVersion.VERSION

tawdry echo
#

someone know how to fix?

#

repository exist

kind hatch
#

Reload the pom?

tawdry echo
#

how?

kind hatch
trail lintel
#

It's time to reach the balmer peak

#

LETS GO

low raven
#

Hello everyone

#

[23:46:14 WARN]: [AnimatedMenuPlus] Failed to load menu file shop.yml!
[23:46:14 WARN]: [AnimatedMenuPlus] me.megamichiel.animationlib.config.ConfigException: Couldn't load shop.yml

echo basalt
low raven
#

ok

kind hatch
#

Does anyone know why when using the ? syntax in mysql queries, it will sometimes append extra apostrophes to the query?

bold vessel
#

Som1 know how i can watch the patern of the craft (like "C C" "CCC "CCC" for a chestplate) with CustomModelData

@EventHandler
    public void onPrepareCraft(PrepareItemCraftEvent event) {
        CraftingInventory inventory = event.getInventory();
        ItemStack[] matrix = inventory.getMatrix();
        int count = 0;
        for (ItemStack item : matrix) {
            if (item != null && item.getType() == Material.CLOCK && item.hasItemMeta()) {
                ItemMeta meta = item.getItemMeta();
                if (meta.hasCustomModelData() && meta.getCustomModelData() == 2) {
                    count++;
                } else {
                    // This item is not an ร‰tincelle Aquatique with customModelData 2
                    count = 0;
                    break;
                }
            } else {
                // This item is not an ร‰tincelle Aquatique
                count = 0;
                break;
            }
        }
        if (count == 9) {
            ItemStack result = new ItemStack(Material.CLOCK);
            ItemMeta meta = result.getItemMeta();
            meta.setDisplayName("ยง3Lingot Aquatique");
            meta.setLore(Arrays.asList("ยงbItem Aquatique"));
            meta.setCustomModelData(3);
            result.setItemMeta(meta);
            inventory.setResult(result);
        } else {
            inventory.setResult(null);
        }
    }```
sullen marlin
#

RecipeChoice.Exact, recipe api

river oracle
#

Is there any API for signs gui yet

remote swallow
#

there is a pr

cloud wharf
#

Hello, is there a way for me to use the obfuscarted sources instead of the mappings?
I have thi son my pom:


        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot</artifactId>
            <version>1.19.3-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>

But it's bringing up the mappins, i really need the normal obfs NMS

remote swallow
#

that should being up obsfucated stuff

river oracle
#

Can't

river oracle
#

Can't legally sign cla

echo basalt
river oracle
#

They won't

#

I'm close to 18

#

So it's fine

echo basalt
#

"yo dad this might seem odd but I need you to put our full name and address as I want to make a PR"

remote swallow
#

is that what you did

cloud wharf
#

So the PacketPlayerInfo was renamed to ClientboundPlayerInfoUpdatePacket?

echo basalt
#

Yeah

cloud wharf
#

that's what I'm mainly finding wierd

#

i see

#

Thx

echo basalt
#

Packets made in the later versions

#

are renamed

#

old packets are still kept the usual

#

So you now have PacketPlayOut and ClientboundWhatever

cloud wharf
#

sounds good, thanks

livid dove
#

"Why was my server using 70% of 24gb of ram with barely any players on" :The "Raz forgot to turn this on in server properties" story

hazy parrot
#

probably some element of list was null

#

try to filter it with obj != null

dreamy kelp
#

Hi, I wanted to update one of my plugins which is utilizing NMS to 1.19.3
I built the remapped jar using builtools (executed using java 17) and my entire maven project as well as my IDE is set to Java 17. However, when building (at the stage of remapping) at keeps throwing me the major version version 63 error, which means that a class file is on java version 19 (but maven only supports up to 17 afaik)
Does anybody know how to change this?

[INFO] --- specialsource-maven-plugin:1.2.3:remap (remap-obf) @ SimpleNPCs ---
Adding inheritance C:\Users\trxss\.m2\repository\org\spigotmc\spigot\1.19.3-R0.1-SNAPSHOT\spigot-1.19.3-R0.1-SNAPSHOT-remapped-mojang.jar
java.lang.IllegalArgumentException: Unsupported class file major version 63
trail lintel
#

Hey guys, so I have been working on getting a compatibility layer set up for my NMS functionality. I set up multiple maven submodules for each specific version of minecraft I am targeting, each with their own pom with the relevant spigot api and minecraft code. But I'm wondering, is all this submodule stuff overkill? Couldn't I just include all the versions of the api/base that I need in my standard pom and have them as scope provided?

echo basalt
#

Because certain API features changed

#

Within spigot

#

For example, on 1.8 you have Player#getItemInHand

#

In the latest versions you need to get the main/off hand from the inventory

remote swallow
#

they should be scope provided anyway

echo basalt
#

On 1.8 you need to use packets to send titles or actionbar messages (or even boss bars)

#

On 1.9 it's native

remote swallow
#

if you only use the api you can just use 1 api, if its nms you need all you want to support

trail lintel
#

But like, couldn't I technically just have them all as scope provided and then do a switch on the relevant version string to instantiate the correct interface?

#

and just have all the versions of spigot api / minecraft base that I need in the root pom?

echo basalt
#

Seems hacky

trail lintel
#

rather than mess with all this submodule stuff

remote swallow
#

sub module is better

echo basalt
#

I wouldn't say it's ideal

#

Here's an alternate environment where submodules are ideal

trail lintel
#

Ok good deal, I will continue with submodules =]

echo basalt
#

Let's say you're hooking into a plugin with 2 major versions

trail lintel
#

But I mean regardless of what method I pick, I'm still going to need to do a switch on version string to instantiate the correct interface right?

echo basalt
#

For example, Worldedit for 1.8 - 1.12 is very different from 1.13+

#

One uses the BlockVector#at, the other uses a constructor and all

#

It becomes a pain to do it in the root module

#

Because it's the same class under the same package

trail lintel
#

That is essentially what I'm going to have to do right?

echo basalt
#

Pretty much

#

I'd probably use some sort of map

#

or registry

trail lintel
#

Ok very good, I will continue with how I am doing it then. Thank you guys =]

#

Very close to getting my backwards compatibility back haha

#

I had to fix localization for that man =] He asked I must deliver

hazy warren
#

my spigot jar only has bukkit.craftbukkit.boostrap stuff in it, how do I get the other library stuff necessay for plugin development?

remote swallow
#

?boostrap

#

?bootstrap

undone axleBOT
#

Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.

Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163

remote swallow
#

maven or gradle is better

hazy warren
#

isn't it a bit of a pain to get NMS with maven tho

remote swallow
#

build spigot

#

change spigot-api to spigot

#

done

hazy warren
#

i built spigot through buildtools and it only has the bootstrap tho

remote swallow
#

depend on spigot now

#

?nms

remote swallow
#

use the stuff on there if you want unobsfucated stuff

restive rapids
#

is there an event I can use to constantly leave a chunk loaded?

remote swallow
#

ChunkUnloadEvent iirc

#

gfukc y

#

my pc

restive rapids
#

so get the chunk that is being unloaded and set it back to loaded again

#

and it just keeps repeating?

remote swallow
#

can probably get the chunk and load it again

restive rapids
#

is there like a event I can use that is constantly running?

#

in ticks?

#

and do it like that?

remote swallow
#

if you get the chunk and load it again on the unload event osmewhat

bold vessel
#

som1 know why this isnt working

#

For do a custom craft with clock with custom model data 3

dry yacht
bold vessel
dry yacht
bold vessel
#

I try with normal clock and with the clock with customodel data 3

#

and its not working

#

i want to make the craft of all the diamond armor (with model 1) with the clock (model 3 instead of diamond)

dry yacht
bold vessel
#

oops

#

im dumb

#

my bad bro

#

๐Ÿ’€

#

And i have a question i see the short in the docs but what he mean

dry yacht
#

Is that how you specify custom model data? I thought you'd just use the ItemMeta to access this property, as you did on the recipe result above: meta.setCustomModelData(3);

dry yacht
river oracle
bold vessel
river oracle
#

That's deprecated 1.8 shit

worldly ingot
#

Pre-1.13, but yeah, you're right

#

Don't use any byte data at all

river oracle
#

Pre 1.13 is too old anyways

worldly ingot
#

CustomModelData is all done through ItemMeta

dry yacht
bold vessel
#

so i create another item stack and i do smth like RecipeChoice.ExactChoice(nameoftheitemstack) ?

dry yacht
#

Yeah, and add the custom model data on that nameoftheitemstack

bold vessel
#

Okkk

#

But why thats was working with the bytes ?

dry yacht
#

No idea tbh, as I wrote my own crafting engine from scratch, lol.

dry yacht
bold vessel
bold vessel
dry yacht
# bold vessel Insane, do you put it on github ?

It is actually, but it's a private repo. Sorry. It's not that fancy, it's just a simulated virtual workbench mapped to a double-chest GUI to support arbitrarily sized grids with a permutation generator for faster recipe resolution. It's all configurable with my expression parser in the config, but I didn't release it. Maybe I will do so one day. The project is halted currently, as I got the holographic displays as my pet project now.

dry yacht
bold vessel
dry yacht
#

Well, anyways, just use the ItemMeta-approach, as the other constructor is marked as deprecated.

bold vessel
dry yacht
bold vessel
#

Do you have a server ?

dry yacht
bold vessel
#

Or u only do it for fun

dry yacht
dry yacht
bold vessel
#

Or u have a jobs ahah

bold vessel
#

Its not working in game

#

Do you know why @dry yacht ?

remote swallow
#

dont you need to use a space not a hashtag for empty

tall dragon
#

XXX*

remote swallow
#

for that you want "III", "I I", " "

pseudo hazel
#

lets say I can make a menu when performing a command that is created like this java public void createCardContext(String cardName, Player player) { ContextMenuUI menu = new ContextMenuUI("What to do with '" + cardName + "'", this); menu.addAction("Remove", Material.BARRIER, (clickType) -> { CardData.removeCard(cardName); Message.sendDebug("Card '" + cardName + "' has been removed successfully!", player); }); menu.addAction("Duplicate", Material.SHULKER_SHELL, (clickType) -> { CardData.duplicateCard(cardName); Message.sendDebug("Card '" + cardName + "' has been duplicated to '" + cardName + "_copy'!", player); }); menu.addAction("Change Name", Material.NAME_TAG, (clickType) -> { String newName = KeyboardUI.getInput(); <------------------------- How do I get this input based on what item the player clicked in the keyboard menu CardData.renameCard(cardName, newName); }); menu.open(player); } How can I implement the KeyBoardUI.getInput() function of the Change Name action?

#

a ContextMenuUI is just an inventory and a keyBoardUI is also an inventory

#

waht I essentially want is the use to be able to click on an item in the keyboard inventory and use that as the input for the Change Name action, but idk how to do that on construction of the context menu

#

the consumer is just the method that will run when the player clicks on an option in the context menu

bold vessel
#

mb

pseudo hazel
#

its an inventory, right now it is used as like a sub menu for other inventories to type stuff in, since it uses a banner pattern with the alphabet which was teh easiest way I could find to do that

tall dragon
#

oh, i usually just open an anvil menu and use the name function of it.

pseudo hazel
#

but in this problem it represents a class that can be used to get teh result from teh player which happens after this menu is constructed

#

oh

#

well i guess im dumb

#

anyways

#

same thing

#

lets say it was an anvil menu

#

and getInput returns the name

bold vessel
#

som1 know why i dont get the enchant in game ?

tall dragon
pseudo hazel
#

okay

#

I need to learn about completablefuture then

tall dragon
#

and that will allow you to run code directly when the player has finished his input

#

and also have access to his input

pseudo hazel
#

okay

#

I guess that makes sense

tall dragon
#

should read

pseudo hazel
#

okay I will

#

thanks

#

from a quick scan it seems like something i half did in other places lol

tall dragon
pseudo hazel
#

exactly haha

tall dragon
#

air is represented by.., well air

#

e.g a space

bold vessel
#

Ok, but thats not the problem when i got the item ig he hasnt the meta

#

how

#

i find why

#

im dumb

#

"meta2"

tall dragon
#

yep

tall dragon
#

so u can avoid this mess

bold vessel
#

its a plugin ?

remote swallow
#

library

bold vessel
#

this?

tall dragon
#

will allow you a pattern like this (psuedocode):

ItemStack stack = new ItemBuilder(Material.DOG_FOOD).
   .name("IDK").
  .lore("line1,"line2").
  .etc().
  .etc().
  .build();
tall dragon
#

most people eventually end up making their own

#

but should work

bold vessel
#

okkk

#

and after i can made a normal patern with this ItemBuilder ?

tall dragon
#

umm wdym?

#

u build it into an ItemStack object at the end

bold vessel
#

nvm its good

tall dragon
#

see how much mess that saves u?

bold vessel
#

Yepp

#

a thousand import in one lmao

tall dragon
#

yea , well when u have really "versatile" objects like an ItemStack. the Builder pattern can be really usefull

echo basalt
#

guy wants a callback

tall dragon
#

i just prefer a future i guess

#

due to other options it has like timeout

pseudo hazel
#

how would you use a consumer then

tall dragon
#

well almost exactly the same

pseudo hazel
#

in this case

tall dragon
#

inside KeyboardUI have a method that starts the input and returns a Consumer<String>

#

accept the consumer when input is received

pseudo hazel
#

oh well yeah I guess

#

it would just be nesting another action inside the current one

#

since clicking to change the name is already being done by a consumer

tall dragon
#

yes it would

pseudo hazel
#

okay

#

I fixed it, I was super blind not realizing I did the exact same thing to make the first action in the first place lmao

twin nimbus
#

how do you summon a warden doing the digging up animation with the spigot api
you can do it with regular mc commands using
/summon minecraft:warden ~ ~ ~ {Brain:{memories:{"minecraft:dig_cooldown":{ttl:1200L,value:{}}, "minecraft:is_emerging":{ttl:134L,value:{}}}}} but idk how that works with the spigot api

pseudo hazel
#

well one way is to just dispatch that as a command

#

but surely there is a better way

twin nimbus
#

yeah

#

but that requires MemoryKey as the first arg

#

and for some reason

pseudo hazel
#

hmm

#

thats annoying

twin nimbus
#

yeahhh

pseudo hazel
#

i cant help with that

#

you would want to make a new memory key, but you cant since the constructor is private

twin nimbus
#

yeap

pseudo hazel
#

sounds like a PR to me xD

twin nimbus
#

lol

twilit wharf
#

I am struggling with some pretty basic inventory stuff and its getting me frustrated. I want to know when a player clicks on a item, so I am listening in a InventoryClickEvent. I am cancelling the event, but the item remains on the cursor. I saw that setCursor is deprecated, but has no mentioned replacement. I tried setCurrentItem but that removed it from the slot and didnt remove it from the cursor. Am I missing something?

#

I am opening a inventory after the click, would that change anything?

dry yacht
#

Delay for a tick before opening the new inventory

pseudo hazel
#

can you show the code you wrote in the click event?

dry yacht
#

It's likely a clientside glitch and the item is actually not on the cursor serverside

pseudo hazel
#

also that

twilit wharf
#
        new EventListener<>(RPGProject.getInstance(), InventoryClickEvent.class, (l, e) -> {
            System.out.println("InventoryClickEvent");
            if (this.disabled) {
                l.unregister();
                return;
            }

            if (!player.getUniqueId().equals(this.player.getUniqueId())) return;
            if (e.getCurrentItem() == null || e.getCurrentItem().getItemMeta() == null) return;
            if (!e.getCurrentItem().getType().equals(resourceBag.getType()) || e.getCurrentItem().getItemMeta().getCustomModelData() != RPGProject.getInstance().getConfig().getInt("static-items.resource-bag.custom-model-data")) return;

            // e.setCurrentItem(null); wasnt working

            e.setCancelled(true);

            openResourceBag();
        });
pseudo hazel
#

ah

#

yeah I would just schedule the new inventory instead of opening it directly

twilit wharf
#

so like Task.syncDelayed(this::openResourceBag);?

pseudo hazel
#

yeah I usually use Bukkit.getScheduler.runTask()

#

but I think either works

twilit wharf
#

I think mine might be a custom API, not sure though

dry yacht
twilit wharf
#

Its the same one I am using for the events

twilit wharf
#

never had that issue before

#

never opened an inventory on a click before to ig

dry yacht
# twilit wharf ok, thanks, I thought I was losing my mind

The event is called before the click actually gets processed serverside. So you're basically opening a new inventory before the click action got cancelled. You opened a new window, with a new window-id, so cancelling the click on the old window-id won't work. Something like that.

But I most definitely understand the frustration which comes with it, xD.

twilit wharf
#

also, I want the player only able to drop an item they grab from an inventory, but not able to place it into their inventory. Would I use InventoryMoveItemEvent to check if it moved into another inventory, or will that call when it picks it up? Or is there a better way?

dry yacht
twilit wharf
#

ok, thanks ๐Ÿ™‚

dry yacht
# twilit wharf also, I want the player only able to drop an item they grab from an inventory, b...

InventoryMoveItemEvent btw does something different than what you'd imagine on first glance. The docs say:

Called when some entity or block (e.g. hopper) tries to move items directly from one inventory to another.

Shift-click-moving items is InventoryAction#MOVE_TO_OTHER_INVENTORY. Knowing at which slot it actually ended up in the other inventory again requires analysis of your own, no idea how they're still missing this feature after all of these years.

twilit wharf
#

yeah, theres a lot to love and hate about spigot/bukkit

twin nimbus
#

how do I convert a hex uuid to an mc int array uuid?

buoyant viper
#

marh

twin nimbus
#

wha

twin nimbus
worldly ingot
#

It's LSB and MSB, but split into two integers

#

UUID.getLeastSignificantBits() and UUID.getMostSignificantBits(), then bit shift and int limit to split

#
UUID uuid = UUID.randomUUID();

long msb = uuid.getMostSignificantBits(), lsb = uuid.getLeastSignificantBits();
int msb1 = (int) ((msb >> Integer.SIZE) & 0xFFFFFFFF);
int msb2 = (int) (msb & 0xFFFFFFFF);
int lsb1 = (int) ((lsb >> Integer.SIZE) & 0xFFFFFFFF);
int lsb2 = (int) (lsb & 0xFFFFFFFF);```
#

That might be wrong. Would need to test it. But I believe it's correct lol

dull magnet
#

The server crashes when the action bar is displayed as a loop statement

worldly ingot
#

I was slightly wrong. See the edit, it's correct

#

Testing with the UUID you provided outputs the correct result

dull magnet
#

I want to make it say success once every second

quaint mantle
dull magnet
#

YEs

quaint mantle
#

Show me your code

dull magnet
#

Can I just copy-paste the code?

quaint mantle
#

yes

dull magnet
#

int in = 0;

@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
    if (sender instanceof Player player) {
        set.add(player);

        for (int d = 0; d<10; d++) {
            player.sendMessage(String.valueOf(in));
            in++;
            player.sendMessage("success");
            try {
                TimeUnit.SECONDS.sleep(1);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
    return false;
}

}

river oracle
#

nahhhh

#

broo

river oracle
dull magnet
#

what?

river oracle
#

TimeUnit.SECONDS.sleep(1);

#

your crashing the server xD

#

?learnjava!

undone axleBOT
river oracle
#

please learn java before trying to start with spigot

icy beacon
#

for mysql, what's a good way to say "if exists - update; if doesn't - insert"?

#

or will "insert" just do that if i add a primary unique key to the table?

dull magnet
#

ah OK

#

sorry

river oracle
icy beacon
#

hmm

river oracle
#

I'm not sure I always just do an exists query than send an update or insert depending on what i get back

icy beacon
#

yeah i can do that but i was wondering if it could be performance heavy

river oracle
#

found this

#

top answer has 2001 upvotes so I'm assuming its pretty good

icy beacon
#

oh thanks a bunch!

quaint mantle
#

?threading

#

what is it

#

?scheduling

undone axleBOT
quaint mantle
#

read that

dull magnet
#

OK

charred blaze
#

How do I know if a sign is empty when it's placed? I tried this on SignChangeEvent

            for (int i = 0; i < 4; i++) {
                lines.append(event.line(i));
            }
            String all = lines.toString();
            if (all.isEmpty()) {
                return;
            }```
#

but its not working

hazy parrot
#

I'm assuming lines are ArrayList

#

In that case, ArrayList to String will never be empty string

charred blaze
hazy parrot
#

Oh right

#

Check what "all" is then

#

Print it and check why it isn't empty

charred blaze
#

below that code is

#

System.out.println(all);

#

and it prints nothing

hazy parrot
#

Do you just want to check if sign is empty?

#

In that case, you can just

charred blaze
#

wait i just got it

#

i think

charred blaze
#

is there a method

hazy parrot
#
boolean empty = true
For line in lines {
      If(!line.isEmpty){
             empty=false
              break
}
}
return empty
charred blaze
#

this isnt a python lol

hazy parrot
#

It's pseduo lmao

#

I'm on phone

charred blaze
#

xd

charred blaze
charred blaze
# charred blaze How do I know if a sign is empty when it's placed? I tried this on SignChangeEve...

when i print "all" here it prints
[08:59:06 INFO]: textcomponentimplcontent,stylestyleimplcolornull,obfuscatednotset,boldnotset,strikethroughnotset,underlinednotset,italicnotset,clickeventnull,hovereventnull,insertionnull,fontnull,childrentextcomponentimplcontent,stylestyleimplcolornull,obfuscatednotset,boldnotset,strikethroughnotset,underlinednotset,italicnotset,clickeventnull,hovereventnull,insertionnull,fontnull,childrentextcomponentimplcontent,stylestyleimplcolornull,obfuscatednotset,boldnotset,strikethroughnotset,underlinednotset,italicnotset,clickeventnull,hovereventnull,insertionnull,fontnull,childrentextcomponentimplcontent,stylestyleimplcolornull,obfuscatednotset,boldnotset,strikethroughnotset,underlinednotset,italicnotset,clickeventnull,hovereventnull,insertionnull,fontnull,children

hazy parrot
#

then just print line which enters !isEmpty and see why it isn;t empty

charred blaze
#

what

hazy parrot
#

its probably " " or smth

charred blaze
#

ill just replace it?

#

i guess

hazy parrot
#

as i said, its probably space

zealous osprey
tall dragon
#

isEmpty = check if completely empty, isBlank = check if only contains whitespace characters like " "

zealous osprey
#

isEmpty just checks if the length is 0, but does not consider blank spaces

tall dragon
#

iirc ๐Ÿ˜’

hazy parrot
#

TIL about isBlank lmao

quaint mantle
#

Hey Guys, How can I write permission in plugin.yml?
If I want to add a permission as regionafk.shop.open is the below right?

permissions:
  regionafk:
    shop:
      open:
hazy parrot
#

Just add

permissions:
         - regionafk.shop.open:
#

Search about plugin yml o ngoogle, there are examples

tall dragon
#

pretty sure its not a list

hazy parrot
#

True, its probably not

tall dragon
#

so

permissions:
    regionafk.shop.open:

so this would be it

drowsy helm
shadow night
#

in the BucketEmptyEvent when I use event.getItemStack() it only returns BUCKET (a empty bucket) but I need to know the data of the water bucket that was emptied, not the result

drowsy helm
#

getBucket()

shadow night
#

getBucket() gives the used bucket, but as a material

#

and I can't get custom model data from a material

drowsy helm
#

ah

#

interact event ig

shadow night
#

ig

shadow night
#

what, why

java.lang.NullPointerException: null
        at java.util.Objects.requireNonNull(Unknown Source) ~[?:1.8.0_321]```
#

I gotta do some null checking stuff, ehhh

quiet ice
#

Although in that case it doesn't change much since that method was likely called explicitly and thus has a different error message

shadow night
#

the what

quiet ice
#

Eh, just ignore my rambling

shadow night
#

ok

regal scaffold
#

Hey guys. I am back

#

Jesus I've been gone

quiet ice
#

not even a month

regal scaffold
#

Nah I would never leave for that long. but over a week I believe

#

Considering I'm here all day hehehe

#

Geol what would you think is the best way to organize a config.yml files if you need to allow pairs of 2 strings to then be able to store in code as a map.

Example:

String1 -> String2

#

Would:

strings:
  string1:pair1
  string2:pair2
  string3:pair3

Be the simplest?

quiet ice
#

imo yaml configurations should be strictly read-only

regal scaffold
#

Oh yes It is

#

I meant for the user to input before the plugin runs

quiet ice
#

Well then provided you didn't accidentally reinvent the array, it should be good enough

regal scaffold
#

tbh with the weird things I've done lately that could be possible but lets hope not

#

Thanks geol.

quiet ice
#

although it depends on what you mean with "pair1", if it is a pair of strings you should store it as it's own configuration section. If it is just a string value, then it's good

regal scaffold
#
  streamer2:
    subdomain:
    split: 0.5
#

I believe we are on the same page here

#

And I just loop through each one adding the values to some data type which idk which one just yet

#

How will I ever store 3 things in a single variable ||classes||

vivid skiff
#

How can i create a yml database in a bungeecord plugin?

eternal oxide
#

yaml is a file syntax, it's not a database

wet breach
#

generally should just use yaml for storing configuration related things as that is what it is good for

regal scaffold
#
streamers:
  streamer2:
    subdomain: #string
    split: 0.5 #double
  streamer3:
    subdomain: #string
    split: 0.5 #double

When using fileConfig#get<something> what should I use to get a list of all streamers.
Is #getList() the best alternative here?

#

Or is it #getStringList

tall dragon
regal scaffold
#

Ohhh and then each key #getList

tardy delta
#

its not a list

regal scaffold
#

Oh you're right it's just a path. the entire yml file just works on paths

#

So then I still need to do key.value

tardy delta
#
for (String streamer : config.getSection("streamers").getKeys(false)) {
  String subdomain = config.getString("streamers." + streamer + ".subdomain");
  double split = config.getDouble("streamers." + streamer + ".split");
}```
warm mica
#

You can use getKeys()

shadow night
#

when running my command I get this output
my command code:

public class GetInfiniteWaterBucket implements CommandExecutor {
    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        ItemStack bucket = new ItemStack(Material.WATER_BUCKET);
        bucket.getItemMeta().setCustomModelData(1000000);
        bucket.addEnchantment(Enchantment.ARROW_INFINITE, 0);
        bucket.getItemMeta().addItemFlags(ItemFlag.HIDE_ENCHANTS);
        bucket.getItemMeta().setDisplayName("Infinite Water Bucket");
        bucket.getItemMeta().setLore(Collections.singletonList("This bucket was enchanted by the most powerful mages to create infinite amounts of water."));

        sender.sendMessage("Item \"Infinite Water Bucket\" given.");

        return true;
    }
}
regal scaffold
#

yeah yeah just understood my error

#

Thanks brush

tardy delta
#

or smth like that, dont have an ide

warm mica
regal scaffold
#

Yeah you're good I got it. made me realize what I did wrong

shadow night
tardy delta
#

bruh

shadow night
#

"placeholdername" is not my real plugin name btw

regal scaffold
#
        for (String streamer : config.getConfigurationSection("streamers").getKeys(false)) {
            streamers.add(new Streamer(streamer, config.getDouble("streamers." + streamer + ".subdomain"), config.getDouble("streamers." + streamer + ".splitAmount")));
        }
eternal oxide
tardy delta
#

you need to set the itemmeta back, getItemMeta returns a copy each time

rough drift
shadow night
rough drift
#

also the meta thing

quiet ice
#

it shouldn't throw an exception though

rough drift
#

it returns a clone of the original each time

quiet ice
#

The actual error is somewhere else

#

Consult your log for more details

wet breach
#

this is why the exception is being thrown

shadow night
#

whats a NPE?

wet breach
#

Null pointer exception

shadow night
#

oh

#

java and null are best friends

#

in a bad way

wet breach
#

something is null, usually an object like plugin if you forgot to assign it a value, and are attempting to access that object while it is null but never bothered to check or better yet, initialize the object with a value ๐Ÿ˜‰

shadow night
#

this will be hard to figure out

#

ah duck it, I'll do it tomorrow

sonic cosmos
#

?paste

undone axleBOT
sonic cosmos
terse ore
#

player.setPlayerListName(null)

#

?d org.bukkit.entity.Player

#

they should make this a command

sonic cosmos
#

doesnt work

brittle loom
#

Hello, does anyone know how to prevent heads from being taken from armour stands?

regal scaffold
#

How can I learn how to use a API if it doesn't have any documentation? Some API's require you to initialize, others have static methods, etc.

Like what am I looking for to figure out how to use it

tardy delta
#

the forum my friend

regal scaffold
#

There's gotta be stuff in the code itself that can specify how it's used

tardy delta
#

ah i thought you were talking about the spigot api

regal scaffold
#

No spigot api has infinite documentatiopn

tardy delta
#

that stuff is a plugin so get its instance with the pluginmanager ig

regal scaffold
#

Yeah it's a plugin and it has 1 event that I need that's all

tardy delta
regal scaffold
#

I guess pluginmanager way is the way. Lets try

tardy delta
#

so you just need to listen for that event?

regal scaffold
#

Yeah the 1 you see there line 33

#

So yeah, getPluginInstance and then listne

tardy delta
#

just depend on the plugin in your plugin.yml, make it a maven dependency with scope set to provided and make a listener for that event like you'd do for any other event

regal scaffold
#

Wait a moment

#

We talking 2 different things here

#

I know about plugin.yml and listenings for events and such

#

But do I need to initialize something or can I literally just listen for the event without any previous stuff?

tardy delta
#
@EventHandler
public void onDonation(DonationReceivedEvent event) {}
#

its a plugin so you dont need to initialize stuff ig

regal scaffold
#

Oh damn

#

I had no clue that was even a thing

#

Lets give that a try then. Interesting stuff I don't even need to tell my plugin that I'm using that

tardy delta
#

wdym

halcyon hemlock
#

what do guys think? Just made this

crimson relic
#

a rich presence? ok

halcyon hemlock
#

yeah

#

you can configure it with .json file and run it through .exe

regal scaffold
#

Wait I'm confused fourteen I was typing it up and I noticed I was wrong

tardy delta
#

how does it hook into the client?

#

i dunno any discord client api

regal scaffold
#

How do I tell my plugin that it's allowed to access that dependency? What you said is just add it to plugin.yml and then make the EventHandler

#

Is that really enough?

regal scaffold
#

Ok then that's crazy but if it works not complaining

wet breach
halcyon hemlock
#

I'm sad discord limits time elapsed to 23:59:59

#

Otherwise I would've made it 53 years

regal scaffold
#

Yeah gotcha forst. Makes sense tbh

#

Now I'm seeing a lot of Deprecated stuff... I guess I can just ignore it

tardy delta
#

you just add the dependency

wet breach
#

yeah you will come across deprecated stuff from time to time

regal scaffold
#

If it says deprecated doesn't actually mean they added a better way to do it right?

wet breach
#

you should avoid using such things if you can, but just because it is deprecated doesn't mean it is not usable either, just have to read the docs on why it is deprecated ๐Ÿ™‚

regal scaffold
#

These docs are garbage

wet breach
#

oh, well can't speak of other projects lmao

regal scaffold
#

Yeah of course I know lol

#

But my goodness it's ass

wet breach
#

not surprising

#

now as far as listening to events that come from other plugins, you can listen for them like you would the normal events but that doesn't mean the event gets fired. Something has to implement the event to fire said event otherwise listening for it is kind of pointless ๐Ÿ˜›

regal scaffold
#

Yes yes of course. I understood that. I'm just a bit surprised plugin specific events are accessible from all other plugins with pretty much no work

wet breach
#

well that is because they extend from the events implementation of spigot

#

if they instead implemented their own event system, then that wouldn't really be the case

#

or if they instead checked who was trying to do something with a given event that is plugin specific that wouldn't be the case either

#

but people are too lazy to do that ๐Ÿ˜›

crimson relic
#

but in this case they want you to be able to use it

wet breach
#

so it is a good thing then that it is easy to do so ๐Ÿ™‚

regal scaffold
#

I just had a thoguht

#

Is events a good way to handle game states?

#

Like, can't you make your own events that you need fired at each moment

#

And listen for them

wet breach
#

sure, it is the easiest way to notify the state of something changed

regal scaffold
#

Holy sht

#

Why didn't I wrap my head around that before

#

When I first saw custom events a few weeks ago I was like wtf this is useless like I gotta create the event AND call it

wet breach
#

I use custom events in my ServerTutorial plugin and even listen to them as well ๐Ÿ™‚

regal scaffold
#

Now I see things that can be done

crimson relic
#

very useful

regal scaffold
#

Yeah just had a breakthrough moment mentally

#

Alright gonna get back to it.

#

Thanks for the chat and help

wet breach
wet breach
#

you can use custom events to combine two events together

pseudo hazel
#

wait what?

#

do you mean call 2 events in one?

#

or wait for both events and send a custom event?

sullen canyon
halcyon hemlock
sullen canyon
# halcyon hemlock could you give more context? or code?

this is the method I send it through

public static CachedRowSet query(String query, Object... vars) {
        CachedRowSet rowSet = null;
        ExecutorService executor = Executors.newCachedThreadPool();

        try {
            Future<CachedRowSet> future = executor.submit(new Callable<CachedRowSet>() {

                @Override
                public CachedRowSet call() {
                    try {
                        PreparedStatement ps = prepareStatement(query, vars);

                        ResultSet rs = ps.executeQuery();
                        CachedRowSet crs = RowSetProvider.newFactory().createCachedRowSet();
                        crs.populate(rs);
                        rs.close();
                        ps.close();

                        if (crs.next()) {
                            return crs;
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                    return null;
                }
            });
            if (future.get() != null) {
                rowSet = future.get();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }

        return rowSet;
    }```
I execute it like ```java
query("SELECT `ban_time` FROM `bans` WHERE `uuid` = ?", player.getUuid());```
wet breach
#

but it really depends on the two events in what I was talking about though

#

you can listen for an event, and then if the other one you wanted to listen to as well comes after you could then combine those two events and throw a custom event that contains the data of both

#

however you might not be able to cancel said two events, but you could implement stuff to make that happen in a similar fashion

sullen canyon
#

oh and also I think it's important, here is my connection code

private void establishConnection() {
        try {
            Class.forName("com.mysql.cj.jdbc.Driver");

            String url = "jdbc:mysql://" + configuration.getString("ip") + ":" + configuration.getString("port") + "/statistics?useSSL=false&useUnicode=true&characterEncoding=UTF-8";
            String user = configuration.getString("user");
            String password = configuration.getString("password");

            this.connection = DriverManager.getConnection(url, user, password);
        } catch (SQLException e) {
            e.printStackTrace();
        } catch (ClassNotFoundException e) {
            throw new RuntimeException(e);
        }
    }```
wet breach
#

also, you can use one method for two events too without needing two different methods if I recall as well

pseudo hazel
#

one method for 2 events? like onEvents(final Event1 ev, final Event2 ev2)?

#

so how would you combine 2 events? i assume using some consumer or future thing

sullen canyon
tardy delta
#

no clue why you need a cachedrowset

#

and you dont show how you set the params

#

why using a future if you're blocking on it?

sullen canyon
#

so what should I use instead?

tardy delta
#

probably want to return a completablefuture

#

with a ResultSet, not a CachedRowSet

#

and please dont create a new threadpool on every invocation

wet breach
#

Don't believe it works if both are thrown at the same time

#

been a while since I messed with the event stuff in spigot/bukkit. But yeah should experiment with stuff with the API though

#

be surprised in what you find out and just because no one else is doing it doesn't mean it isn't possible either ๐Ÿ˜›

pseudo hazel
#

I mean events cant really be thrown at the exact same time right? like it would just be on another thread or whatever

tardy delta
#

there are async events

pseudo hazel
#

okay so some events are thrown on their own thread and some are coming from the main thread or what?

#

is there somewhere I can read about this?

#

like I just try to handle every event as if its happening async I guess

#

but idk if thats the way it actually works

wet breach
#

well its part of knowing what asynchronous means, doesn't necessarily mean another thread but in spigot asynchronous stuff does come from another thread. While technically most of the other events are synchronous, it doesn't mean 2 events can't be called one after the other, but how its called isn't really all that relevant because the server isn't going to wait for something to happen with that first event before firing the second one

#

so, you can have interactevent get fired at the same time blockbreak is happening

pseudo hazel
#

hmm

#

so if you combine those events in one method does it only call the method once for a random event or does it call it both times once for each event or can you set it up to have one event wait for another

#

or is there no way to find out

wet breach
#

without looking at concrete implementation right now, it would call the method twice one for each event

#

hence why you wouldn't be able to listen to both events at the same time

pseudo hazel
#

yes that makes sense to me

#

but then it also makes less sense to have multiple events in 1 method

wet breach
#

but it doesn't mean you can't make the code in the method diverge depending which it is though. Part of what makes OOP great sometimes when you combine it with functional programming ๐Ÿ˜„

pseudo hazel
#

unless the way you handle each is nearly identical

#

thats true

wet breach
#

instead of duplicating methods, you would just condense

#

or if you were making some custom events, it could make it easier etc

pseudo hazel
#

yeah and maybe you need like 1 extra check or whatever but it will reduce duplication in the end

#

okay I see

#

well thanks for your time i guess

wet breach
#

yep, always love showing people different views on doing things mainly because I am advocate of doing things differently unlike everyone else

pseudo hazel
#

yes me too haha

#

thats why I was wondering about how it would work when you mentioned it

quaint mantle
#

hello

#

i had a question, about server softwares that can run plugins and spigot plugins.

#

well

#

i am aware of spigot, paper and purpur as being one of the major server softwares most minecraft server seem to use.

#

can somebody tell me something about them?

crimson relic
#

no

quaint mantle
#

is there an advantage of using one over other?

#

like any trade offs or any caveats or something like that?

#

just a general question about server softwares.

#

and just trying to learn more about them.

eternal oxide
#

If you write a plugin for spigot it works on all of them. Not the other way around

quaint mantle
#

i know that

eternal oxide
#

you asked

quaint mantle
#

my bad

#

yeah, i am aware of that, they are forks of spigot

#

but is paper really all that better than spigot?

#

as it is said?

eternal oxide
#

better?

remote swallow
#

it may run better on low end servers but when you get high end it doesnt really matter

pseudo hazel
#

its different

quaint mantle
#

it says something along the lines of aiming to be more optimised than spigot.

pseudo hazel
#

if it was objectively better than spigot noone would use just spigot

eternal oxide
#

if you have crap server hardware then Paper may perform better.

quaint mantle
#

intriguing.

#

why so?

eternal oxide
#

I stick with Spigot for reliability

remote swallow
#

so it runs off the main thread

quaint mantle
#

doesn't spigot also run things off of the main thread?