#help-development

1 messages · Page 928 of 1

native nexus
#

Hmm I am just looking through his code to see why he made it concurrent

umbral ridge
#

@solar musk is SystemInfo your api library?

#

/CMarcoo/SystemInfo

#

I'm not seeing SystemInfo class in your code

#

That's not really it

#

Nevermind lol, I see you've used oshi-core API

#

I though you coded everything yourself

#

so it's basically a wrapper plugin

hazy parrot
#

You can

#

Skill issue

upper hazel
#

someone know how work with GRPC ?

#

help pls )

undone axleBOT
#

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

upper hazel
#

ok

#

i dont undestand why?

#

i mean what with artifact

blazing ocean
quaint mantle
#

i need small help

#

when i had my code in a command which puts a image on a map it had very good quality but now i made it a method it has very bad quality

thin wind
#

Hello I wanted to do a plugin that link a discord acc to a minecraft one with a code. What is the more efficient between hosting a bot in a minecraft plugin or the self projects which are communicating through a websocket server ?

chrome beacon
chrome beacon
#

both are valid options

#

Hosting the bot on the server is usually easier for users

quaint mantle
#

is it a possibility that it gives me the map before all the pixels are coloured?

thin wind
upper hazel
chrome beacon
quaint mantle
#

is it possible that Bukkit's map coloring gives me the map before its fully colored?

chrome beacon
# upper hazel here exists some general channels for dev ?

^^
try adding

    <plugin>
      <groupId>kr.motd.maven</groupId>
      <artifactId>os-maven-plugin</artifactId>
      <version>1.6.2</version>
      <executions>
        <execution>
          <phase>initialize</phase>
          <goals>
            <goal>detect</goal>
          </goals>
        </execution>
      </executions>
    </plugin>
quaint mantle
#

because when the exact same code was under a command it was looking very good but now i just made a method and used the method to give map it looks ugly

thin wind
quaint mantle
#

honestly both are fine

wraith dagger
#

is there any guide or tutorial for using net.minecraft.server in 1.20 mojang remapped?

quaint mantle
#

can someone help me with uhh increasing quality of image put on the minecraft map?

upper hazel
tidal marlin
#

It works ! Thanks a lot !

vestal mountain
#

hi! im trying to use this import: import net.minecraft.server.v1_18_R1.PathfinderGoalFloat; this is the error: Cannot resolve symbol 'v1_18_R1' my defenencies: java <dependencies> <dependency> <groupId>org.spigotmc</groupId> <artifactId>spigot-api</artifactId> <version>1.18.2-R0.1-SNAPSHOT</version> <scope>provided</scope> </dependency> <dependency> <groupId>org.spigotmc</groupId> <artifactId>spigot</artifactId> <version>1.18.2-R0.1-SNAPSHOT</version> <scope>provided</scope> </dependency> </dependencies>

quaint mantle
#

is there a way to temporarily register a chatListener?

cinder abyss
#

you only need spigot, spigot-api is included in spigot

vestal mountain
#

oh okey

cinder abyss
#

check if it resolves the error

chrome beacon
cinder abyss
#

yes also

vestal mountain
#

thenks

vestal mountain
#

now its saysing: Cannot resolve symbol 'minecraft' ```

<dependencies>
    <dependency>
        <groupId>org.spigotmc</groupId>
        <artifactId>spigot</artifactId>
        <version>1.18.2-R0.1-SNAPSHOT</version>
        <scope>provided</scope>
        <classifier>remapped-mojang</classifier> <!-- Important! -->
    </dependency>
</dependencies>

</project>

#
        <plugins>
            <plugin>
                <groupId>net.md-5</groupId>
                <artifactId>specialsource-maven-plugin</artifactId>
                <version>1.2.2</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>remap</goal>
                        </goals>
                        <id>remap-obf</id>
                        <configuration>
                            <srgIn>org.spigotmc:minecraft-server:1.18.2-R0.1-SNAPSHOT:txt:maps-mojang</srgIn>
                            <reverse>true</reverse>
                            <remappedDependencies>org.spigotmc:spigot:1.18.2-R0.1-SNAPSHOT:jar:remapped-mojang</remappedDependencies>
                            <remappedArtifactAttached>true</remappedArtifactAttached>
                            <remappedClassifierName>remapped-obf</remappedClassifierName>
                        </configuration>
                    </execution>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>remap</goal>
                        </goals>
                        <id>remap-spigot</id>
                        <configuration>
                            <inputFile>${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar</inputFile>
                            <srgIn>org.spigotmc:minecraft-server:1.18.2-R0.1-SNAPSHOT:csrg:maps-spigot</srgIn>
                            <remappedDependencies>org.spigotmc:spigot:1.18.2-R0.1-SNAPSHOT:jar:remapped-obf</remappedDependencies>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>```
quaint mantle
#

is there a way to make a new MapView without a world name?

chrome beacon
#

It needs to belong to a world

#

you can just take the players current world

#

it doesn't matter much

vestal mountain
#

if i reload maven says this: org.spigotmc:spigot🫙remapped-mojang:1.18.2-R0.1-SNAPSHOT was not found in https://hub.spigotmc.org/nexus/content/repositories/snapshots/ during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of spigot-repo has elapsed or updates are forced

Try to run Maven import with -U flag (force update snapshots)

chrome beacon
vestal mountain
#

i downloaded but how i can run?

chrome beacon
#

double click it

vestal mountain
#

what?

chrome beacon
#

Just run the jar file

#

?bt

undone axleBOT
vestal mountain
#

BuildTools.jar?

chrome beacon
#

yes

vestal mountain
#

noting happends

chrome beacon
#

It should open a GUI for you

vestal mountain
#

it dont oppend

kind hatch
#

Did you download the latest version of BuildTools?

vestal mountain
#

oh it oppends

kind hatch
#

I bet it’s the web requests that slow it down.

vestal mountain
kind hatch
#

Should make that a priority fix.

chrome beacon
vestal mountain
#

okey

#

its installing

chrome beacon
#

When we link guides don't skip them

#

or skip steps

grave laurel
#

I am making a plugin that detects if a player is afk, but I have no idea how to do it. Maybe with an enum or hashmap or so?

chrome beacon
#

Not an enum

#

but yeah a hashmap could work

grave laurel
#

so a hashmap with a boolean?

chrome beacon
#

if you want a hash map with a boolean you can use a set

buoyant viper
#

wat da fuck is an actual way to return a value from a thread using a callback

like just deadass invoking the callback method at the end of the thread ?! on god?!

chrome beacon
#

Are you using completeable futures

buoyant viper
#

im actually in bed contemplating but id probably use futures yeah

grave laurel
chrome beacon
#

Set

#

a collection type

#

in this case a HashSet

grave laurel
#

alr but what if I wanted to count the time somebody is online but not afk?

chrome beacon
#

depends

#

Why do you need to do that

agile anvil
#

Remember the date he logged in. When he starts being afk count the difference between those two dates (login and now). When he's not afk set the loggin date to now. And when he disconnects count the difference too

vestal mountain
chrome beacon
#

Not much

#

If it's done you can compile your plugin

vestal mountain
#

okey

grave laurel
quaint mantle
#

is there a way to register listener temporarily?

#

like register it for the while my event is running

#

then unregister it?

agile anvil
agile anvil
quaint mantle
#

its like you know chat games

#

only check for answer while event is active

#

i mean i guess i could use a boolean too

agile anvil
#

The boolean would be a proper way

#

Especially for code clarity

quaint mantle
#

Can u help me 1 thing i am a bit of afriad of doing it myself i dont wanna cause dupes

agile anvil
#

Ahahah sure

quaint mantle
#

