#help-development

1 messages · Page 1131 of 1

buoyant viper
#

ive rewritten the code to utilize some NMS and pass through like 1 method spigot uses but now i just get error decoding, and the issue becomes related to packet length but with a slightly different error lol

#

channel = "wildfire_gender:sync";

#

this did work as intended on 1.20.6 when i wrote the no-NMS vers

#

i know server type is purpur but this is affecting every vers ive tested

eternal night
#

Do you have the client stacktrace?

buoyant viper
#

i added in the line spigot does that i ignored (Unpooled.wrappedBuffer) and now it works flawlessly 🫠 what the fuck

eternal night
buoyant viper
#

so i cant use the API method, but i can do exactly what the API method does internally and it works fine?

#

how the fuck did i skill issue that one

#

at this point the only point of failure is when i would normally be converting it to a byte array for sendPluginMessage

#

rather than directly let NMS handle the ByteBuf

#

petition to let me pass a ByteBuf to sendPluginMessage 😭

#

got a really dumb idea that relies on DataInput/OutputStreams and ByteArrayInput/OutputStreams

#

this is going to get so fcked so quickly

buoyant viper
#

anyways

#

i suck at network related code, is there a better way to handle that shit

chrome beacon
#

might be worth just making the decoders implement autoclosable instead of having your own close (finish) method

buoyant viper
chrome beacon
#

ah I see

#

yeah that is a bit odd

buoyant viper
#

i guess i couldve actually just made the decoder and encoder classes extend datainput and dataoutput streams directly if anything instead of fields but idk

#

thatll be a problem for future me to solve (aka tomorrow night)

sly topaz
#

the structure is kinda weird but the code looks fine

chrome beacon
sly topaz
#

what is shouldSync supposed to do though?

#

also, do you have to encode the data every time you have to send it to players? You could just save the encoded data as a byte array in the GenderData and only re-encode it when necessary

buoyant viper
#

its basically whats supposed to let me only encode it when necessary, like u suggested

#

but for some reason its just refusing to work properly

sly topaz
#

but encoding it for every player isn't necessary, though I haven't exactly looked deep at the code so there's something I might be missing here, it doesn't like you have to encode that byte array every time

#

ah wait, the mod has its own synchronization mechanism, that makes sense

buoyant viper
#

i think i can actually avoid ever having to (de)serialize anything at all

#

i can just pass the byte array received from players to everyone else 😭😭😭

#

its not like theres any real processing going on in the plugin of the settings anyway

#

all its really utilized for is logging what their assigned gender is

sly topaz
#

might be worth creating an issue on their github to make sure synchronizing the data with the mod is non-essential, they might have plans for it in the future

buoyant viper
#

yeah

grim hound
#

why is PlayerSpawnChangeEvent @Deprecated and for removal?

hazy parrot
#

Are u sure u are using spigot

grim hound
#

ah okay, I understand the confusion now

young knoll
#

If I had a nickel for every person that asks about a deprecation that comes from paper

orchid trout
#

youd have at least 2

young knoll
#

A license?

#

What

chrome beacon
#

Enable online mode and the server will handle that for you uwu

young knoll
#

Ah is that what they mean

#

👀

shadow night
#

Yes

#

In quite a lot of communities (especially non-english) an official minecraft account is referred to as 'license'

wet breach
grim hound
#

uhhhhhhh

#

wat

blazing ocean
#

🗿

grim hound
#

why can't I load a native lib?

blazing ocean
#

Why would you even want to do that in a plugin lmao

#

(spark does not count)

grim hound
#

so do you know why it happens?

grim hound
eternal night
#

Cannot load amd64 on aarch

wet breach
eternal night
wet breach
#

using java -XshowSettings:properties -version you can find the java.library.path

grim hound
#

I might've compiled my jar wrongly then

blazing ocean
#

I mean, makes sense

grim hound
wet breach
grim hound
#

I mean I see it

wet breach
#

those are the shared lib paths for natives

grim hound
#

I'm not sure whether I know the cause

#

/usr/lib/jvm/java-21-openjdk-21.0.3.0.9-1.0.1.el8.aarch64/bin/java -Xms24G -Xmx24G -jar server-1.21.jar nogui
is how I start my server

#

so it might be that these don't match

wet breach
#

/usr/lib is on the path for searching

#

not sure I understand what issue you are having difficulty with o.O

#

its quite simple, the native you are wanting to load has to reside in those paths or the directory of the jar

eternal night
#

isn't only "loadLibrary" the thing that even relates to the library path tho?

wet breach
#

the error involves the load method for natives, and the specific error in this case is unsatifisedlink error which you only get if the native was not found or a dependency of the native not found

#

or for some reasonly couldn't be loaded

eternal night
#

Well yea, there is a file not found or am I tripping

grim hound
#

so is it that this library is unsupported in my environment or that the file actually cannot be found?

eternal night
#

idk, the screenshot is blurry af on my phone

#

terrible people would say pastebins exist

wet breach
#

could be both, or one of the other. however if its not supported in your environment typically you wouldn't find it in the shared lib paths either

eternal night
river oracle
#

What a cruel and unfair world that would be

eternal oxide
#

Why libp-cap on a minecraft plugin?

chrome beacon
#

They're trying to hijack the connection so they can make a login plugin for offline mode servers

chrome beacon
#

Then what are you doing

grim hound
#

I'm really just testing out on how this works

wet breach
blazing ocean
grim hound
#

do you perhaps know the command to downloading this stuff on the console?

wet breach
#

can use curl if you want

grim hound
#

... I think I just downloaded the .html of that website

#

xd

#

no output

wet breach
#

use -O option before the link

grim hound
#

brah

wet breach
#

did you check to see if it downloaded?

eternal night
#

-L

#

as with like any other package repo, you are gonna be redirected to a mirror for the actual file

wet breach
#

ah right

#

curl -L -O (link)

grim ice
#

Any idea why this happens?

#

No error in console

smoky anchor
#

show the commands code

grim hound
#

same error message

wet breach
#

weird

#

guess just download it to your pc and then upload to server

grim hound
#

It might actually be the fact that it cannot be found

eternal oxide
#

at what point are you getting the link error?

wet breach
#

it exists

#

oh you mean the native error message\

grim hound
eternal oxide
#

startup of server?

#

did you package pcap in your plugin?

wet breach
#

well the dependencies for libpcap is glibc and libnl

grim hound
#

it shows up when I try to load pcap

eternal oxide
#

yeah thats just headers though. natives are platform specific

#

did you sudo apt-get install... ?

grim hound
#

I'll try it in a different plugin and see if my build is the issue

cunning solstice
#

i still trying to understand how dependencies work, can anyone explain pls?

grim hound
#

not protocol lib

cunning solstice
#
  • protocol lib just seemed interesting
grim hound
grim hound
cunning solstice
#

can you explain pls

#

how to install libs

grim hound
#

both libs are packet libs

grim hound
cunning solstice
#
plugins {
    id 'java'
}

group = 'hawkstudios'
version = '1.0-1.20.2'

