#help-development

1 messages ¡ Page 737 of 1

quaint mantle
#

some jvm flags fuck it up also

quiet ice
#

At which point you wouldn't care about cents.

quaint mantle
#

na

#

BigDecimal and BigInteger work fine

quiet ice
#

Both of these have a hefty performance penalty

quaint mantle
#

hence work fine

river oracle
#

I must be ill too

quiet ice
#

Integer-only economies are probably best suited for performance.

worldly ingot
lilac dagger
#

You don't need great precision for mc economy

river oracle
#

main issue I come accross when comitting is trying to work with current implementation

sterile token
#

I told you as someone who known someone that worked many years with Banks as backend developer, and first thing he told me Java fucks up when working banking numbers

lilac dagger
#

But you do need big decimals for size

quaint mantle
#

but yes that would be lovely

quiet ice
#

Banks run on integers

sterile token
#

I was told best lang for Baking is around C++ or even Golang

quiet ice
#

What do you think BigDecimal is?

lilac dagger
#

That should be covered within doubles i think?

quaint mantle
#

yesnt

river oracle
#

wrong reply lol

quiet ice
#

Yes, perhaps not 32-bit ints, but still ints

quaint mantle
#

more complicated than just some ints

sterile token
#

yeah banks fight is around C++ or Golang as i said before

river oracle
quaint mantle
river oracle
#

like if you're dealing with real money cobol is an absolute

quiet ice
#

Beyond 64 bits you have issues with CAS.
Beyond 256 bits CAS is very difficult
Beyond 512 bits CAS is impossible without locking.

drifting viper
#

Guys where should i put my gist in ?, Is there something like resources ?

sterile token
quaint mantle
#

i should say more bug prone

quaint mantle
#

not just a regular cas instruction

elfin cairn
#

can someone help me find the spigot 1.20.1 api please

sterile token
elfin cairn
#

how do i do that?

sterile token
#

?buildtools

undone axleBOT
quiet ice
#

But in the real world I have to agree that floating point numbers are not well suited, but fixed-point numbers should be perfectly fine in a base-10 system

#

As far as I have been taught Banks store data as BCD which is cringe but oh well.

river oracle
elfin cairn
#

got it where do i put it

river oracle
#

if you use vanilla java dependency management 💀 but you need to build buildtools and add the api jar to your classpath

sterile token
#

You must be taking about Graven** 🤔 🤨

quaint mantle
#

silly

quiet ice
#

But I mean BCDs are just another way of representing integers, just happens to not be the standard two's-complement system I know and love.

#

what

quaint mantle
#

and in fact there have been a lot of attempts to migrate from cobol

river oracle
#

I guarentee its nearly impossible to find cobol developers to employ

quaint mantle
#

one of my work projects got commissioned to migrate from cobol, that was just direct excruciating pain

#

yeah

#

and well most cobol code bases dont have all the nice coding practices applied

#

so

#

its just spaghetti

quiet ice
#

I have no clue what that is supposed to do. If a is 0 it returns 0, if a is 1 it returns ~0 (and vice-versa), if a is 2 it returns ~0 ^ 1, if a is 3 it returns ~0 ^ 2, if a is 4 it returns ~0 ^ 3, if a is 5 it returns ~0 ^ 4.

Okay I think I see a pattern, but what is it's use?

river oracle
#

two compliment is weird cuz you can have -0 iirc

quiet ice
#

I always thought of two's complement as a way to store integers in a binary fashion

#

Ah, it defines how negative and positive values are stored. Your function just does x = -a

drifting viper
quiet ice
#

Is anyone aware of tools for drawing "UML" sequence diagrams that either have extremely lax rules or are not UML-compliant? I'm kinda at the point where I almost consider doing it myself.

#

More specifically I am asking for UML tools that don't have this kind of garbage (it's not just Papyrus that has this so obviously it is specced, somehow.)

#

(What's funny is that if I was to reverse the object initialization order it would look usable, but at that point I'd get scolded by my teachers for doing it right-to-left instead of left-to-right)

glass wharf
#

Hey, I'm trying to figure out how to spawn a player NPC using NMS in 1.20.2,

I'm getting a Nullexception on this line

playerConnection.send(new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.ADD_PLAYER, npc));
java.lang.NullPointerException: Cannot invoke "net.minecraft.server.network.PlayerConnection.l()" because "player.c" is null
        at net.minecraft.network.protocol.game.ClientboundPlayerInfoUpdatePacket$Entry.<init>(ClientboundPlayerInfoUpdatePacket.java:185) ~[?:?]
        at net.minecraft.network.protocol.game.ClientboundPlayerInfoUpdatePacket$Entry.<init>(ClientboundPlayerInfoUpdatePacket.java:182) ~[?:?]
        at net.minecraft.network.protocol.game.ClientboundPlayerInfoUpdatePacket.<init>(ClientboundPlayerInfoUpdatePacket.java:30) ~[paper-1.20.2.jar:git-Paper-207]
        at live.mcmafia.mcmafia.managers.PacketManager.spawnNPC(PacketManager.java:47) ~[MCMafia-1.0-SNAPSHOT-remapped.jar:?]
        at live.mcmafia.mcmafia.commands.MafiaCommand.onCommand(MafiaCommand.java:52) ~[MCMafia-1.0-SNAPSHOT-remapped.jar:?]

Could anyone help me out?

young knoll
#

The NPC's connection is null

glass wharf
#

so it hasnt been spawned into the world?

#
ServerPlayer npc = new ServerPlayer(minecraftServer, serverLevel, gameProfile, clientInformation);

I feel like there may be some problems with the client information, I wasnt really sure what it was so I grabbed it like this

ClientInformation clientInformation = serverPlayer.clientInformation();
young knoll
#

I think you’ll have to set the connection to something

#

You can probably make a dummy connection

elfin cairn
#

theres multi errors in my code help pls

glass wharf
# young knoll The NPC's connection is null

Nothing looks like it is Null, 🤔

Output of npc.toString()

EntityPlayer['Mafia'/15, uuid='ffa8f542-a7ff-44cb-a78e-ee4634fa47cf', l='ServerLevel[world]', x=0.00, y=0.00, z=0.00, cpos=[0, 0], tl=0, v=false](Mafia at 0.0,0.0,0.0)

Output of serverPlayer1.toString()

EntityPlayer['Silverrzz'/14, uuid='b112991d-06f2-48bf-944b-f936c1056685', l='ServerLevel[world]', x=0.34, y=0.00, z=0.55, cpos=[0, 0], tl=2718933, v=true](Silverrzz at 0.33928129748421054,0.0,0.5471839256635685)

Output of playerConnection.toString()

net.minecraft.server.network.PlayerConnection@111f5163
ServerPlayer npc = new ServerPlayer(minecraftServer, serverLevel, gameProfile, clientInformation);
npc.setPos(x,y,z);

//broadcast npc to server
MCMafia.getInstance().getServer().broadcastMessage(npc.toString());


ServerPlayer serverPlayer1 = ((CraftPlayer) player).getHandle();

MCMafia.getInstance().getServer().broadcastMessage(serverPlayer1.toString());

ServerGamePacketListenerImpl playerConnection = serverPlayer1.connection;

MCMafia.getInstance().getServer().broadcastMessage(playerConnection.toString());

playerConnection.send(new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.ADD_PLAYER, npc));
young knoll
#

Okay but what about the NPCs connection

glass wharf
#

would that be npc.connection?

young knoll
#

Yes

glass wharf
#

Yeah it is null

#

okay

elfin cairn
#

Can someone help me pls

young knoll
#

?ask

undone axleBOT
#

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

elfin cairn
#

I have no idea how to fix these issues

sterile token
#

So there is no solution to the issue ?

elfin cairn
#

i have no idea

ivory sleet
#

legitimately ask your question

sterile token
elfin cairn
#

i have leant a bit and this isnt my script

sterile token
#

What script? Im too confused

elfin cairn
#

its a custom one

#

off someone

sterile token
#

oh you mean code*

elfin cairn
#

yes

sterile token
#

Right, so far i wouldnt code

#

Unless i learn Java and well learned, not like most that learn it while trying to code

elfin cairn
#

can i show it to you

quaint mantle
#

Yeah

#

Just drop your code here

#

Use pastebin

elfin cairn
#

how do i fix unexpected token

#

how do i use pastebin

#

whats the link#

glad prawn
#

?paste

undone axleBOT
elfin cairn
#

thanks

#

what i do now i have put my text in

#

its over the letter limit

thin iris
#

wdym

#

@elfin cairn

elfin cairn
#

nvm its alr

thin iris
#

do you know java

bronze crystal
#

how do I get the id of an itemstack? for example "5:1" pls tag

young knoll
#

Oh no it’s 1.8

chrome beacon
#

They've just copy pasted code from somewhere and want you to spoonfeed them until it's in a working state

bronze crystal
young knoll
#

You want numeric item ids

#

Smells very 1.8

bronze crystal
#

no I am in 1.20

remote swallow
#

they dont have ids now