for a duration of 30 seconds i want to set 0 of player to a map

#

but i want to give their item back when event is done or if they decide to leave

agile anvil
#

Set 0 of players?

quaint mantle
#

slot 0*

agile anvil
#

Oh

#

Okay

#

So what is your plan for that?

quaint mantle
#

i am thinking of adding them to hashmap

agile anvil
#

What key and what value ?

quaint mantle
#
    public void giveMap(ItemStack map){
        HashMap<UUID, ItemStack> itemofPlayers = new HashMap<>();
        Bukkit.getOnlinePlayers().forEach(p -> {
            ItemStack item = p.getInventory().getItem(0);
            if(!item.getType().isAir()){
                itemofPlayers.put(p.getUniqueId(), item);
            }
            p.getInventory().setItem(0, map);
        });
    }```
#

probably uuid

#

and value = itemstack

#

if its air i wont add

agile anvil
#

Okay until now that makes sense

#

But I have some stuff on mind:

quaint mantle
#

? like

agile anvil
#

Why did you put the map inside your method? (Variable scope)
What if a player join after the starting of the game ?

quaint mantle
#

well i have a list of players who will join it

#

you can register for the game if u want 30 seconds before it starts

agile anvil
#

Okay

quaint mantle
#

item.getType().isAir() why can this produce nullpointerexception?

remote swallow
#

item is null probably

chrome beacon
#

^^

quaint mantle
#

so i need to add a nullcheck

#

alr

#

well then .isAir wont be needed

agile anvil
#

So what I would do is having your Map accessible outside your method. The map is well defined.

You can have one method to launch the game after 30 seconds, which means putting the participants slot 0 in the HashMap and removing their first item.
Then you have a timer again if I well understood to stop the game. Once you stop you just have to get all the players from the map one by one and give them their item back (be careful of concurrent modifications).

If the player leave the server, just check if it is in the map, and if it is the case give its item back and remove it from the map

#

Just one thing:
If you give items in the 0 slot for the game, be careful of the players that had nothing in slot 0 before the game start (they won't be in the map) and be sure to remove the given item from them

agile anvil
quaint mantle
#

well if item is not null then it has to be something right

shadow night
#

Most of the time air is null

buoyant viper
#

pretty sure in newer mc an empty slot is AIR, old used to be null or something

quaint mantle
#

wait 1 i have small question

#

regarding how itemstacks work

#

What if the item is from a mod

shadow night
quaint mantle
#

i think i gotta test things for that one

shadow night
quaint mantle
#

x(

shadow night
#

Never mix plugins and mods

buoyant viper
#

an item is an item no matter what tho uwu

buoyant viper
#

all items stem from itemstack

shadow night
#

Unless there is some fucked up mod that, just as all mods like to, decides to do shit the exact wrong way

remote swallow
#

in my mods i recode the entire creative gui and item system so i dont have to register them as item stacks

shadow night
#

🤯

quaint mantle
#

nah that mod is fairly well coded ig i will just code this plugin as i intended

shadow night
#

why mix mods and plugins

quaint mantle
#

dont ask me , ask the owner

shadow night
#

Then tell the owner that you should never mix mods and plugins

shadow night
quaint mantle
#

imma just finish this plugin how i intended it duh

#

uh i have a really stupid question

agile anvil
#

I mean mixing mods and plugins isn't a bad idea once you know what you're doing

quaint mantle
#

is there a way to add wait in ticks?

young knoll
#

?schudling

agile anvil
#

Using Bukkit Schedulings

quaint mantle
#

oh

young knoll
#

?scheduler

shadow night
agile anvil
#

?scheduling

undone axleBOT
young knoll
#

?scheduling

undone axleBOT
agile anvil
#

Gotcha

young knoll
#

Hush

quaint mantle
#

chill guys

young knoll
#

But at that point just code mods

shadow night
#

And I have a thicc feeling this is the opposite case

shadow night
#

You can do everything bukkit plugins do with forge or fabric mods

quaint mantle
#

its fine x) i am only doing this cause i liked this idea

shadow night
#

and mods will also make some stuff easier such as custom items or mixins

inner mulch
#

mods also finally allow ppl to assign buttons to certain actions

#

which plugins cant cuz its client side 😔

shadow night
#

Ah, GUIs, love them

#

The old good GUIs

young knoll
#

Hey we have a few buttons

#

Like F

shadow night
#

Lol

young knoll
#

and sneak

shadow night
inner mulch
#

i guess you can disable item swapping

shadow night
#

1.8 moment

remote swallow
agile anvil
#

Won't be as sexy tho

vestal mountain
#

someon can help me with this import error: import net.minecraft.server.v1_18_R1.PathfinderGoalFloat; error: Cannot resolve symbol 'minecraft' pom.xml: <dependencies> <dependency> <groupId>org.spigotmc</groupId> <artifactId>spigot</artifactId> <version>1.18.2-R0.1-SNAPSHOT</version> <scope>provided</scope> <classifier>remapped-mojang</classifier> <!-- Important! --> </dependency> </dependencies>

#
        <plugins>
            <plugin>
                <groupId>net.md-5</groupId>
                <artifactId>specialsource-maven-plugin</artifactId>
                <version>1.2.2</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>remap</goal>
                        </goals>
                        <id>remap-obf</id>
                        <configuration>
                            <srgIn>org.spigotmc:minecraft-server:1.18.2-R0.1-SNAPSHOT:txt:maps-mojang</srgIn>
                            <reverse>true</reverse>
                            <remappedDependencies>org.spigotmc:spigot:1.18.2-R0.1-SNAPSHOT:jar:remapped-mojang</remappedDependencies>
                            <remappedArtifactAttached>true</remappedArtifactAttached>
                            <remappedClassifierName>remapped-obf</remappedClassifierName>
                        </configuration>
                    </execution>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>remap</goal>
                        </goals>
                        <id>remap-spigot</id>
                        <configuration>
                            <inputFile>${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar</inputFile>
                            <srgIn>org.spigotmc:minecraft-server:1.18.2-R0.1-SNAPSHOT:csrg:maps-spigot</srgIn>
                            <remappedDependencies>org.spigotmc:spigot:1.18.2-R0.1-SNAPSHOT:jar:remapped-obf</remappedDependencies>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
blazing ocean
#

what?

quaint mantle
#

nevermind

#

i am stupid its okay

#

just forget i said it

vestal mountain
#

someon can help me with this import error: import net.minecraft.server.v1_18_R1.PathfinderGoalFloat; error: Cannot resolve symbol 'minecraft' pom.xml: <dependencies> <dependency> <groupId>org.spigotmc</groupId> <artifactId>spigot</artifactId> <version>1.18.2-R0.1-SNAPSHOT</version> <scope>provided</scope> <classifier>remapped-mojang</classifier> <!-- Important! --> </dependency> </dependencies>

blazing ocean
#

you dont have to ask twice

chrome beacon
vestal mountain
#

?

chrome beacon
#

class and package names are now from mojang

#

That import won't work

quaint mantle
#

should i use AsyncPlayerChatEvent for when player sends a message?

blazing ocean
#

if using paper, yes

vestal mountain
blazing ocean
#

?mappings

undone axleBOT
quaint mantle
#

i am using spigot

blazing ocean
tidal marlin
#

Hello again !
I'm trying to display player heads in menus.
But there are problems : offline players head are not good and I know why.
The reason : textures' URL, in PlayerProfile, are null. So I have to update this profile in order to get the correct URL.
The problem : its toooo long, to do that each time I want to display heads !
I've tryed to set this URL for all players one time but this URL doesn't stay and go back to null after few times.
Someone knows if a plugin reset the PlayerProfile or PlayerProfile texture ? Or if it's a Spigot's bug ?

blazing ocean
# quaint mantle i am using spigot

PlayerChatEvent deprecated in paper for this reason:

Listening to this event forces chat to wait for the main thread, delaying chat messages. It is recommended to use AsyncChatEvent instead, wherever possible.

#

so yes

#

(i know its spigot but still)

quaint mantle
#

This appears when kick a player with a command (custom one) handleDisconnection() called twice

chrome beacon
vestal mountain
#

but it sasy cannot resolve symbol minecraft

blazing ocean
#

did you run buildtools with --remapped?

vestal mountain
#

no how i can run that?

blazing ocean
#

?buildtools

undone axleBOT
vestal mountain
#

okey thenks

slender elbow
blazing ocean
#

oh lmao

#

i always use paper jd

vestal mountain
#

why this code sasy this error? public void initPathfinder() { this.goalSelctor.a(0, new PathfinderGoalFloat(this)); this.goalSelctor.a(2, new PathfinderGoalLookAtPlayer(this, EntityHuman.class , 8.0F)); }˛ error: Cannot resolve symbol 'goalSelctor'

lilac dagger
#

do you mean this.goalSelector?

vestal mountain
#

yes

lilac dagger
#

Selctor != Selector

vestal mountain
#

ohh im sorry

#

Cannot resolve symbol 'goalSelector'

chrome beacon
#

You should stop copy pasting code you find online

#

that won't work

vestal mountain
#

i have this import: import net.minecraft.world.entity.ai.goal.PathfinderGoalFloat;

chrome beacon
#

The code above is obfuscated and you're using mapped

vestal mountain
#

how i can code this?

quaint mantle
#
org.bukkit.configuration.InvalidConfigurationException: Top level is not a Map.```
#

