#help-development

1 messages · Page 389 of 1

green prism
#

Good night

echo basalt
#

@green prism I don't see the point of this

#

you're creating a copy and iterating over the copy

sonic elm
#

bro wants to make a mc rust server by asking others to make the plugins for him for free lolz u should quit its a waste of time

terse ore
#

Would you mind helping me out with this?

#

I am not sure what to do

quaint mantle
#

akex06

terse ore
#

yeah

#

?

terse ore
zealous osprey
#

Anyone know why I'm getting a class cast exception here?
ClassCastException: java.lang.Integer cannot be cast to java.lang.Long
Code:
if (((Integer) location.getBlockX()).longValue() != ((Long) locationJson.get("x"))) return false;?

#

And the locationJson.get("x") returns a long, checked that.

river oracle
#

You can't cast Integer to long

zealous osprey
#

I can't do so directly, that's why I'm using the inbuilt version of the java.lan.Integer class

river oracle
#

Doesn't change anything

#

Can't convert Integer to Long by cast

paper viper
#

They are completely different wrapper classes not related

zealous osprey
#

bruh XD

#

should have checked that

restive mango
#

If I create a sync bukkitrunnable in an async task in order to resynchronize some information, will that cause the async thread to hang until the first tick of that bukkitrunnable has been run?

eternal night
#

no

tawny remnant
lost matrix
small hawk
#

Is there a method to center text using player#sendMessage, so whatever the player Chat Options are, it will be always centered?

lost matrix
tardy delta
#

is there a better way than making 1000 bufferedreaders to read a bunch of mojang recipe files with gson? im already using a dir stream

lost matrix
#
String json = Files.readString(pathToRecipe);
#

java.nio

tardy delta
#

doing that 1000 times (1000 recipe files)

lost matrix
#

Well yeah...

tardy delta
#

if theres no better way, ok then

worldly ingot
#

Not really lol

quaint mantle
#

does a remapped mojang dependency exist for 1.8.8?
since im getting this error:

org.spigotmc:spigot:jar:remapped-mojang:1.8.8-R0.1-SNAPSHOT was not found in https://oss.sonatype.org/content/groups/public/ during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of sonatype has elapsed or updates are forced
#

?paste

undone axleBOT
undone axleBOT
quaint mantle
#

i still wanna use it tho idrc that its old

lost matrix
worldly ingot
#

he's right, but to answer your question, no

#

Mappings were released in like 1.16 iirc

lost matrix
#

Remapped came in 1.17 iirc

worldly ingot
#

something around there

#

basically, not 1.8

lost matrix
#

^^

quaint mantle
#

i dont wanna make anything pvp but i dont like the system for pve either, so is there anyway i can work around it?

worldly ingot
#

You can use online libre mappings

#

Forge, Fabric, the like. I actually don't know if Fabric mappings were available

#

Did it exist 8 years ago? lol

chrome beacon
#

It didn't

worldly ingot
#

Then yeah, Forge/MCP mappings are your only chance

#

CraftBukkit mappings are incomplete

chrome beacon
#

Forge/MCP are incomplete too

#

So good luck with that

worldly ingot
#

Less incomplete than CB

quaint mantle
#

well i dont really NEED to use `1.8 if theres a way to work around the combat sytstem?

lost matrix
#

I honestly dont like the take where you rely on either 1.8 or 1.9+ combat.
You can be very innovative and create a fast paced combat system in the latest
version if you just think creatively.

worldly ingot
#

thinking is too hard

chrome beacon
quaint mantle
#

yea im using viabackwards but last time i used smt for old combat mechanics it messed up everything but maybe thats cus i was using the wrong plugin

#

also ive realised that enemies get stunned when they get hit so u cant hit them for a while, any way to change this too?

chrome beacon
#

That has existed for quite a while

#

You can make your own plugin to remove it, if ocm can't

quaint mantle
#

ocm also has a feature for that?

chrome beacon
tawny remnant
#

I want to add to my plugin that you dont have to type /"itemName" but /"pluginName" "itemName"
how do i do that?

lost matrix
chrome beacon
#

Register a conmand called pluginName and then create arguments

tawny remnant
topaz moon
#

sub commands

hazy parrot
#

That what args parameter is used inside onCommand method

regal scaffold
#

Hey guys

#

To get each NMS class for each version I need to run buildtools with --remapped for each version I need?

lost matrix
#

Yes

regal scaffold
#

BrUh

#

Fun

#

Ty smile

lost matrix
#

Write a quick script

regal scaffold
#

ChatGPT does have a specialt in doing that

#

But it's fine

#

Now last questions, Do the R1, R2 mean .1 .2?

remote swallow
#

not always

regal scaffold
#

How can I know

#

1_17_R1
1_17_R1_2
1_18_R1

#

etc

remote swallow
regal scaffold
#

Fair, ty

tawny remnant
#

What event is left click event?

remote swallow
#

player interact event

#

check what action

tawny remnant
#

i dont think its working

remote swallow
#

did you register the event

tawny remnant
#

yes

remote swallow
#

?paste the code

undone axleBOT
tawny remnant
quaint mantle
#

what happened to Entity.setLocation(loc);

remote swallow
chrome beacon
#

In nms?

quaint mantle
chrome beacon
#

What version

quaint mantle
#

1.19.3

remote swallow
tawny remnant
chrome beacon
quaint mantle
#

oh yea thx

#

how about on non NMS entities

chrome beacon
#

Then teleport them

lost matrix
# regal scaffold How can I know

Just add all versions you need to this list:

@ECHO OFF

set versions=1.19 1.19.1 1.19.2

for %%x in (%versions%) do java -jar ./BuildTools.jar --remapped --rev %%x

@PAUSE
quaint mantle
chrome beacon
#

Don't teleport that it will look bad

#

You need to make the nametag an entity riding the player

regal scaffold
#

Unfortunately

#

Java versions are required for buildtools

quaint mantle
regal scaffold
#

So I have to constantly switch

quaint mantle
#

and also the name tag will be inside the head of the entity so it has to be located higher

quaint mantle
eternal oxide
#

combine with 7Smile&'s code ```bat
@echo off

mkdir BuildTools
cd BuildTools

SET JAVA_CURRENT="C:\Program Files\Eclipse Adoptium\jdk-19.0.1.10-hotspot\bin\java.exe"
SET JAVA_8="C:\Program Files\AdoptOpenJDK\jdk-8.0.252.09-hotspot\bin\java.exe"

SET BUILDTOOLS_URL="https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar"

curl -z BuildTools.jar -o BuildTools.jar %BUILDTOOLS_URL%

SET /p Input=Enter the version: || set Input=latest
for /f "tokens=1,2,3 delims=." %%a in ("%input%") do set major=%%a& set minor=%%b& set revision=%%c

IF "%major%"=="latest" (
SET cmd=%JAVA_CURRENT%
GOTO execute
)
IF "%major%"=="1" (
IF %minor% GEQ 17 SET cmd=%JAVA_CURRENT%
IF %minor% LEQ 16 SET cmd=%JAVA_8%
)