young knoll
#

What do you need the id for

bronze crystal
young knoll
#

They were basically removed 7 versions ago

bronze crystal
#

oh

#

So what do I use instead?

#

for example in a config were the user should add some items

young knoll
#

Use the material name

#

Or the items namespaced key

#

ie stone or minecraft:stone

bronze crystal
#

ok ty

young knoll
#

Combined with Material.matchMaterial

bronze crystal
#

does anyone know a list with all material names? like "RED_WOOL", ..

thin iris
#

is it possible to make a npc strafe / have player like fighting movement

young knoll
undone axleBOT
bronze crystal
#

oh I see

#

ty again

young knoll
#

Ignore the stuff with the legacy prefix

opaque scarab
#

Is org.bukkit.block instantiated when a chunk is loaded, or when a block is accessed such as world#getBlockAt() ?

young knoll
#

Good question

#

Hold on

#

When accessed

opaque scarab
opaque scarab
# young knoll When accessed

So if I did something like ```
HashMap<Block, Class> hashmap = new HashMap<>();
Hashmap.put(world.getBlockAt(loc), var)

then
```Class var = hashmap.get(world.getBlockAt(sameLoc))```
It would return null?
young knoll
#

Wut

#

Do you have any reason to use block as a key

#

You can just use the location

#

Or even convert that further into a vector, but you’ll lose the world

glass wharf
#

Would anyone who is better at understanding technical conversation help me with this thread?
https://www.spigotmc.org/threads/create-fake-player-1-20-2.621480/

I'm having the same issue discribed where I cant use the ClientboundPlayerInfoUpdatePacket to add my fake player because the entry uses the method player.connection.getLatency()
and since a fake player does not have a connection, it errors

They talk about a fix here, but I dont quite understand

young knoll
#

Looks like one option is using reflection to set the connection

glass wharf
#

I got it! I feel like I cheated slightly xD

#

I set the npc connection to the players connection it was being shown to

#

appears to have worked

young knoll
#

Another option appears to be using a different constructor for the packet

opaque scarab
# young knoll You can just use the location

Isn’t the location instantiated when accessed as well? I need to access a value tied to a block in a hashmap, but I need to put the value and key (block / location / whatever) in when the chunk is loaded, and access it any time. (I can’t use a persistent data container in a block for my application)

young knoll
#

Yes but the block contains more data

#

I also don’t know if it has a proper hashcode impl

sterile token
#

I cant imagine that this code would be breaking whole legacy colors*. So far i think why didnt they use regex?

public static String translateAlternateColorCodes(char altColorChar, String textToTranslate) {
        char[] b = textToTranslate.toCharArray();

        for(int i = 0; i < b.length - 1; ++i) {
            if (b[i] == altColorChar && "0123456789AaBbCcDdEeFfKkLlMmNnOoRr".indexOf(b[i + 1]) > -1) {
                b[i] = 167;
                b[i + 1] = Character.toLowerCase(b[i + 1]);
            }
        }

        return new String(b);
    }```
blazing flare
#

If I want to remove a specific amount of items from a players inventory (eg: 128 cobblestone, 32 oak logs) what's the best approach? This information is stored in a map, given that 128 exceeds the max stack size for cobblestone.

young knoll
#

I would use removeItem and just pass all the stacks

blazing flare
#

Didn't realise I can pass multiple itemstacks to that method. I assume I'd have to turn 128 cobblestone into two itemstacks of 64 and pass them both in?

young knoll
#

I think you might just be able to pass a stack of 128 cobble

noble lynx
#

anyone have proguard rules for plugins

trim lake
#

Can I remove block with packets? Cannot find a way to do. Or just get rid of MC animation at the end of my edited animation true packets.

young knoll
#

Why remove it with packets

#

Just remove it remove it

trim lake
#

just remove block? or just wdym idk

#

I need that to call block break event as well so... if the block is in region or just something

#

I mean is all good, but the animation at the end is not looking good xD

grand flint
trim lake
trim lake
grand flint
#

🤷‍♂️

trim lake
river oracle
#

what are you trying to do

#

regenerating blocks or something?

hybrid spoke
trim lake
#

nah, just created custom block breaking system and need to break that blokck xD

trim lake
hybrid spoke
#

easiest you can go

trim lake
#

probably ye, but can I somehow change fake recive packet? Just then I can send PlayerDigType.

hybrid spoke
#

no idea what you mean

young knoll
#

If you want the event to be called

#

Player.breakBlock

trim lake
trim lake
#

that should break block and call event right?

rotund ravine
#

It’s not really that hard

trim lake
#

idk how with protocol lib

noble lynx
rotund ravine
#

Why tho?

trim lake
#

if I tired break fire or just something what is one click it will broke my code because break time is 0

noble lynx
rotund ravine
rotund ravine
trim lake
rotund ravine
noble lynx
rotund ravine
#

You literally asked about obfuscation rules

noble lynx
#

nbo

#

i asked for proguard rules

#

like this if anyone has a setup for spiogt plugins

#

its like a set of guidelines for the obuscator to know what to obuscate and stuff

rotund ravine
#

Just google it surely someone has posted it i guess.

trim lake
rotund ravine
#

Ah

trim lake
#

gonna googleit xD

mighty mason
#

Hey, quick question, Java related. Two different instances of a class should have different hashcodes, right?

young knoll
#

Only if the contents are different

mighty mason
#

Im having a weird problem, im not the best at java but, there it goes.

Im creating a new instance of a Custom class that i have via command

if(strings.length == 1){
            ZooFeeAnimal animal = ZooFeeAvailableEntityTypes.valueOf(strings[0]).label;
            animal.Spawn(p.getLocation());
            animal.setSex(sex);
        }

This is the ZooFeeAvailableEntityTypes

public enum ZooFeeAvailableEntityTypes {
    COW(new ZooCow(ZooAges.Baby, ZooSex.Male)),
    GOAT(new ZooGoat(ZooAges.Baby, ZooSex.Male)),
    BUNNY(new ZooBunny(ZooAges.Baby, ZooSex.Male)),
    AXOLOTL(new ZooAxolotl(ZooAges.Baby, ZooSex.Male)),
    PIG(new ZooPig(ZooAges.Baby, ZooSex.Male));

    public final ZooFeeAnimal label;

    ZooFeeAvailableEntityTypes(ZooFeeAnimal label) {
        this.label = label;
    }
}```

Right after spawn im adding the instance of that class to a static List in the main plugin class. Like this
```java
ZooFee.AllAnimals.add(this);

After that im runnin a scheduler on the Main class of the plugin to check the Growt possibilities for each one

public void TryGrow(){
        for (ZooFeeAnimal a : AllAnimals){
            a.checkOnGrowth();
        }
    }

Thing is, every single type of animal is getting the same Age even i spawn a new one

#

Sorry for the long question

#

Notes: Every animal has different entities and every entity is insine the ZooFeeAnimal as a referece. Every class from the same animal in AllAnimals share the same hashcode (I dont know why)

#

Data should not be the same, because i have a reference of the new Entity inside the ZooFeeAnimal class

young knoll
#

Did you override the hashcode method

mighty mason
#

Nope

young knoll
#

Well either way that doesn’t matter

#

List doesn’t rely on hashcode

mighty mason
#

Thats the weird thing

#

After i spawn a new cow it spawns with the same age as the first cow

#

But if you check the ZooFeeAvailableEntityTypes im always creating a new instance

young knoll
#

I don’t see you always creating a new instance

mighty mason
#

COW(new ZooCow(ZooAges.Baby, ZooSex.Male))

young knoll
#

Yes

#

That makes the cow constant have a single instance

mighty mason
#

So, im not creating a new cow instance?

#

ZooCow*

#

Sorry, im not too experienced on Java

young knoll
#

You are

#

But just the one

#

And every time you reference that enum constant you get the same instance

mighty mason
#

I see

#

so the problem is the enum?

#

Maybe not the best way to get a new instance of a class

#

But i dont really want to check for each class when i use the command

young knoll
#

You can use a supplier/function

#

In your case looks like you want a BiFunction

#

Takes 2 arguments and returns a type

echo basalt
#

I'd just make a supplier

young knoll
#

Oh yeah the arguments are constant

#

So a supplier is fine

mighty mason
#

So i just change the COW(new ZooCow(ZooAges.Baby, ZooSex.Male)) for a Suppliert?

#

Supplier*

young knoll
#

Yes

mighty mason
#

COW(ZooCow::new) this gives me a "Cannot resolve constructor"

young knoll
#

That looks for a constructor with no args

#

Try COW(() -> new ZooCow(args))

mighty mason
#

Just what i did

#

Thank you very much @young knoll

ornate patio
#

anyone have suggestions for a clean way to support sqlite and mysql

#

without having to do stuff like this