?

#

FileConfiguration config = WhosThatPixelmon.getInstance().getConfig(); Bukkit.broadcastMessage(TextUtils.getFancyText(config.getString("starting-message")));

buoyant viper
#

Pixelmon...

quaint mantle
#

its a name

vestal mountain
quaint mantle
#

wait shtt i think i found whhat i did wrong

#

bruh

#

starting-message = "§f starting rn."

#

💀

chrome beacon
#

If you're just here to get things done then no I'm not going to bother

quaint mantle
#

i never thought i would be soo down bad

vestal mountain
#

You can send me a video or ayting?

chrome beacon
#

No when working with NMS you're mostly on your own

quaint mantle
#

did he not compile using buildtools?

chrome beacon
#

You spend most of the time reading the decompiled code from Mojang

#

You can ctrl click the class the open it (in Intellij)

sterile flicker
quaint mantle
#
org.bukkit.configuration.InvalidConfigurationException: Top level is not a Map.
        at org.bukkit.configuration.file.YamlConfiguration.loadFromString(YamlConfiguration.java:61) ~[server.jar:3096a-Spigot-9fb885e-af1a232]```
#

wait why

#

it did send me the message from config

buoyant viper
#

maybe try starting-message: instead of starting-message = ? idk

#

not too keen on how yaml formatting is

quaint mantle
#

it was like that before lmao

buoyant viper
#

o

quaint mantle
#

and it didnt even do anything

#

uh the plugin "has some errors rn"

acoustic pendant
#

Hey, could someone give me an advice on how to save a list of itemstack to config?
I've tried different ways but I don't get it

#

This says that configurationsection is null

inner mulch
#

you need to serialize and deserialize thenm

chrome beacon
#

My guess is that there isn't a section called Rewards

acoustic pendant
acoustic pendant
#

just
Rewards:

slender elbow
#

that is not a configurationsection

rough drift
slender elbow
#

that is just null

rough drift
#

^

acoustic pendant
#

That makes sense

quaint mantle
#

can u check my config file too

#

prefix: "§c[WHOS THAT PIXELMON?" starting-message: "§f starting rn." success-added: "you have been successfully added to game" title-message: "Starting New Pokemon Game Shortly" fancy-text: "true"

#
org.bukkit.configuration.InvalidConfigurationException: Top level is not a Map.
        at org.bukkit.configuration.file.YamlConfiguration.loadFromString(YamlConfiguration.java:61) ~[server.jar:3096a-Spigot-9fb885e-af1a232]``` i dunno why it gives this error
acoustic pendant
rough drift
quaint mantle
#

should i remove " "

eternal oxide
#

you probably have an invisible character in the file

quaint mantle
#

color codes character?

eternal oxide
#

no

#

also spacing on the 4th line looks odd

quaint mantle
#

lemme fix it rq

#
org.bukkit.configuration.InvalidConfigurationException: Top level is not a Map.
        at org.bukkit.configuration.file.YamlConfiguration.loadFromString(YamlConfiguration.java:61) ~[server.jar:3096a-Spigot-9fb885e-af1a232]```
#

still

quaint mantle
#

yea i removed the " " from true

#

also

#
org.bukkit.event.EventException: null
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:310) ~[server.jar:3096a-Spigot-9fb885e-af1a232]
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[server.jar:3096a-Spigot-9fb885e-af1a232]
        at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:589) [server.jar:3096a-Spigot-9fb885e-af1a232]
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:576) [server.jar:3096a-Spigot-9fb885e-af1a232]
        at net.minecraft.server.v1_16_R3.PlayerConnection.chat(PlayerConnection.java:1858) [server.jar:3096a-Spigot-9fb885e-af1a232]
        at net.minecraft.server.v1_16_R3.PlayerConnection.c(PlayerConnection.java:1796) [server.jar:3096a-Spigot-9fb885e-af1a232]
        at net.minecraft.server.v1_16_R3.PlayerConnection.a(PlayerConnection.java:1734) [server.jar:3096a-Spigot-9fb885e-af1a232]
        at net.minecraft.server.v1_16_R3.PacketPlayInChat$1.run(PacketPlayInChat.java:43) [server.jar:3096a-Spigot-9fb885e-af1a232]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630) [?:?]
        at java.lang.Thread.run(Thread.java:831) [?:?]
Caused by: java.lang.IllegalStateException: MapInitializeEvent cannot be triggered asynchronously from another thread.```
#

1 more thing

#

these stuff soo annoying i cant lie

vestal mountain
#

Someone can help me with PathFinderGoal?

quaint mantle
#

should i use non async eventt

chrome beacon
#

Async event is fine

#

you just need to jump back to the main thread

#

You can use the scheduler

quaint mantle
#

how do i jump

chrome beacon
#

?scheduling

undone axleBOT
chrome beacon
#

runTaskLater

quaint mantle
#

so i just run it 1 tick later?

chrome beacon
#

yeah

vestal mountain
quaint mantle
chrome beacon
chrome beacon
quaint mantle
#

do u know anything about issues from my config file?

chrome beacon
#

Could you send it as a file

quaint mantle
#

Sure give me a second

#

oh wait

#

i think i know the issue

#

you know how to you need to remove the old config?....

#

yea lemme try w new config

#

i am soo stupid

vestal mountain
#

i want to my bee follow me: ``` private void spawnBee(Location location, Player owner) {
Bee bee = (Bee) location.getWorld().spawnEntity(location, EntityType.BEE);

    String customName = "§6Méhecske Pet §8(§7" + owner.getName() + "§8)";
    bee.setCustomName(customName);
    bee.setCustomNameVisible(true);


    bee.setAI(true);
    bee.setSilent(true);
    bee.setCanPickupItems(false);
    bee.setInvulnerable(true);

    bee.setMetadata("owner", new FixedMetadataValue(this, owner.getUniqueId().toString()));


}```
chrome beacon
#

Use PDC instead of metadata

vestal mountain
#

okey but how my bee follow me?

chrome beacon
#