:execute
%cmd% -jar BuildTools.jar --generate-source --generate-docs --remapped --output-dir .. --rev %Input%

cd ..

pause```

lost matrix
#

I see

eternal oxide
#

above code will select the correct java version

lost matrix
#

Well Elgarl just gave you a gem there

regal scaffold
#

Which ones do I install?

eternal oxide
#

you combine both

regal scaffold
#

I mean

#

Which jdk's

#

Just 19 and 8?

eternal oxide
#

you need two java 8 and whatever current build

regal scaffold
#

Ok

quaint mantle
worldly ingot
#

Why can't they be normal and just use >= and <=?

lost matrix
eternal oxide
#

nice

lost matrix
#

Im thinking solar pannel and furnace generator for now...

remote swallow
#

7smile

#

slimefun fork

#

go

lost matrix
#

Wait is slimefun still a thing?

#

I thought it died in 1.12 or something

quaint mantle
remote swallow
lost matrix
#

Holy... Slimefun is still actively developed.

remote swallow
#

its so badly coded

lost matrix
#

I made sure to make this plugin scalable and pretty efficient

remote swallow
#

does it have an api or have a way to determine its own blocks/items/etc

primal goblet
#

can some one help me with this?

lost matrix
remote swallow
lost matrix
#

It uses TileStates as machine bases so most of it is stored in the PDC of the base block.

#

And there is a simple method to get from Block to IMachine

remote swallow
#

fun

primal goblet
lost matrix
#

Unloading and loading a world is done sync. I have had the same issue while writing a SkyBlock server which used multiple worlds
for multiple islands. I ended up actually forking the server because the world loading is hard coded on the main thread.

lost matrix
#

I whish there was a Bukkit.createWorldAsync() method which returns a Future<World> but thats sadly not a thing

#

Get an NVMe SSD for your server XD

#

Let me take a look at your code again. Maybe there is something you can improve on still.

primal goblet
lost matrix
primal goblet
primal goblet
lost matrix
#

??

#

Im talking about your Files being deleted on the main thread

primal goblet
#

ohhh

lost matrix
#

All of this should not be done there

primal goblet
#

i can make new thread and put the code on it, or this will destroy the server?

lost matrix
#

You cant run any bukkit api from another thread. So for example loading the chunk will break.

primal goblet
#

@lost matrix i have a socket server, if i can let the socket server delete the files that will be ok ?

lost matrix
#

Run your IO on a different thread and you bukkit code on the main thread...

primal goblet
#

hmm

primal goblet
# lost matrix Run your IO on a different thread and you bukkit code on the main thread...

if i did this?

public synchronized boolean cloneUWU() {
        try {
            new Thread(() -> {
                try {
                    FileUtils.copyDirectory(new File("/minecraft/servers/SurvivalGames/maps/" + this.getMapName()), new File(this.getMapName()));
                } catch (Exception e) {}
            }).run();
            World world = Bukkit.createWorld(new WorldCreator(this.getMapName()));
            if(world != null) {
                world.getSpawnLocation().getChunk().load();
            }
            return world != null;
        } catch (Exception e) {
            return false;
        }
    }
lost matrix
#

I dont know what that is supposed to mean but it sounds alarming

lost matrix
primal goblet
lost matrix
#

Also: You are hiding your exceptions. Never do that.

primal goblet
#

i'm gonna try to let the socket do the files things
and send a socket message to the server to load the world, i guess this will be smooth
cuz java sucks

#

if i can't did this, i will try to make the files things in other thread as you said

lost matrix
#

Those two things run in parallel (so at the same time)

primal goblet
primal goblet
lost matrix
#

What does that even mean the socket does "the file things"
A socket is used for communication. I dont see why it should
touch any Files at all.

primal goblet
#

them making it in thread, load the world files when the vote finished, when the game will be started before like some seconds load the world. i guess this will be smooth as it will be 1 map loaded only

tardy delta
#

Calling run on a thread :(

lost matrix
#

lol i even missed that

tardy delta
#

It's not in parallel

primal goblet
#

there's a start method instead of run should i use it?

tardy delta
#

If you want to do stuff async use the scheduler ig

#

And yes

primal goblet
tardy delta
#

Not sure if you need to await the result

lost matrix
#

smh

primal goblet
#

lol

tardy delta
#

You're recreating the map ig so don't you need to wait for the current map to get deleted?

#

Reading this on a phone goes brr

primal goblet
#

so there's no way the world not deleted

#

i'm gonna try a scheduler then the thread, but i have to learn some java first 🥲
but yeah thanks you guys *flower*

tardy delta
#

I want cookies not flowers

primal goblet
dry yacht
lost matrix
#

There is actually already a framework for that

last sleet
#

I'm not experienced at all in this, but are there ways of adding "fake" players with custom AI (just attacking, jumping/following around other players, simple stuff) ?
I think it's possible, but I can't find anything online about how to do this. Could someone refer me to something please?

dry yacht
#

Oh, who would've guessed...

last sleet
#

I'm not trying to do something overly complex, just have some "bots" that jump around and attack you if you're near them

lost matrix
#

Thats very complex

#

Simplest approach:
Write custom AI entities and disguise them using LibsDisguises

haughty storm
#

I have problems remapping my nms. I ran the buildtools with java -jar BuildTools.jar --rev 1.19.2 --remapped and this is my pom.xml https://paste.md-5.net/irojajemoy.xml as soon as I added the classifier and the plugin in my pom.xml some of the nms classes like WorldServer just vanished. Any ideas why?

remote swallow
#

is there a way to get the latest 1.version.patch number

remote swallow
haughty storm
#

Sorry, I don't know what you mean by that

remote swallow
#

with just org.spigot:spigot:version you use the obsfucated minecraft server code, class names are renamed so you dont have stuff like new rkab(...), using remapped its the class, field, etc names that are used unobsfucated in mojang code

eternal oxide
#

?nms

haughty storm
#

Sorry, I sent the wrong pom.xml

eternal oxide
#

You are also building a spigot 1.19.2 plugin against java 8, it requires 16? or 17 I forget which

remote swallow
#

17 iirc

#

16 is 1.17, 17 is 1.18 and higher if my brain is working

remote swallow
#

what i said still applies

#

without the classifer its spigot mappings and obsfucated stuff

haughty storm
#

I do have the classifier though

eternal oxide
#

wrong java version

quaint mantle
#

Since with mojang mappings EntityPlayer doesnt exist anymore,
how do i create an npc?

remote swallow
#

thats why the field changes

#

because you are now using the real class names, not spigot mappings

haughty storm
#

I just updated that

eternal oxide
#

EntityPlayer is now ServerPlayer or somethign like that

quaint mantle
#

oh yea it is

#

thx

haughty storm
remote swallow
eternal oxide
#

yes but it's really easy to find the new classes,

quaint mantle
eternal oxide
#

Most IDE's will auto suggest

remote swallow
#

most stuff on 1.18.2 or higher stays the same iirc

eternal oxide
#

yep, just a few packet name changes

quaint mantle
#

i can just ctrl + f and look it up

remote swallow
#

yeah

#

yeah, spigot mappings are EnitityPlayer, mojang mappings are ServerPLayer

quaint mantle
#

got it thx

eternal oxide
#

x/z

haughty storm
#

How do I create a FakePlayer using nms? Every resource or thread I see uses

new EntityPlayer(server, world, new GameProfile(target.getUniqueId(), target.getName()), new PlayerInteractManager(world));

But if I try to do that

ServerPlayer npc = new ServerPlayer(server, world, new GameProfile(p.getUniqueId(), p.getName()), null);

It says that the last arg needs to be a ProfilePublicKey

tardy delta
#

never heard of the class FakePlayer

cunning canopy
#

Oh no.... I did rm -rf * in the wrong ssh terminal

round finch
#

💀

#

Rip

cunning canopy
#

Did it in the home directory aswell

eternal oxide
#

You can pass null for ProfilePublicKey Unless it's an actual player, then you need their actual key

haughty storm
eternal oxide
#

for an NPC you need to extend ServerPlayer in your own class so you can override the connection

#

if you don;t block outgoing packets to the NPC you will crash yoru server

haughty storm
#

So I would have to create my own NPC class that extends ServerPlayer

eternal oxide
#

yes

haughty storm
#

ok, thank you very much

quaint mantle
#

I've got 3 jars, 1.8 1,7 1.16 since i depend on all 3 the only issue is when I call Bukkit.getOnlinePlayers() I get this

opaque scarab
#

I’ve asked this before, but I’m asking again because I’d like to hear more opinions. If I’m writing a custom system for a server, should I divide the different parts of the server such as rank management, custom NPCs, etc, into different plugins, then make them communicate with each other? I’m new

gaunt mountain
#

No idea if this is the right place to ask but, I'm trying to take the behavior of foxes and apply them to tamed and named cats. How do I do this?

I mean like, so that they roam around and stuff

remote swallow
#

and dont use thread.sleep

quaint mantle
#

why

#

and it works for my friend which is weird?

hasty prawn
quaint mantle
#

it doesnt error for him

remote swallow
#

if you do it wrong you will just lag the server

gaunt mountain
#

Thank you!

remote swallow
#

minecraft is single threaded

#

by sleeping you stop the thread

quaint mantle
#

its on a sperate thread

#

im aware of how java works

hasty prawn
opaque scarab
twilit roost
#

how can I display Objective in PLAYER_LIST and BELOW_NAME at same time?

quaint mantle
#
<html>Overload resolution ambiguity:<br/>public open fun getOnlinePlayers(): Array&lt;(out) Player!&gt;! defined in org.bukkit.Bukkit<br/>public open fun getOnlinePlayers(): (MutableCollection&lt;out Player!&gt;..Collection&lt;Player!&gt;?) defined in org.bukkit.Bukkit
eternal oxide
#

apply to x and z instead of x and y

#

y is vertical

tardy delta
#

kotlin 🤡

quaint mantle
#

i tried using this as it said in the comments of a video

 npc.getEntityData().set(new EntityDataAccessor<>(16, EntityDataSerializers.BYTE), (byte)127);
#

but when i do it gives me an error

java.lang.ClassCastException: class java.lang.Byte cannot be cast to class java.lang.Integer (java.lang.Byte and java.lang.Integer are in module java.base of loader 'bootstrap')
alpine swan
#

what is an effective and efficient way to store player data for a lot of players

would it be best to use one big config file, or lots of per-player config files, or a database, or what (and why)

quaint mantle
#

Do titles show up on top of everything?

#

Like, if I'm looking in a chest

river oracle
#

Ofcourse I'd cache as well to make data fetch times much faster if the data is being constantly used

remote swallow
#

yaml config stored on players pdc with more pdc Steve_Cool

river oracle
#

🔥🔥🔥🔥

remote swallow
#

json is confusing imho

river oracle
#

Your confusing

lost matrix
remote swallow
#

and

remote swallow
river oracle
#

I'll hedge bets that'll never happen 😂

remote swallow
#

can we access players pdc async?

river oracle
#

I doubt it, but who knows

lost matrix
#

Unless you are reading directly from the players file

alpine swan
lost matrix
#

Does this look cool or what

alpine swan
quaint mantle
river oracle
remote swallow
#

expand it

#

more

#

go

alpine swan
river oracle
#

Yeah

lost matrix
#

^

#

*Packet based ofc

river oracle
#

I am excited for those new fucking entities coming in 1.20

remote swallow
#

make it so you can build bigger lines

#

like pylons

river oracle
#

Omfg you know ima rave for that shit

lost matrix
#

Yeah those entities look pretty useful

river oracle
alpine swan
river oracle
tardy delta
#

what entities

#

im clearly not up to date about anything

river oracle
#

Omg you'll love these mf things

quiet ice
#

No.
Don't message me out of the blue about plugin ideas out of the blue, unless you are rather certain that I'm the only one really suitable for the task (however I am quite certain that you don't know my strong suits and thus it is almost certain that I am not the only one capable of doing it).

alpine swan
#

ofc its opinion

river oracle
# tardy delta im clearly not up to date about anything

Hey everyone! I wasn't too invested in the recent Minecraft snapshots that had been releasing until I saw these new entities. The possibilities are endless with the interactions and block display :D That being said, the first thing I decided to make with them was a piano.

Sorry the video is very short, I wanted to get this out before the update...

▶ Play video
#

Even though this is basic asf

chrome beacon
river oracle
#

They should honestly be banned

#

Not sure why they are allowed to do that

chrome beacon
#

They also pinged almost every booster

tardy delta
#

oh ive seen that vid on minestom dc

quiet ice
#

Yeah - honestly at some point there should be a voteban command

tardy delta
#

minecraft:interaction huh

quiet ice
#

Where's the democracy when you need it?

lost matrix
river oracle
#

This is why I have my dms off uwu

#

They are always too lazy to friend request

#

Those who actually want business will care enough to friend you

quiet ice
#

I have never seen people that really want buisness

chrome beacon
tardy delta
#

i only get friend requests from people that dont respond after that \💀

chrome beacon
quiet ice
#

Perhaps back in my bukkit plugin development hayday - but these days there is noone DMing me directly for reasons that are justifyable

lost matrix
river oracle
#

:P they are a creators dream

sterile token
dry yacht
#

org.yaml.snakeyaml.error.YAMLException: The incoming YAML document exceeds the limit: 3145728 code points.

:(

lost matrix
#

Uhm... F?

sterile token
#

🤣

green prism
#

Can you help me please?

StackTrace

Caused by: java.lang.NullPointerException: Cannot invoke "it.mikeslab.labutil.inventories.annotations.ClickEvent.action()" because the return value of "java.lang.reflect.Method.getAnnotation(java.lang.Class)" is null

Library Class Involved:
https://paste.md-5.net/hucosoqoru.php

Class using that library and that class:
https://paste.md-5.net/cawecamida.java

Context:
Using my CustomGUI API. I've got an error from using that Annotation-Action click association.

Where is the InventoryClickEvent Event?:
https://paste.md-5.net/yoqejokaga.cs

Repo?
https://github.com/MichealsLab/LabUtil-Inventories

GitHub

MikesLab's Util for creating YAML based custom inventories with Events, Placeholder & much more! - GitHub - MichealsLab/LabUtil-Inventories: MikesLab's Util for creating YAM...

lost matrix
#

?npe

undone axleBOT
#

The NullPointerException, (commonly referred to as NPE), is thrown in the following cases, but not sealed to: 1. null is passed into a method or constructor which does not allow it; 2. When trying to access a field on an object pointing to null; 3. Casting null to a primitive. See https://stackoverflow.com/a/3988794/17047120 for information on how to debug NPEs.

dry yacht
green prism
lost matrix
sterile token
#

But ofc you can then switch between Json, SQLite, H2

#

Also something i ask too much, is why the fuck they ddint create something like SQlite meant for Json storage 🤔

green prism
# lost matrix Something is trying to reflect an annotation that is not present on runtime.

No sense, the annotation is real

    @ClickEvent(action = "BUY")
    public void buyClick(InventoryClickEvent event) {
        ShopUtils sellUtils = plugin.getShopUtils();
        Player player = (Player) event.getWhoClicked();

        Component result = sellUtils.buyItem(player, Buyable.ARMOR, 1, event.getSlot());
        plugin.getAudience().player(player).sendMessage(result);
    }

    @ClickEvent(action = "CLOSE")
    public void closeClick(InventoryClickEvent event) {
        ShopUtils sellUtils = plugin.getShopUtils();
    }

Please, help me... I'm going crazy

dry yacht
#

The only reason it cannot handle big files is because it's stupid spec makes the parser end up as such a complicated state machine that it would probably take forever to parse big files and they want to sweep that under the rug.

sterile token
dry yacht
#

Yaml

sterile token
#

yeah, as i said Yaml must not be used for storage

#

Its not designed for that, that why Json exists

quaint mantle
dry yacht
green prism
#

Just a lib to handle inventories

remote swallow
quaint mantle
sterile token
lost matrix
quaint mantle
#

Oh

green prism
sterile token
#

I seen that but didnt want to say it

#

I have seen that guy doing the same things for some people 💀

#

But idk so far its not my problem so i just blocked him on the momment i was told hahaha

lost matrix
#

Here i suppose

green prism
#
    public Consumer<InventoryClickEvent> loadClickEvent() {
        return (e) -> {
            
            if(objectContent.isEmpty()) return;
            if(inventory.getItems().get(e.getSlot()) == null) return;
            if(inventory.getItems().get(e.getSlot()).getValue() == null) return;
            
            String elementAction = inventory.getItems().get(e.getSlot()).getValue();
            
            objectContent.keySet().stream()
                    .filter(obj -> objectContent.get(obj).getKey().equals(name)) 
                    .forEach(obj -> objectContent.get(obj).getValue().stream()
                            .filter(method -> method.getAnnotation(ClickEvent.class).action().equals(elementAction)) //This line
                            .forEach(method -> {
                                try {
                                    method.invoke(obj, e);
                                } catch (Exception exception) {
                                    exception.printStackTrace();
                                }
                            }));
        };
    }
}
```java
green prism
sterile token
#