#
if (Config.MYSQL.ENABLED) {
    createPlayersTableQuery = """
        CREATE TABLE IF NOT EXISTS `Players` (
            `uuid` BINARY(16) PRIMARY KEY,
            `mmoClass` INTEGER,
            `secondaryMmoClass` INTEGER,
            `statPoints` INTEGER NOT NULL DEFAULT 0
    """ + statFieldString + ");";
}
else {
    createPlayersTableQuery = """
        CREATE TABLE IF NOT EXISTS "Players" (
            "uuid"    TEXT,
            "mmoClass" INTEGER,
            "secondaryMmoClass" INTEGER,
            "statPoints" INTEGER NOT NULL DEFAULT 0
    """ + statFieldString.replace("`", "\"") + ", PRIMARY KEY(\"uuid\"));";
young knoll
#

Make an interface with all the methods you need

#

Then a class for MySQL and one for SQLite

#

That implement it

ornate patio
#

good idea

#

thanks

buoyant viper
#

?jd-s for me

undone axleBOT
dusky crane
#

Which part of Bukkit/Spigot checks for the Java version?

#

I'm trying to disable spigot's Java version check so I can use Java 21 on spigot 1.16.5.

wraith dragon
#

Anyone with experience with world edit? Im looking for a way to get all the blocks in a schematic then after that send block change packets according to the blocks

upper hazel
#

who has a list of exceptions that are usually set when checking whether a file is saved? Don't want to use a generic exeption

lost matrix
upper hazel
lost matrix
upper hazel
#

FileNotFoundException

#

SecurityException

#

IllegalArgumentException

#

nsupportedOperationException

#

DirectoryNotEmptyException

#

ileAlreadyExistsException

#

AccessDeniedException

#

FileLockInterruptionException

#

FileSystemException

lost matrix
#

So most of them are just covered by IOException

#

Just go for IOException

upper hazel
lost matrix
#

Here is everything thats covered

upper hazel
#

oh cool

lost matrix
#

Just use IOException for IO

upper hazel
#

what should I use to display the error?

#

RuntimeExeption?

lost matrix
#

Depends if you need it to fail the current stack or not.
If its a critical exception then you can forward it to a RuntimeException.
You could also just print the stack trace of the IOException and properly handle it...

pulsar zodiac
#

Hi I have a question about Command Block target selectors.
How would I use the Bukkit API to implement selectors, especially @p, myself? Like, which API is useful for it.
I read on: https://hub.spigotmc.org/jira/si/jira.issueviews:issue-html/SPIGOT-4295/SPIGOT-4295.html
that md_5 said "Again, @p can easily be done by plugins. Bukkit already provides API specifically for this purpose"

I am aware of the CommandHook plugin, but currently it does not yet work for 1.20.2, so I was wondering how to not be dependent on it.
Thank you in advance for the help! 😊
What API should I use?

orchid gazelle
#

Is it more efficient to trigger redstone signals of blocks via plugin loop or redstone loop?
Like for example, switching the redstone lamp on/off every second

lost matrix
glad prawn
#

then use java 11

eternal night
#

0 reason to use java 11 KEKW

glad prawn
#

🤣

eternal night
#

if you want to support dead versions, go with java 8

quiet ice
#

OpenJ9 is a strange move

lost matrix
dusky crane
#

How can I run build tools without redownloading everything?

#

I could try pasting the new main before it finishes.

remote swallow
#

Theres a wiki and a flag for it

dusky crane
#

Question: Which Main do I have to modify to make BuildTools compile it with that Main?

quiet ice
#

Wasn't -DIknowWhatIAmDoingISwear for that?

young knoll
#

Nah that bypasses the spigot version check

#

Not java

quiet ice
#

Ah okay

dusky crane
quiet ice
#

Figured as much

dusky crane
#

Why does this exist?

if (false && Main.class.getPackage().getImplementationVendor() != null && System.getProperty("IReallyKnowWhatIAmDoingISwear") == null) {
                    Date buildDate = new Date(Integer.parseInt(Main.class.getPackage().getImplementationVendor()) * 1000L);

                    Calendar deadline = Calendar.getInstance();
                    deadline.add(Calendar.DAY_OF_YEAR, -28);
                    if (buildDate.before(deadline.getTime())) {
                        System.err.println("*** Error, this build is outdated ***");
                        System.err.println("*** Please download a new build as per instructions from https://www.spigotmc.org/go/outdated-spigot ***");
                        System.err.println("*** Server will start in 20 seconds ***");
                        Thread.sleep(TimeUnit.SECONDS.toMillis(20));
                    }
                }```
chrome beacon
#

So get users to update

#

because they won't otherwise

young knoll
#

^

quiet ice
#

Because it is an EOL version?

young knoll
#

Then it’s being bypassed

#

Yeah that’s how Md disables the outdated delay for the final release for a given version

dusky crane
#

How can I compile spigot from IntelliJ?

quiet ice
#

Java is not C !!!!111!!11elf!!!!elf!!!11

dusky crane
#

I've done it.

young knoll
#

I actually have no idea how to compile spigot without buildtools

#

Kek

dusky crane
quiet ice
#

mvn package something

dusky crane
#

Step 2: cd into spigot

#

Step 3: mvn package?

#

or cd into Spigot-Server?

lost matrix
#

I would have cloned the repos from the stash...

quiet ice
#

If there is a pom there is a mvn package

dusky crane
#

true.

#

I've managed to get Java21 to work with Spigot 1.16.5.

young knoll
#

I’d just run buildtools with the flag to not pull from remote

dusky crane
young knoll
#

It’s on the wiki

small iron
#

I want to ask,

How are they doing on programs like New Plugin Updates Available?

<resource link>```
young knoll
#

There’s a simple api for it

dusky crane
#

A simple API, 1 endpoint, 1 String

#

1 HttpRequest.

young knoll
#

Or you can use a lib that makes it even more simple

#

:p

dusky crane
#

is a the stat Avg tick dispalyed in the gui with a value of 0.000ms good?

small iron
terse pumice
#

Coll did you get anywhere with the ItemFrameMeta ?

young knoll
#

Yes and no

#

I have it basically working but it requires the virtual entity PR to be merged first

#

Which will probably be a little while

terse pumice
#

Ooh ok, I'll keep an eye out

drowsy cosmos
#

I've a sword that can summon a lightning strike on a target entity upon hitting. That part is working. However, the lightning damages both the target entity as well as the wielder. How do I make the wielder immune to the lightning zap?

sick edge
#

Hi the spigot non api 1.20.2 with mojang mappings isn't released yet correct?

young knoll
#

It is

chrome beacon
#

It's released

young knoll
#

shh

#

Yes it is released

#

In fact it releases with spigot, it doesn't require any extra work

sick edge
#

I previously had 1.19.4 version and just changed it to 1.20.2 but am now geting could not find artifact is it not in the spigotmc-repo anymore?

chrome beacon
#

It never has been

#

It's put in your local maven repo by BuildTools

young knoll
#

^ run buildtools with --remapped

sick edge
#

Hm I did execute the buildtools but forgot the remapped thx 😄

#

And one more question: Is there any good plugin like md5 special source for gradle? And how would I load the build tools stuff into my local gradle repo? Manually?

young knoll
#

There is paperweight

#

But that gives you the paper api

eternal night
young knoll
#

There are a few of those

#

But they all recommend userdev

eternal oxide
#

I only recomend to use Maven as its what spigot supports.

sick edge
#

Ok thx guys

ornate patio
#

Hello how can I just remove this line objective.getScore("§700:30:00").setScore(6); from the scoreboard without removing the others ?

sick edge
#

If I'm using a paper server do I also have to use paper in my NMS Plugin? In the past it has worked with my plugin using spigot but after remapping and using the remapped-obf jar in my plugins folder I get errors were classes are not found (ap class)

#

I went from 1.19.4 to 1.20.2

eternal oxide
#

you don;t use the remapped-obf jar

#

you use the one with no addon

sick edge
#

Ah ok so the remapped-obj is with mojang mappings? I have 4 jars: One normal, one with -remapped, one with -remapped-obf and one with original- (From shadow plugin I guess)

So the one without anything is the one to use?

eternal oxide
#

yes

sick edge
#

Ok thx

eternal night
#

Would still highly recommend using papers internals if you are running paper

#

while paper maintains API compatibility with spigot, it certainly does not maintain that compatibility in its internals

young knoll
#

Yeah I have to change my ASM for paper

#

smh my head

upper hazel
#

Does anyone know if the Singleton pattern is needed in single-threaded environments?

#

i mean i can just load intsance in load class for exemple

#

but sonar list dont think so

worldly ingot
#

Needed? No

upper hazel
#

then what problem does it solve?

#

The only place where this is useful, as for me, is where the developer constantly forgets to register instance

#

but this registration is needed 1 time

#

well, and probably in a multi-threaded environment

worldly ingot
#

Singletons just enforce that there's only ever one instance of an object. In some situations that's just useful

upper hazel
#

but not in plguin minecraft ✅

upper hazel
#

ahh this for this

#

but will there be bugs when creating a new instance

worldly ingot
#

For JavaPlugin instances? You'll get an exception because the classloader prevents you from even doing it

#

In my case in VeinMiner, no, you can create new instances of it. It just makes no sense to do so

upper hazel
#

Well, that means there is no point in protection

worldly ingot
#

It depends on what all happens in the constructor of some object. Maybe there are side effects of doing it. Maybe there aren't. Though so long as you're designing your code's access modifiers correctly then you shouldn't be concerned

#

Yes, somebody can reflectively create new instances of it but at that point that's a them problem

#

They're doing something stupid so let 'em shoot themselves in the foot lol

upper hazel
#

yeaa

clear panther
#

?tryandsee

undone axleBOT
upper hazel
#

such things are probably needed for insurance in some bank program

inner mulch
#

?paste

undone axleBOT
inner mulch
chrome beacon
#

you need to set it back

#

also

#

?conventions

inner mulch
chrome beacon
#

getKiller will always be a player

chrome beacon
inner mulch
#

what do i need to do ?

#

how can i define the itemmeta

#

differently

chrome beacon
#

set the item meta after editing it

inner mulch
#

okay

#

thank you

zenith gate
#

when setting attack speed, what is slow and what would be fast? I thought it was in secondeds so like a 11.3 attack speed would take 11.3 seconds but that don't seem to be the case, everything is just fast.

thin iris
#

is it possible to make an armor stand text only visible to a certain player

drifting viper
blazing ocean
#

is there a way to download a world zip and then spin it up on a new temporary world (can get deleted after usage)?

#

i know how to download one, do you just do the basic file operations to use it?
e.g.

  • download
  • make new world dir
  • copy to world dir
  • use
  • remove world dir when unloaded
dusky crane
thin iris
#

do i need to add a # in chatcolor.of

upper hazel
#

is there a point to this? public static final Logger LOGGER = Bukkit.getLogger(); for use in another classes or i can use just bukkit.getLogger

lost matrix
# thin iris is it possible to make an armor stand text only visible to a certain player

Yes, but you need to use packets for that.
When an entity is spawned, every player receives a spawn and a metadata packet for the spawned entity.
If you now construct those packets and only send it to a single player, then only his client will know of this entity.
This is often referred to as a "fake" entity because not even the server is aware of it, meaning it wont get ticked,
doesnt draw any resources but is also not functional at all.

lost matrix
upper hazel
#

how do this

#

create?

lost matrix
river oracle
thin iris
#

im trying to make ai npc's and need some time before the http request is done and i want to have like a loading screen above the npc's head

lost matrix
blazing ocean
thin iris
dusky crane
dusky crane
#

Bukkit.loadWorld() might help?

lost matrix
#

But the general approach is ok. The main problem is that spigots world management system sucks
and does IO on the main thread, causing unpreventable lag when loading worlds

dusky crane
#

The system sucks, especially pre 1.17-1.18.

#

I don't know why my plugin can only make worlds only from onEnable.

river oracle
dusky crane
#

What Thread does Bukkit.createWorld need to be run in?

river oracle
#

main thread

river oracle
#

if you want to make worlds asynchronously you'd need to make your own world generator

dusky crane
#

I don't care about the freeze.

dusky crane
#
@Override
    public ChunkGenerator.ChunkData generateChunkData(World world, Random random, int chunkX, int chunkZ, BiomeGrid biome) {
        ChunkData chunkData = createChunkData(world);
        world.setBiome(16 * chunkX,64,16 * chunkZ, Biome.BIRCH_FOREST);
        world.setSpawnLocation(new Location(world,32,64,32));
        for (int x = 0; x < 16; x++) {
            for (int z = 0; z < 16; z++) {
                chunkData.setBlock(x+chunkX*16,0,z+chunkZ*16,Material.BEDROCK);
                for (int y = 0; y <= 64; y++) {

                    if (y > 0 && y < 7){
                        chunkData.setBlock(x,y,z,Material.LAVA);
                    }
                    if (y > 3 && y < 35) {
                        if (random.nextDouble() < 0.2) {
                            int i = random.nextInt(10);
                            if (i == 0){
                            chunkData.setBlock(x, y, z, Material.DIAMOND_ORE);
                            } else if (i < 6) {
                                chunkData.setBlock(x, y, z, Material.IRON_ORE);
                            } else if (i > 6 && i < 9) {
                                chunkData.setBlock(x, y, z, Material.GOLD_ORE);

                            }else {
                                chunkData.setBlock(x, y, z, Material.LAPIS_ORE);

                            }

                        }
                    }
                    if(y > 35 && y < 60){
                        chunkData.setRegion(0, y,0,15, y, 15, Material.STONE);
                    } else {
                        chunkData.setRegion(0, y, 0, 15, y, 15, Material.DIRT);
                    }
                    }
                }
            }
        Bukkit.getLogger().info("Generation complete");
        return chunkData;
    }

    @Override
    public boolean isParallelCapable() {
        return true;
    }```
river oracle
#

you'd need to provide error

dusky crane
#

I forgot how to run stuff on the main thread.

chilly hearth
#

bruh

dusky crane
#

I remember my server just timing out and never responding.

river oracle
eternal oxide
#

you are probably downloading the world sync

dusky crane
#

This is how I used to make it: Bukkit.getScheduler().runTask(this, () -> Bukkit.createWorld(new WorldCreator("arena-" + worldCount).generator(new CustomChunkGenerator())).getWorldBorder().setSize(1000));

dusky crane
#

Or in a virtual thread?

thin iris
#

how do i make comments in config

dusky crane
#

Maybe use #. I'm not sure.

worldly ingot
#

It's YAML syntax, so yes, # for comments

thin iris
#

like this? config.addDefault("# Do not touch if you don't understand this", "");

dusky crane
#

This seems to freeze my server.```java
public static synchronized void createArenaWorld(){
Bukkit.getScheduler().runTask(Main.instance, () -> Bukkit.createWorld(new WorldCreator("arena-" + worldCount).generator(new CustomChunkGenerator())).getWorldBorder().setSize(1000));
updateCounter();
Bukkit.getLogger().info("Start of generation");
try {
Bukkit.createWorld(new WorldCreator("arena-" + worldCount).generator(new CustomChunkGenerator()));
}catch (Exception e){
Bukkit.getLogger().severe(e.getMessage());
}
Bukkit.getLogger().info("Generating world");

}```
eternal oxide
#

your CustomChunkGenerator is probably calling itself

young knoll
#

Or is trying to access chunks outside the worldgen region

shadow night
#

Not related to the issue but I thought naming the main class Main was against conventions

worldly ingot
#

The only situation where you should name your class Main is if it has the main method

shadow night
#

And also not related to the issue but I also thought we use the JavaPlugin logger and not the Bukkit logger

worldly ingot
#

Correct

blazing ocean
#

FileUtil#delete doesn't exist, so can I just use the commonio way?

import org.apache.commons.io.FileUtils;

FileUtils.deleteDirectory(new File("foo"));
#

wait that package doesnt exist anymore

#

i got it

hazy parrot
blazing ocean
#

oh lol

worldly ingot
#

I think Files also has a method for it if you have a Path object

lost matrix
#

Only works with files and empty directories. Non-empty directories need to be recursively deleted.

blazing ocean
#

yeah its a recursive dir

worldly ingot
#

Then File#delete() should be fine then lol

#

Ugh. Stupid Files making you do more work

blazing ocean
#

doesn't this do the job?

void delete(File file) {
  if(file.isDirectory()) {
    File[] files = file.listFiles();
    if(files == null) return;
    for(File child : files) {
      delete(child)
    }
  }
  file.delete();
}```
lost matrix
#

sure

subtle folio
#

all fun and games until file is another dir

hazy parrot
subtle folio
#

oops

#

i didnt see that

icy beacon
#

😄

dusky crane
dusky crane
# eternal oxide your CustomChunkGenerator is probably calling itself

Which part of this is calling itself? I think that might be the issue.

@Override
    public ChunkGenerator.ChunkData generateChunkData(World world, Random random, int chunkX, int chunkZ, BiomeGrid biome) {
        ChunkData chunkData = createChunkData(world);
        world.setBiome(16 * chunkX,64,16 * chunkZ, Biome.BIRCH_FOREST);
        for (int x = 0; x < 16; x++) {
            for (int z = 0; z < 16; z++) {
                chunkData.setBlock(x+chunkX*16,0,z+chunkZ*16,Material.BEDROCK);
                for (int y = 0; y <= 64; y++) {

                    if (y > 0 && y < 7){
                        chunkData.setBlock(x,y,z,Material.LAVA);
                    }
                    if (y > 3 && y < 35) {
                        if (random.nextDouble() < 0.2) {
                            int i = random.nextInt(10);
                            if (i == 0){
                            chunkData.setBlock(x, y, z, Material.DIAMOND_ORE);
                            } else if (i < 6) {
                                chunkData.setBlock(x, y, z, Material.IRON_ORE);
                            } else if (i > 6 && i < 9) {
                                chunkData.setBlock(x, y, z, Material.GOLD_ORE);

                            }else {
                                chunkData.setBlock(x, y, z, Material.LAPIS_ORE);

                            }

                        }
                    }
                    if(y > 35 && y < 60){
                        chunkData.setRegion(0, y,0,15, y, 15, Material.STONE);
                    } else {
                        chunkData.setRegion(0, y, 0, 15, y, 15, Material.DIRT);
                    }
                    }
                }
            }
        Bukkit.getLogger().info("Generation complete");
        return chunkData;
    }```
young knoll
#

What version is this

dusky crane
#

Running on Java 21.

young knoll
#

Ah

#

That's the old worldgen api, no idea how that works

#

Or if it really works tbh

chilly hearth
#

actially

young knoll
#

Does chunkData not have a setBiome in that version

dusky crane
dusky crane
young knoll
#

interesting

dusky crane
#

I don't think the API changed until 1.17

worldly ingot
#

You should be using BiomeGrid#setBiome()

lethal coral
#

how can I detect when a display entity is clicked? For my use-case I thought about using an invisible ravager or slime (somthing with a bigger hitbox), but if there's a better way I'd like to use that

young knoll
#

You can use an interaction entity as a passenger

#

Or you can raytrace

quaint mantle
#

hi guys i played in mcci
and i wonder this
my hud like this in lobby
but my health and hunger bar are visible in the game

worldly ingot
#

This makes use of action bars, custom textures, and negative font widths

quaint mantle
#

they do this using shaders, but how exactly?

quaint mantle
#

i wonder they hide vanilla healthbar and food bar

#

but in game they not

worldly ingot
#

They don't need it in the lobby. They probably have different resource packs for each game mode, the ones in the modes that require health bars not removing them

river oracle
quaint mantle
#

i downloaded they texturepack with jdgui

#

and check icons.png

#

they didnt removed healthbar and foodbar

#

and i search something

#

they doing this with shaders

young knoll
#

Maybe they hide it with shaders

quaint mantle
#

but how shaders have this settings ?

young knoll
#

Hiding them isn't hard

quaint mantle
#

and can i do this in 1.16.5 ?

young knoll
#

Toggling it is a bit different

#

Nope

#

Core shaders are 1.17+

zealous osprey
#

Toggling could be done with checking the particle layer for a certain color and toggling it based on that.

worldly ingot
#

Shaders can do pretty much anything. They let you shift around vertices with a vertex shader so they can just shift the bars to the left or right, well off the player's screen

young knoll
#

I think you can also just change the color to have 0 alpha

#

Or something

eternal oxide
#

yes

worldly ingot
#

Depends on whether or not you want to write a vertex or a fragment shader 😛

river oracle
#

I didn't know servers could use shaders

quaint mantle
#

but to activate (i mean health bars) this in the game, do i need to renew the resource pack every time I log in to the game?

young knoll
#

It's a resource pack feature

river oracle
young knoll
#

Well core shaders aren't quite the same as those shaders

#

I don't think you'll get any SEUS ray tracing with core shaders

#

But you can do some cool stuff

quaint mantle
#

btw i think this
can i do custom health and food bar with actionbar feature ?
i will make health anims and more 😄
and i will remove healthbar from icons.png

worldly ingot
#

"Shader" is kind of a shitty term for OpenGL's shader pipeline ngl

young knoll
#

Yeah you could do a health bar on the action bar

worldly ingot
#

They're more accurately called "shader programs". They don't necessarily have to add things like shade to a tree

quaint mantle
#

if someone installs another source pack etc.

zealous osprey
#

maybe a bit off topic, but have any of you ever tried integrating some GPU computing code with Java. So something like Cuda for Nividia?

lost matrix
zealous osprey
#

Maybe, gotta check before I try something... questionable ¯_(ツ)_/¯

lost matrix
#

Or if you are fine with OpenCL then you can use what minecraft uses, lwjgl

zealous osprey
#

I just want too compute something using a graphics card, preferably not needing to create like 2 images too transfer data, instead using the PCIE IO port directly.

lost matrix
zealous osprey
#

That's what I originally planned; But then I'd need to make sure that I only run the binary once and then just keep feeding it data instead of booting up new binaries every time I want to calculate something

quaint mantle
golden turret
#

so... I made a lot of commits and then I realized that I forgot to change the git data before running BuildTools

#

how can I fix it and use my name?

remote swallow
#

chat ur git settings

golden turret
#

I also want to preserve the commit dates

golden turret
remote swallow
#

their in .gitconfig in ur userhome

golden turret
#

after I realized everything was in the name of BuildTools I ran the git config to update my name and email

golden turret
#

I believe it was using the ones from BuildTools before

remote swallow
#

yeah if it isnt set it swaps to buildtools

#

it should work if you change the config, you will need to commit new stuff for it to change

golden turret
#

but how I update the name and email of old commits?

remote swallow
#

idk if you can or how, @worldly ingot might

worldly ingot
#

I don't think you can, at least not as far as my git knowledge is aware

warped furnace
#

Hi, I want to create a virtual book that can be edited from the config and when it exceeds the number of characters it moves to other pages, how can I do it, I tried it myself but it didn't work

eternal night
wet breach
void harbor
#

Hello can anybody help with the Buildtools?

#

Everytime if i try to get the git of 1.10.2 this error upcoming

#
fatal: 'C:/Users/nikie/downloads/Bukkit' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
HEAD is now at c5bf6bc6 SPIGOT-249: Set skull owner by UUID
Resetting Spigot-API to Bukkit...
HEAD is now at c5bf6bc6 SPIGOT-249: Set skull owner by UUID
  Applying patches to Spigot-API...
Applying: POM Changes
Using index info to reconstruct a base tree...
M    pom.xml
Falling back to patching base and 3-way merge...
Auto-merging pom.xml
CONFLICT (content): Merge conflict in pom.xml
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patchPatch failed at 0001 POM Changes

When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
  Something did not apply cleanly to Spigot-API.
  Please review above details and finish the apply then
  save the changes with rebuildPatches.sh
Error compiling Spigot. Please check the wiki for FAQs.
If this does not resolve your issue then please pastebin the entire BuildTools.log.txt file when seeking support.
java.lang.RuntimeException: Error running command, return status !=0: [C:\Program Files\Git\usr\bin\bash.exe, applyPatches.sh]
    at org.spigotmc.builder.Builder.runProcess0(Builder.java:1062)
    at org.spigotmc.builder.Builder.runProcess(Builder.java:993)
    at org.spigotmc.builder.Builder.main(Builder.java:738)
    at org.spigotmc.builder.Bootstrap.main(Bootstrap.java:27)```
kind hatch
void harbor
#

no i have all versions compiled but only 1.10.2 will not work. I will try in another directory

kind hatch
#

It compiled just fine for me. :p

void harbor
#

how u open like this?xD i use gitbash xD

young knoll
#

Shadow always flexin that gui

#

Smh

kind hatch
#

I can't help it. lol

#

Although I'll say it time and time again, regular old BuildTools should be run in a new directory every time. Yes it means more downloading, but it will remove 90% of issues.

young knoll
#

Yeah but I don’t have all day smh

void harbor
quiet ice
karmic grove
#

im trying to get this title using event.getInventory().getType().getDefaultTitle() but that is "Chest" so how do i get normal name

kind hatch
#

InventoryView#getTitle()

young knoll
#

Uuid in a title seems… questionable

karmic grove
young knoll
#

What event

karmic grove
#

InventoryClickEvent

young knoll
#

Event#getView

karmic grove
#

oh

#

lol thanks

mighty mason
#

Question: Using the setPersistent to an Entity makes in unspawneable even after reload or chunk unloading?

#
By default all entities are persistent. An entity will also not get persisted, if it is riding an entity that is not persistent.

The persistent flag on players controls whether or not to save their playerdata file when they quit. If a player is directly or indirectly riding a non-persistent entity, the vehicle at the root and all its passengers won't get persisted.```

This is the Javadocs info. But it isnt too specific
young knoll
#

It stops them from being saved to the server files

mighty mason
#

But not from despawning on reload or chunk unload, right?

#

This suits better what im trying to archive?

void setRemoveWhenFarAway(boolean remove)
Sets whether or not the living entity despawns when away from players or not.
young knoll
#

Yes

#

Probably

karmic grove
#

Bukkit.createInventory what is the owner what does it do?

mighty mason
#

Off bukkit question: Does it really matters the complexity shown by CodeMetrics?

#
    public void CreateStats(){

        if(this.Holder instanceof ZooFeeAnimalMilkable && this.Holder.Sex.equals(ZooSex.Female)){
            ZooFeeAnimalMilkable animal = (ZooFeeAnimalMilkable) this.Holder;
            ItemStack MilkQuality = ItemManager.BuildItem("&r&f&lMilk Quality: &r&6&l" + animal.MilkQuality.label,
                    Material.MILK_BUCKET,
                    1,
                    new ArrayList<>(
                            Arrays.asList(
                                    ChatUtils.setColorName("&r"),
                                    ChatUtils.setColorName("&r&f&lNext Quality: &r&6&lVery good"))
                    ),
                    true);

            this.Menu.setItem(13, MilkQuality);
        }
        // Age
        ItemStack Age = ItemManager.BuildItem("&r&f&lAge: &r&6&l" + this.Holder.Age.label,
                Material.CLOCK,
                1,
                new ArrayList<>(
                        Arrays.asList(
                                ChatUtils.setColorName("&r"),
                                ChatUtils.setColorName("&r&f&lTime left: &r&l" + "45~ days"))
                ),
                true);


        // Sex
        Material Sex = this.Holder.Sex.equals(ZooSex.Male) ? Material.STICK : Material.DRIED_KELP;
        String SexString = this.Holder.Sex.equals(ZooSex.Male) ? "&9&lMale ♂" : "&d&lFemale ♀";
        ItemStack SexItem = ItemManager.BuildItem("&r&f&lSex: " + SexString, Sex, 1, null, null);


        // Ride Animal
        ItemStack Ride = ItemManager.BuildItem("&r&6&lRide",
                Material.SADDLE,
                1,
                new ArrayList<>(
                        Arrays.asList(
                                ChatUtils.setColorName("&r"),
                                ChatUtils.setColorName("&r&f&l&oWujuuuuuuuuuuu!"))
                ), true);

        this.Menu.setItem(19, Age);
        this.Menu.setItem(22, Ride);
        this.Menu.setItem(25, SexItem);


    }
#

It says this code has a complexity of 10, but, is it that complex?

fossil lily
#

java.lang.RuntimeException: Error running command, return status !=0: [C:\WINDOWS\system32\cmd.exe, /D, /C, C:\Users\Loudbook\Downloads\BuildTools\apache-maven-3.6.0/bin/mvn.cmd, -Dbt.name=3871, javadoc:jar]

"C:\Program Files\Eclipse Adoptium\jdk-20.0.2.9-hotspot\bin\java.exe" -jar BuildTools.jar --rev latest --generate-docs

Getting this error when running build tools. Any ideas?

#

Running on windows. FAQ mentions Linux.

slender elbow
fossil lily
#

whelp

kind hatch
fossil lily
#

Ran in a new directory :)