also when spawning entities and modifying them you should use the spawn method that accepts a consumer

#

In this case you need to use NMS to create and spawn your entity

#

and not the method above

vestal mountain
#

okey sure, but how my bee following me?

chrome beacon
#

You make a goal

vestal mountain
#

i know but how?

chrome beacon
#

Take a look at one of the existing goals

#

I've told you what to do

vestal mountain
#

you can send me a link?

inner mulch
#

is player.sendMessage alr async or do i need to make it async myself?

vestal mountain
hazy parrot
inner mulch
#

cuz chat is async

hazy parrot
#

you don't have to do anything

inner mulch
#

thats why i asked

chrome beacon
#

Premature optimization is bad

#

You'll only make things more complex and harder to maintain

vestal mountain
#

this.goalSelector.addGoal(1, new PathfinderGoalFollowOwner(this, Player.class, 0.8F));? Expected 5 arguments but found 3,Cannot resolve symbol 'goalSelector'

chrome beacon
#

Yeah

#

it's not called goalSelector

#

nor does that constructor that 3 arguments

vestal mountain
chrome beacon
#

I'm not going to repeat my self anymore

vestal mountain
#

but i dont find anyting

chrome beacon
#

We've given you multiple ways

vestal mountain
#

send me a website please

chrome beacon
#

?switchmappings

vestal mountain
#

but there is noting that can help me

chrome beacon
#

it can

vestal mountain
#

im trying PathFinder 5 hours but i dont find anyting working

#

someone can help me?

lost matrix
vestal mountain
#

no

#

how i can do that?

lost matrix
# vestal mountain how i can do that?

You extend the NMS class, and override methods which you want to be changed.
There is one method responsible for initializing AI goals. This should be overridden.
PS: This comes with quite a bit of additional work. And also make sure to use mojangs mappings.

tall dragon
#

If i use protocollib to send a packet, will that function on all minecraft versions where that packet exists? Despite the nms packet structure being changed with different versions?

lost matrix
tall dragon
lost matrix
tall dragon
#

Id imagine sometimes enums could be represented by a byte

lost matrix
clear elm
#

how can i do that it sends you will be teleported in 5 seconds and not 5.0 "tp" is an double variable

#

plr.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText("§a You will be teleported in " + tp + " seconds"));

clear elm
#

okay ty

sterile flicker
#

https://pastes.dev/eFmVpbapYY sorry for the ping, but could you please take a look at my current code, maybe you can tell why the sword stops in one place and does not follow the snowball)

slender elbow
sterile flicker
soft hound
#

Anyone knows how the if statements worked with the ??

on return for example?

echo basalt
#

return condition ? ifTrue : ifFalse ?

soft hound
#

ohhh okay okay

#

thanks!

quaint mantle
#

is there a way to remove WhosThatPokemon:WhosThatPokemon from tabcompletions?

stark moss
#

Hi. Im having this error where when I send "/pauseclock", "/resumeclock" and "/final" nothing happens. The console has no errors when I issue it.
I'm also having another error where after the first is created, any more clocks will automatically result in "End of Quarter" and the progress refuses to go down. This even happens if the clock has ended/I rejoin and it doesn't work anymore.

This script is using net.kyori.adventure for the bossbars

Here is the script:
https://paste.md-5.net/nucodabamo.java

ivory sleet
#

yea

#

sth like that

rough ibex
#

and you havent implemented any of the changes we talked about

stark moss
#

yeah bc i need help with it, and all i get is learn oop, which isnt really helpful at the moment

rough ibex
#

because its true

#

and I told you what to separate

#

and how to do it

stark moss
#

and i am still learning java

rough ibex
#

and the help is to learn OOP

#

that is the help

#

-dont take up that offer

stark moss
#

i dont get what you mean by "the command shouldn't know about the bossbar"

rough ibex
#

learning java implies also learning OOP

#

the command and the bossbar are separate

#

the bossbar is part of the clock

#

the command can know about the clock

#

but the bossbar is implementation detail

#

for example - you may want to later choose to use an actionbar instead

#

or chat

lost matrix
stark moss
rough ibex
#

the commands dont edit the bossbar

#

the commands talk to the clock

#

and the clock edits the bossbar

#

the bossbar is just a front-end for your time

sterile flicker
lost matrix
#

Man working with old versions is just pure jank

#

Alternatively create your own custom projectile. I would probably go for that at this point.

#

With custom projectile i mean: A new object which has a tick method and gets moved every tick.

quaint mantle
#

is there a way to remove WhosThatPokemon:WhosThatPokemon from tabcompletions?

echo basalt
#

Might be an event for that

young knoll
#

PlayerCommandSendEvent

