#help-development

1 messages · Page 818 of 1

undone axleBOT
young shell
#

Thanks. Send a mail

pulsar lava
#

do I have to worry about that warning?

ember quiver
chrome beacon
#

It's a warning that meta could be null

#

That would only happen if the item is air

grand flint
#

very nice

#

why didnt it show up

weak meteor
#

yoooo

grand flint
#

why did urs not show up

weak meteor
#

dont do that

grand flint
#

redirect people there every day

pulsar lava
#

is it possible to print logs in the cmd when I'm getting an error? so I can debug what could it be

chrome beacon
#

That would be the default behaviour

#

No?

green plaza
#

?mappings

undone axleBOT
pulsar lava
green plaza
#

What is this commands for md_5 mapings?

pulsar lava
#

oh

#

I meant printing my own logs

chrome beacon
#

You can do that too if you want

green plaza
#

?map

#

?mapings

#

?nms

pulsar lava
chrome beacon
#

get the logger from your plugin instance and call one of them methods on it

pulsar lava
#

alr thank you

noble adder
#

can anybody remove smoke particle from my worldguard ?

haughty granite
#

hey, how to register a plugin on maven?

orchid gazelle
#

I saw some plugins have colored "redstone" particles. Is that a thing or is that resourcepack-stuff?

haughty granite
young knoll
#

Redstone particle is rgb

mortal hare
#

Unsupported Java.
Your build is currently configured to use Java 21 and Gradle 8.5.

#

why is running java 21 is so damn hard

#

when its been released like 2 months ago

#

GRADLE 8.5 SUPPORTS JAVA 21

#

yet i get this error

#

EXPLAIN

#

ok this seems to popup whenever error is made while running the application

#

tbh makes no sense still

#

and it seems like intellij issue

wet breach
#

Seems you found the issue

quaint mantle
#

1.20.3 nms is 1_20_R3?

#

or what

young knoll
#

Easiest way is to check

warm mica
#

What are the odds that 1.21 is gonna use java 21

slender elbow
#

3%

mortal hare
#

i see no reason why not to upgrade

#

apart from users being annoyed to upgrade (official launcher has built in jre anyways)

worldly ingot
young knoll
#

Real chads use nextInt(1,101)

grand flint
#

@upper hazel look

cinder karma
#

Is there any appreciable execution time difference between pulling a value from config and storing it for future use, or just pulling it from the config every time you need it?

young knoll
#

Probably nothing noticeable

#

The config is already held in memory

river oracle
#

Boom just generated 2 random numbers between 0 and 101

remote swallow
#

59

#

why dont we just get choco to make them

#

a bot can just dm choco "Pick a random number between 1 and -1"

ashen remnant
#

Java
System.out.println(“Hello World!”);
That’s how you print right?

quaint mantle
#

Yeah

grand flint
quaint mantle
#

guys

#

My nightmares have come to reality

#

I forgot that I made a testing RDS on aws and found this on my credit card logs

#

Hey guys working with spigot api 1.8.8 and i am wondering how i would create the death animation to play out just like it normally would when u die?

Let me explain, I have set up simple instant respawn system by setting player's health to 20 when they die and it works fine and takes away the respawn screen just like i want it too, although it does take away the death animation. I was wondering if this is possible to replicate with a specific packet?

remote swallow
#

im trying to add a binary search to my insert function for a leaderboard but for some reason it just like doesnt work, its like somewhat right but most of it is off. Test class is https://paste.md-5.net/sawohuhijo.cs and data printed is

sullen marlin
remote swallow
#

the binary search?

#

ignore the print and temp methods, just the first thing i thought of to test it to make sure it works before adding it into the actual plugin

sullen marlin
#

Ye no reason to diy binary search

remote swallow
#

oh wait DIY

#

i did see the binary search in arrays but forgot to check if it could take a comparator

grand flint
#

probs is w packets

vital sandal
#

hmm how do I access these methods?

#

I don't see any of that currently

#

as well as this ?

#

and is there any alternative to it?

vocal cloud
#

The annotation should tell you what it means?

covert yacht
#

Hello ! I am trying to use the docker-api in my spigot plugin but i have an issue getting the classes to be loaded: i get a ClassNotFound exception.

Here is the dokcer api url : https://mvnrepository.com/artifact/com.github.docker-java/docker-java/3.3.4
Here is my pom.xml : https://paste.md-5.net/lunasexuho.xml
plugin.yml : https://paste.md-5.net/ijacuwabuf.sql

also here is the structure of the inside of my plugin data folder:

root@MCCODERS:/data/MCCodersServer/plugins# ls -R MCCoders
MCCoders:
config.yml  lib  translations

MCCoders/lib:
docker-java.jar