slender elbow
#

the problem is that javadoc.io is down and the javadoc goal fails because of it as it can't link them

fossil lily
#

Ended up downloading Javadocs of the maven repo online

kind hatch
#

Javadoc generation needs to make web requests?

slender elbow
#

to link, yes

#

you can pass offline links to the tool but i don't remember how you do that

kind hatch
#

Sounds like something that should be PR'd to BuildTools.

quaint mantle
kind hatch
slender elbow
#

--generate-docs go brrrr

mighty mason
#

But anyways i have to make strings and then add them to a list, thats more boilerplate code there

fervent robin
#

Are there any good packet apis that I can just shade in my plugin so the user doesnt need a plugin on the server?

young knoll
#

Only one I know of is PacketEvents

quaint mantle
#

can someone help me with one line on my elevators skript?

opal carbon
#

please dont shade nms into your plugin

deep herald
#

anyone know how to register a command using extends Command?

opal carbon
#

oh okay

deep herald
opal carbon
#

you get command map

#

with reflection

#

then add it in

#

commandmap is on javadocs so read those for that

deep herald
#

well i wasnt expecting to make a whole cmd api

#

i just wanted to make it so there is no core: infront of it

young knoll
#

I mean, you can disable that in the server settings

#

Or with an event

deep herald
#