sterile flicker
# lost matrix Mount an armorstand on your projectile and set its head to your item. Might meed...
EntityArmorStand as = new EntityArmorStand(nmsSnowball.getWorld(), nmsSnowball.getBukkitEntity().getLocation().getX(), nmsSnowball.getBukkitEntity().getLocation().getY(), nmsSnowball.getBukkitEntity().getLocation().getZ());

                as.getBukkitEntity().setGravity(false);
                as.setInvisible(true);
                as.setInvulnerable(true);
                PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving(as);
                ((CraftPlayer) p).getHandle().playerConnection.sendPacket(packet);

                PacketPlayOutEntityEquipment p2 = new PacketPlayOutEntityEquipment(as.getId(), EnumItemSlot.HEAD, CraftItemStack.asNMSCopy(new ItemStack(Material.DIAMOND_SWORD)));
                ((CraftPlayer) p).getHandle().playerConnection.sendPacket(p2);``` can you tell me how to hide parts of the armor stand except the head?
scarlet gate
#

I am trying to store an Object in a yaml file but am getting an exception regarding global tags not being allowed when loading the file. The object I am storing is relatively simple only containing integers, strings and also a Date object.

A section of the yaml:

daily-rewards: !!me.oak.rewards.module.DailyModule$UserData
  dayNum: 1
  lastCollectedDate: null
  streakLength: 1
frozen canyon
#

how can i link my crate keys to voting rewards?

sterile flicker
# lost matrix Mount an armorstand on your projectile and set its head to your item. Might meed...
EntitySnowball nmsSnowball = ((CraftSnowball) e.getEntity()).getHandle();

                nmsSnowball.setInvisible(true);
                nmsSnowball.shooter = ((CraftPlayer) p).getHandle();
                nmsSnowball.getBukkitEntity().setMetadata("ballType", new FixedMetadataValue(SumeruRpg.plugin, "custom"));
                nmsSnowball.setLocation(p.getEyeLocation().getX(), p.getEyeLocation().getY(), p.getEyeLocation().getZ(), 0.0F, 0.0F);;
                EntityItem item = new EntityItem(
                        ((CraftWorld) p.getWorld()).getHandle(),
                        p.getPlayer().getEyeLocation().getX(),
                        p.getPlayer().getEyeLocation().getY(),
                        p.getPlayer().getEyeLocation().getZ(),
                        CraftItemStack.asNMSCopy(new org.bukkit.inventory.ItemStack(Material.DIAMOND_SWORD)));
                item.setNoGravity(true);
                nmsSnowball.getBukkitEntity().setVelocity(p.getLocation().getDirection().multiply(1));
                EntityArmorStand as = new EntityArmorStand(nmsSnowball.getWorld(), nmsSnowball.getBukkitEntity().getLocation().getX(), nmsSnowball.getBukkitEntity().getLocation().getY(), nmsSnowball.getBukkitEntity().getLocation().getZ());

                as.getBukkitEntity().setGravity(false);
                as.setInvisible(true);
                as.setInvulnerable(true);
                PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving(as);
                ((CraftPlayer) p).getHandle().playerConnection.sendPacket(packet);

                PacketPlayOutEntityEquipment p2 = new PacketPlayOutEntityEquipment(as.getId(), EnumItemSlot.HEAD, CraftItemStack.asNMSCopy(new ItemStack(Material.DIAMOND_SWORD)));
                ((CraftPlayer) p).getHandle().playerConnection.sendPacket(p2);
                nmsSnowball.getBukkitEntity().addPassenger(as.getBukkitEntity());

                
#

what could be wrong, this somehow leads to the sword getting stuck somewhere in the middle?

#

the snowball stops hitting an invisible armor stand

frozen canyon
#

how can i link my crate keys to my voting rewards

chrome beacon
frozen canyon
#

no i have a voting plugin already in my files and now i need toe get it working with crates

chrome beacon
#

This channel is for development

quaint mantle
#
@EventHandler
    public void onBossDamaged(EntityDamageEvent damageEvent){
        if(damageEvent.getEntity() == entity){
            Bukkit.broadcastMessage(damageEvent.getEntity().getLastDamageCause() + " dealt " + damageEvent.getDamage() + " damage!");
        }
    }
#

so i have a small problem

#

how can I get damager name from damage event?

#

or player even better

#

thats the entity that GETS damaged

#

i need the damager

#

omg im dumbo

#

thanks so much

#

fucking life saver i would have never figured this out (im lazy)

#

now only to get top damager list

#

agchem

#

i miss c++ where i could arr.push_back(x) :(

#

ill figure this out myself tho

hazy parrot
#

list.add?

quaint mantle
#

doin a little project with mythicmobs

#

exactly

#

but if many ppl hit the entity

#

then you can add up their damages

#

right?

#

because its still a damage event its not restricted to one player hitting it

#

it will proc if someone else damages it right?

jagged quail
#

cmarco check general

quaint mantle
#

first of all, what the hell is a wrapper, second of all why cant i just make a list in my class because these are gonna need hard resetty after mob killed

#

i dont need damage list tho

lost matrix
#

You want to sum up the damage each play has done over the kill?

quaint mantle
#

i need it all sumed into one int per player

#

why cant i make two lists

lost matrix
#

A simple Map<UUID, Double> would be enough then.

jagged quail
#

cmarco "yourtime" is detected as a trojan

quaint mantle
#

glad ion have that

#

<3 linux

#

so its fine if i just make two lists

#

and reset when i need to

#

right?

#

all i really need these for is printing highest numbers

#

with player names

kind hatch
#

Then a map would work just fine.

quaint mantle
#

right

kind hatch
#

Unless you want the full damage history.

quaint mantle
#

can i get player name frm uuid?

kind hatch
#

Yes

quaint mantle
#

and if not?

#

some ppls might get 2 hits on the mob and leave

kind hatch
#

You can still get the name if they are offline

quaint mantle
#

cuz bored

kind hatch
#

Just use OfflinePlayer#getName() if the player isn’t online.

quaint mantle
#

right how do i make that map then

#

no its the right channel <3

#

wow

#

what do i do with that

kind hatch
#

Use it to instantiate your map.
:p

quaint mantle
#

i only know maps in c++ :(

#

im sorry for being dumb and slow im still learning

#

mallnutrition

#

will do tomorrow

#

its getting late

#

eepy time for me

kind hatch
#

Map<UUID, Double> damage = new HashMap<>();

#

Crazy concept.

hazy parrot
mystic pike
remote swallow
#

?workdistro

icy beacon
#

Run ?cc list in #bot-commands

topaz iron
#

Hi, I'm wondering how to code an inventory animation. I'm thinking of using 'Bukkit.getScheduler().runTaskLater' and a loop to have several per second (10) and then assign it to the inventory. However, I think it's not really optimized, so if you have any suggestions, I'm all ears.

echo basalt
#

Oo smile is typing

lost matrix
#

You go

young knoll
#

Use a single repeating task and then something to track the current animation frame

echo basalt
#

When working with menus I like to have a layer system so I can have the "base layer" which does all the regular logic and any sort of layers above that

#

Given that, I'd probably make an "AnimatedLayer" which wraps a list of pre-calculated animation frames

#

And that layer just increments and renders the current frame on the menu

#

go away

#

shoo

lilac dagger
#

why does everyone treat marco like this?

topaz iron
#

yes why not

echo basalt
#

But yeah your animation frame is just a fancy Map<Integer, ItemStack> containing the items that changed

#

or the whole frame itself, depends on your renderer

young knoll
#

Ew legacy materials

#

:c

echo basalt
#

Anyways back to working on fake blocks for the 5th time

#

xmaterial

#

cool I'm not using ProtocolLib

#

uh

rough ibex
#

well the problem is supporting 1.6.4

umbral ridge
#

hey

#

ItemMeta clone(); copies the itemmeta?

#

there's no javadoc

lost matrix
#

The ItemMeta is always a clone

umbral ridge
#

Alright

#

Those are all the heads that exist in minecraft as Material?

#

Can't find any more

lilac dagger
#

it's best if you try to reduce the number of call of new item metas @umbral ridge

umbral ridge
#

Wasn't there a witch head as well

lilac dagger
#

but i think you know this

#

just one getItemMeta is fine

rough ibex
#

you get a clone of the itemmeta and work on that

umbral ridge
rough ibex
#

if you need to modify it, you get it, keep it, and set it back

umbral ridge
#

I got it from ItemStack

lilac dagger
umbral ridge
#

Yeah but it's from ItemStack

#

I'm not saying ItemMeta itemMeta = new ItemMeta... idk if you even can do this, I dont have time for this right now

lilac dagger
#

well when you do itemstack.getitemmeta you basically get a clone

#

which is a new item meta

#

as you can see

umbral ridge
#

I call it like n times within the same second once per day, shouldn't affect performance

#

n could be around 250

lilac dagger
#

well it could easily explode

umbral ridge
#

actually, 9 times 3 times chests

lilac dagger
#

and then you trust your garbage collector to not stall your code

umbral ridge
#

its nothing to worry about

#

i'm not as paranoid as some people

#

a few bytes or kb don't hurt my 64gb of ram

lilac dagger
#

the thing is the garbage collector will most likely have to do multiple passes to clean it up

#

because there are references

#

and those objects will also add up

umbral ridge
#

It's nothing to worry about, happens once a day, every 24 hours

echo basalt
#

cool do I really want to write all of this from scratch

umbral ridge
#

thanks for the paranoid tip XD

desert yarrow
#

Hello, can someone gelp me with one problem with my server?

rough ibex
#

this is for making plugins

lilac palm
#
public static void assignTexture(ItemStack head, String url, String profileName, UUID profileID) {
        SkullMeta skullMeta = (SkullMeta) head.getItemMeta();
        GameProfile profile = new GameProfile(profileID, profileName);
        profile.getProperties().put("textures", new Property("textures", url));
        try {
            Field profileField = skullMeta.getClass().getDeclaredField("profile");
            profileField.setAccessible(true);
            profileField.set(skullMeta, profile);
        } catch (IllegalArgumentException | SecurityException | NoSuchFieldException | IllegalAccessException e) {
            e.printStackTrace();
        }
        head.setItemMeta(skullMeta);
    }```
#

I can't post images, but it says "inconsistent skull meta, you shouldn't use reflection anymore" - Bukiit server logs

lilac dagger
#

you miss an extra field

echo basalt
#

Yeah bukkit has a player profile thing

#

And you can set profiles directly on the skull meta

lilac palm
#

wdym

#

How do I create a fake profile then?

echo basalt
#

skullMeta.setOwnerProfile

lilac palm
#

Do I need a real player profile then?

echo basalt
#

uH

#