MCCoders/translations:
messages_en_US.yml  messages_fr_FR.yml```

Please tell me if you need more infos ^^
#

Note that i tried shading but without any success

drowsy helm
#

you need to shade it

#

wdym without success?

covert yacht
drowsy helm
#

did it actual shade it?

#

decompile and have a look

covert yacht
#

Maybe i'm wrong somewhere

i tried checking with : jar tf MCCoders-0.3.0.jar | grep docker

and got return :

com/github/dockerjava/zerodep/shaded/org/apache/commons/codec/language/bm/Rule$Phoneme.class
com/github/dockerjava/zerodep/shaded/org/apache/commons/codec/language/bm/sep_approx_french.txt
com/github/dockerjava/zerodep/shaded/org/apache/commons/codec/language/bm/sep_approx_hebrew.txt
com/github/dockerjava/zerodep/shaded/org/apache/commons/codec/language/bm/sep_exact_hebrew.txt
com/github/dockerjava/zerodep/shaded/org/apache/commons/codec/language/bm/sep_rules_french.txt
com/github/dockerjava/zerodep/shaded/org/apache/commons/codec/language/RefinedSoundex.class
com/github/dockerjava/zerodep/shaded/org/apache/commons/codec/net/URLCodec.class

that meant it was correctly shaded i think ? but still

chrome beacon
#

Exclude it from the shade

covert yacht
#

How can i know which file to exclude ?

#

This does not work

<excludes>
  <exclude>META-INF/*.SF</exclude>
  <exclude>META-INF/*.DSA</exclude>
  <exclude>META-INF/*.RSA</exclude>
</excludes>
upper hazel
lost matrix
rotund ravine
#

Well on first try it certainly is

vague swallow
#

omg haha how long did it take you to find it?

rotund ravine
#

Searched

#

Takes twos expnds

#

Seconds

lost matrix
rotund ravine
#

Would be easier in space i guess

rotund ravine
lost matrix
#

Yeah 🙂

vague swallow
vague swallow
obsidian drift
#
player.setPlayerListName(ChatColor.BOLD + "TEST " + ChatColor.RESET + player.getName());

The bold ChatColor doesnt seem to be working when using setPlayerListName?

#

Other ChatColors seem to be working

#

ITALIC does not work either

rotund ravine
#

Guess they don’t work there

obsidian drift
#

They did on paper 1.20.2

#

ill check spigot 1.20.2 now

#

spigot 1.20.2

#

seems like the spigot 1.20.3 update broke specific chatcolors in tablist

storm crystal
#

Paper for the win lol

obsidian drift
#

paper hasn't come out with 1.20.3 yet and when they do they will probably have the same bug

rotund ravine
#

Nothing paper related here

obsidian drift
#

ill report the bug

obsidian drift
rotund ravine
#

Jkjk

obsidian drift
#

Ok i reported the bug

quaint mantle
#

Does OfflinePlayer just give uuid hashcode?

#

Or it doesnt do hashcode at all

eternal oxide
#

what?

slate tinsel
#

What do I need to add In my pom.xml to use: org.apache.commons.lang.StringUtils;

rotund ravine
#

Nothing iirc apache commons is part of spigot?

eternal oxide
#

I remember somethign about dropping lang in favor of lang3

odd pier
#

hi

#

how to get custom inventories name(what i want: detect that is my inventory)

native ruin
#

Are you talking about Gettype or smth else

iron cave
#

but you really should compare inventories by instance not title

lost matrix
#

Did you make sure that they are on the ground and not hanning on a wall?

#

?img

undone axleBOT
#

Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.

Here's some screenshot utilities that can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org

lost matrix
#

Alright, add debug messages and check which part of your code acts unexpected

iron cave
#

wait cherry and bamboo weren't in 1.19.4

lost matrix
#

Yeah, right...

iron cave
#

nope

#

1.20 they were added

#

experimental datapack maybe? cant remember if they were added to that

remote swallow
#

Do you have the experimental datapack enabled

eternal night
#

I mean, the types exist via experimental datapacks.

#

idk if via-version fucks around there ?

iron cave
#

he has via and via backwards so maybe

eternal night
#

I mean

#

what is your plugins api version in your plugin.yml ?

#

okay

#

Welp, should work ™️

#

but I mean, 1.19.4 remains unsupported and I don't have a local setup to verify

#

I think I am good 😅

#

cherry signs in 1.19.4 means something enabled the experimental feature flags

#

that world is fucked anyway

smoky anchor
#

Heyo, random question, changelog for 1.20.3 says

  • Material.GRASS is now Material.SHORT_GRASS
    Will this be fixed for existing plugins with that bytecode manipulation thingie ?
eternal night
#

it is already fixed

#

Commodore does the rewrite

dry hazel
#

my beloved

spare hazel
#

how can i add enough velocity to a player to push them half of the way towards an entity?

rotund ravine
#

Mathh

spare hazel
rotund ravine
#

To add enough velocity to a player to push them half of the way towards an entity, you need to calculate the vector between the player and the entity, and then multiply it by a factor that depends on the distance and the desired speed. One possible way to do this is:

  • Get the player's location and the entity's location using player.getLocation() and entity.getLocation().
  • Subtract the player's location from the entity's location to get the vector between them using entity.getLocation().subtract(player.getLocation()).
  • Get the length of the vector using vector.length(), which is the distance between the player and the entity.
  • Divide the vector by the length to get a unit vector in the same direction using vector.normalize().
  • Multiply the unit vector by a factor that determines how fast and how far you want to push the player. For example, if you want to push the player half of the distance at a speed of 10 blocks per second, you can use factor = distance / 2 / 20, where 20 is the number of ticks per second in Minecraft.
  • Set the player's velocity to the resulting vector using player.setVelocity(vector).

Here is an example of how the code might look like:

// Get the player and the entity
Player player = ...;
Entity entity = ...;

// Calculate the vector between them
Vector vector = entity.getLocation().subtract(player.getLocation()).toVector();

// Get the distance
double distance = vector.length();

// Normalize the vector
vector.normalize();

// Calculate the factor
double factor = distance / 2 / 20;

// Multiply the vector by the factor
vector.multiply(factor);

// Set the player's velocity
player.setVelocity(vector);
#

I hope this helps you with your plugin development. 😊

Source: Conversation with Bing, 06/12/2023
(1) How do I gradually apply velocity in Spigot? - Stack Overflow. https://stackoverflow.com/questions/35214761/how-do-i-gradually-apply-velocity-in-spigot.
(2) How do I set player velocity in Spigot? | Hypixel Forums. https://hypixel.net/threads/how-do-i-set-player-velocity-in-spigot.3409987/.
(3) Solved - Set A Players Velocity? | Bukkit Forums. https://bukkit.org/threads/set-a-players-velocity.145866/.
(4) player.setVelocity() not launching player into Y-Direction. https://bukkit.org/threads/player-setvelocity-not-launching-player-into-y-direction.208939/.
(5) Entity (Spigot-API 1.20.3-R0.1-SNAPSHOT API). https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/Entity.html.
(6) 1.16.5 - Trying to spawn entity that has velocity in a ... - SpigotMC. https://www.spigotmc.org/threads/trying-to-spawn-entity-that-has-velocity-in-a-certain-direction.469959/.
(7) Location (Spigot-API 1.20.2-R0.1-SNAPSHOT API). https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Location.html.

icy beacon
rotund ravine
#

Idk either, it is interesting though

night grove
rotund ravine
#

Visit dynmaps discord

young knoll
#

I beleive it was removed

#

Gotta add it yourself

slender elbow
#

commons was removed in favour of guava, yes

spare hazel
#
@Override
    public void customSpawnFeatures(LivingEntity entity, Player spawner) {
        if(spawner == null) return;
        
        entity.getLocation().add(0, 1 , 0);
        entity.setAI(false);
        entity.setGravity(false);
        entity.setInvulnerable(true);
        
        spawner.sendMessage(TextData.getString("data.entity.EVIL_GOLEM.dialogue"));
        spawner.playSound(spawner.getLocation(), Sound.UI_TOAST_IN, 100f, 0f);
        entity.damage(1, spawner);
        new BukkitRunnable(){
            @Override
            public void run() {
                spawner.sendMessage(TextData.getString("data.entity.EVIL_GOLEM.dialogue2"));
                spawner.playSound(spawner.getLocation(), Sound.UI_TOAST_IN, 100f, 0f);
                for(int i = 0; i < ARMY_SIZE; i++){
                    IranSkyEntities.getInstance().getServer().getScheduler().runTaskLater(IranSkyEntities.getInstance(), () -> entity.getWorld().spawnEntity(spawner.getLocation().add(random.nextInt(-1, 1), random.nextInt(-1, 1), random.nextInt(-1, 1)), EntityType.PILLAGER), (i * 10L) + 1);
                }
                new BukkitRunnable(){
                    @Override
                    public void run() {
                        entity.setAI(true);
                        entity.setGravity(true);
                        entity.setInvulnerable(false);
                    }
                }.runTaskLater(IranSkyEntities.getInstance(), (ARMY_SIZE * 10L) + 51);
            }
        }.runTaskLater(IranSkyEntities.getInstance(), 30);
    }```