repositories {
    mavenCentral()
    maven {
        name = "spigotmc-repo"
        url = "https://hub.spigotmc.org/nexus/content/repositories/snapshots/"
    }
    maven {
        name = "sonatype"
        url = "https://oss.sonatype.org/content/groups/public/"
    }
    maven {
        url = "https://repo.dmulloy2.net/repository/public/"
    }
}

dependencies {
    compileOnly("org.spigotmc:spigot-api:1.20.2-R0.1-SNAPSHOT")
    compileOnly group: "com.comphenix.protocol", name: "ProtocolLib", version: "5.2.0";
}

def targetJavaVersion = 17
java {
    def javaVersion = JavaVersion.toVersion(targetJavaVersion)
    sourceCompatibility = javaVersion
    targetCompatibility = javaVersion
    if (JavaVersion.current() < javaVersion) {
        toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
    }
}

tasks.withType(JavaCompile).configureEach {
    options.encoding = 'UTF-8'

    if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
        options.release.set(targetJavaVersion)
    }
}

processResources {
    def props = [version: version]
    inputs.properties props
    filteringCharset 'UTF-8'
    filesMatching('plugin.yml') {
        expand props
    }
}
grim hound
#

yeah so

#

remove all protocol lib stuff

cunning solstice
#

i may be good at modding, but right now im making mc server, so im trying to learn how plugin works