oh my bad

#

Really sorry

#

O confused you with another guy

green prism
lost matrix
sterile token
#

So far, why dont you use Spigot events-driven system?

lost matrix
#

It looked more robust

sterile token
#

Spigot already has implemented an EventBus, which allow you to create custom event and listening

green prism
# lost matrix It looked more robust

It gives me no stack trace
At least this line gives me a giant error:
.filter(method -> method.getAnnotation(ClickEvent.class).action().equals(elementAction)) //This line

#

Sorry, I forgot to say that

naive bolt
sterile token
#

Please those weird uris are blocked on my country, so i suggest using ?paste

#

😬

ivory sleet
sterile token
lost matrix
tardy delta
#

oh i hate that you have to put try catch in a lambda instead of giving the exception to the outer method signature

ivory sleet
#

Sneaky throwsthocc

tardy delta
#

lombok 🤡

ivory sleet
#

💀

quaint mantle
#

Trying to render the second layer of a skin on an NPC with this code

 npc.getEntityData().set(new EntityDataAccessor<>(16, EntityDataSerializers.BYTE), (byte)127);

but when i try to im getting this error:

java.lang.ClassCastException: class java.lang.Byte cannot be cast to class java.lang.Integer (java.lang.Byte and java.lang.Integer are in module java.base of loader 'bootstrap')