eh

deep herald
#

i didnt want the commented out parts

echo basalt
#

could be better made

mighty mason
# echo basalt A bit

Im not the best at Java, but, can you give me some direction to make that code better

magic glacier
#

Ambiguous plugin name, what could genrate this thing? ,searched in Google and nothing helped

mighty mason
#

Not asking for code tho

echo basalt
#

Hmm in the context of GUIs it's weird

#

It's not super easy to do this without like a proper gui framework

#

I'm not a fan of the idea of seeing this hardcoded

mighty mason
#

You think i maybe should use Foundation as a GUI Manager?

tall dragon
magic glacier
tall dragon
mighty mason
#

"As a GUI Manager", not saying its just that

#

But, looking at it, it looks pretty good. Paginate, Menus, Different kind of menus

tall dragon
#

i mean its preference. ive used it for a while i personally dont like how they handle menus

mighty mason
#

Or which one do u recomend?

#

recommend*

echo basalt
#

the one that's caused me the least trouble is def TriumphGUI

#

But they all have their own little quirks

tall dragon
#

i'd always recommend making your own tbh. that way you can make it just the way you like.

echo basalt
#

I just have my own

tall dragon
mighty mason
#

Oh, thank very much

#

Ill do my own

#

I have a question regarding textures: Is it "hard" to make textures and items looking like MCCI textures?