I believe you can just create one with the api

lilac dagger
#

or set owner profile

sullen marlin
#

Don't encourage more reflection,use the api

lilac dagger
#

md5 is angry

#

i knew it

#

sorry

rough ibex
#

reflection is theBad

echo basalt
#

hm I need to work on a surface api

lilac dagger
#

would be cool if the api would support signature and value

#

and not just url

quiet ice
#

Method handles > Reflection

umbral ridge
#

skin-value is a 64chars long value that is basically a texture

#

Yeah I think that's all deprecated now lol

#

dang it

lilac dagger
#

it's no biggie, for me, for now

young knoll
#

That was never API

#

That was part of Authlib

quaint mantle
#

anyone know how I can impl my own event which detects when a zombie hits a door

chrome beacon
#

Using existing events?

#

or do you want to edit spigot

young knoll
#

I don’t think there is anything that detects that in the api

quaint mantle
#

damn

#

well I knew that already

#

but how would I make my own event like that

young knoll
#

Uhh

#

Modify the spigot source

#

Or do some janky hacks

quaint mantle
#

alr nvm i aint doing allat

echo basalt
#

Cool there's no api to see if a player is tracking a chunk

#

fml

young knoll
#

Well at least you have NMS

quaint mantle
#

like a ZombieHurtDoorEvent

#

like each individual "hurt"

young knoll
#

ZombieKnockKnockEvent

rough ibex
#

ZombieOpenUpTheDoorEvent

#

Hardcore

#

Check the wiki

young knoll
#

They need to spawn with a certain NBT tag

#

They can knock on any difficulty but only break the door on hard

wet breach
young knoll
#

Didn’t think about interact

#

But probably not

analog mantle
#

Do you guys have any idea how I can make this string look better?

remote swallow
#

colour

rough ibex
#

maybe something easier to read

young knoll
#

Pretty sure that top left button gives you the clone url

analog mantle
rough ibex
analog mantle
rough ibex
#
1. Player1 [close, armor] at X n Y n Z n in world```
#

I don't know what you base danger off

#

but if you can, try giving short hints

#

close to you, armored, hp, incoming

#

if they're in the same world omit that part

analog mantle
#

I'm personally more of a streams guy myself,

rough ibex
#

I gave a format

#

its up to them how they implement it

#

theyre for box drawing

#

also its just Unicode

quaint mantle
#

guys

void frost
#

Hey all, any advice on where to start looking at this issue? https://imgur.com/a/c5RBCIR

It's only on some servers with my plugin on it.

quaint mantle
#

where do you think is the best place to display stuff like a thirst bar and heat bar

#

all at once

rough ibex
#

your plugin is not r/w in UTF-8

quaint mantle
#

that only supports one bar at a time tho right

young knoll
#

You can fit a ton with custom font magic :p

wet breach
void frost
rough ibex
#

plugin

#

your plugin is reading data not in UTF-8

#

utf-8 always

void frost
#

How do i fix this?

rough ibex
#

see when you read in files

#

check your IO

quaint mantle
#

ill prob just use a scoreboard

void frost
rough ibex
#

your plugin reads in files, right?

#

config

void frost
#

the GUI does not read from config files, no. It reads in code

#

If thats the questiopn

rough ibex
#

show us

void frost
#

Like the code?

rough ibex
#

yes

void frost
#
    @Override
    public ItemStack render() {
        String minBetFormatted = DecimalFormat.getCurrencyInstance(Locale.US).format(minBet);
        String maxBetFormatted = DecimalFormat.getCurrencyInstance(Locale.US).format(maxBet);
        ItemStack item = new ItemStack(Material.REDSTONE_LAMP);
        ItemMeta meta = Objects.requireNonNull(item.getItemMeta());
        meta.addEnchant(Enchantment.DURABILITY, 1, true);
        meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
        meta.setDisplayName("§c§lWheel of Fortune");
        meta.setLore(List.of(
                "§7Spin the wheel to try out your fortune!",
                "",
                "§7Minimum Bet: §a%s §7– Maximum Bet: §a%s".formatted(minBetFormatted, maxBetFormatted),
                "",
                "§eClick to play!"
        ));
        item.setItemMeta(meta);
        return item;
    }
#

Example of GUI Item

wet breach
#

Translatealternatecolorcodes()

void frost
lilac dagger
#

no

wet breach
#

Most likely since the section symbol is unicode and java is weird when you use unicode characters directly

void frost
#

Ah, that will be a pain 💀

#

Have like 20 GUI classes

#

It's a huge plugin

wet breach
#

Part of development. Besides switching to this api lets your text stuff be more configurable in terms of color later on

#

Also you should look into not hard coding your stuff and make use of config files

solid apex
#

Can I open this Inventory for a Player?

wet breach
#

Makes future changes easier

wet breach
# lilac dagger no

It is possible that may not be their issue, but given how many people have had issues with unicode characters probably best to start with that first lol

solid apex
#

The donkey doesn't matter, it can also be completely black

lilac dagger
#

true

sullen canyon
#

if playes leaves server (PlayerQuitEvent) and I kill him at this moment, would the PlayerDeathEvent be called before player actually leaves or not?

So,

PlayerQuitEvent
// do some 1
player.damage(10000);
// do some 3

PlayerDeathEvent
// do some 2

The code will be executed sync in way
do some 1
do some 2
do some 3?

lilac dagger
#

damage will trigger before quit happens

#

quit event is happening before the actual code

sullen canyon
solid apex
#

I will try this thanks :D

lilac dagger
#

death happens before as well

sullen canyon
void frost
analog mantle
#

this is very clean, but can you send me the [ character in the same unicode family you used for these? ┏┣┗

#

There doesn't appear to be a left bracket one for a single unicode

quaint mantle
#

nice

umbral ridge
#

how do you get rid of this warning

hazy parrot
#

don't use latest or release as version xd

umbral ridge
#

my plugin version?

hazy parrot
#

jetbrains annotations dependencie

umbral ridge
#

ohh but what do I put then

young knoll
#

A concrete version

#

Whatever the latest version number is in this case

umbral ridge
#

alright that fixed it

#

yea

#

what abt that? xD

#

btw this is the 1st time I'm compiling a plugin after codign it for about 1 week

hazy parrot
#

its safe to ignore

#

not much you can do about it, other then manually exclude

#

as warning suggests

umbral ridge
#

I mean im using org.jetbrains because otherwise I can't use @NotNull and stuff

#

If I use @NotNull or any of that stuff it FORCES me to use org.jetbrains

#

because it's not inbuilt??

#

in jdk

eternal oxide
#

you shoudl not be shading annotations

umbral ridge
#

it's done that by default

eternal oxide
#

set annotations to compile scope

hazy parrot
#

provided *

eternal oxide
#

or that

umbral ridge
#

So if I use provided then it should still work?

eternal oxide
#

yes

#

those annotations are not use at runtime

umbral ridge
#

thanks

umbral ridge
#

Xd

#

I have no idea about kotlin

#

but I do wanna learn it, just don't have time for new stuff right now

fallen lily
#

It adds up very quickly

umbral ridge
#

I already know so much stuff

#

I went through web and desktop apps, logo design, ui/ux design

fallen lily
#

Kotlin will be pretty helpful then

umbral ridge
#

i heard kotlin is for cross platform apps?

fallen lily
#

You can use JetPack Compose to build mobile, web & desktop apps

umbral ridge
#

yea I heard about it

rough ibex
#

Java is already cross-platform

#

JVM

#

you can compile Kotlin for other targets

umbral ridge
#

Java... not many styling frameworks and it's probably harder to build one (GUI)

frozen canyon
#

can someone help me here quick nobody is responding in help-server

umbral ridge
#

a lot of not-so-good stuff abt java

fallen lily
#

Only on the desktop platform

rough ibex
#

didnt you know 3 billion devices run java

fallen lily
#

Yes, the figure of which miraculously hasn’t changed in the course of 15 years

#

And the 3billion includes SIM & Credit cards

umbral ridge
#

does Material#valueOf return null if item isnt found?

young knoll
#

No

#

It’ll throw an exception

#

Use matchMaterial

umbral ridge
#

how does it work

#

will it compare the exact string to find portions

fallen lily
umbral ridge
#

I'll look at jd

young knoll
#

It can use the exact material name

young knoll
#

It can also handle minecraft:name

umbral ridge
young knoll
#

IRON_INGOT iron_ingot and minecraft:iron_ingot

#

No, that’s for pre 1.13 names

umbral ridge
#

ahh

glad prawn
umbral ridge
#

so matchMaterial returns null if it isnt found

#

or still exception

#

I can't look at the class because my intellij keeps freezing when i want to

#

?jd-s

undone axleBOT
umbral ridge
#

null yes

young knoll
#

Bill

#

Null

umbral ridge
#

Bills

young knoll
#

Sadly does not return Bill

umbral ridge
#

Sadly Bill is hidden away and private

#

can only access it with password

small holly
#

Hey quick question I am having some gson issues and currently the fix I have found for it is adding --add-opens java.base/java.util=ALL-UNNAMED to the start script for the server is there a way I can like do it within the library? (Its a public ones meaning yknow not everyone will be able to add --add-opens java.base/java.util=ALL-UNNAMED to the JVM args

#

Without it it throws illegal access because it cant access java.utils in java 17

umbral ridge
#

fancy stuff

young knoll
#

Make custom adapters

small holly
#

Im not making a custom adapter for all java utils classes

young knoll
#

And don’t rely on the native reflection system GSON uses

#

What on earth are you serializing

small holly
#

Its for storing custom NBT data so it needs to store various things and I have no control over what they try store because again its public

young knoll
#

Explain further

small holly
#

the one I am testing with it throws issues just trying to store random even though its literally just

"random": {
  "seed": 102919196753037,
  "nextNextGaussian": 0.0,
  "haveNextNextGaussian": false
}
``` cant even access seed
young knoll
#