cunning solstice
grim hound
#
maven("https://mvnrepository.com/artifact/com.github.retrooper.packetevents/api")
maven("https://mvnrepository.com/artifact/com.github.retrooper.packetevents/spigot")
``` is what you should place for PE in `repositories`
cunning solstice
grim hound
#

and compileOnly("com.github.retrooper:packetevents-spigot:2.4.0") in dependencies

grim hound
cunning solstice
#

alr :/

grim hound
#

cuz these are for spigot

cunning solstice
#

just pasted

grim hound
#

yep

cunning solstice
cunning solstice
#

ok, i clicked reload and it has errors

grim hound
cunning solstice
blazing ocean
grim hound
grim hound
grim hound
#

don't remove mavenCentral()

cunning solstice
#

oh

grim hound
#

api

#

one

#

and add maven("https://repo.codemc.io/repository/maven-releases/")

cunning solstice
#

i'd rather do default

grim hound
#

you did none of that

cunning solstice
#

default:

plugins {
    id 'java'
}

group = 'hawkstudios'
version = '1.0-1.20.2'

repositories {
    mavenCentral()
    maven {
        name = "spigotmc-repo"
        url = "https://hub.spigotmc.org/nexus/content/repositories/snapshots/"
    }
    maven {
        name = "sonatype"
        url = "https://oss.sonatype.org/content/groups/public/"
    }
}

dependencies {
    compileOnly("org.spigotmc:spigot-api:1.20.2-R0.1-SNAPSHOT")
}

def targetJavaVersion = 17
java {
    def javaVersion = JavaVersion.toVersion(targetJavaVersion)
    sourceCompatibility = javaVersion
    targetCompatibility = javaVersion
    if (JavaVersion.current() < javaVersion) {
        toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
    }
}

tasks.withType(JavaCompile).configureEach {
    options.encoding = 'UTF-8'

    if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
        options.release.set(targetJavaVersion)
    }
}

processResources {
    def props = [version: version]
    inputs.properties props
    filteringCharset 'UTF-8'
    filesMatching('plugin.yml') {
        expand props
    }
}
blazing ocean
#

PacketEvents has a guide on how to use it.

cunning solstice
#

(how it was on start)

grim hound
cunning solstice
#

fine

#

oops

#

fine

grim hound
#

I mean at this point

#

you just have to be doing it on purpose

cunning solstice
#

wdym

umbral ridge
#

HawkStudios

#

XD

grim hound
cunning solstice
#

it's my solo bussiness

#

but fine

cunning solstice
#

thanks i guess?

#

but i didn't do anything good

grim hound
#

this

#

not just copy and paste

#

read

cunning solstice
#

fine

grim hound
#

it exists within my jar

#

that's what the lib does

#

for loading

eternal night
#

ClassLoader#getResourceAsStream instead

grim hound
blazing ocean
#

what

grim hound
#

with changed code

blazing ocean
#

why

grim hound
blazing ocean
grim hound
blazing ocean
#

Instead of doing it on the class

grim hound
blazing ocean
#

PCapNative.class.getResourceAsStream

grim hound
#

I get what you mean

grim hound
blazing ocean
#

idk ask lynx

grim hound
#

so I guess it couldn't create that file, is that it?

#

oh wait

#

they don't create that file at all xd

#

right?

#

that's the thing

cunning solstice
#

i honestly still don't understand anything

#

i readed entire thing

grim hound
# grim hound

wait, but doesn't Files.copy already create a file?

cunning solstice
#

but idk how

eternal night
#

if that is the libs code, I guess they know what they are doing

grim hound
eternal night
#

usually Class#getResourceAsStream is wrong as resources are included at the root of the jar, not nested into the same folder as the .class file

grim hound
eternal night
#

So if you do A.class.getResourceAsStream it'll search in the folder dev/lynxplay/shittylib/ for it where A.class lives

#

instead of just t he root of the jar

eternal night
#

so like

grim hound
#

it's like

#

broken

#

wtf

dry hazel
worthy yarrow
#

You just replace ‘platform’ with ‘spigot’ for example

fading drift
#

anyone know something I can use for running mc server through intellij for debugging

mellow juniper
#

hi

#

I'm trying to make some basic changes in one of my plugins config files, but it's not working

icy kelp
#

I need a fast help

river oracle
#

WHAT OKAY

#

SPIT IT OUT

#

FASTER

#

you gotta type faster man what if everything explodes

icy kelp
#

import org.bukkit.*;
import org.bukkit.block.Block;
import org.bukkit.block.Chest;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;

import java.net.http.WebSocket;


public class Zrzut implements CommandExecutor, Listener {
    private double x, y, z;

    @Override
    public boolean onCommand(CommandSender commandSender, Command command, String s, String[] args) {

        Player player = (Player) commandSender;

        if (!player.isOp() || args.length != 3) {
            return false;
        }

        Inventory inv = Bukkit.createInventory(null, 27, ChatColor.translateAlternateColorCodes('&', "&l&6ᴢʀᴢᴜᴛ"));
        player.openInventory(inv);


        // Info
        player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&c&lZrzut zostanie zrzucony na: "));

        String strx = "&a --- X: " + args[0];
        String stry = "&a --- Y: " + args[1];
        String strz = "&a --- Z: " + args[2];

        x =  Double.parseDouble(args[0]);
        y = Double.parseDouble(args[1]);
        z = Double.parseDouble(args[2]);

        player.sendMessage(ChatColor.translateAlternateColorCodes('&', strx));
        player.sendMessage(ChatColor.translateAlternateColorCodes('&', stry));
        player.sendMessage(ChatColor.translateAlternateColorCodes('&', strz));
        //

        return false;
    }

    @EventHandler
    public void onInventoryClose(InventoryCloseEvent event) {
        Player player = (Player) event.getPlayer();

        Inventory inv = event.getInventory();

        if (event.getView().getTitle().equals(ChatColor.translateAlternateColorCodes('&', "&l&6ᴢʀᴢᴜᴛ"))) {
            World world = player.getWorld();

            Location loc = new Location(world, x, y, z);
            Block block = loc.getBlock();

            block.setType(Material.CHEST);
            Chest chest = (Chest) block.getState();
            chest.setCustomName(ChatColor.translateAlternateColorCodes('&', "&l&6ꜱᴋʀᴢʏɴɪᴀ ᴢʀᴢᴜᴛᴜ"));
            Inventory chestInventory = chest.getBlockInventory();

            for (int i = 0; i < inv.getSize(); i++) {
                ItemStack item = inv.getItem(i);
                if (item != null) {
                    chestInventory.addItem(item);  // Dodanie przedmiotu do skrzynki
                }
            }
        }
    }
}

Why x, y, z isnt changing? its still 0

#

x = Double.parseDouble(args[0]);
y = Double.parseDouble(args[1]);
z = Double.parseDouble(args[2]);

I think it should change after this

river oracle
#

it seems that you have horrible design

#

I think that's the general issue

icy kelp
river oracle
#

firstly for guis

#

?gui

river oracle
#

don't abuse class fields for storing data on your inventories

#

this will break if two players run the command at any point

icy kelp
#

I need to get the args[0] args[1] args[2] in the event called onInventoryClose

river oracle
#

take a look at the thread posted above 😉

#

you can store data in those

umbral ridge
#

XD

icy kelp
river oracle
#

oh my friend did you not read the thread at all?

icy kelp
#

I'm searching there for storing values

river oracle
#

lol it doesn't explicity say

#

but its heavily inferred

#

if you look at the structure its pretty clear you can throw any good old values in the constructors

icy kelp
#

actually you're not helping me

#

you just can say what do to and I'm gonna learn with that

#

not that thread

eternal night
#

Y2K is known for not being helpful sadly Sadge

river oracle
#

yeah

#

Usually I just try to be as much as an asshole as possible

river oracle
# icy kelp actually you're not helping me
  1. Follow the general recommendations of that thread for Menu Design
  2. Pass the data you want into the constructor of your Menu, its then stored for later
  3. Grab your Menu and use what data you need in InventoryCloseEvent
icy kelp
river oracle
#

I mean you could do it fully functionally but java isn't really meant for functional programming

#

I'd stick with a OOPy esque design

grim hound
slender elbow
#

xd

undone axleBOT
#

For Beginners:

Codecademy - Learn Java: Interactive Java programming course from basics to more advanced concepts. Perfect for absolute beginners.
https://www.codecademy.com/learn/learn-java
JetBrains Academy - Java Developer Track: Learn by doing with projects and challenges. It covers Java fundamentals to advanced topics.
https://www.jetbrains.com/academy/
Udemy - Java Programming Masterclass for Software Developers: Updated courses that cover Java 8 to Java 17 features. Suitable for those who prefer structured learning.
https://www.udemy.com/course/java-the-complete-java-developer-course/

For Intermediate to Advanced Learners:

Oracle Java Tutorials: The official guides by Oracle for Java programming—great for understanding the depth of Java.
https://docs.oracle.com/javase/tutorial/
Baeldung - Learn Java and Spring: Focus on Spring Framework and modern Java technologies. Best for intermediate learners aiming to expand their knowledge.
https://www.baeldung.com/

Practice and Hands-on Learning:

Exercism - Java Track: Solve exercises and get feedback from mentors. Great for practicing coding skills.
https://exercism.io/tracks/java
LeetCode: Practice your coding skills and prepare for technical interviews with Java.
https://leetcode.com/

Free Resources and Documentation:

Java Programming and Documentation: A comprehensive collection of Java programming guides, tutorials, and API documentation.
https://docs.oracle.com/en/java/

Community and Support:

Stack Overflow: A vast community of developers. Great for getting help with specific problems or understanding concepts.
https://stackoverflow.com/questions/tagged/java
r/learnjava on Reddit: Join the community of Java learners and get advice, share resources, and discuss projects.
https://www.reddit.com/r/learnjava/

Remember: Learning to program takes practice and patience. Don't hesitate to experiment with code and participate in community discussions. Happy coding! 🎉

paper viper
charred pendant
#

Hello Everyone! Today, I decided to experiment on creating Custom Enchantments for my server, to make the experience cooler for the players. I tried implementing a custom enchantment using CodedRed's video (https://youtu.be/wd1FUOT-BJY?si=vWtiZM5qBmxUKwwZ) but I am experiencing some issues. The Constructor for my Custom Enchantment class doesn't allow any arguments inside the super() inheritage function, as shown in the video. Has something changed?

eternal night
#

are you running 1.15

charred pendant
#

1.21 to be exact

paper viper
#

The enchantment class changed

#

More specifically the constructor

eternal night
#

Yea so, that "hack" has been removed for a while ^

#

especially since 1.21 as minecraft now has custom enchantments in vanilla

charred pendant
#

Oh, didnt know what. Is there an alternative way to do so?

eternal night
#

Well, datapacks can do it in 1.21

#

||paper-api can do too run ||

charred pendant
#

Is there a tutorial for this?

#

Or is it "unofficial" ?

eternal night
#

For datapack generation ^

charred pendant
carmine mica
#

yes

charred pendant
#

I'll look into it. Thanks guys!

icy kelp
#

I have a problem

    public void onInventoryClose(InventoryCloseEvent event) {
        if (!isZrzutInventory(event.getView().getTitle())) {
            return;
        }

        Player player = (Player) event.getPlayer();
        Inventory inv = event.getInventory();



        player.sendMessage("X: " + blockPosition.get("0"));
    }``` Here blockPosition.get("0") gives me null, but everywhere it gives me my value
#

I've tried everything and I still don't know how to fix it

pliant topaz
#
  1. what is blockposition
icy kelp
pliant topaz
#

get takes in an integer

#

ah nvm

#

what are yiz excactly trying to do?

eternal oxide
#

did you add a key "0" ?

pliant topaz
#