tall dragon
#

if you do some research. not really

quaint mantle
#

can yall help me with one line on my skript its an error.

tall dragon
#

you just gotta read up on how the resourcepacks & model data work

echo basalt
#

it's mostly just having the art style rather than complex

magic glacier
#

And the same message appears and the plugin isn't enabled

quaint mantle
#

i need to know what do i replace the 'on jumping' method to in my skript it wont work for 1.20.1

mighty mason
quaint mantle
#

i believe

tall dragon
tall dragon
quaint mantle
#

do you guys do skripts here?

echo basalt
deep herald
magic glacier
#

As there is a function that I want to use

tall dragon
#

with what build tool?

#

maven?

echo basalt
#

bros prob not using any

magic glacier
#

No , jars

echo basalt
tall dragon
#

hmm using intellij build artifacts for compiling i guess?

tall dragon
orchid gazelle
#

is it possible to give Commands a return message if I return onCommand?

#

like, return "Yo the entered name is invalid" instead of just returning false

quaint mantle
#

no

young knoll
#

onCommand only returns a boolean

#

Just send the sender a message

orchid gazelle
#

just return false;

#

and then send message?

quaint mantle
#

and deep down minecraft uses brigadier which just has a lambda that returns an int

young knoll
#

You probably want to return true if you are sending your own message

deep herald
#
Arrays.asList(
  new AlertCommand()
).forEach(command -> getCommand(command.toString()).setExecutor(command));```anyone know why this wont work?
orchid gazelle
#

and I wanna let the user know what they did wrong

quaint mantle
#

what does command.toString return?

deep herald
young knoll
#

the boolean you return just controls if spigot will show the usage message from the plugin.yml

quaint mantle
#

it has to be a valid command

#

from ur plugin.yml

orchid gazelle
deep herald
#

it is

#

i dont use the default api alot so ive forgotten

young knoll
orchid gazelle
#

alright thanks

quaint mantle
#

me neither dw

deep herald
young knoll
#

did you override the toString

quaint mantle
#

yes but toString returns something else

#

unless u override it

#

as coll said

deep herald
#

what do i put

young knoll
#

Otherwise it ain't gonna return alert

deep herald
#

how am i gonna return it

mighty mason
young knoll
#

override toString if you want to do it that way

quaint mantle
#

like any ai service they have a subscription

#

but u get some free creds

deep herald
#

what do i put in that spot for the alert cmd

quaint mantle
#

why don't you just use a new method

#

getName() or something in your command class

deep herald
#

thats my cmd

#

ignore the top part

magic glacier
quaint mantle
#

you need to override toString

#

if u gonna use it

#

like that

deep herald
#

explain

#

again i havent used the default api

#

in a while

quaint mantle
#
class NoobCommand implements BlahInterface {
  @Override public String toString() {
    return "alert";
  }
}```
deep herald
#

what else can i do

tough mica
quaint mantle
#

maybe just do it normally

#

getCommand("alias").setExecutor(new AlertCommand());

deep herald
#

alr

#

i was just trying to make it easier

quaint mantle
#

no

#

you were just overengineering your code

deep herald
#

well i did it for this

#

so

quaint mantle
#

ugh

#

why dude

#

I mean sure

#

it can be nice to create a shorter function for PluginManager::registerEvents

#

but like

#

thats goofy

fervent robin
#

Hey I get com.comphenix.protocol.reflect.FieldAccessException: Field index 0 is out of bounds for length 0 on the #setType line of this code

 WrapperPlayServerSpawnEntity packet = new WrapperPlayServerSpawnEntity(minecraftAI.getProtocolManager().createPacket(PacketType.Play.Server.SPAWN_ENTITY));
        packet.setEntityID(EntityUtil.getNextEntityID(world));
        packet.setType(EntityType.PLAYER);
        packet.setX(loc.getX());
        packet.setY(loc.getY());
        packet.setZ(loc.getZ());
        packet.broadcastPacket();
worldly ingot
#

Whatever wrapper API you're using doesn't support the version your server is running

tough mica
valid burrow
#

I asked this before but didnt get a repsonse can anyone here help me with MySQL?

I am able to conect to my local host database but once i try to use one that is hosted online i get this error ```Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.```

i dont know if this is only the case with this specific database cause i dont really have a spare database that i can try it out with

worldly ingot
tough mica
#

and how can i do this?

worldly ingot
#