Why would you need to store a random

#

Just store the seed

small holly
#

Thats not the issue though thats just an example because its part of a class that needs to be stored

young knoll
#

Okay back up

#

What are you storing with NBT data

#

Items? Entities?

small holly
#

If I don't have the JVM arg it cant access literally anything

young knoll
#

Well yeah, because you shouldn’t be trying to store these kinds of things

small holly
#

not even just those

#

it cant even access String

fallen lily
#

How about you write type adapters for what users will actually be able to change

#

then you can extrapolate what you dont need

#

and save yourself some time and sanity

young knoll
#

Gson 100% has a string adapter

#

Wat

small holly
#

I dont think you are understanding it wont let me access almost anything its being really fucken stupid this stuff worked when I did it a while ago for I think it was 1.8

#

Theres just so much stuff not working that use to work fine

dry forum
#

is BlockFormEvent the right event to be using when trying to detect copper block changing

small holly
fallen lily
#

Ever heard of

#

Interfaces perhaps

young knoll
#

Generally you only let the user store simple types and go from there

fallen lily
#

void serialize(JsonObject obj)

young knoll
#

Numbers, strings

small holly
fallen lily
#

What is the idea then

#

This doesn’t seem like a good idea by the looks of it

#

But

young knoll
#

All you’ve shown is trying to store a Random

#

Which is wack

slender elbow
#

you'll be happy to know Random implements java.io.Serializable :kappa:

young knoll
#

Shouldn’t gson deal with that

#

Wtf do I pay you for google

small holly
#
    /**
     * Used internally to serialize the nbt data
     * @param content The class you want to serialize
     * @return The now serialized json string
     */
    private static String serializeContent(Object content) {
        return gson.toJson(content);
    }

    /**
     * Used to convert the stored json into a populated class
     * @param cls The class you want to populate
     * @param json The NBT json compound
     * @return The now populated class
     * @param <T> The type of the class you want to populate
     */
    private static <T> T deserializeContent(Class<T> cls, String json) {
        return gson.fromJson(json, cls);
    }

    /**
     * Stores custom NBT content
     * @param compoundTag The Compound tag you want to store in, usually use your plugins one
     * @see LuaCore#getCompountName()
     * @param content The value of the data you want to store
     * @param nameSpaceKey where you should get the data from later
     */
    public static void storeNBTContent(NBTCompound compoundTag, Object content, String nameSpaceKey) {
        LuaMessageUtils.json_dump(content);
        String json = serializeContent(content);

        compoundTag.setString(nameSpaceKey, json);
    }

    /**
     * Stores custom NBT content for entity
     * @param readWriteNBT The ReadWriteNBT tag you want to store in, usually use your plugins one
     * @see LuaCore#getCompountName()
     * @param content The value of the data you want to store
     * @param nameSpaceKey where you should get the data from later
     */
    public static void storeEntityNBTContent(ReadWriteNBT readWriteNBT, Object content, String nameSpaceKey) {
        LuaMessageUtils.json_dump(content);
        String json = serializeContent(content);

        readWriteNBT.setString(nameSpaceKey, json);
    }


    /**
     * Gets custom NBT data
     * @param cls The class you want to map to
     * @param nameSpaceKey The key you set in {@link #storeNBTContent(NBTCompound, Object, String)}
     * @param compoundTag The NBTCompound you are storing the custom NBT in
     * @return Fully mapped class
     * @param <T> The class type
     */
    public static <T> T getNBTContent(Class<T> cls, String nameSpaceKey, NBTCompound compoundTag) {
        if (compoundTag.hasTag(nameSpaceKey)) {
            String json = compoundTag.getString(nameSpaceKey);
            LuaMessageUtils.verboseMessage("Deserializing " + json);
            return deserializeContent(cls, json);
        }
        return null;
    }

    /**
     * Gets custom NBT data
     * @param cls The class you want to map to
     * @param nameSpaceKey The key you set in {@link #storeNBTContent(NBTCompound, Object, String)}
     * @param readWriteNBT The NBTCompound you are storing the custom NBT in
     * @return Fully mapped class
     * @param <T> The class type
     */
    public static <T> T getEntityNBTContent(Class<T> cls, String nameSpaceKey, ReadWriteNBT readWriteNBT) {
        if (readWriteNBT.hasTag(nameSpaceKey)) {
            String json = readWriteNBT.getString(nameSpaceKey);
            LuaMessageUtils.verboseMessage("Deserializing " + json);
            return deserializeContent(cls, json);
        }
        return null;
    }
EntityBuilder entityBuilder = new EntityBuilder(EntityType.DROWNED);
// Entity builder stuff between here because I cba doing it all here
NBTUtils.storeNBTContent(compound, entityBuilder, nameSpace);

example would be something like this.
where say block place even you want to get the nbt from it to spawn the entity. once again it worked in previous projects with 1.8 and 1.12

small holly
young knoll
#

NBT should be pretty easy to serialize

#

It’s just primitives and strings

small holly
young knoll
#

Seems like you got something funky going on with gson

fallen lily
#

Old GSON ver on new JDK maybe

#

Idk how they deal with encapsulation

small holly
#

nope latest gson

fallen lily
#

Hm

#

Are you sure thats the one being used lol

small holly
#

yes very sure

fallen lily
#

Doesnt spigot/mc ship with its own

#

Have you relocated your GSON

small holly
#

implementation('com.google.code.gson:gson:2.10.1')

#

yes

young knoll
#