is there anything i can improve?
spare hazel
slender elbow
#

general utility libraries

river oracle
#

WeakReferences get GC'd if the thing they reference get GC'd right?

#

Wait I understand now I read an article nvm

slender elbow
#

i mean you can keep a hard ref to the object but forget about the weak ref, the WeakRef will get GCd but the other won't

river oracle
#

Alr

ivory sleet
quiet ice
#

No Reference objects will get GC'd (that is they behave like any other object)

#

However the object they reference may get GCd depending on the type. Objects behind WeakRef will get inaccessible if nothing else refers to them

#

Objects behind Phantom refs stay for even longer (till the GC or finalization I think?)

ivory sleet
#

Yo have reference queues also which ucan register to

#

but yeah

#

Well

#

Yes I think its past finalization

#

Where as weak indicates state of finalizable

slender elbow
#

finalizers are the devil

night grove
remote swallow
night grove
#

I already ask they are not answering

#

but ill wait

rotund ravine
deep ibex
#

I've been following a tutorial on how to start setting up a plugin with intellij, and I've reached a point where I'm unable to mimic what the tutorial is telling me to do. The tutorial wants me to add the outputFile tag to change the location the project is saved, so that it goes into the plugins folder in my world file. Is there any reason I can't just move the file location itself to the plugins folder manually? Or will it re-create the project file at the original location each time I save it?

#

or should I just change my output directory? I feel like that might not save the file though to the right place if I'm to re-edit the project again.

chrome beacon
#

the plugins folder in my world file
I assume you mean server folder

#

not the world itself

#

Is there any reason I can't just move the file location itself to the plugins folder manually?
You can ofc move the plugin yourself

deep ibex
#

But I guess I'm worried that if I do manually move it, either I'll have to move it each time I want to test a new version of it (not the worst thing in the world I guess :P) or that the Intellij project will no longer have access to it.

river oracle
slate tinsel
slate tinsel
#

Thanks 🙂

slate tinsel
# river oracle ?nms

The only thing I had "forgotten" was "<classifier>remapped-mojang</classifier>" but when I add it net.minecraft disappears

river oracle
#

wlel the classes change

#

?mappings

undone axleBOT
river oracle
#

EntityTypes becomes EntityType

slate tinsel
remote swallow
#

just run buildtools anywhere

#

it adds it to maven local which ur plugin can then use

river oracle
#

java -jar BuildTools.jar --rev 1.18.2 --remapped
in your case you'd obv change the verison

remote swallow
#

id recommend not running it inside ur plugins project folder because you might accidentally commint nms to git

river oracle
#

never done that before for sure

remote swallow
#

i almost did it

#

but i havent so far

river oracle
#

I've only committed NMS to CraftBukkit once

remote swallow
#

thats what i almost did

kindred sentinel
#

I have a problem...

remote swallow
#

reload maven

river oracle
#

weload uwu

kindred sentinel
#

nothing has changed

river oracle
#

you see, their is no version

kindred sentinel
#

oh..

river oracle
#

but Mr Jar plugin begs you add a version

#

the real solution here is to add it in pluginMangement tags with the version and then just do it like that

#

but you could also just add the version to every profil

proud badge
#

does a player have a PDC

river oracle
#

yes

#

?jd-s

undone axleBOT
river oracle
#

all the sub interfaces of PersistentDataHolder do

proud badge
#

Can I not pull the data if the player is offline?

river oracle
#

no PersistentDataHolder for OfflinePlayer

proud badge
#

Rip

remote swallow
#

@young knoll did something relating to ofline pdc for players but idk if it got prd

young knoll
#

Not yet

proud badge
remote swallow
#

just store the color as a string

proud badge
#

can I convert it back to a colour? if so how (whats the method)

remote swallow
#

ChatColor.valueOf should exist iirc

quaint mantle
#

Did Discord changed app icons?

river oracle
#

Nah youre just going crazy

quaint mantle
quaint mantle
#

Looks weird

river oracle
#

Yeah

remote swallow
#

bc translate alt code wont translate BLUE

river oracle
#

Is always been that

remote swallow
#

no it hasnt

quaint mantle
remote swallow
#

doesnt minedown take that format

quaint mantle
#

Idk

#

I just know that ChatColor#translateAlternateColorCodes name is way too long

#

😔

remote swallow
#

thats why everyone makes a util method

shadow night
#

call it just t

quaint mantle
#

ChatColor#t

shadow night
#

And make it just run the previous name lol

rotund ravine
#

c.c for fun

quaint mantle
#

c.ctacttscotfa

(Chat.ChatTranslateAlternateCodeToTheSpecifiedCharacterOnTheFirstArgument)

fluid river
fluid river
#

why

quaint mantle
#

Why not?

fluid river
#
public static String paint(String text) {
    return ChatColor.translateAlternateColorCodes('&', text);
}```i'm alr with that alone
#

hex is for pussies

quaint mantle
#

hex is a wonder of world

#

The fact that #fff means white in binary is simply awesome

ivory sleet
#

&x&f&f&f&f&f&f

#

Cursed but it works right

quaint mantle
native nexus
#

Very cursed

ivory sleet
#

idr

native nexus
#

It’s cursed that you can use bungee chat api functionally on a normal spigot server.

ivory sleet
#

well its more the name that tend to throw off people

#

I mean its been packaged with spigot for a long time now x)

native nexus
#

I am too lazy to look at the source code to see why

quaint mantle
remote swallow
#

i mean would you rather having to shade the chatapi urself or add it urself if ur spigot server was on bungee bc it didnt shade it

native nexus
#

True but couldn’t they just make one for spigot

remote swallow
#

then what are you gonna use for sending stuff from bungee

#

its easier to just have all spigot include bungeechat

quaint mantle
#

Plus that way you can send a bungeecord formatted message from spigot

#

Without having to do weird stuff

#

All is done by spigot

native nexus
#

¯_(ツ)_/¯

ivory sleet
fluid river
#

and let spigot convert it to colored text

ivory sleet
#

since components and minecraft text isnt gonna change on proxy

river oracle
#

inventory pr

vast raven
#

How to avoid paper armorstand tick when disabled? Does teleporting armorstand work?

vast raven
#

uh right

#

nvm

main barn
#
if (targetPlayer != null) {
                            try {
                                int amount = Integer.parseInt(args[2]);

                                double maxHealth = targetPlayer.getMaxHealth();
                                double newMaxHealth = maxHealth + amount * 2;
                                newMaxHealth = Math.ceil(newMaxHealth * 2) / 2;
                                targetPlayer.setMaxHealth(newMaxHealth);

                                player.sendMessage(ColorUtils.translateColorCodes("&#FF4500&lBF &8⏩ &fAdded " + amount + " hearts to " + targetPlayer.getName()));
                                return true;
                            } catch (NumberFormatException e) {
                                player.sendMessage(ColorUtils.translateColorCodes("&#FF4500&lBF &8⏩ &fInvalid amount. Usage: /bf addhearts <player> <amount>"));
                                return true;
                            }
                        } else {
                            player.sendMessage(ColorUtils.translateColorCodes("&#FF4500&lBF &8⏩ &fPlayer not found. Usage: /bf addhearts <player> <amount>"));
                            return true;
                        }``` why does this make the hearts look like this? it happens with all my other cmds / setmaxhealth things too (i cant heal past that half a heart basically is my issue)