Since Minecraft 1.13 we have access to custom fonts. Since I have not seen much about it here a little video about it.
I want to show you everything you need to know and provide some ideas how you can use fonts creatively.

Resourcepack: https://dmanager.stevertus.com/pack/stevertus:custom-font

Reddit article: https://www.reddit.com/r/Minecraft...

▶ Play video
fervent robin
worldly ingot
#

I don't know what version your server is running but that doesn't look like nearly enough data. In the latest version, this is what all is required

    private final int id;
    private final UUID uuid;
    private final EntityTypes<?> type;
    private final double x;
    private final double y;
    private final double z;
    private final int xa;
    private final int ya;
    private final int za;
    private final byte xRot;
    private final byte yRot;
    private final byte yHeadRot;
    private final int data;```
quaint mantle
#

wiki vg

#

To the rescue

worldly ingot
#

The wiki isn't relevant here

fervent robin
#

Yeah its not, but it still shouldnt throw Field index 0 is out of bounds for length 0

worldly ingot
#

ProtocolLib uses reflection to set fields, not the raw data sent over the network

quaint mantle
fervent robin
quaint mantle
#

If they use an old version

worldly ingot
#

It's not relevant at all. I'm telling you, it's not relevant

fervent robin
#

i do and im looking at the older version

quaint mantle
#

checking it out can be easy enough to figure out the fields

worldly ingot
#

The data documented on the wiki is not the same as the data required by PL

#

Do not use wiki.vg for reference here. I'm telling you

#

Whatever version you're running you'll want to take a look at the PacketPlayOutSpawnEntity class. Those are the field types you need to set

#

In the latest version, it's the fields I sent above

quaint mantle
#

🤦‍♂️

echo basalt
#

xa, ya and za are velocity btw

#

No clue why we send the entity uuid but whatever

fervent robin
#

Shouldnt it not throw Field index 0 is out of bounds for length 0 even if I dont have all the fields set? Cause its getting thrown when I try to set it

worldly ingot
echo basalt
#

we don't use it anywhere else but whatever

worldly ingot
#

The client needs it for consistency

echo basalt
#

eh true

#

helps debug

worldly ingot
#

Would be really awkward if any of the NBT holding UUIDs pointed to some entity that existed on the server but not on the client

#

Not even debug

#

Just synchronization

worldly ingot
#

Even if you're not expressly using it, set it to some default value like 0 (for integers)

#

If you're getting that exception you mentioned it's probably because you're setting the wrong types

#

Or you're running the wrong version of ProtocolLib or there's a bug, but the latter seems unlikely

echo basalt
#

protocol wrappers are eh

#

they're autogenerated and don't always match

heady grove
#

Hi, I've created a class that extends BlockPlaceEvent and am calling this.setCancelled(true) but the block is still placed and the event doesn't seem to get cancelled? Any idea why?

echo basalt
#

show code

#

no idea how you expect it to work

heady grove
#
public class ClaimBlockPlaceEvent extends BlockPlaceEvent {

    public ClaimBlockPlaceEvent(Block placedBlock, BlockState replacedBlockState, Block placedAgainst,
            ItemStack itemInHand, Player thePlayer, boolean canBuild, EquipmentSlot hand, boolean isCompanyClaim) {
        super(placedBlock, replacedBlockState, placedAgainst, itemInHand, thePlayer, canBuild, hand);
        Claim currentClaim = ChunkUtils.getClaim(block.getChunk());

        if (currentClaim.isLandClaimed()) {
            thePlayer.sendMessage("This chunk is already claimed by " + currentClaim.getLandOwner());
            this.setCancelled(true);
            return;
        }

        Claim newClaim = new Claim(
            thePlayer,
            isCompanyClaim,
            true
        );

        ChunkUtils.setClaim(block.getChunk(), newClaim);
        thePlayer.sendMessage("Chunk claim successful");
    }
}

I definitely fall into the currentClaim.isLandClaimed() path as I get the message issued in chat

echo basalt
#

Yeah but

#

Bukkit doesn't listen to itself

#

Like that's not how you make event listeners

fervent robin
#

I still get Field index 0 is out of bounds for length 0 for setting the UUID

PacketContainer container = minecraftAI.getProtocolManager().createPacket(PacketType.Play.Server.SPAWN_ENTITY);
        container.getIntegers().write(0, EntityUtil.getNextEntityID(world));
        container.getUUIDs().write(0, UUID.randomUUID());
        container.getEntityTypeModifier().write(0, EntityType.PLAYER);
        container.getDoubles().write(0, loc.getX());
        container.getDoubles().write(1,loc.getY());
        container.getDoubles().write(2, loc.getZ());
        container.getIntegers().write(1, 0); //XA
        container.getIntegers().write(2, 0); //YA
        container.getIntegers().write(3, 0); //ZA
        container.getBytes().write(0, (byte)0); //xRot
        container.getBytes().write(1, (byte)0); //yRot
        container.getBytes().write(2, (byte)0); //yHeadRot
        container.getIntegers().write(4, 0); //data (idk what to set)
fervent robin
#

1.8.9 unfortunately

echo basalt
#

ow

worldly ingot
#

Probably slightly different data back then

#

Like I said, refer to PacketPlayOutSpawnEntity

heady grove
worldly ingot
#

I bet you it's not even an EntityType field

echo basalt
#

hey look we didn't send the id

worldly ingot
#

Yeah that's what I thought lol

fervent robin
#

Yeah I looked it up but I can only find obfuscated version

worldly ingot
#

Usually the serialization at least gives you hints as to what it is, and that you can cross reference against wiki.vg

#

(the correct version of wiki.vg, that is)

echo basalt
#

a - entityid
b - x (int variant, multiply by 32 and floor)
c - y (int variant)
d - z (int variant)
e - xVel (short variant, multiply by 8000)
f - yVel (short variant)
g - zVel (short variant)
h - pitch (byte variation, multiply by 256 divide by 360)
i - yaw (byte variation)
j - entity type
k - metadata

#

there you go

fervent robin
#

alright thx

#

unrelated question why does the X value need to be processed like that cant it just be sent normally?

echo basalt
#

In the protocol it's an int

#

But the position is a double

#

So it's multiplied by 32

fervent robin
echo basalt
#

Well

#

you write it as an int

#

It's the index in the registry

worldly ingot
#

What are you trying to do by the way?

#

Because it looks like you were trying to spawn a player, which actually uses a different packet in 1.8

fervent robin
#

are u serious

worldly ingot
#

Spawn named entity

#

At least if I'm remembering correctly. This is 8 year old information I'm trying to remember

#

PacketPlayOutSpawnNamedEntity

young knoll
#

Didn’t it use a different packet until 1.20.2

#

Uhh

river oracle
#

IK its been there since 1.8 so that's all you really need to know

#

if you're dipping below 1.8 you have mental issues so no help for you there

young knoll
#

Was it really there in 1.8?

worldly ingot
#

Yes I believe so

young knoll
#

Damn I thought it was closer to 1.12

worldly ingot
#

Action bars were probably closer to 1.12

#

Chat messages were 1.8 though for sure

young knoll
#

Guess I can just check the old docs

#

Doh they don’t have a search bar

#

Did it have a different repo back then?

fervent robin
#

Ok so now I dont get any errors but I also dont see any entity and when I print all the player entities it doesnt print one with the right entity id

Location loc = new Location(world, 0, 61, 0);
        PacketContainer container = minecraftAI.getProtocolManager().createPacket(PacketType.Play.Server.NAMED_ENTITY_SPAWN);
        container.getIntegers().write(0, 535456);
        container.getUUIDs().write(0, UUID.randomUUID());
        container.getIntegers().write(1, (int)Math.floor(loc.getX()*32));
        container.getIntegers().write(2, (int)Math.floor(loc.getY()*32));
        container.getIntegers().write(3, (int)Math.floor(loc.getZ()*32));
        container.getBytes().write(0, (byte)0);
        container.getBytes().write(1, (byte)0);
        container.getIntegers().write(4, 0);
        container.getDataWatcherModifier().write(0, new WrappedDataWatcher());
        minecraftAI.getProtocolManager().broadcastServerPacket(container);
        for(Entity entity1 : world.getEntities()) {
            if(entity1.getType() == EntityType.PLAYER) {
                Bukkit.getLogger().info("Found a player with ID: " + entity1.getEntityId());
            }
        }
young knoll
#

Well world.getEntities won’t show it

#

It doesn’t exist on the server

fervent robin
young knoll
#

Any errors on the client or server

fervent robin
# young knoll Any errors on the client or server

On client there is

Error executing task
java.util.concurrent.ExecutionException: java.lang.NullPointerException
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:192)
at g.a(SourceFile:45)
at ave.av(SourceFile:881)
at ave.a(SourceFile:325)
at net.minecraft.client.main.Main.main(SourceFile:124)
Caused by: java.lang.NullPointerException
at bcy.a(SourceFile:301)
at fp.a(SourceFile:75)
at fp.a(SourceFile:16)
at fh$1.run(SourceFile:13)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at g.a(SourceFile:44)
... 3 more

#

dont know how to read obfuscated client classes tho

thin iris
#

i have a bunch of classes with info like name, age, nation that extend an abstract class. i want to spawn a npc with it but idk how to get the info from that class into the npc? like /npcb <npc name> would spawn it with it’s information does anyone know how id do this 😊

tribal quarry
#

take a look at NMS entity's constructor to see how it creates the datawatcher

tribal quarry
thin iris
tribal quarry
fervent robin
# tribal quarry You are sending the client an empty datawatcher, i think thats the case

Did it exactly how they did it and still get that

Mine:
WrappedDataWatcher dataWatcher = new WrappedDataWatcher();
dataWatcher.setObject(0, (byte) 0);
dataWatcher.setObject(1, (short)300);
dataWatcher.setObject(3, (byte) 0);
dataWatcher.setObject(2, "");
dataWatcher.setObject(4, (byte) 0);

Theirs:
this.datawatcher = new DataWatcher(this);
this.datawatcher.a(0, Byte.valueOf((byte) 0));
this.datawatcher.a(1, Short.valueOf((short) 300));
this.datawatcher.a(3, Byte.valueOf((byte) 0));
this.datawatcher.a(2, "");
this.datawatcher.a(4, Byte.valueOf((byte) 0));
tribal quarry
quasi berry
#

any clue why line 227 isn't actually setting the display name? all the other stuff such as setting banner patterns here works properly

fervent robin
#

your just setting the meta of a copy of the items meta you have to set the item meta of the item with the modified displayname

#

?paste

undone axleBOT
tribal quarry
quasi berry
#

right okay

tribal quarry
fervent robin
#

when the packet is sent

#

yes

#

but it never spawns

tribal quarry
#

Can you try it with forge?

fervent robin
#

why

tribal quarry
#

because I think it might has different obsucated names that we can map and see whats wrong (forge is based off MCP)

fervent robin
#

oh alr one sec

tribal quarry
#

some are like func_0223..

fervent robin
# tribal quarry some are like func_0223..
Error executing task
java.util.concurrent.ExecutionException: java.lang.NullPointerException
    at java.util.concurrent.FutureTask.report(FutureTask.java:122)
    at java.util.concurrent.FutureTask.get(FutureTask.java:192)
    at net.minecraft.util.Util.func_181617_a(SourceFile:45)
    at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:1014)
    at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:349)
    at net.minecraft.client.main.Main.main(SourceFile:124)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
Caused by: java.lang.NullPointerException
    at net.minecraft.client.network.NetHandlerPlayClient.func_147237_a(NetHandlerPlayClient.java:484)
    at net.minecraft.network.play.server.S0CPacketSpawnPlayer.func_148833_a(SourceFile:75)
    at net.minecraft.network.play.server.S0CPacketSpawnPlayer.func_148833_a(SourceFile:16)
    at net.minecraft.network.PacketThreadUtil$1.run(SourceFile:13)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at net.minecraft.util.Util.func_181617_a(SourceFile:44)
    ... 9 more
fervent robin
#

1.8.9

tribal quarry
#

ok, give me a second

fervent robin
#

unfortunately

#

What?

river oracle
#

how else would ya do it :P

tribal quarry
#

Are you sure you are sending the player info packet just before the named entity spawn?

fervent robin
tribal quarry
#

yeah, that should be it, try testing it out

young knoll
#

Can’t just make it and then do nothing :p

slender elbow
#

bet

lilac dagger
#

But i still think that all the schedulers are looped every tick

tribal quarry
# fervent robin Uh no I wasnt aware I had to the code I sent here was all the code

I would just use NMS straight-forward (On ancient versions like 1.8), it just hurts to use plib, even hypixel, idk:

          GameProfile playerProfile = ((CraftPlayer) player).getProfile();
            EntityPlayer shopNPC = (EntityPlayer) shopEntity;

            EntityUtils.setPlayerProfile(shopNPC, playerProfile.getId(), playerProfile.getName());
            EntityUtils.setPlayerTextures(shopNPC, playerProfile);

            connection.sendPacket(new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.ADD_PLAYER, shopNPC));
            connection.sendPacket(new PacketPlayOutNamedEntitySpawn(shopNPC));
tribal quarry
sterile token
#

Something to ask, if you use components on spigot? You have to use the ChatColor from bungeecord or the spigot one i jsut got confused

young knoll
#

The bungee one

sterile token
young knoll
#

Yeah idk why you’d need that

#

You can use the bungee one for everything

sterile token
#

Trying to fix shity issues with color codes

#

Which have been there since 1.8x and never been fixed

sterile token
#

Well what happen is the next, when you use colro codes in components the color code is applied to the first lines and the others lines the color is not applied

young knoll
#

You aren’t meant to use them directly in components

#

Use fromLegacyText or a component builder with the .color methods

opal juniper
#

No. You need to either weakref the player or store the UUID and check with that

#

the player will go stale otherwise

#

and idk if the isOnline check will work

young knoll
#

It will

opal juniper
#

OMG!!!

#

amazing code then 20/10

#

storing uuid is more common place tho 🥰

sterile token
young knoll
#

Use a library like minedown

sterile token
#

Doesnt make sense i mean its weird

young knoll
#

I mean adventure is no different

#

That’s just how components are

fluid cypress
#

how do you call the thing in between the square brackets?

/somecommand minecraft:acacia_stairs[facing=east,waterlogged=true]

block data? block info? whatever, is there something in the api to parse a string like that and set those properties into a Block object? without having to manually use setFacing, setWaterlogged and all that?

sterile token
#

they can just simply fix the issue using the ChatColor regex pattern, getting the text part and applying the color to that part by doing ChatColor#getByChar(), then you are done

#

💀

worldly ingot
#

If you go by vanilla's standards, block states

#

but Bukkit calls it BlockData

#

You can create one with that string using Bukkit#createBlockData(String)

fluid cypress
#

cool, thanks

sterile token
#

I sometimes asked myself too much why using third parties is so complicated. I mean they do really too much weirdone things

young knoll
sterile token
young knoll
#

?

drowsy helm
#

is it more efficient to calculate a hash multiple times for subsets of data or once over the entire set. not really sure the O(n) of a hash

worldly ingot
#

I'm not sure I understand

#

If you can calculate a hash once then why would you not do that?

drowsy helm
#

Okay so say I had a massive database with N records that i want to synchronize with a remote db. Is it better to hash the ENTIRE db and match it once or hash each record and match each one

#

I guess it really depends on sample size could be a converging thing

worldly ingot
#

Oh, I see

#

Unsure the best approach for that tbh, but hashing the whole database just sounds like a long nightmare lol

drowsy helm
#

more theoretical then anything, guess i have to do some deep dives into hashing algos lol

sick edge
#

I have a question regarding nms (1.20.2), In 1.19.4 this worked but now it doesnt and it finds no advancement at all:
I sent a ClientboundUpdateAdvancementPacker with my root Advancement as an AdvancementHolder which seems to be new and it worked before. I just want it to show an empty page and then send more packets later on.
This is the creation of the root advancement and conversion to advancementholder:

Advancement rootAdv = new Advancement(Optional.of(new ResourceLocation(namespace, "root")), Optional.of(new DisplayInfo(air, Component.nullToEmpty(""), Component.nullToEmpty(""), new ResourceLocation("minecraft", "..."), FrameType.TASK, false, false, true)), AdvancementRewards.EMPTY, new HashMap<>(),AdvancementRequirements.EMPTY, false);
        rootAdvHolder = new AdvancementHolder(new ResourceLocation(namespace, "root"), rootAdv);

Thx in advance I already tried a bit

kind hatch
#

Are you doing like actual advancements with packets? The API should cover those.

sick edge
#

No I dont want actual advancements just for each player to view them (its for a bingo) and I need custom positions which is why the api isn't sufficient

river oracle
#

Could not resolve dependencies for project sh.miles.suketto:bukkit-core:jar:2023.10.5: The following artifacts could not be resolved: sh.miles.suketto:core:jar:2023.10.5 (absent): why would I be getting this error when compiling. I'm genuinely confused.
I shouldn't need to shade here I'm pretty sure
https://paste.md-5.net/vadocukevi.xml Everything is shaded in my dist module

warped shell
#

I need an efficient way to get all the blocks which a player can see currently within a range. Is there a good way to do this without nesting for loops?

remote swallow
#

To me that looks like maven

river oracle
remote swallow
kind hatch
warped shell
#

I feel like that would be very intensive since I want to run it once per second

river oracle
#

ChunkSnapshots would be ideal if you plan to run this asynchronously

warped shell
#

can i access snapshots async?

river oracle
#

yeah but you have to make them synchronously

warped shell
#

wait so cna I or can I not access chunk snapshots async?

kind hatch
#

ChunkSnapshots are a thread-safe read-only task.

warped shell
#

cool

kind hatch
#

You should be fine to do it async.

warped shell
#

epic

river oracle
#

you can't make ChunkSnapshots asynchronously though

warped shell
#

ye