Yeah spigot ships with it

fallen lily
#

Peculiar

#

What JRE are you using

small holly
small holly
# fallen lily What JRE are you using
openjdk 17.0.10 2024-01-16
OpenJDK Runtime Environment (build 17.0.10+7-Ubuntu-120.04.1)
OpenJDK 64-Bit Server VM (build 17.0.10+7-Ubuntu-120.04.1, mixed mode, sharing)
#

exact same one its being compiled with too only windows version

fallen lily
#

And what is the trace you get when trying to de/serialize

small holly
#

but others get various different ones some being java.utils some being java.io

#

all saying module java.base does not "opens PACKAGE_WITH_ISSUE" to unnamed module

umbral ridge
#

Unable to make field private final

small holly
#

it serializes private final fine

fallen lily
slender elbow
#

i mean yeah, if the module isn't open to reflection for its inaccessible fields and types then you won't be able to access

small holly
#

I have had it complain about java.lang.String but as said adding --add-opens java.base/java.util=ALL-UNNAMED to the jvm args makes it run fine and again I can't rely on the end user to do that as not all will be able to

slender elbow
#

it certainly will work fine with j.l.String

#

but that's just how it is for the things it does not have an adapter for

small holly
#

usully ye but idfk why its doing that

slender elbow
#

the string thing or in general?

#

cuz like

#

this isn't java 8 anymore, that's why

fallen lily
#

Strongly coupled internal and public API modules my beloved

#

words dreamed by Ron Pressler

#

Nobody else

fallen lily
#

Only Ron committing JVM crimes

#

He wants to lock JNI and JVMTI behind flags too

#

🤓

small holly
#

I just need a way to not need to add --add-opens java.base/java.util=ALL-UNNAMED but have the same outcome

fallen lily
small holly
#

with that arg it gets the outcome I want

fallen lily
#

Remove serialisation of stuff you dont have adapters for

slender elbow
#

why do you want to serialize a random instance anyway lol

fallen lily
#

And it will magically work again

umbral ridge
small holly
fallen lily
#

just expose serialization and serialization methods in a base type 🙄

#

I know its not ideal

#

But the world isnt all sunshine and rainbows

#

You have to put in some work if you wish to hack stuff together like this

#

Especially with new Java

#

alternatively you can use annotations to expose the fields

#

You will still have to write custom serialization logic for that though

slender elbow
#

you do have control over the things you serialize, what

fallen lily
#

So either way you are going to have to write adapters

small holly
slender elbow
#

what you want is some magical solution that with no effort you can just serialize everything

#

that does not exist lol

umbral ridge
#

xDD

fallen lily
#

Minimalists when they are encountered with a scenario that requires writing code

small holly
#

again, --add-opens java.base/java.util=ALL-UNNAMED this makes it work.

slender elbow
#

yes but this is not java 8 anymore, which is why you "need" that

#

you don't need that, you need to stop relying on gson's reflective serializer

fallen lily
#

^

umbral ridge
#

slender elbow
#

and add adapters of your own

#
jshell> new com.google.gson.Gson().toJson("hello", String.class)
$3 ==> "\"hello\""

it sure works fine for String

fallen lily
#

He probably miss-read the trace

small holly
umbral ridge
#

does String RANDOM_DURABILITY not match regex [A-Z_]? xD

agile anvil
#

No

#

Your regex is waiting one character

umbral ridge
agile anvil
#

Add a "+" if you want [1, inf[ chars

umbral ridge
#

o

#

Thanks!!

agile anvil
umbral ridge
#

kinda new to regex

agile anvil
umbral ridge
#

Yeah yeah we'll see

wet breach
#

I am currently at work so dm'ing still wouldnt be effective. Best to just comment here in case i dont answer and allowing someone else to possibly do so

wet breach
wet breach
#

Going alright. Turns out they are not replacing my squeeze lift which is annoying. So now i have to wait for it to get repaired so it can break again

umbral ridge
#

lol

#

squeeze lift? is it so small?

wet breach
#

Squeeze lift is a fork lift. But instead of forks it has paddles to squeeze at the sides instead

#

Its so i can stack tires and move the stacks

umbral ridge
#

Ohh

#

That's not too bad

#

Why do you want it replaced? xD

wet breach
#

No its not, but the one i have is old and constantly breaking. We bought new fork lifts but for whatever reason replacing this one is for whatever reason difficult. This last repair is because the wiring harness melted and it took out a few components with the harness lol

umbral ridge
#

lol

wet breach
#

The next thing to break is either going to be the oil pump or the hydraulic pump

umbral ridge
#

they want you to have the old stuff xD

#

Everyone else is using newer ones and you're stuck with old

#

XD

wet breach
#

Well, its a surprise they are fixing this instead of buying a new one. The repairs for this right now costs almost the same as if they just bought a new one

#

I am hoping if the hydraulic pump goes out they might just buy a new one lol

umbral ridge
#

loll

agile anvil
#

Old machinery is always more robust than new one

#

But at somepoint people need to change still ahah

analog mantle
#

How can I send a player an actionbar message

tender shard
#

that notation makes no sense lol

umbral ridge
#

What notation

tender shard
#

using a mixture of # and .

umbral ridge
#

is that better?

tender shard
#

now they'll ask "what's TextManipulator?" :p

somePlayer.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacy("hewwo"));
umbral ridge
#

it's an example

#

quickly pulled up one of my plugins where I use action bar messages

glad prawn
umbral ridge
#

lol

#

then @tender shard is going to answer because i dont have time

rough ibex
#

good strat

quaint mantle
#

is there a player leave event i cant find it on docs

#

oh ofc its called quit event

analog mantle
#

How can I make the player drop a specific armor item?
I'm making a thing where it picks a random armor piece that matches a predicate, and I want them to drop it

#

I am having a critical issue where (I think) seemingly randomly it picks an armor piece and drops it but doesn't remove it

#

If there is a way to remove an item based on the itemstack

#

that would fix all my problems

agile anvil
#

Can you show us the code where you pick the random item ?

#

You can't check equality between ItemStack since each item is unique. You have to check on the Material level

agile anvil
#

player.sendMessage("You stay.");

umbral ridge
#

Imagine if it was cancellable

#

People would need to ALF F4

quaint mantle
#

xd not really canceling it but

#

adding item to player if they leave

#

how to cancel drop of items

#

using Q

agile anvil
#

PlayerDropEvent

agile anvil
#

Same goes for connection timed out

#

So theorically you can't unplug internet

quaint mantle
#

wait u cant cancel leave event right

agile anvil
#

of course not ahah

#

It's physically impossible

quaint mantle
#

image if bukkit made a way to cancel it

#

wait but then if u alt f4 u close game but u still in server

#

but then u try joining again u get kicked for joining from same account but u cant get kicked

#

xDDD

agile anvil
#

damn that's.... not explicit ahah

#

So your problem is that the item from the inventory is not removed ?

analog mantle
#

Yes

#

this is the bit that matters

agile anvil
#

What if you change

p.getEquipnent().setItem(getArmorIndex(armorIndex), new ItenStack(Material.AIR));

By ```java
p.getEquipnent().setItem(armorIndex, new ItenStack(Material.AIR));

analog mantle
#

p.getEquipment().setItem(armorIndex, new ItemStack(Material.AIR));

agile anvil
#

So what's the method getArmorIndex?

analog mantle
agile anvil
#

Did you try to add some debbuging messages to check which armor should be removed

#

Which armorIndex, what is the resulting of getarmorIndex etc ?

agile anvil
#

Add debugging message to check

analog mantle
#

How can I check a random thing

agile anvil
#

I mean

#

Maybe your armor list is empty

#

who knows

#

just add some messages