because blockPosition.get("0) would yield the value associated with the key 0

#

0 is just your string, its not a position of some sort, just the identifier key to that integer value

icy kelp
#

Command gives me x, y, z and I need to get x, y, z in onInventoryClose

pliant topaz
#

and why do you store it in a map? if its just xyz use a Location instead

icy kelp
#

I mean thats a good idea

#

But my brain even didnt got that idea

pliant topaz
#

a map is only really useful in cases where you need to associate one value with another, say an enchantment as key and the level of it as value

icy kelp
#
    public void onInventoryClose(InventoryCloseEvent event) {
        if (!isZrzutInventory(event.getView().getTitle())) {
            return;
        }

        Player player = (Player) event.getPlayer();
        Inventory inv = event.getInventory();



        player.sendMessage("X: " + loc.getBlockX());
    }```

Why the location here is null?
#

loc = new Location(player.getWorld(), Integer.parseInt(args[0]), Integer.parseInt(args[1]), Integer.parseInt(args[2]));

umbral ridge
#

need to add a null check

pliant topaz
#

and make sure you are putting in the correct values are actually correct

icy kelp
#

I'm trying to fix that for like 1.5h or more...

pliant topaz
#

show your entire code which contains declaration and definiton of the location, where the args for it come from and what you have problems with

#

use ?paste

#

?paste

undone axleBOT
pliant topaz
#

there

icy kelp
pliant topaz
#

did you confirm your location is defined with the correct coordinates?

#

or any coordinates for that matter?

icy kelp
#

im gonna record you a fast video

#

it should print at the end player.sendMessage("X: " + loc.getBlockX());

#

but it didnt

pliant topaz
#

instead of doing loc = ... do this.loc

#

this just refers to the class, so you're not mistakenly modifying something else or not defining it correctly

icy kelp
#

still error

pliant topaz
#

can u paste your new code again please?

icy kelp
#

sure

pliant topaz
#

hm

#

sorry, i dont think i can help you with it unfortunately :/ maybe someone else here is able too

icy kelp
#

thats okay

chrome beacon
#

Don't detect inventories by their name

icy kelp
#

and thats actually not the problem

chrome beacon
chrome beacon
#

?gui

icy kelp
#

bruh you're the 2nd person who send me this and I even dont understand what about is that

#

you're sending me the designs

#

but I need the solution

chrome beacon
#

1.21

#

Or was it 1.20.5

#

One of the two

pliant topaz
chrome beacon
viscid carbon
#

Theres a command for this but i forget what it is lol

silent slate
#

Hey, ive been using this code to implement a local jar file and now all my other dependencies dont work anymore, they are marked red with the note of :cannot resolve symbol

Any ideas why?
Ive just put random things for groupId, artifactId and version, I dont know what to put there

            <groupId>me.mondlw.laserstaff</groupId>
            <artifactId>laserstaff</artifactId>
            <version>1.0</version>
            <scope>system</scope>
            <systemPath>H:/Lukas/\MC/Altstadt/LaserStaff-1.20/target/LaserStaff-1.0.jar</systemPath>
        </dependency>```
acoustic pendant
#

Hey! Does someone know why when using this

    public void restoreCrop() {

        World world = block.getWorld();
        Chunk chunk = block.getChunk();

        if (!chunk.isLoaded()) {
            world.loadChunk(chunk);
            chunk.setForceLoaded(true);
            chunk.load();
        }

        levelChunk.setLoaded(true);

        section.setBlockState(x, y, z, grownState);

        ClientboundBlockUpdatePacket packet = new ClientboundBlockUpdatePacket(blockPos, grownState);

        for (Player player : Bukkit.getOnlinePlayers()) {
            CraftPlayer craftPlayer = (CraftPlayer) player;
            ServerPlayer serverPlayer = craftPlayer.getHandle();
            serverPlayer.connection.send(packet);
        }

    }```
#

If the chunks unloads it doesn't work?

#

I have all those loads because i'm trying to solve it but it still doesn't work

#

If the player disconnects and the chunk unloads when this method is running, the block doesn't update

worldly ingot
#

I have no clue why you're using NMS for this though

#

Block#setType() and Player#sendBlockChange() both exist, but if you're changing the type on the server, the latter isn't necessary

acoustic pendant
kind hatch
#

It's because you are sending packets to the player.

#

Nothing is actually changing on the server

acoustic pendant
eternal oxide
#

set a chunk ticket until you are finished. Then the chunk can;t unload

acoustic pendant
#

Chunk ticket?

kind hatch
worldly ingot
#

Yes. Basically a "pls don't unload, i'm doing something"

kind hatch
#

If you are setting the block state directly, why the need for nms?

worldly ingot
#

We have API for it ^, but if you're dead-set on using NMS for it, obviously there's internal chunk tickets too

#

Ender pearls use them in the newest snapshot, for instance. Among other things, obviously. Nether portals and whatnot

acoustic pendant
#

Oh, so it would be like a chunk loader ig

worldly ingot
#

Yes

acoustic pendant
#

However, why setForceLoaded doesn't work there?

worldly ingot
#

¯_(ツ)_/¯

acoustic pendant
#

Is it really heavy if I never remove the Chunk ticket?

eternal oxide
#

yes, remove it when finished

#

else you end up with random chunks being kept loaded when there is no need

acoustic pendant
cunning solstice
#

guys, when creating plugins in intelij wich is better? - spigot, paper or bukkit

sly topaz
#

how is bukkit even an option

cunning solstice
#

but uh i feel like spigot and paper the same

eternal night
#

Well you are asking in the spigot discord, so, the answer is presumably just gonna be spigot

cunning solstice
#

:/

eternal night
#

Depends a lot more on your target environment. Are you planning on running the plugin on a paper server, just go with paper-api? Spgiot server? spigot-api

cunning solstice
#

purpur

eternal night
#

I mean, then you can even go with purpur-api lol

cunning solstice
#

:/

#

never heard of it but alr

eternal night
#

The only reason to go down the fork tree is if you wanna support such servers

cunning solstice
#

it exist daym

eternal night
#

if you don't need your plugin to ever run on spigot, there isn't much gain in using spigot-api

sly topaz
#

lynx trying hard to not just say to use paper

eternal night
#

trying very hard indeed

kind hatch
#

If you want maximum compatibility with all servers, you'll develop against spigot though.

cunning solstice
#

:/

#

i honestly coded with spigot a bit so i

#

g

eternal night
#

I mean, paper-api is based on spigot-api

#

purpur on paper

cunning solstice
#

true

kind hatch
eternal night
#

?

kind hatch
#

Paper specific plugins that utilize all of that don't work on spigot.

eternal night
#

never claimed that?

sly topaz
#

of course, if you use platform-specific API, then you're going to be vendor-locked

cunning solstice
#

:/

eternal night
#

but if they are gonna run their plugin on a purpur server, why should their plugin not be able to use the better API offered by paper and its forks

kind hatch
eternal night
#

the only reason you use spigot API is because you are gonna publish that plugin and, as you said, want maximal compatibility with any server out there

cunning solstice
#

im confused a bit xd

#

bt les not be mad

#

each api has it's feature

sly topaz
eternal night
#

Well the question is just, are you planning on releasing the plugin for others

#

or is it a private plugin

cunning solstice
eternal night
#

then yea, just go with spigot 👍

cunning solstice
#

XD

upper hazel
#

who knows how to catch exceptions that do not occur through "try cath" code?

#

exception event handling

#

any idea?

eternal oxide
#

no exception will not be caught in a try/catch

upper hazel
#

I need answers from those who have worked with spring, if there are any.

worldly ingot
#

Are you wanting to catch exceptions that haven't been handled by a try/catch?

upper hazel
worldly ingot
#

I want to say there's an exception hook somewhere in the runtime. I just can't find it

slender elbow
#

each thread has its own uncaught exception handler

worldly ingot
#

It's in Thread, right, thank you

slender elbow
#

or if it doesn't, there's the default one for all threads, but it can be overridden

worldly ingot
#
Thread.setDefaultUncaughtExceptionHandler((t, e) -> {
            
});
#

(then yes, one per thread, that's just the default one)

#
Thread thread = new Thread();
thread.setUncaughtExceptionHandler((t, e) -> {
            
});
upper hazel
#

oh

worldly ingot
#

Thread.currentThread() exists if that's all you want

upper hazel
#

Thanks, I'm gonna go dig into the java code.

#

runtime extends thread?

slender elbow
#

huh

#

no?

upper hazel
#

bruh

slender elbow
#

what are you looking at

upper hazel
#

those who've been working since spring will know what I mean.

#

exception handler

#

"exception process" - event hook this

#

runtime exception

#

I want to catch exceptions and send them to my server.

#

logs for plugin

#

for example

#

or want do some event

slender elbow
#

why not set the Thread's uncaught exception handler?

upper hazel
#

i want do like this

#

runtime exception handling

#

handling in custom event

slender elbow
#

you want to return an http response when an exception happens?

upper hazel
#

eh

#

no

slender elbow
#

then setting the thread's uncaught exception handler will do

#

like choco showed above

upper hazel
#

runtime not extend thead

#

you say so

slender elbow
#

what does runtime have to do with anything

upper hazel
#

okay, it doesn't matter. We're a little confused about the language barrier, but thanks for the tip.

slender elbow
#

???

#

choco's code example is a working example of how you can register an exception handler for exceptions that are not caught in a try-catch

upper hazel
#

this is dem traslater

#

deeple not help me 😦

slender elbow
#

i don't know what you mean by "runtime"

upper hazel
#

spring handling only runtime exceptions

#

not errror or smth else

slender elbow
#

okay?

#

what's the problem

eternal oxide
#

A runtime exception is ANY exception which occurs while the code is executing

slender elbow
#

you can just check instanceof Error return;

upper hazel
#

this was throwable

#

bruh

#

thread*

tidal hamlet
#

Yoo!
Is it possible to hide a command in tab?

chrome beacon
#

Yes

#

How you do that depends on what command you want to hide

tidal hamlet
#

what do you mean by "what command"?

#

@chrome beacon ^^

chrome beacon
#

Is it your command

#

Is it from another plugin

#

Is it a vanilla or spigot one

tidal hamlet
#

My command from my own plugin

#

a spigot one

chrome beacon
#

If you give that command a permission Spigot will remove it

#

For users without that permission

tidal hamlet
#

I still want people to be able to run it though, just don't see it in tab

chrome beacon
#

Why though

jagged quail
#

i got pinged thonk

chrome beacon
#

^ you can use that but it just seems like a bad idea

tidal hamlet
chrome beacon
eternal oxide
#

Never forgive! Drawn and quartered

tidal hamlet
chrome beacon
#

Is that command from the seedcracker mod

#

If so the server won't even see it

tidal hamlet
#

oh, we did get this though through the console

#

ahh you can't send images here?

chrome beacon
#

?img

undone axleBOT
#

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

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

chrome beacon
#

Client commands are usually intercepted by the client

tidal hamlet
chrome beacon
#

Meaning they don't get sent at all

#

Not sure if that's the case when it comes to the seedcracker mod

#

But I would assume so

tidal hamlet
#

I see, coz we have seen people using /seedcracker multiple times in the console, figured out we would make a plugin that insta bans people when they execute /seedcracker

chrome beacon
#

I mean sure you can use the api ElgarL sent for that

tidal hamlet
#

alright, gonna look into it. Thanks! :)

glossy laurel
#

How do I load YamlConfiguration files which contain player info async in between AsyncPlayerPreLoginEvent and PlayerJoinEvent

native bison
#

are u sure you shouldn't be using a database for that

young knoll
#

Why do you need to do it inbetween those events

rough ibex
#

I should use CF more.......

echo basalt
#

I have a dedicated collection class for that :)

native nexus
#

Anyone else running into status code: 522 while building (packaging) with maven?

eternal oxide
#

Not enough info, need log

native nexus
#

?paste

undone axleBOT
native nexus
eternal oxide
#

oh 1.8

native nexus
#

nvm I think I found out the problem...

slender elbow
#

5xx just means that the server hosting the maven repo is shitting itself

native nexus
#

Actually, yep no... placeholderapi is being a bum

#

Looks like the repo is offlince lmfao

slender elbow
#

yeah they're having issues

fading drift
#

is there a way to use run task plugin for spigot or just paper

carmine mica
#

dont cross post

glossy laurel
#

And is that javascript??!!

buoyant viper
#

thats

#

thats Kotlin

river oracle
#

.kt means Javascript

halcyon hemlock
#

javascript 👎

blazing ocean
pure dagger
#

if i have a list, main thread and BukkitRunnable have acces to the list - one gets the values in loop or adds elements, other one gets the values and removes them, do i have to use some synchronized word or something?

hazy parrot
#

Use locks or threadsafe collection

undone axleBOT
hybrid turret
#

every time it tries to write the file just contains [

#

this worked in a different project, why tf is it not working now?!

frail willow
#

When there is a world called first_world, is the data from its PersistentDataContainer stored in the world folder or in the first_world folder in a physical sense?

torpid blaze
#

Hey,
is there a way to send a Forward plugin message when a player joins a server?

hybrid turret
#

YES

#

but for now only til october

blazing ocean
hybrid turret
#

bc free prime

dark moth
#

is there any way to pop a totem without killing the player

shadow night
#

Probably

inner mulch
dark moth
#

but i want to texture it too

#

but give me ur idea

#

anyway

inner mulch
#

isnt there a player#playAnimation?

dark moth
#

ooo

#

dunno

#

idk

blazing ocean
#

no

dark moth
#

but i think the pop up is a particle effect

blazing ocean
grim hound
#

do per-world GameRules no longer work?

chrome beacon
#

Should work

grim hound
#

If I set a World object keepInventory to true

#

and someone changes it to false with a command

#

does that change the world's settings as well?

eternal night
#

yes

chrome beacon
#

yes

eternal night
#

(If they are in that world ™️)

grim hound
#

is there any event to prevent that?

eternal night
#

Don't give players permissions to change gamerules?

grim hound
eternal night
#

Yea

grim hound
#

I thought game rules were global

eternal night
#

no, they are per-world

grim hound
#

so a /gamerule only changes the gamerules of the very world it's executed in?

eternal night
#

yes

hidden fable
#

Hello!

#

I want to change the minimum spawn distance for mobs from 24 to 8

#

is it possible?

grim hound
small current
#

hello
i'm changing blocks to another material using sendBlockChange, then im turning them back to how they were. giving the material and byte

worldPlayer.sendBlockChange(location, type, data)

but some blocks, like moss block glitch and turn to air and you have to click on them to turn it back to moss. How this happens?

grim hound
eternal night
hidden fable
grim hound
#

it's only configurable in server.properties otherwise

hidden fable
#

let me check

hidden fable
#

in spigot server.properties

grim hound
grim hound
#

but what about Intel for example?

chrome beacon
#

Both Intel and AMD works

grim hound
#

okay

#

which one is said to be more compatible?

#

(we ain't talking about intel 8 & 9 slowly dying rn)

chrome beacon
#

Both are fine

proven ocean
#

Does anybody know Protocollib and can explain to me, why this error occurs?

        final PacketContainer packetContainer = protocolManager.createPacket(PacketType.Play.Server.ENTITY_METADATA, true);
        packetContainer.getBytes().write(0, glowingValue);
com.comphenix.protocol.reflect.FieldAccessException: Field index 0 is out of bounds for length 0
at com.comphenix.protocol.reflect.FieldAccessException.fromFormat(FieldAccessException.java:49) ~[ProtocolLib.jar:?]
at com.comphenix.protocol.reflect.StructureModifier.write(StructureModifier.java:315) ~[ProtocolLib.jar:?]
grim hound
#

is to switch to packet events

#

then we can talk

proven ocean
#

Can I send packets with packet-events?

#

Like forcefully send an update packet to the metadata? Or is that packet sent regularly by design?

grim hound
#

you can do even more than with protocol lib

proven ocean
#

ah

#

interesting

grim hound
#

packet events is a faster, more compatible, more intuitive packet library with more features and it even gives you more possibilities

#

like you can write a server engine with packet events

#

or even make a forked version without netty

grim hound
grim hound
#

and arm has 4 cpus and 24 gb of ram max

#

they hate me

#

will a minecraft server even start with 1 GB of ram?

chrome beacon
#

yes

#

but you might have less than 1GB since the OS will use some

grim hound
#

I always started up my vm with max ram so uh

#

will hope this can also be the case here

chrome beacon
#

Not recommended

grim hound
#

so how much should I allocate?

chrome beacon
#

Depends on how much the OS uses

#

Hard to say really

small current
#

hello
i'm changing blocks to another material using sendBlockChange, then im turning them back to how they were. giving the material and byte

worldPlayer.sendBlockChange(location, type, data)

but some blocks, like moss block glitch and turn to air and you have to click on them to turn it back to moss. How this happens?

dawn flower
#

How do I make the lore of any item to be separated by a new line for every x amount of characters?

#

Similar to how it would look if you were using a small monitor

tender shard
hybrid turret
#

huh thanks alex

young knoll
#

ChatPaginator can probably help you there

dawn flower
#

And how would I modify all items that is shown to players?

#

Is there a packet that shows the item to the player

young knoll
#

There is, yeah

dawn flower
#

Which one is it?

young knoll
#

I believe it’s the set slot packet

#

And also the window items packet

dawn flower
#

Is that the same packet sent to the player to modify their inventory?

#

Let's say a player does /lore add whatever, is that packet sent?

young knoll
#

Yeah

dawn flower
#

Alright, thanks

echo basalt
#

there are 2 packets

#

Window items and set slot

#

There's also equipment but that's wonky

#

Set slot is sent when setting a specific slot (let's say 0)

#

And window items is sent to update the entire inventory including cursor

#

If you're doing, let's say, client-sided lore

#

Make sure to update the cursor too

#

Now, the creative inventory is wonky is fucked and if you attempt to copy (middle-click) a modified item it'll actually modify it

young knoll
#

If you just move the item it'll actually modify it

#

Because the creative mode client has full authority on items

halcyon hemlock
#

hey everyone

#

illusion and coll

echo basalt
#

hi

thorn crypt
#

Hey hey, I was wondering, how can I retrieve in a list, all possible states of a block, for exemple the REDSTONE_WIRE, it has different states (redstone powered, wired to the east/north/south/west etc)

inner mulch
#

an if statement with lots of || isn't faster than a simple hashmap right?

river oracle
#

It'll be way faster because you have to end up iterating over your values collection with the map

#

If you're using all your Or statements anyways a hashmap isn't sensible as a data structure

eternal night
#

wat

river oracle
#

Not even sure how the two are remotely interchangeable

eternal night
#

oh I read ifelse

#

Well you could replace with a HashSet

river oracle
#

It looks way nicer at a large scale tho

inner mulch
#

true a set is better

#

map doesnt make sense

eternal night
#

compared to a lot of ||

river oracle
#

Imho a set still doesn't make sense it really depends how many || we are talking

#

If it's infinitely expandable you'll want a collection

inner mulch
#

all the java primitve wrappers

inner mulch
#

only at 70k it is faster??

river oracle
#

8 || is not that much

#

Or was it 7 meh whatever

slender elbow
#

||ing a few variables together isn't gonna be the bottleneck that slows your server down 💀

inner mulch
#

is there a better way to find out if its a java primitve

#

wrapper

eternal night
#

instanceOf

#

or use a switch

hybrid turret
#

can i get a list of all tamed animals of a specific player in the current world?

eternal night
#

no, they are not linked to the player data

hybrid turret
#

what

#

how does the game know who can sit them down and stuff?

eternal night
#

no like, sorry, the player does not know about them

torn shuttle
#

it's very, very good at guessing

slender elbow
#

the game is smart

eternal night
#

the entity knows its tamed by player x

hybrid turret
#

yea

eternal night
#

but player x does not know it tamed entity a, b and c

hybrid turret
#

pretty much that

#

any entity tamed by player X

eternal night
#

Yea you'll have to track that by yourself

hybrid turret
#

ergh

#

nothing with idk nbt or sum i can fumble with?

eternal night
#

I mean, you can iterate every entity loaded

#

but that would only yield the loaded ones

river oracle
#

Could go through every region file

hybrid turret
#

hmmm

eternal night
hybrid turret
#

ah yes

#

crashing the server 1 on 1

blazing ocean
#

mspt stonks

torn shuttle
#

framerate-based physics stonks

river oracle
#

Do it on startup

inner mulch
#

there is no way to have one method return all types of primitves right?

river oracle
#

Primitives aren't object so

#

Ya kinda can't

inner mulch
#

:(

torn shuttle
#

hm

#

can't you

river oracle
#

I smell meh design

eternal night
#

just return a long

torn shuttle
#

ok you can't unless you use wrappers

eternal night
#

and do some fuckery

torn shuttle
#

long?

#

coward

#

return a string

eternal night
#

even better

torn shuttle
#

can't believe chat is full of cowards today

slender elbow
#

LinkedList<Byte>

river oracle
torn shuttle
#

a real man gets a string and has an automation system set up to ping a random person on fiverr to categorize what kind of value it is

#

I'm bringing back jobs

#

I'm single-handedly offsetting any and all jobs lost to ai

slender elbow
#

didn't he die a long time ago?

eternal night
torn shuttle
#

I'll be the first non-american american president

#

finally some real diversity

worldly ingot
torn shuttle
#

I'm cancelling the antitrust lawsuit against google and instead I am forcing them to hire human switch operators to manually route all emails

#

boom, just created a trillion new jobs

worldly ingot
#

Any time I come in here there's like a 40% chance Emily wrote some cursed shit lol

eternal night
#

tbf I like my cursed shit better

worldly ingot
#

That was pretty bad too

#

Credit where credit is due

eternal night
#

its efficient

slender elbow
#

yeah lynx is studying for it

eternal night
#

pack every primitive into a long

#

big performance improvements

#

new paper patch incoming????

worldly ingot
#

Yeah. Less objects on the heap Kappa

eternal night
worldly ingot
#

2 ints or 1 long?

#

Yeah that’s what I thought

eternal night
#

IntPair for maximum performance

#

all the overhead of an object, all the discomfort of a packed primitive representation

rare cave
#

i want to add custom blocks to my server. is it okay to use mixin or modifying the source code would better?

eternal night
#

the best of both worlds

#

spigot does not support mixins

slender elbow
#

"but I'm running cardboard"

eternal night
#

wtf is cardboard

slender elbow
#

fabric x bukkit

eternal night
#

oh so they looked at mohist and went yes

slender elbow
#

tbf directly implementing the api isn't a terrible idea

#

porting server patches however

#

harold

eternal night
slender elbow
#

sponge did it but did it well

eternal night
#

.offer(Key.WHAT).flatMap(this::suckIt).firstChild(Player.class).cause().wtf()

slender elbow
#

hold my RegistryAccess.registryAccess().registry(RegistryKey.ENCHANTMENTS).getOrThrow(EnchantmentKeys.UNBREAKING).supportedItems().contains(RegistryAccess.refistryAccess().registry(RegistryKey.ITEMS).getOrThrow(ItemTypeKeys.WOODEN_SWORD))

rare cave
#

mohist i guess their development is unstable

eternal night
slender elbow
#

no clue

#

I never looked at their api

eternal night
#

oh

#

disappointed

slender elbow
#

can't risk voiding my cla

#

can't look at any api ever

worldly ingot
river oracle
slender elbow
grim ice
#

how do I stop Entity#setLeashHolder(null)

#

from dropping a leash

worldly ingot
#

I feel like that was a bug that got fixed

#

If it's still happening, we probably have to set pluginRemoved in setLeashHolder() as well

kind coral
#

hello everyone! may i ask for some help from you folks?

i am making a library for my plugins but for some reason i am getting a class cast exception (as far as i can see i am not casting anywhere)

Stacktrace: https://paste.gg/p/anonymous/1e1d26c855b74a129942544bb5be8f8c
CarpenterPlugin class: https://paste.gg/p/anonymous/210ff6fea0b54e609a3bb7b8dc56c1ae
Carpenter class: https://paste.gg/p/anonymous/7455dfa7a82544549ddb5985fcc11a7c
StringConfigurationEntryBridge https://paste.gg/p/anonymous/7f4ea434b7b44e00b32420877e26bf87

pure dagger
worldly ingot
# kind coral hello everyone! may i ask for some help from you folks? i am making a library f...

I'm confused. What's the difference between your CarpenterPlugin and Carpenter classes? It seems to me CarpenterPlugin isn't actually your JavaPlugin instance, Carpenter is. JavaPlugin#getPlugin() is getting from the ClassLoader which plugin loaded that class and tries to cast it as type <T> (which in this case, is CarpenterPlugin). Which raises the question, why is the former extending JavaPlugin?

kind coral
#

CarpenterPlugin is used in all the plugins depending on the Carpenter library

#

Carpenter is the main class of the library

worldly ingot
#
public class ExamplePlugin extends JavaPlugin {

}

public class SomeOtherClassInMyPlugin {

    public static SomeOtherClassInMyPlugin getInstance() {
        // This is ExamplePlugin because that's what loaded this class
        Object instanceObject = JavaPlugin.getPlugin(SomeOtherClassInMyPlugin.class);

        // This is Java casting it to this type (which it's not)
        SomeOtherClassInMyPlugin instance = (SomeOtherClassInMyPlugin) instanceObject;
        return instance;
    }

}
#

This is essentially what's happening right now, if I'm understanding it correctly

#

CarpenterPlugin was loaded by Carpenter so it's part of Carpenter's classloader

kind coral
#

the CarpenterPlugin class is used in another project

#

with its own plugin.yml etc.

#

it depends on the carpenter library to work

worldly ingot
#

I'd still avoid using JavaPlugin#getPlugin() for this. You're likely better off just with a static accessor

#

JP#gP() is your issue currently

kind coral
#

what do you suggest in this case? considering i have many addons to develop that depend on the Carpenter library

#
package it.alessandrocalista.roleplaycops;

import it.alessandrocalista.roleplaycops.item.BulletItem;
import it.alessandrocalista.roleplaycops.item.GunItem;
import tech.nicecraftz.carpenter.CarpenterPlugin;

public final class RoleplayCopsPlugin extends CarpenterPlugin {

    @Override
    public void load() {
        getLogger().info("loading roleplaycops");
        loadCopItems();
        getLogger().info("RoleplayCops has loaded successfully.");
    }

    private void loadCopItems() {
        getLogger().info("loading cop items");
        BulletItem bulletItem = new BulletItem();
        getLogger().info("loading bullet item");
        registerCarpenterItem(bulletItem);
        getLogger().info("loaded bullet item");
        registerCarpenterItem(new GunItem(bulletItem));
        getLogger().info("loaded gun item");
        registerCarpenterItem(new GunItem(bulletItem));
        getLogger().info("loaded gun item");
    }

    @Override
    public void unload() {
    }

    @Override
    public String getProductName() {
        return "roleplaycops";
    }
}
#

this is the main class of the addon for example

#

kind of debugging a lot, sorry for that, needed to use mockbukkit but cant rn

worldly ingot
#

Extending a class that extends JavaPlugin also feels sketchy to me, especially if it's part of another class loader

kind coral
#

Do you suggest making CarpenterPlugin a final public class

worldly ingot
#

Which it seems to be, because you said it's its own plugin

kind coral
#

like using composition instead of inheritance

worldly ingot
#

Well I don't think that consumers of your library should ever be calling upon your library's plugin instance

#

Ideally that's hidden entirely

kind coral
#

The addons most of the time just call on the Carpenter library for the configurationprocessor and item builder / and some static utilities

#

like should i make a abstraction layer on top of carpenter and base my plugins off of that?

sly topaz
#

I don't understand the benefit of the abstraction here

#

you just changed the onEnable/onDisable method names

#

just adding a namespace you track on your own (why not just use the plugin name if it is different plugins?) sounds rather pointless imo

kind coral
#

well i also need to process class annotations etc.

#

Like, because i handle my messages and config data with the use of annotation i decided to have a class extending javaplugin to manage them directly and avoid typing the same line of code when i for example:

  • reload the config ( i process every tracked object and set the new data to the annotated fields of that object )
  • register the events/items ( they automatically get processed as well as the custom items when they get registered )
  • has me the configuration processor and item service always on scope on the main class of the plugin
proper cobalt
#

Does anyone know how I can construct this packet using ProtocolLib

Set Equipment
Packet ID     State     Bound To     Field Name     Field Type     Notes
0x5B     Play     Client     Entity ID     VarInt     Entity's ID.
Equipment     Slot     Array     Byte Enum     Equipment slot (see below). Also has the top bit set if another entry follows, and otherwise unset if this is the last item in the array.
Item     Slot     

I've tried this:

public static void setEquipment(Player player, int entityId) {
        // 0x5B
        PacketContainer packet = protocolManager.createPacket(PacketType.Play.Server.SPAWN_ENTITY);

        packet.getIntegers().write(0, entityId);
        packet.getItemSlots().write(0, EnumWrappers.ItemSlot.HEAD);
        packet.getItemModifier().write(0, SkullCreator.itemFromBase64("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMzJmZjhhYWE0YjJlYzMwYmM1NTQxZDQxYzg3ODIxOTliYWEyNWFlNmQ4NTRjZGE2NTFmMTU5OWU2NTRjZmM3OSJ9fX0=")); // TODO(): get from cfg

        protocolManager.sendServerPacket(player, packet);
    }

But that gives me com.comphenix.protocol.reflect.FieldAccessException: Field index 0 is out of bounds for length 0

chrome beacon
proper cobalt
#

Wait I'm an idiot

#

I forgot to change it

sly topaz
#

why are you sending the packet manually tho, I believe there's API for that

proper cobalt
#

This is why u dont copy n paste code

proper cobalt
sly topaz
chrome beacon
#

^^

proper cobalt
#

How do I pass LivingEntity to that

#

Cuz I'm spawning the armour stand using packets too

chrome beacon
#

Just use ProtocolLib then

proper cobalt
#

I am

neon wraith
#

I was wondering if there was a website or somewhere you could see all available packets

proper cobalt
sly topaz
#

wiki vg has the protocol reference, however the names often don't match spigot/mojmap so you'll have to do some guess work there

proper cobalt
#

Even with this code

    public static void setEquipment(Player player, int entityId, String skin) {
        // 0x5B
        PacketContainer packet = protocolManager.createPacket(PacketType.Play.Server.ENTITY_EQUIPMENT);

        packet.getIntegers().write(0, entityId);
        packet.getItemSlots().write(0, EnumWrappers.ItemSlot.HEAD);
        packet.getItemModifier().write(0, SkullCreator.itemFromBase64(skin));

        protocolManager.sendServerPacket(player, packet);
    }

I get com.comphenix.protocol.reflect.FieldAccessException: Field index 0 is out of bounds for length 0 on line 52
This is line 52: packet.getItemSlots().write(0, EnumWrappers.ItemSlot.HEAD);

eternal oxide
#

?mappings

undone axleBOT
sly topaz
neon wraith
proper cobalt
#

I see the problem I guess,

    packet.getItemSlots().write(0, EnumWrappers.ItemSlot.HEAD);
        packet.getItemModifier().write(0, SkullCreator.itemFromBase64(skin));

These 2 need to be written to the first array instead of seperately

proper cobalt
neon wraith
sly topaz
#

you can not

neon wraith
sly topaz
#

sending the packet to a single player will just cause buggy behavior, the tick is handled almost completely by the server and the player follows

neon wraith
#

Got it

young knoll
#

Certainly would be interesting

hushed spindle
#

i dont know if i can ask about resource packs here, but im trying to remodel a golden apple and enchanted golden apple to something. enchanted golden apple works, regular golden apple doesn't. the json files apart from their model paths are exactly the same (i even copied the enchanted golden apple file from the golden apple). it's almost like golden_apple is not a recognized material

#

the issue doesnt seem to be related to the contents of the file, because i renamed the golden apple json to enchanted_golden_apple.json and removed the other one and that worked fine for enchanted golden apples

young knoll
#

check client logs

hushed spindle
#

no errors in client logs either

halcyon hemlock
#

Rate it out of 11

#

Compared to spigot

#

event system

young knoll
#

0/11

#

Name before type in function parameters = bad language

#

Don’t @ me

glossy laurel
#

How do you use YamlConfiguration async?

ivory sleet
glossy laurel
river oracle
#

YamlConfiguration has negligable performance impact

ivory sleet
#

No i meant are you writing, or are you reading or doing both concurrently?

young knoll
#

YamlConfiguration is essentially a fancy map wrapper

#

I don’t think said map is concurrent

ivory sleet
#

Its not

glossy laurel
#

Hm

#

Could it be blocking?

#

Or something like thay

river oracle
#

IO always blocks unless its done asynchronously concurrently

young knoll
#

It’s not io if it’s already loaded

#

Or you are saving it

river oracle
glossy laurel
glossy laurel
young knoll
#

Futures!

#

Woo

river oracle
#

which can probably be done asynchronously given you reach into the lower level stuff of whatever that YAML library is called again

glossy laurel
young knoll
young knoll
glossy laurel
#

You just slap it all in one block and youre fine so like

#

🤷‍♂️

#

So completableFuture in minecraft plugins is legit recommended?

river oracle
river oracle
echo basalt
#

speaking of concurrent loading

glossy laurel
echo basalt
#

have any of y'all nerds faced wonky issues with loading files async?

glossy laurel
river oracle
echo basalt
#

for some reason this has random moments where the file exists but it just returns nun

#

either that or it fails to read and assumes 0 as the default value for the int, still haven't debugged

glossy laurel
#

💀

glossy laurel
#

Or suplyAsync

#

The basic kind

#

Where it just starts running stuff without blocking

river oracle
#

I'd make an ExecutorService too so you don't use to many threads

glossy laurel
#

How do I make a feature block the thread if it still isn't completed at an event

river oracle
#

but yeah you don't really need much

young knoll
#

It uses the common pool by default doesn’t it

glossy laurel
#

Aint it like 16

river oracle
river oracle
#

there is no one answer

glossy laurel
young knoll
#

Better than the craft scheduler pool

#

It’s unbounded :p

glossy laurel
#

So what happens if u run out of threads? It just queues up tasks?

young knoll
#

It makes a new one

#

I once had some bad code that kept blocking threads forever

#

and eventually there were a lot

echo basalt
#

depends on the pool thumbsup

#

craft scheduler uses a cached thread pool? o_o good to know

glossy laurel
#

I was thinking of storing them in a hashmap

blazing ocean
glossy laurel
#

But idk how to make a feature to store in hashmap so like

hushed spindle
#

basic file io too

#

or do you mean smtn else

glossy laurel
#

I dont get it

#

Is it like yaml configuration

hushed spindle
#

google json api

glossy laurel
#

But nor tly

young knoll
#

It’s a json api

#

Made by google

glossy laurel
glossy laurel
hushed spindle
#

yea shoulda been more clear there

glossy laurel
#

I thought it was built into bukkit as yaml?

young knoll
#

What

hushed spindle
#

bukkit has yamlconfiguration if thats what you mean

young knoll
#

Yaml and json aren’t the same

#

Mostly*

hushed spindle
#

it does a decent job

#

good for configs but little else

#

json is solid for a lot of tasks but its easier to make syntax mistakes in it so its not as recommended for config stuff

#

the average joe is more likely to fuck it up