vague swallow
#

How does the path to a sound from a ressource pack has to look like?

main barn
vague swallow
rotund ravine
chrome beacon
#

You have 10 hearts and 20 hp

#

meaning 1 heart is 2 hp

#

oh and set max health is deprecated

#

use attributes

main barn
worldly ingot
#

I mean if it's deprecated then there's probably an alternative

#

In this case, the alternative is attributes

#

#setMaxHealth() uses attributes under the hood but we'd rather you use the API that you should be using

brazen badge
chrome beacon
#

Try running it

brazen badge
#

i've done it 18 times

chrome beacon
#

what did you run

#

and what happened

rotund ravine
#

?paste

undone axleBOT
rotund ravine
#

Ur stuff

brazen badge
vague swallow
#

Does anyone know how to play a sound from a Ressourcepack?

brazen badge
brazen badge
worldly ingot
#

So if it's a custom sound it will be whatever string you pass

chrome beacon
# brazen badge

You need to run the shadowJar task or make the build task depend on shadowJar

vague swallow
worldly ingot
#

Well your sound should be registered and have a custom key

vague swallow
#

how do I do that?

worldly ingot
#

(pack_format is obviously not correct, but the general structure should still be fine)

vague swallow
#

Thanks!

fossil flax
#

how can i send a message in the action bar in a event listener? (plugin version 1.8)

chrome beacon
#

what do you want to do

brazen badge
#

make the build task depend on shadowJar

chrome beacon
#

build.dependsOn("shadowJar")

#

^ groovy

brazen badge
chrome beacon
#

You can't rely on the Intelisense when working with Gradle

#

It will show that error a lot

rotund ravine
#

Ur intellisense is so borked

chrome beacon
brazen badge
#

it isn't working

chrome beacon
#

Could you send your new build file

#

and log

brazen badge
dry hazel
#

kotlin has good autocompletion and error checking

chrome beacon
chrome beacon
dry hazel
#

not at all

shadow night
#

Kotlin is also ugly

brazen badge
#

so this: PersistentDataContainer customBlockData = new CustomBlockData(block, plugin); may work

#

but it doesn't

chrome beacon
#

?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.

river oracle
#

also that's an external library

#

you should probably ask mfnalex

#

and you did you just can't wait it seems

grand flint
valid burrow
#

whats the new/better was

upper hazel
#

how rename plugin derictory with configs like -> class (RSkilsDuels) -> jar (R_skils_duels) ->derictory(R_skils_duels)

scenic onyx
#

are to much? (modules)

upper hazel
#

and it doesn’t matter at all, in fact the main thing is that you feel comfortable

#

ah wait i was found

remote swallow
scenic onyx
valid burrow
#

what event is triggered when renaming an entity with a nametag

thin iris
#

how do i check if a block is a crop

eternal oxide
#

Tag.CROPS.isTagged(block.getType())

thin iris
#

thank u <3

thin iris
eternal oxide
#

good question, Ageable?

thin iris
#

maybe

#

ill try this

 if (crop instanceof Ageable ageable) {
                    if (ageable.getAge() == ageable.getMaximumAge()) {
                        return;
                    }
                    if (!isNight(player.getWorld())) {
                        ageable.setAge(ageable.getAge() + 1);
                    } else {
                        ageable.setAge(ageable.getMaximumAge());
                    }
                }
night grove
#

Do you guys know some plugin that in exact time server will automatically shut down and automatically turn on like in 23PM it will shut down and in 8 AM will turn on

eternal oxide
#

no plugin can do that

tardy delta
#

just make a cron job

night grove
#

where can i make that?

kindred valley
#
public class Loyal extends JavaPlugin {
    CustomConfigSetup setup = new CustomConfigSetup();
    @Override
    public void onEnable() {
        saveDefaultConfig();
        setup.createCustomConfig();
    }
}```
#
public class CustomConfigSetup extends Loyal{
     File customConfigFile;
     FileConfiguration fileConfig;

    public void createCustomConfig() {
        customConfigFile = new File(getDataFolder(), "specifiedblocks.yml");
        if (!customConfigFile.exists()) {
            customConfigFile.getParentFile().mkdirs();
            saveResource("specifiedblocks.yml", false);
        }
        fileConfig = new YamlConfiguration();
        try {
            fileConfig.load(customConfigFile);
        } catch (IOException | InvalidConfigurationException e) {
            e.printStackTrace();
        }

    }

    public FileConfiguration getFileConfig() {
        return fileConfig;
    }
}``` what i do wrong here
young knoll
#

You can't create an instance of a class that extends JavaPlugin

kindred valley
#

whyu

quaint mantle
#

It’s your plug-in class

kindred valley
#

ah fuck

#

i forgot to instance plugin

topaz cape
#

what packets do i need to send the player to make the client think he died

scenic onyx
#

simple

#

or

topaz cape
fossil flax
#

the nametag character limit is 16 for version < 1.13?

young knoll
#

pretty sure it still is

scenic onyx
# topaz cape ?????

do
for(i = 0, i>100000, i++){
player.sendPacket(RiderPacket)
}
Similar at this

young knoll
#

You would have to send whatever the health packet is

#

With a value of 0

topaz cape
scenic onyx
topaz cape
#

minecraft death screen

scenic onyx
remote swallow
#

kicking is not dying

fossil flax
scenic onyx
fossil flax
scenic onyx
fossil flax
#

i know the basics of java development but im not a senior

remote swallow
#

dont trust ai for nms

fossil flax
#

not even a junior

scenic onyx
#

is not aggiorned

scenic onyx
fossil flax
#

si

scenic onyx
# fossil flax si

sto facendo un plugin delle bedwars multi instaza (Multi server tipo hypixel) per il mio server e stavo pensando anche io a questa cosa. Se vuoi quando trovo la soluzione te la do

scenic onyx
winter galleon
#

meta.setDisplayName(i); = error: incompatible types: int cannot be converted to java.lang.String

#

why?

#

i can't do i.toString()

chrome beacon
#

An int is a primitive not an object

winter galleon
#

right

#

how can i do this instead?

chrome beacon
#

so you can't call methods on it

#

"" + i

winter galleon
#

wow

#

java is a cool place

chrome beacon
#

or just String.valueOf(i)

#

There are many ways to do it

winter galleon
#

oh okay tysm

#

im new to java

#

and to plugin development

#