When i try use

EntityDataSerializers.INT), 127

it just doesnt work

lost matrix
tardy delta
#

oh i hate that crap

lost matrix
#

Byte

tardy delta
#

feels like jsonsimple

#

((Number)smth).doubleValue()

ivory sleet
#

What yo have against json simple apart from that its ancient and sucks?

pseudo hazel
#

i mean that sounds like a good reason to not use it

tardy delta
#

idk the moment i start using gson, its for using the reflection part, not (de)serializing manually

#

but i switched now anywyas

remote swallow
#

i should learn json

ivory sleet
tardy delta
#

always fun when gson doesnt know how to deserialize smth

sterile token
tardy delta
#

trying to write a recipe loader that loads the clients recipes into their java object 💀

green prism
# lost matrix Well your first filter was correct. If you dont see any method invocations after...

If I were to start that library from scratch, what would you recommend I do to optimize things?
The idea was to register listeners (one for each inventory registered) and then work with annotations to associate events with a method.
Also, instead of working with slots, work with actions: associate an action to each CustomItem obtained from the config, which will then be checked on click and invoke the relative method.

tardy delta
#

going kinda brr, i need 1000 bufferedreaders for that

ivory sleet
tardy delta
#

how does mc even has 1000 recipes

ivory sleet
#

Lol

tardy delta
#

luckily they are divided into groups

#

so ye :)

#

oh and this isnt spigot btw

ivory sleet
lost matrix
# green prism If I were to start that library from scratch, what would you recommend I do to o...

Use MethodHandles instead of relfect.Method. On that note: A Benchmark i did yesterday for measuring how expensive each
method call is:

Benchmark                                 Mode  Cnt   Score   Error  Units
ReflectionBenchmark.callMethodPublic      avgt    5   0,987 ± 0,003  ns/op
ReflectionBenchmark.handleMethodPrivate   avgt    5   3,851 ± 0,006  ns/op
ReflectionBenchmark.handleMethodPublic    avgt    5   3,908 ± 0,210  ns/op
ReflectionBenchmark.reflectMethodPrivate  avgt    5  16,220 ± 1,851  ns/op
ReflectionBenchmark.reflectMethodPublic   avgt    5  15,788 ± 0,993  ns/op
tardy delta
#

lowest score is best right

quaint mantle
tardy delta
#

me and jmh are no good friends

ivory sleet
lost matrix
lost matrix
ivory sleet
#

Like if you unreflect a reflective object to a method handle that object iirc will invoke slower as it delegates to reflective invocation

sterile token
quaint mantle
tardy delta
#

thats js my man

green prism
sterile token
pseudo hazel
#

cuz it adds up

ivory sleet
#

But ye works

lost matrix
quaint mantle
lost matrix
#