if (args[0].equalsIgnoreCase("1")){ for (int i = 0; i == 53; i++){ ItemStack arredo = new ItemStack(Material.PURPUR_BLOCK); ItemMeta meta = arredo.getItemMeta(); meta.setCustomModelData(i); meta.setDisplayName("" + i); arredo.setItemMeta(meta); inv.setItem(i, arredo); } player.openInventory(inv); }

sorry again, somebody can tell me why the gui opens but with no items?

remote swallow
#

gonna need some more code than that

winter galleon
#

nice!

#

what i need to add?

remote swallow
#

show where you define the inventory

#

if anything just show the whole method

winter galleon
#
        if (sender instanceof Player){
            Player player = (Player) sender;

            Inventory inv = Bukkit.createInventory(null, 9*6, "Arredamento");

            if (args.length == 1){
                if (args[0].equalsIgnoreCase("1")){
                    for (int i = 0; i == 53; i++){
                        ItemStack arredo = new ItemStack(Material.PURPUR_BLOCK);
                        ItemMeta meta = arredo.getItemMeta();
                        meta.setCustomModelData(i);
                        meta.setDisplayName("" + i);
                        arredo.setItemMeta(meta);
                        inv.setItem(i, arredo);
                    }
                    player.openInventory(inv);
                }
            }

        }
    return true;
    }```
remote swallow
#

looks correct, add debug statements

winter galleon
#

okay

chrome beacon
#

so it won't run

#

0 isn't 53

winter galleon
#

ooo im so stupid

#

omg

#

tysm

gleaming grove
#

Is there anyway to get proper clicked action in creative mode or there will be always Createive? I would like to know when item was right clicked

chrome beacon
#

It doesn't know what you did to cause that

umbral ridge
remote swallow
#

why filter when you want to check to see what somethng is

gleaming grove
umbral ridge
#

does HttpURLConnection throw an exception if the response code isn't 200?

worldly ingot
#

It shouldn't

#

You should be able to getResponseCode() and it will return one of the constants defined in that class

#

I would maybe recommend HttpClient though if you're using Java 11 or higher. Just a bit of a more refined API

umbral ridge
#

thanks choco, yeah I will probably switch to HttpClient 👌

worldly ingot
#

The docs on the HttpClient class are pretty well written. Gives you a nice snippet example

umbral ridge
#

I'm making an updater class for my plugin

#

want to make it efficient and async of course

worldly ingot
#

I'm really selling HttpClient here but it has in-built async support :p

river oracle
#

if choco is selling something like I sell Inventory PR its gotta be good

young knoll
#

Choco is paid by HttpClient

umbral ridge
#

Choco is HttpClient

#

choco with async support

river oracle
#

waiting for the human brain to release async support tho fr. I can only do 1 task at once

young knoll
#

Some people already have it

remote swallow
#

how did they get the update before us

livid dove
#

Not really anywhere else to ask propper. But what was the reasoning behind yeeting the Enchant Registry now? Not sad its gone (was gonna happen eventually lol) but just seemed outa nowhere lol

carmine mica
#

the enchant registry is not yeeted

#

Registry.ENCHANTMENT is still there

#

as is the nms BuiltInRegistries.ENCHANTMENT

livid dove
#

You lost me at nms lmao

carmine mica
#

internal vanilla code (aka not part of the API)

livid dove
#

No I mean... you lost me

carmine mica
#

both registries still exist

#

the API one just wraps around the vanilla one

livid dove
#

I know...
I meant... "you lost me at nms" as in "no deal" as in "god in heaven have mercy, don't make me touch nms"

young knoll
#

Then do custom enchantments the proper way

#

It starts with p and ends with dc

livid dove
#

... erm...

carmine mica
#

its not a perfect replacement. like how do I add the glowing effect? a hidden enchant? then I have to have special handling for those items in the grindstone, etc, etc, etc.

#

I do recommend using PDC tho if using a hidden enchant is fine for showing the glowy effect

young knoll
#

Fair

livid dove
#

Am I going mad... PDC isn't that literally what was just pulled? Or am I being moronic

young knoll
#

Not the worst though

#

What? pdc is nothing to do with the enchantment registry

kindred valley
#
 ItemStack stack;
    @Override
    public void onEnable() {
        l = this;
        stack = new ItemStack(Material.ANDESITE);
        stack.getItemMeta().setCustomModelData(1);
        Bukkit.getPlayer("limpeex").getInventory().addItem(stack);
        if(stack.hasItemMeta()){
            if(stack.getItemMeta().getCustomModelData() == 1){
                System.out.println("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA");
            }
        }````
livid dove
#

I feel like either I have a gap in my knowledge... or I've used something without knowing its pdc

kindred valley
#

what is wrong here on stack

young knoll
#

?pdc

young knoll
#

You need to modify it and then use setItemMeta

livid dove
#

So it wouldn't be an enchantment... It'd be a PDC holding shit that smells like an enchantment works like an enchantment, but isn't an enchantment

#

Am I right in that?

young knoll
#

Yes

livid dove
#

That's moronic imo

#

And I wanna be clear

#

Utterly imo

#

Like no objective reason other than "I liked my enchants being actually enchants as it led to less of a headache"

#

Now I have to shove a load of new objects into items to store a separate instance of an object that'll then mimic everything to do with enchants.

Then set up a whole enchantment system to fake add the fake enchants to an item in the enchantment table.

#

Like Jesus christ lmao

#

I get it for the most part.

But still that utterly sucks. I actually really hate the idea of adding more shit to be stored memory.

In this case literally adding an object to store the data for my other object.

It's completely a personal opinion. But that seems hella messy

#

Nms is probably gonna just be the play.

And that hurts deep lmao

warm mica
#

God I hate mineacademy so badly, it makes people worse developers

livid dove
#

That came outa nowhere loo

#

Lol

warm mica
#

Because I got really furious for spending a lot of time in fixing a project that was written in mineacadmies "foundation" library

young knoll
#

Yes I’m sure that 10kb of memory will be missed

warm mica
#

It is so bad, it's sad

#

Don't ask me why

livid dove
# young knoll Yes I’m sure that 10kb of memory will be missed

Look man. I just personally think having a bodge job wrapper for enchantments shpild of been adressed by making a better system. Not gutting it and having to use a PDC.

It was neat you could bodge it.

Would of been brilliant if it had been made better, not removed.
Imo ofc

young knoll
#

We can’t make a better system

#

Enchantments aren’t data driven

livid dove
#

Then why not leave it be? Why remove it?

young knoll
#

Because it wasn’t api

#

It also didn’t really do much

#

Didn’t work with anvils or the table without extra code, all it did was let you access stuff through ItemMeta directly

livid dove
#

Which in itself was a really nice QoL thing imo

young knoll
#

I mean I guess

#

But it’s not hard to make a quick wrapper for that

livid dove
#

Consider for a moment that most custom enchant plugins also wanna add general functionality to vanilla enchants.

You know how nice it was to loop through the enchants on an item and find urs and the vanilla stuff?
Now it's gotta be some frankenstein bs with calls to the PDC and enchants

warm mica
#

Idk what has changed but an API for custom enchantments would indeed be nice

young knoll
#

Sure but it would be a janky hack

#

It wouldn’t integrate with the registry and wouldn’t work properly for clients

livid dove
young knoll
#

You mean the thing we are working on replacing?

#

Yeah I have

livid dove
#

I thought that was paper

warm mica
#

They are busy creating spigot 2.0

livid dove
#

Maybe there is some weird thing where both of yall are trying to replace it with diff ideas but I swear paper said they are thinking of replacing kt

young knoll
#

We have been working on it for a while

#

ItemType and BlockType

livid dove
#

Fair.
But yeah man I dunno.

I personally think forcing anyone who wants to do custom enchants to use PDCs is jankier than a registered enchant that doesn't have all the bells and whistles.

At least irs adjacent to what it's supposed to be rather than a container on every single.item u enchant, that then needs to have its metadata changed to look enchanted.

#

Maybe it's me being dumb.

But the registered enchant that doesn't quite work feels a lot less jank than "this isn't an enchant at all, but we sure as hell gonna make it look like one"

young knoll
#

Using a built in api for a very valid use case

#

Vs reflectively changing a value to inject stuff into a registry that isn’t tied to the vanilla registry

livid dove
#

I'll conceded lmao

#

Conceed

#

Conceed jesus

#

Also, as long as inventories ar eloaded item by item by half the popular plugins in the community every time a player clicks, I ain't putting persistent data containers on items lmao

#

Can't wait for a player to lag machine a server by enchanting loads of items with custom enchants then spam clicking their inv

young knoll
#

I mean it’s just a map internally

livid dove
#

Right. And?
A map is good yes, but it being called synchronously by every item being loaded is not good juju

#

Normal inv? Yeah cool.

Player spam clicking and reloading his inv every click

#

Hell nah

ivory sleet
#

what exactly is your issue?

#

I mean, I get that single threaded minecraft has its limits

#

but given that the average server scarcely reaches 50 players I doubt thats much on the server

#

but now if that is the case u do have certain softwares that address that specific point

livid dove
#

I don't find that to be a comforting system lmao

ivory sleet
#

have you benchmarked its horizontal scalability?

young knoll
#

Tbf i think all items with meta automatically have a container anyway?

#

I’ve never actually looked if it’s created lazily or not

ivory sleet
#

u mean if ItemMeta is created lazily? (yes it is)

young knoll
#

Nah the container inside it

livid dove
ivory sleet
#

the pdc container? coll

young knoll
#

Ye

ivory sleet
#

im just curious what methodology u used

ivory sleet
young knoll
#

Yeah just checked

#

It’s not

ivory sleet
#

but item meta is right? so that should do it

young knoll
#

True

#

Idk itemstacks are weird

#

Because there are 2 types

remote swallow
#

Am i an item stack

young knoll
#

Maybe

#

Ideally itemstack would be an interface like everything else

#

But you can’t instantiate an interface

ivory sleet
#

I think it could be neat with 2 interfaces

#

one that represents an actual, living item stack residing somewhere such that live manipulations of it is reflected

#

and one thats just a context, remoteless item stack

young knoll
#

Would probably have to be 3, ItemMirror, ItemCopy (naming isn’t my thing) and then the base itemstack

#

Still couldn’t instantiate them tho

ivory sleet
#

yea

#

and then maybe we'd introduce factory methods in ItemFactory to create these new coolings

#

difference between ItemCopy and item base?

#

btw

wet breach
young knoll
#

I just kept the base for ease of backwards compat

livid dove
ivory sleet
#

ah coll I see

#

fair

livid dove
#

@formal vector u still got the screenies?

wet breach
ivory sleet
#

well I think its highly in the api endusers interest to get this api where we differentiate between "copied" items and "living" items

#

:)

young knoll
#

Yeah

ivory sleet
#

man the new discord icons so goofy

young knoll
#

But removing new ItemStack would be a pretty big hit

#

It’s a very core part of the api

livid dove
ivory sleet
#

oh yeah true, backwards compat def needed ⚒️

#

also big issue with itemstack is that it never got any static factory methods

wet breach
ivory sleet
#

so its pretty hard to build compat on top of it (since many explicitly invoke its constructors)

young knoll
#

Shame you can’t define a constructor in an interface

ivory sleet
#

fr lol

livid dove
wet breach
#

The what guy?

#

I havent heard such things lol but ok

livid dove
#

getInventoryHolder

#

I made a big stink about it months ago and got reemed for it 😅

wet breach
#

Lol

livid dove
wet breach
#

So why not just keep it cached then

livid dove
#

You can't.

It's not a plugin issue. It's an api issue

#

Get holder snapshots the holder every time.

#

If the holder is a block entity... it by effect snapshots the inventorytoo

#

Item by item

wet breach
#

Hmmm not sure why it does that then. But i am sure there is a way around it.

livid dove
#

Nope

young knoll
#

The way around it is just to not use getHolder

#

You rarely need it

livid dove
#

Issue is col every major.plugin uses it somewhere

#

It adds up hard

wet breach
#

Well that is a quality issue more then anything lol

livid dove
#

U know 12% thread use on one method is insane

wet breach
#

That isnt too terrible

young knoll
#

I mean we could probably cache it

#

I’m not sure if there would be any repercussions for that

livid dove
#

In a 100 player fight... 12% being used on that method is ludicrous

wet breach
wet breach
#

Seems like the whole snapshot thing should be its own method like chunks

livid dove
#

*paper ironically did a solution to this and added a boolean that by standard is true for snapshotting

wet breach
# livid dove Safety

This doesnt make sense either since there is nothing unsafe in dealing with the live inventory

livid dove
#

*inventoryHolders

#

The issue lies in block entities containing an instance f their inventory

wet breach
#

I still dont see the issue when chunks need to be loaded for them anyways

livid dove
#

How u mean?

wet breach
#

You cant manipulate the inventory of a block that is in an unloaded chunk. Therefore you will need the live inventory instanced regardless. I just dont see the reason to automatically make a snapshot except if you wanted to handle the inventory in another thread or at least parts of it. I suppose it makes sense if like you didnt want the inventory changing but i mean the snapshot has to get saved back if it gets changed anyways

livid dove
#

Thing I can think of is imagine pissing around with the holder of a chest. And someone breaks the chest as its doing golder.logic

#

*holder logic

wet breach
#

It only changes where it errors

livid dove
#

*shrugs

wet breach
#

I would rather the logic to hault sooner rather then later

livid dove
#

Either way yeah. That's the problem. Did a thread on it ages ago.

So yeah until that's fixed I'm not adding the problem by using sodding pdcs

#

Because here's the rub. Pdcs make that holder problem worse.

But ud never know as ud only ever see inventory snapshots causing issue in the profiler

river oracle
#

there are many better solutions than implementing meh api

livid dove
#

Agreed. But they do. Lots.of widely used.knes too

ivory sleet
#

now its been fixed

river oracle
ivory sleet
#

but it was once not

#

unsure

young knoll
#

This is why we need those sweet sealed classes

river oracle
young knoll
#

That would bump api version :(

#

What java version is sealed classes?

river oracle
ivory sleet
#

I think it would break too much of backwards compat

#

and the subclasses have to be known at compile time anyway

young knoll
#

Yes but md likes his java 8 :p

river oracle
#

ahhh

young knoll
#

We are bumping to 9 soon™️

ivory sleet
#

sealing wont do much, or well it may do too much

livid dove
#

Either way.
Yeah it's a bigger problem than folk realise as it's repercussions arnt seen.

We say nbt is a resource hog, that custom items suck ass for tps.

Ironically they arnt the problem

It's sociology.

Custom items usually trade well in big servers. They are moved around a lot... in SHULKERS.

The lag inherent to custom items is a repercussion of the item being snapshotted 27^27 times each time the inventory is transfered from one chest to another

wet breach
river oracle
young knoll
livid dove
#

27^27 times for every plugin that uses it too...

wet breach
ivory sleet
#

aw its not a wiki

#

nvm

young knoll
#

True but this is just the dependency

#

Not the actual build version

river oracle
#

Considering I'm not in paper discord I feel like maybe this is something @livid dove should bring up with them. Considering he made his case here I believe it would also be applicable there

livid dove
#

Need to wind back on the salt lol

river oracle
#

you'd have to unfreeze it though

livid dove
#

But now my reservations of making every enchanted item in a plugin a pdc due to get holder...

Can I have my registry back plox

young knoll
#

You can definitely inject into the vanilla registry

#

Should you is another question

livid dove
river oracle
livid dove
#

Until get holder is fixed

#

It's all I ask 🤣😭

river oracle
#

imho the easiest way to fix this without doing some pdc shit is to inject into the vanilla registry

livid dove
#

Don't make me use pdc papi. Please

river oracle
#

no PDC required just a bit of Reflection

young knoll
#

We really need to address a way to deal with custom registry content soon™️

ivory sleet
#

isnt that like half addressed lol

river oracle
livid dove
#

Add it back in next commit and just remove it when the replacement exists

#

I'm begging lmao

river oracle
#

well there already is a replacement just not in API, because well data driven Enchantments don't exist yet

ivory sleet
young knoll
#

The main problem is

#

They are frozen

river oracle
young knoll
#

We need to burn more coal so we can melt the registries!

river oracle
ivory sleet
river oracle
river oracle
wet breach
young knoll
#

We sorta did

#

But it was never really looked into

ivory sleet
#

having registries frozen makes sense tho

#

esp since more and more of registries are being synced w client

young knoll
#

Does it?

#

Yeah that’s the thing

#

What happens if you modify a client synced registry while players are online

ivory sleet
#

exactly

young knoll
#

The answer: I have no idea

river oracle
#

What we really need is a Configuration Phase loading for the plugin so we can safely allow injection into the registries

young knoll
#

Yeah that would be good

#

But

ivory sleet
#

which is why there should be a moment during startup where plugins can modify registries

young knoll
#

What if a plugin gets unloaded

livid dove
#

Right I'm off to bed.

All I know is they took out the map in enchantment registry and its stink poo poo and should be added back in till a true solution is found.

Spigot was born from bodge jobs. Let us keep the bodge till an official.soluton exists

ivory sleet
#

which is a problem coll

young knoll
#

Indeed

wet breach
young knoll
#

So is the dreaded

#

/reload

river oracle
#

reloaded isn't supported that's already official

ivory sleet
#

I mean, I think its worth to yeet reload functionality

#

it was never good, never has been and will never be

wet breach
river oracle
young knoll
#

Yes plugins changing at runtime probably deserves to die

wet breach
young knoll
#

But will the slime allow that, who knows

ivory sleet
ivory sleet
livid dove
#

Not that I'm biased... but mythic have took reload and made it essentially a qol feature when making changes to the configs

young knoll
#

Reloading configs is fine

#

It’s ripping out the entire plugin instance and making a new one that is… less ideal

ivory sleet
#

^

livid dove
#

Lmao

ivory sleet
#

if it just called sth like JavaPlugin#onReload()

#

then it would be fine

livid dove
#

Anyway I'll pay you 1p if u add the registry back in k thanks bye lmao

young knoll
#

Yeah that would be more reasonable

ivory sleet
#

1 pizza for coll

livid dove
#

He defo means my 1p offer

wet breach
#

Well plugins typically handle their own reloading and should. We probably could just modify the reload command to just only reload server configs and not everything

ivory sleet
#

yea

young knoll
#

There’s already a command for that

#

/spigot reload iirc

#

Or maybe it’s Bukkit reload

boreal jungle
#

Hola, hay plugin de register/login para la 1.20.2

wet breach
#

Seems redundant on that lol

young knoll
#

Either way it reloads the various server ymls

river oracle
#

thank god for my 1 day of spanish class so I can read that sentence /j

ivory sleet
#

anyway, I think its reasonable to consider /reload a bad way of refreshing resources at runtime, classloading issues, binary incompatibility, eventual packet issues, sync issues, mem leaks... the list can be made long if not even longer

wet breach
#

Which reminds me that i need to look and see if world unloading was fixed

river oracle
#

speaking of new things @young knoll I'd really appreciate if you could try out some of your plugins that involve inventories with my PR. I fixed a lot of bugs today and am getting ever closer to a finalized version. I really just need help making sure legacy compat is good to go. Outside of the unavoidable indirect breaking changes

young knoll
#

If you really wanted to be able to disable plugins at runtime you could have a Boolean in JavaPlugin that would stop most functionality

#

Ie events, schedulers, that kind of thing

livid dove
#

There is the back end problem still.

But literally 6 of the 8 mem leaks from world instance plugins I've seen last 3 months have been "there was an error but it being async led to the error not showing half the time"

wet breach
#

Still an issue

ivory sleet
#

anyway coll, it may be possible to resync registry entries that are held during runtime with the client (if reload for instance), another issue is ofc if some plugin x holds a reference to a registry element put in by plugin y, and plugin y unloads

livid dove
#

E.g everyone points to the radiator boiling , the wall paper peeling and the central heating being way too hot.

But noone is noticing the house is on fire

wet breach
ivory sleet
#

yeah, so even in mojangs code, they wrap registry entries with holder objects all the more

livid dove
#

Or maybe a better metaphor is everyone saying Jimmy is clumsy due to him naturally hitting his head on the same beam every day , but noone notices Jimmy needs glasses.

The beam is still there, but he wouldn't hit it twice as much

young knoll
#

I don’t think you can resync at runtime

#

It’s a configuration phase only packet

ivory sleet
#

ah

#

hmm

wet breach
#

I wonder what happens if that packet is sent again

#

🤔

#

Well i have work so i cant test that right now lol

ivory sleet
#

iirc when looking at papers draft they talked about some sort of client reset mechanism

#

tho that would prompt texture pack loss among other things

young knoll
#

Hmm

#

I assume you can force the client back into configuration phase

#

I think proxies do it

#

It’s probably better to just say no to registry changes after startup

river oracle
young knoll
#

@eternal night said they were going to make a draft of what it would look like with a generic subclass

#

But I’m not sure they ever did

river oracle
#

oh my bad

#

lynx never fully tested my inventory pr so yk

#

I had to do what I had to do

wet breach
#

Lol

young knoll
#

I’m still unsure on the generic subclass part

river oracle
#

no generics UwU

young knoll
#

Even if we removed runtime reloading, plugins still load too late to mess with registries/datapacks

river oracle
#

Configuration phase ftw

#

we probably just have to add a new loading phase @young knoll that's inevitable

young knoll
#

Yes but how would plugins use it

#

Can’t be in the main class

ivory sleet
#

Why not?

#

Can’t you just load in all plugins earlier?

young knoll
#

Static initializers

#

private final ItemStack myEpicItem = new ItemStack()? Nope that’ll break

ivory sleet
#

Hm I see

young knoll
#

No server instance exists that early

ivory sleet
#

Fair enough

young knoll
#

I guess the option would be that plugins have to opt in to loading that early

#

But then… plugins depending on other plugins

river oracle
#

well worst case here's what you do.
Add something to the plugin.yml that indicates it should load during configuration phase add a new class

public class MyConfigurationMainClass extends ConfigurationPlugin {
  
  @Override 
  public void onConfigure() {
    Registry.WHATEVER.register(KEY, new Entry());
  }
}
ivory sleet
young knoll
#

True

#

You could ignore the dependency during this early phase

ivory sleet
#

Yea, welp, ima head off to bed now, gn yall :)

young knoll
#

gn

young knoll
river oracle
#

I mean what is another safe way of even doing that though

#

Configuration phase is so early

ivory sleet
#

Yeah that could work, but its always awkward when you have two entry points

young knoll
#

Again there is the idea of forcing plugins to opt in

ivory sleet
#

As it usually leads to lazy setters

weak meteor
#

someone got

#

a Block Adapter

#

for gson?

young knoll
#

If a plugin opts in that is them asserting they don’t have any static initializers that would cause problems

weak meteor
#

i found one but its with net.minecraft

ivory sleet
weak meteor
#

i just used a ItemStack adapter last time i needed one

young knoll
#

That’s all block really is

weak meteor
#

so if i use

#

LocationAdapter

ivory sleet
#

Spigot wise yeah lmao

weak meteor
#

would work?

ivory sleet
#

Yes write a LocationAdapter

#

with gson

weak meteor
ivory sleet
#

extends TypeAdapter<Location>

weak meteor
#

but thought it wont work cause Location

young knoll
#

You only need to adapt the world

#

Aka convert it to a string or uuid

#

The x y and z are just simple numbers

ivory sleet
#

Goofy, they used strings

#

or the one u sent at least ciro

weak meteor
#

yeah

#

idk

#

its the second adapter i use

#

lol

ivory sleet
#

Fair, well its prob fine to use that one

#

:)

weak meteor
#

okay

#

thanks

#

gotta try

wet breach
young knoll
#

Yeah but then once again

#

Multiple entry points

weak meteor
#

yea no

wet breach
weak meteor
#

so

#

how can i make my own adapter?

#

time to learn

ivory sleet
#

well

#

Can I link you a tutorial?

weak meteor
#

if you want

#

i got this

#

i now a block its just 3 coords and a id, isnt it?

young knoll
#

I guess technically you could have 2 entry points but a plugin would only use 1

carmine mica
wet breach
carmine mica
#

a block is a world and 3 coords

weak meteor
young knoll
#

Old plugins would use the existing JavaPlugin and new ones would extend JavaPlugin2™️

weak meteor
#

OH YEA

#

but im coding on spigot :(

#

da same!!

wet breach
#

Thats fine just pointing out paper does things differently now especially in regards to chunks

weak meteor
#

yea

#

but the adapter

#

why making it so hard

#

:(

river oracle
#

its not hard to make ajson adapter

#

just implement JsonSerializer and JsonDeserializer

weak meteor
#

i did

river oracle
#

register it with your gson instance

weak meteor
#

but idk what code to put on the method

#

like in there

#

i know theres code on there

young knoll
#

You need to write the world uuid, x, y, and z

#

Assuming you just want to store the location of a block

weak meteor
#

yea

#

i dont need anything else

river oracle
#

tf is this supposed to do

weak meteor
river oracle
#

there is a lot more to a block than x y and z. There is BlockData, BlockState, World and more not to mention the state, x y and z itself are completely mutable and arbitrary

weak meteor
#

so

#

how can i

#

like

#

how can i say it

river oracle
#

why are you serializing the block is the big question

weak meteor
#

i need to store the block

river oracle
#

why

weak meteor
#

like

#

the coords

#

and stuff

#

why?

river oracle
#

what is important about teh block

weak meteor
#

cause i listen to block break event

#

and x block in x, y z coords

#

its unbreakable

#

and well

#

if block == blockofjson event.setcancelled(true)

#

thats it

#

what if i make like

#

Coordinates

#

with members World, Int x, y z

#

and well i compare that

#

not the whole block7

river oracle
#

I don't really have time to explain everything but your approach is really flawed

#

Blocks can't be deserialized from json you'll have to find a better approach here

weak meteor
#

yeah

#

i guess it was too easy

#

ill think it

#

but by the moment

#

time to sleep

#

gn for everyone

carmine mica
#

why can't a Block be deserialized? its just a world and 3 numbers

#

the exact same as location

ivory sleet
#

I think it depends on what we mean by block x)

carmine mica
#

Block block, the api Block type

ivory sleet
#

if its the spigot one, then yea

carmine mica
ivory sleet
#

Myea

river oracle
#

I mean sure you could do that, but you'd be totally in the wrong mind set to be doing something like that

carmine mica
#

what is different between doing that to Location or Block

#

you can just do it to Location and call getBlock() on that location

#

Location and Block are really just the same thing with different methods

river oracle
#

personally wouldn't use Location either for such things 🤷‍♂️ simplify it down to an x y z and cut out all the extra crap

#

if you absolutely need add the world UUID too

ivory sleet
#

paperOhhh Position (mayhaps)

river oracle
#

i don't even get location

carmine mica
#

yes, Location sucks

#

mutability, possibly null worlds, all bad

ivory sleet
#

Why doesnt location encapsulate the world uuid instead?

river oracle
ivory sleet
#

True

river oracle
#

but I feel like that may be too much of an API change

worldly ingot
#

As weird as this sounds, Blocks don't exist on the server