gtg walk my doggo

remote swallow
#

show

pseudo hazel
#

a byte is just a smaller and more annoying int

lost matrix
tardy delta
#

LOL

ivory sleet
#

🥲

tardy delta
#

man listenin' spotify

remote swallow
alpine swan
#

if you want to access the main class instance from a different class, is there any difference between making a static method which returns the instance and making a variable from that in other classes, and making a static variable and setting that to the instance in onEnable()

tardy delta
#

?di

undone axleBOT
remote swallow
#

di where you can

pseudo hazel
#

yikes

#

di makes it look more messy imo

remote swallow
#

no not really

#

its like 3 extra lines the class

pseudo hazel
#

yeah in every class

remote swallow
#

and about 5 less in the main class

quaint mantle
#

does
Integer.byteValue() == (byte) int

pseudo hazel
#

I would hope so

remote swallow
tawny remnant
remote swallow
#

discord

#

frick you

#

@RequiredArgsConstructor

quaint mantle
tawny remnant
pseudo hazel
#

its more like why isnt a static accessor for your plugin not good

remote swallow
sterile token
pseudo hazel
#

wdym

quaint mantle
quaint mantle
pseudo hazel
#

its literally one variable for something that you know can only be one of

ivory sleet
#

I do not advice exposing a public variable in any sort of weird way, that’ll make ur code hard to maintain rather rapidly

pseudo hazel
#

if you wanna use a static variable or function I would say it makes the most sense for a plugin instance

alpine swan
pseudo hazel
#

what people think is better combined with what the language says is better

ivory sleet
#

Well there turns out to that singletons are evil in excessive usage

tardy delta
#

ugh int count = Optional.ofNullable(obj.get("count")).map(JsonElement::getAsInt).orElse(0);

pseudo hazel
#

yes thats why the reccomendation is to just not use it at all if it can be prevented

quaint mantle
pseudo hazel
#

but like, to a certain point I think its fine

rapid topaz
#

I dont understand why this is an error. Can someone help?

tardy delta
#

im missing let count = obj.get("count")?.getAsInt() || 0

remote swallow
tardy delta
ivory sleet
#

Singletons can be fine, but you have to really consider the scope in which the singleton is going to be contained within to avoid problems later

remote swallow
#

^^

quaint mantle
sterile token
tardy delta
#

smh

rapid topaz
#

forgot a listener

alpine swan
ivory sleet
quaint mantle
tardy delta
sterile token
pliant flame
#

Omg ‘tis the mighty Conclure 😱

remote swallow
#

conclure is sus

#

very emo

ivory sleet
#

No

remote swallow
#

we are choosing to ignore the fact its a matching pfp at this time

ivory sleet
pseudo hazel
#

he says with the emo anime pfp

tardy delta
#

mfs Exception in thread "main" java.lang.RuntimeException: Failed to invoke constructor 'net.minestom.server.network.packet.server.play.DeclareRecipesPacket$DeclaredShapedCraftingRecipe(String, int, int, String, List, ItemStack)' with args [null, 0, 0, boat, null, ItemStackImpl[material=minecraft:air, amount=1, meta={}]]

remote swallow
#

null

ivory sleet
remote swallow
#

conclure

pseudo hazel
#

yes I agree, and with a plugin instance I would argue that the scope would be the whole plugin so then it would be fine to just use a static thing

remote swallow
#

whos it matching with

ivory sleet
#

blob, so from my perspective I choose singleton if I want to lazily get something

#

Else it doesn’t make sense to choose a singleton

tardy delta
#

who else has no clue what they aare doing

pseudo hazel
#

i guess thats another way of putting it

ivory sleet
remote swallow
#

smh

quaint mantle
#

cool, new error:

[19:17:22] [Netty Server IO #2/ERROR]: Error receiving packet 78
java.lang.NullPointerException: Cannot invoke "java.util.List.iterator()" because "var0" is null
remote swallow
#

so many people here developing stuff while not being a real dev

#

smh

#

smh

pseudo hazel
#

what is a real dev

ivory sleet
#

And if the singleton is lazy (which it likely is going to be) then you have to care about there only being one instance, which becomes a bit more crucial to properly think about when this singleton is used in multiple threads

Else singletons are bad because they hide the fact they components depend on them, they become tightly coupled to components that depend on them

remote swallow
ivory sleet
#

Since you for instance never pass a singleton to a constructor, we all can agree that it wouldn’t make much sense, thus normal dependency injection should be used rather

pseudo hazel
#

then I know no fake devs

hazy parrot
ivory sleet
#

class Singleton{
//with methods and stuff
}

record Dependence(Singleton singleton){}

//you never (almost) see this
new Dependence(Singleton.getInstance());

alpine swan
#

would something like that work fine (i mean it worked fine)

pseudo hazel
#

exactly cuz tehre is reason to

ivory sleet
#

That public there is a bit meh

#

It goes against the principle of that you should write your code defensively to avoid future misinputs that may be written by either you, or other contributors

sterile token
pseudo hazel
#

why

#

give me an actual good reason

alpine swan
pseudo hazel
#

other than principles and shit

hazy parrot
ivory sleet
pseudo hazel
#

its literally one static function for the central object of the whole plugin, i.e. the plugin instance

quaint mantle
#

Bruh giving main plugin class is bad practice.

ivory sleet
#

Anyone who has worked on a software infrastructure with more than a million lines of code knows how it feels like when those getInstances are insinuated everywhere.

sterile token
pseudo hazel
#

I mean the only danger is you need to watch out that it doesnt grow out of control and use it in places where it isnt supposed to be used

hazy parrot
#

how does it scales badly

ivory sleet
#

Your software system becomes a spaghetti and a mess if let’s say you decide to use a singleton for every middle layered level component

pseudo hazel
#

and besides, the result is already from a singleton thanks to bukkit

ivory sleet
#

For instance, the lowest level components are going to end up hiding their dependence on those middle leveled components

hazy parrot
#

using singleton for class which is and can only be singleton scales to spaghetti code ?

pseudo hazel
#

yes I agree with you conclure, but like I said I think its an acceptable use in this case

ivory sleet
#

Its the top level class of your system

#

That is a violation of abstraction technically

hazy parrot
#

having abstraction on places it doesn't have to exist >>

pseudo hazel
#

then di just hides that fact by making it seem like its supposed to belong in your lower classes

hazy parrot
#

lets just use hungarian notations

lost matrix
ivory sleet
#

Mye

alpine swan
#

is there a difference between

public static Plugin getinstanceorsomethingidk(){
  return this;

and

private Plugin plugin;
@Override
public void onEnableOrOnLoadidkthedifference(){
  plugin = this;

public static Plugin getinstanceorsomethingidk(){
  return plugin;

and

public static Plugin plugin;
@Override
public void onEnableOrOnLoadidkthedifference(){
  plugin = this;

(refer directly to the static plugin variable in other classes)
ivory sleet
#

Guice and dagger are still fine I suppose

quaint mantle
#

Never static

alpine swan
lost matrix
#

But yes its incredibly annoying finding out dependencies if you have the singleton pattern everywhere

ivory sleet
#

^

#

You lose SOLID completely also

lost matrix
#

*But you can battle a lot of problems with lazy references

alpine swan
pseudo hazel
#

some words people said some time ago

ivory sleet
#

Okay, maybe if you create a little hobby project for the cause, practicing whatever principles you like may be fine then

quiet ice
alpine swan
#

btw whats the difference between onload and onenable

ivory sleet
#

onLoad is called way earlier

quiet ice
sterile token
#

yeah but ig you want to maintain an stable and big software, making it able to scale easly you must use DI

lost matrix
ivory sleet
#

Like almost as soon as your plugin constructor is invoked

alpine swan
quiet ice
#

not many

ivory sleet
#

World generation iirc

lost matrix
pseudo hazel
sterile token
sterile token
ivory sleet
pseudo hazel
#

true

ivory sleet
#

Static should be used for stateless designs ideally

pseudo hazel
#

okay makes sense

lost matrix
#

Was about to point that out

ivory sleet
#

Factory methods, utility functions, helper methods, nested builder classes etc

lost matrix
#

If you dont combine static and final then you are probably doing something wrong

alpine swan
#

ehhhh il probably keep setting a static variable to plugin instance in onenable until it breaks something

pseudo hazel
#

yeah I guess the singleton is just implemented using static since thats the easiest way

ivory sleet
#

Ye, I mean the canonical pattern of singleton doesnt talk at all about static

#

It just says like, have one instance and make damn sure it has a global access point

hard socket
#

guys I have this method here and I want to know if there is an app or webiste that can draw me this I am tired of opening mc everytime

#
                        for (int iteration = 0; iteration < 5; iteration++) {
                            double angle = 72.0D * iteration;
                            double nextAngle = 72.0D * (iteration + 2);
                            angle = Math.toRadians(angle);
                            nextAngle = Math.toRadians(nextAngle);
                            double x = Math.cos(angle) * 3.5D;
                            double z = Math.sin(angle) * 3.5D;
                            double x2 = Math.cos(nextAngle) * 3.5D;
                            double z2 = Math.sin(nextAngle) * 3.5D;
                            double deltaX = x2 - x;
                            double deltaZ = z2 - z;
                            double distance = Math.sqrt((deltaX - x) * (deltaX - x) + (deltaZ - z) * (deltaZ - z)) * 0.11D;
                            for (double d = 0.0D; d < distance - 0.1D; d += 0.02D) {
                                loc.add(x + deltaX * d, 0.0D, z + deltaZ * d);
                                MathParticles.spawnParticle(p.getWorld(), pe, loc, rgb1, rgb2, rgb3);
                                loc.subtract(x + deltaX * d, 0.0D, z + deltaZ * d);
                            }
                        }```
undone axleBOT
#

You can use the discord code block format to display code or just text in a more pleasing way:
```java
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {

}

}```
Becomes:

public class MyPlugin extends JavaPlugin {
    @Override
    public void onEnable() {

    }
}```
alpine swan
#

is it possible for players to join the server before onEnable? (assuming im not using reload or a plugin reload plugin or anything weird like that)

ivory sleet
pseudo hazel
#

I mean for my accessor I just use return getPlugin(MyPlugin.class); xD

ivory sleet
#

If it isnt too heavy on desmos

#

That’s arguably more fine

ivory sleet
#

Altho assuming you do cache that

pseudo hazel
#

who, me?

ivory sleet
#

Ye

pseudo hazel
#

oh, no I dont

#

i didnt know it was an expensive operation

ivory sleet
#

Not heavy, but its a bit more than just a variable lookup

#

Fyi (:

sterile token
pseudo hazel
#

I guess so

hard socket
sterile token
pseudo hazel
#

okay I cached it xD

ivory sleet
#

Nice

pseudo hazel
#

making my plugin better 1 cache at a time

ivory sleet
lost matrix
#

Oh oh he is gonna have a weird problem, learn about cache invalidation soon and then stop caching again.

pseudo hazel
#

nah

remote swallow
#

1 cache at a time? i cache everything

#

nothing goes un cached

ivory sleet
#

As a wise man once said, cache the cache

pseudo hazel
#

I just wont notice it until its too late 🤷

ivory sleet
#

Java GC is kinda epic when it comes to invalidation and cleaning up tho, so dw bout it too much

green prism
#

Can I store inventory data inside a Custom Holder assigned to the inventory?

ivory sleet
#

Ye you can

green prism
#

Ty

ivory sleet
#

Nothing’s technically preventing you from it

green prism
#

right?

ivory sleet
#

iirc its just getHolder()

quaint mantle
#

What happens if I call Runtime.getRuntime().gc() every tick?

ivory sleet
#

But yes

lost matrix
#

Why can we have this but custom Predicate<ItemStack> recipe choices are "too leaky"

ivory sleet
#

Most jvms have that disabled

#

(Like server owners disable it with a flag)

#

iirc its disabled in aikars flags, so hence why

quaint mantle
#

If it didn't disabled 🤔

lost matrix
#

Then you gonna tank your performance big time, thats all

haughty storm
#

How would I remove a FakePlayer from the tablist?

ivory sleet
#

Its like asking “Hi GC, please for the sake of our beloved god, I hereby inquire you to collect my dirty garbage as soon as your possibly can work your ass off, thanks”

#

And then jvm is probably gonna invoke a sweep relatively soon

ivory sleet
#

Ye you definitely should touch some grass

ivory sleet
#

Been working on that math expression validator for way too long I reckon

wet breach
#

even if its not disabled it still doesn't do anything

#

in regards to the GC

ivory sleet
#

I mean it does

ivory sleet
#

It asks jvm to sweep asap

#

Not that it forces the jvm to do it

tardy delta
ivory sleet
#

But the jvm will take those calls into account

wet breach
#

yeah just asks the GC

tardy delta
#

ah

#

nvm

#

people think i work on it when im working on other stuff

ivory sleet
#

Ye fourteen, just that (:

#

Some guy referred to you as the math guy even

tardy delta
#

i got one push i gotta do and that basically completes my current goals

wet breach
ivory sleet
#

Ye lol

tardy delta
#

someone even asked me to publish it on a projects showcase thing 💀

#

if they want that ig

green prism
#

smile are you there?

lost matrix
#

Yeah

green prism
# lost matrix Yeah
    @EventHandler
    public void onClick(InventoryClickEvent event) {
        if(event.getClickedInventory() == null) return;
        if(event.getClickedInventory().getHolder() == null) return;
        if(!(event.getClickedInventory().getHolder() instanceof Holder)) return;

        Holder holder = (Holder) event.getClickedInventory().getHolder();
        CustomInventory inventory = identifyInventory(holder);
        
        if(inventory == null) return;
        event.setCancelled(true);
        
        int slot = event.getSlot();
        String action = (inventory.getItems().get(slot).getValue() + "").toLowerCase();
        if(action.equals("")) return;
        
        Object listenerInstance = listeners.get(inventory.getName()).getKey();
        
        try {
            MethodAccessUtil.invokeMethod(listenerInstance, action, event);
        } catch (Throwable e) {
            throw new RuntimeException(e);
        }

    }

MethodAccessUtil:
https://paste.md-5.net/vodayitepo.java

Smth like this?

ivory sleet
tardy delta
#

always fun when i have an exception on a line that doesnt exist

sterile token
tardy delta
#

funniest thing i saw today was ConstructorConstructor#construct in gson

lost matrix
sterile token
tardy delta
lost matrix
sterile token
green prism
sterile token
green prism
#

and Im also tired af

quaint mantle
tardy delta
#

lol

green prism
#

wait, is it possible?

quaint mantle
#

Ye

green prism
#

overwrite Bukkit's classes?

tardy delta
#

the whole point of the underscore prefix is to not call "this" but yet they do 💀

green prism
#

starting from packets, ending with gui custom clicks?

lost matrix
tardy delta
#

probably decompiled

quaint mantle
lost matrix
#

There can be two inventories open with the same name which breaks your approach.

green prism
#

it's like an ID (it's not the displayName)

lost matrix
green prism
#

What can I do about that?

sterile token
lost matrix
green prism
# lost matrix What is your "action" String representing?
title: <blue>Shop!
size: 27
filler: BLACK_STAINED_GLASS_PANE
items:
  12:
    material: DIAMOND_HELMET
    customModelData: 10000
    displayName: "<blue>Armors Shop"
    action: ARMORS_SHOP
    lore:
      - "<gray>Click to open <blue>Armors Shop</blue>!"
  13:
    material: PLAYER_HEAD
    texture: d831830a7bd3b1ab05beb98dc2f9fc5ea550b3cf649fd94d483da7cd39f7c063
    displayName: "<blue>Exchanger Shop"
    action: EXCHANGER_SHOP
    lore:
      - "<gray>Click to open <blue>Exchanger Shop</blue>!"
  14:
    material: DIAMOND_HELMET
    customModelData: 10000
    displayName: "<blue>Weapons Shop"
    action: WEAPONS_SHOP
    lore:
      - "<gray>Click to open <blue>Weapons Shop</blue>!"

It's something to replace more easily the "ClickableSlot" thing

quaint mantle
green prism
#

seems pretty heavy

lost matrix
ivory sleet
#

InventoryHolder is fine in most cases but ye comparing the objects is better

sterile token
# green prism ```java @EventHandler public void onClick(InventoryClickEvent event) { ...

Be like:

class MenuListener implements Listener {

  MenuHandler handler;

  onInventoryOpen(InventoryOpenEvent event) {
     Player player = (Player) event.getPlayer();
     Optional<Menu> menu = handler.getMenu(event.getViews().getTopInventory());
     if (!menu.isPresent()) return;
     MenuEvent open = new MenuOpenEvent(player, menu.get());
     Bukkit.getPluginManager().callEvent(open);
     event.setCancelled(open.isCancelled());
  }  

}

class MenuOpenEvent extends MenuEvent {
  
  final HandlerList handlers = new HandlerList();
  
  public MenuOpenEvent(Player player, Menu menu) {
    super(player, menu);
  }

  // HandlerList static getter 
}

Written using pseudo code

#

😂

#

Idk why you over complicating

green prism
#

oh okay pseudo

sterile token
#

Yeah it forget that haha

#

But i suggest readin

green prism
#

?eventlistener

quaint mantle
#

F

sterile token
#

I dont remember the cmd

green prism
#

?listener

sterile token
#

and now they removed the ?help command, so we cant see the command list

tawdry echo
pseudo hazel
#

how to fix what

tawdry echo
#

placeholders dont work

#

still is %rank_name%

lost matrix
pseudo hazel
#

he is already printing them apparently xD

tawdry echo
#

and i dont get anything

quaint mantle
lost matrix
quaint mantle
green prism
lost matrix
#

Its "name", right?
And what branch do you think "name" does trigger here?

            case "rank_name": return user.getGroup().getName();
            case "rank_prefix": return user.getGroup().getColoredPrefix();
            case "rank_icon": return user.getGroup().getColoredIcon();
            case "rank_time": return TimeUtil.toText(user.getLeftGroupTime());
lost matrix
green prism
#

Ohhh that static HashBasedTable

#

Are you talking of that?

lost matrix
#

Yeah. It may contain objects which are linked to game objects.
If someone references a chunk in his GUI or a World, then those can never be unloaded.

green prism
#

In your opinion, what could be a solution?

lost matrix
#

You dont need to cache the object itself

green prism
#

ohhhh okay!! So the ListenerClass Instance Object is the problem

lost matrix
#

In MethodHandles invoke method the first object you pass will be the object you invoke your method on.

#

So you can have a MethodHandle without having the actual object

green prism
#

So it becomes permanently stored, right?

lost matrix
#

Your table should look more like this:

HashBasedTable<Type, String, MethodHandle>

or

HashBasedTable<Class<?>, String, MethodHandle>
green prism
#

I miss something...
If I don't need an Object anymore, why not using a Map<String, MethodHandle>?

lost matrix
#

Because two different classes can have the same method name which would simply overwrite the other one

green prism
#

So, I need to pass a Class<Ex: ListenerClass> instead of an Object param

#

okay I got it

#

thank you

tawdry echo
lost matrix
#

But you call .getClass() on the object

lost matrix
#

Or at least put the obj in your varargs and get the class of the first one

green prism
#

Simply like that

lost matrix
lost matrix
#

.invokeWithArguments(args);
in args the first object is the object you are going to use this method on.
The rest are the parameters

#

Wait a minute let me not confuse invoke and invokeWithArgs

tawdry echo
lost matrix
tawdry echo
#
name: Permissions
version: '1.0-SNAPSHOT'
main: me.xemuain.permissions.Permissions
api-version: 1.19
authors: [ Xemuain ]
description: Plugin for manager players permissions

softdepend: [PlaceholderAPI]
lost matrix
quaint mantle
tawdry echo
#

ty bro

quaint mantle
quaint tapir
#

if I want to check when a player takes damage from another player how do i get both players

#

I can getEntity

#

but that only gets one

quaint tapir
#

`public class Events implements Listener {
@EventHandler
public void OnAttack(PlayerInteractEvent event){

}

}
`

#

but what do I put

#

in the public void OnAttack

#

PlayerInteractEvent???

remote swallow
#

EntityDamageAtEntityEvent iirc

quaint tapir
#

oh thank you im stupid

pseudo hazel
#

EntityDamageByEntityEvent but close enough

glad prawn
#

Xd

quaint tapir
#

when I do event.getDamager() I cant do .getInventory

#

how do I check the inventory of the attacker

pseudo hazel
#

first check if its a player

#

then cast it

quaint tapir
#

oh thanks

pseudo hazel
#

how would I separate my plugin into 2 different versions where one is just an expanded version of the other

#

and still keep it maintainable reasonably well

tardy delta
#

ah yes need to abuse gson now so i know the file name of where the jsonelement comes from in a deserialize 🤔

#

wtf

quaint mantle
#

how do i remove an NPC? the remove action doesnt exist for some reason

swift sequoia
tardy delta
#

does anyone knows how i would get my filename into the typeadapter? cuz i need it too to construct a valid recipe object. Could probably give it to the reader but that feels hacky

swift sequoia
quaint mantle
#

also is there an easy way to prevent entities from burning (specific custom ones)

onyx fjord
#

something like that

#

or alternatively invisible (no particles) potion effect

quaint mantle
#

yea ill just make a list of my custom mobs and when the combust event fires ill cancel it for all of the entities in the list

coral kelp
#

Can anyone make a rainbow text animation going to the left into a hex code for me to rename snowballs

onyx fjord
#

??

#

for an item ?

coral kelp
#

yes

onyx fjord
#

that would be glitchy as fuck wouldnt it

quaint mantle
#

yea

onyx fjord
#

cuz you have to update the name all the time

coral kelp
#

Ik a server that done it

#

I can send it to you in dms if you want

onyx fjord
#

show us a video of that then

#

nah here

quaint mantle
#

yea

coral kelp
quaint mantle
#

thats a resource pack

coral kelp
#

yes

quaint mantle
#

yea, no code involved

#

maybe a little but def not spigot

coral kelp
#

can anyone do it possibly?

#

yeah that server runs on paper 1.19.3 a dev told me stuff about it

tardy delta
#

is that a map?

#

or item on the wall?

coral kelp
#

nope it's a textured snowball by oraxen

#

basically just a png added to a snowball

quaint mantle
#

well yea the name is a resourcepack or a mod tho

#

it doesnt have to do with a spigot plugin afaik

onyx fjord
#

oraxen just makes it easy to create packs

#

and has mechanics

coral kelp
#

umm the dev said he got his emojis from twemoji-master but he didn't say much about how to do rainbow text ill check dms one second

#

nah he didn't say anything about rainbow text it's a resourcepack i am guessing cause when i was in server the pack glitched and the item was just plain white writing

remote swallow
#

anyone here know or have a project thats on github that uses gson in spigot stuff

coral kelp
onyx fjord
#

nah

#

if its colors

#

its math

coral kelp
#

:{

onyx fjord
#

and i suck at math

coral kelp
#

Anyone else know how

quaint mantle
#

why does Ai suck so much

onyx fjord
#

and why is it so biased

quaint mantle
#

im trying to make an npc character attack/follow the player

chrome beacon
#

You could just use Citizens and Sentinels

coral kelp
# coral kelp

anyone know where i can find an emoji like the dab one?

quaint mantle
#

lets say i wouldnt want to use that for whatever reason,
Any good way doing it myself?

echo granite
#

Why doesn't this code disable picking up items? In fact it doesn't even show an error message neither anything in console

ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(this, PacketType.Play.Client.PICK_ITEM)
        {
            @Override
            public void onPacketSending(PacketEvent event)
            {
                System.out.println("Disabled picking #1");
                event.setCancelled(true);
            }
            
            @Override
            public void onPacketReceiving(PacketEvent event)
            {
                System.out.println("Disabled picking #2");
                event.setCancelled(true);
            }
        });
mortal hare
knotty gale
#

how would I broadcast a message, but instead of it being in the chat, it is on the action bar?

mortal hare
#

Item#setOwner()

#

just set this to an UUID that is not used

#

and voila

#

or

#

Item#setPickupDelay(Integer.MAX_VALUE)

#

this wouldnt allow for players to pickup items for at least 3 years in real life

echo granite
mortal hare
#

im surprised that theres even a packet for that

#

since it could be easily handled by a server

#

by tracking entity and player locations

#

maybe you're catching server sent packet?

echo granite
#

bruh without the packet it wouldn't be possible to use the bukkit event lol

echo granite
mortal hare
#
Pickup Item

Sent by the server when someone picks up an item lying on the ground — its sole purpose appears to be the animation of the item flying towards you.
#

pickup is handled by the server

#

server sends that packet to make the animation on the client

#

just use the api

#

and the server wont send the packet

#

and item wouldnt dissapear

#

if you cancel this packet

#

item would dissapear

#

but no animation will be invoked on the client

echo granite
#

Nothing happens when I run the code I sent

#

The animation runs

#

No log is sent to the console

knotty gale
#

how would I broadcast a message through the action bar?

mortal hare
#

are you running protocollib

#

as a plugin?

echo granite
#

Yes ofc

mortal hare
#

sorry for dumb question

echo granite
#

with provided scope on maven

mortal hare
#

hmm

#

interesting

echo granite
#

They have an example on their wiki with chat, I ran it and it actually worked

#

So it's not a wrong setup or something

#

Something must be ignoring my listener or the packet itself

mortal hare
#

what mc version are you running

echo granite
#

1.19.3

#

papermc

mortal hare
#

protocollib ver?

chrome beacon
mortal hare
#

BFS and DFS for pathfinding at least

echo granite
#

the latest one for 1.19.3, you don't download it from spigot but from their own site

mortal hare
#

there are better algorithms though

echo granite
quaint mantle
#

isit possible to give potion effects async using packets?

chrome beacon
#

Yeah

quaint mantle
#

what packet

mortal hare
#

for a clientside effect only, yes.

quaint mantle
#

i jhate spigots gay ass tread safety

#

no its like invisiblity

mortal hare
#

its not spigot that its at fault

#

its the underlying vanilla minecraft server that is not designed for concurrency

quaint mantle
chrome beacon
#

Show your code

#

?paste

undone axleBOT
mortal hare
small hawk
#

How should i check if around my block that i placed, if any liquids are in 8 block range? I guess it's not check block after block with getlocation().getX - 1 and so on.

quaint mantle
mortal hare
#

if you only want to make certains people for certain entities invisible you can do that

#

im not sure why would you use packets

#

to add potion effects though

quaint mantle
mortal hare
#

are you trying to make nopacket vanish to prevent hacked clients from seeing you even if you're invisible?

#

if that's so you need to send remove player or entity packet (smth like that) to do that

chrome beacon
chrome beacon
#

Spigot has hide and show player methods

mortal hare
#

even better solution, I agree with that. ^^

quaint mantle
shadow spear
#

how can i use this plugin's api?

eternal night
#

presumably you depend on the jar ?

shadow spear
eternal night
#

no you'd just listen to it like any other event

shadow spear
#

Okay, thanks a lot!

mortal hare
#

Lets say i need to return boxed primitive type

#

is storing Boxed primitive type as a static field

#

help to prevent autoboxing?

#

is there any way to retrieve boxed primitive from a final field somewhere like empty immutable collections?

#

like boxed boolean?

#

or does JVM optimize that for you

#

@eternal night ik you know this

#

i guess this works

#

but im not sure if i should use it

#

instead of returning primitive type

eternal night
mortal hare
#

return true would autobox everytime

#

for a return type of Boolean

#

im wondering if using static field Boolean.TRUE would be better in this case

eternal night
#

Yea it does that for intergers too

#

to some degree

#

how large is the int cache again think

coral kelp
#

can anyone make a rainbow text animation into a hex or somehow name a snowball for example HelloThere but rainbow moving text running to the left?

eternal night
#

I mean, I'd say if you 100% need the performance, return Boolean.TRUE

#

if this is specifically for booleans