#help-development
1 messages · Page 1131 of 1
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
Do you have the client stacktrace?
this is client stacktrace
i added in the line spigot does that i ignored (Unpooled.wrappedBuffer) and now it works flawlessly 🫠 what the fuck

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
anyways
i suck at network related code, is there a better way to handle that shit
I don't see you calling the finish methods anywhere?
might be worth just making the decoders implement autoclosable instead of having your own close (finish) method
they are called in the decode and encode method in GenderData, weird places, i know
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)
the structure is kinda weird but the code looks fine
Use the DataInput and DataOutput interfaces if you want to do it that way
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
its supposed to let me not resend all of the saved data when say only 1 player updates their settings
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
I mean, you do have to send it always, otherwise the other players won't get updates
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
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
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
yeah
why is PlayerSpawnChangeEvent @Deprecated and for removal?
Are u sure u are using spigot
ah okay, I understand the confusion now
If I had a nickel for every person that asks about a deprecation that comes from paper
youd have at least 2
Enable online mode and the server will handle that for you 
Yes
In quite a lot of communities (especially non-english) an official minecraft account is referred to as 'license'
I would say its more used in the non-english communities then it is in the english ones
Yes
🗿
why can't I load a native lib?
so do you know why it happens?
cuz this is weird
Cannot load amd64 on aarch
if the native is not in the java.library.path then the native must reside in the same directory as the jar

using java -XshowSettings:properties -version you can find the java.library.path
aaaah
I might've compiled my jar wrongly then
I mean, makes sense
I meant that I compiled it into my jarinjar, not the most outer jar
yeah, I'm not really sure
look for java.library.path
I mean I see it
those are the shared lib paths for natives
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
/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
isn't only "loadLibrary" the thing that even relates to the library path tho?
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
Well yea, there is a file not found or am I tripping
so is it that this library is unsupported in my environment or that the file actually cannot be found?
idk, the screenshot is blurry af on my phone
terrible people would say pastebins exist
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

Imagine a world where people actually used pastebins
What a cruel and unfair world that would be
if the native you are trying to load is amd64 do know that there is a aarch64 version as well
Why libp-cap on a minecraft plugin?
They're trying to hijack the connection so they can make a login plugin for offline mode servers
no xd
Then what are you doing
I'm really just testing out on how this works
this makes no sense unless you were trying to mitm
Arch Linux ARM 
um uh
do you perhaps know the command to downloading this stuff on the console?
can use curl if you want
use -O option before the link
did you check to see if it downloaded?
✨ -L ✨
as with like any other package repo, you are gonna be redirected to a mirror for the actual file
show the commands code
It might actually be the fact that it cannot be found
at what point are you getting the link error?
start-up
well the dependencies for libpcap is glibc and libnl
it shows up when I try to load pcap
yeah thats just headers though. natives are platform specific
did you sudo apt-get install... ?
I'll try it in a different plugin and see if my build is the issue
i still trying to understand how dependencies work, can anyone explain pls?
first thing: use packet events
not protocol lib
im newbie though
- protocol lib just seemed interesting
precisely
no way is that an argument against using packet events
both libs are packet libs
show your build.gradle
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
}
}
i may be good at modding, but right now im making mc server, so im trying to learn how plugin works
alr :/
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`
so i have to clear them or what
and compileOnly("com.github.retrooper:packetevents-spigot:2.4.0") in dependencies
no
alr :/
cuz these are for spigot
just pasted
yep
ok :/
now this
ok, i clicked reload and it has errors
add mavenLocal()
breh
Pretty sure PE is on maven central...
then remove the api part
I just said whatever came to mind
remove
api
one
and add maven("https://repo.codemc.io/repository/maven-releases/")
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
}
}
(how it was on start)
@cunning solstice just follow this
wdym
good luck 👍
@cunning solstice read
this
not just copy and paste
read
btw
it exists within my jar
that's what the lib does
for loading
ClassLoader#getResourceAsStream instead
you mean that I should recompile it?
what
why
cuz this doesn't work for me
just do this lol
but where?
Instead of doing it on the class
that's the library's code
PCapNative.class.getResourceAsStream
I get what you mean
but why?
idk ask lynx
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
wait, but doesn't Files.copy already create a file?
oh
if that is the libs code, I guess they know what they are doing
I mean, it had no updates in more than a year
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
but this one is really weird
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
yeah I know
https://docs.packetevents.com/getting-started
The code blocks provided below include a placeholder PLATFORM; please substitute it with one of the supported modules: spigot, bungeecord, velocity
You just replace ‘platform’ with ‘spigot’ for example
anyone know something I can use for running mc server through intellij for debugging
hi
I'm trying to make some basic changes in one of my plugins config files, but it's not working
I need a fast help
WHAT OKAY
SPIT IT OUT
FASTER
you gotta type faster man what if everything explodes
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
I'm learning it
don't abuse class fields for storing data on your inventories
this will break if two players run the command at any point
I need to get the args[0] args[1] args[2] in the event called onInventoryClose
XD
You mean storing values in the HashMap?
oh my friend did you not read the thread at all?
I'm searching there for storing values
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
actually you're not helping me
you just can say what do to and I'm gonna learn with that
not that thread
- Follow the general recommendations of that thread for Menu Design
- Pass the data you want into the constructor of your Menu, its then stored for later
- Grab your Menu and use what data you need in InventoryCloseEvent
About that design here you're just telling me that I need to make everything with objects?
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
So will this lib just never work on any aarch systems?
xd
?learnjava
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! 🎉
Yes because it specifically said it was for “AMD64”
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?
are you running 1.15
1.21 to be exact
Yea so, that "hack" has been removed for a while ^
especially since 1.21 as minecraft now has custom enchantments in vanilla
Oh, didnt know what. Is there an alternative way to do so?
Is this the paper-api method?
yes
I'll look into it. Thanks guys!
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
- what is blockposition
public Map<String, Integer> blockPosition = new HashMap<>();
did you add a key "0" ?
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
Command gives me x, y, z and I need to get x, y, z in onInventoryClose
and why do you store it in a map? if its just xyz use a Location instead
... I didnt think about that
I mean thats a good idea
But my brain even didnt got that idea
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
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]));
need to add a null check
and make sure you are putting in the correct values are actually correct
I'm trying to fix that for like 1.5h or more...
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
there
did you confirm your location is defined with the correct coordinates?
or any coordinates for that matter?
im gonna record you a fast video
it should print at the end player.sendMessage("X: " + loc.getBlockX());
but it didnt
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
still error
can u paste your new code again please?
hm
sorry, i dont think i can help you with it unfortunately :/ maybe someone else here is able too
thats okay
Don't detect inventories by their name
then how?
and thats actually not the problem
No the problem is most likely you having two instances of the same class
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
Actually, a build plan is often better then the solution, because you learn in the process of making it
I did tell you what the problem is
People here dont spoonfeed.
They want to help with your problem and have you figure out how to fix it yourself, therefore making you a better programmer and problem solver
Theres a command for this but i forget what it is lol
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>```
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
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
I know, I have been told that a lot, just practicing with NMS and it is a bit better performance-wise.
However I was looking why this code woudn't work if the player disconnects (I guess if the chunk unloads) Could you help me with that?
It's because you are sending packets to the player.
Nothing is actually changing on the server
Yeah, but the block it's still updating
set a chunk ticket until you are finished. Then the chunk can;t unload
Chunk ticket?
I don't get it
Yes. Basically a "pls don't unload, i'm doing something"
If you are setting the block state directly, why the need for nms?
I'll look that thanks
.
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
Oh, so it would be like a chunk loader ig
Yes
However, why setForceLoaded doesn't work there?
¯_(ツ)_/¯
yes, remove it when finished
else you end up with random chunks being kept loaded when there is no need
Uh, I'll try that
guys, when creating plugins in intelij wich is better? - spigot, paper or bukkit
Spigot or paper
how is bukkit even an option
bukkit no code xd
but uh i feel like spigot and paper the same

Well you are asking in the spigot discord, so, the answer is presumably just gonna be spigot
:/
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
purpur
I mean, then you can even go with purpur-api lol
The only reason to go down the fork tree is if you wanna support such servers
it exist daym
if you don't need your plugin to ever run on spigot, there isn't much gain in using spigot-api
lynx trying hard to not just say to use paper
trying very hard indeed
If you want maximum compatibility with all servers, you'll develop against spigot though.
true
Tell that to all of the events that paper has that spigot doesn't.
?
Paper specific plugins that utilize all of that don't work on spigot.
never claimed that?
of course, if you use platform-specific API, then you're going to be vendor-locked
:/
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
That's only if they intend to run it on that platform and not any others.
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
just use whatever you feel is the best
Well the question is just, are you planning on releasing the plugin for others
or is it a private plugin
spigot fr fr
then yea, just go with spigot 👍
XD
who knows how to catch exceptions that do not occur through "try cath" code?
exception event handling
any idea?
no exception will not be caught in a try/catch
I need answers from those who have worked with spring, if there are any.
Are you wanting to catch exceptions that haven't been handled by a try/catch?
Yes, and also the ones that have been processed.
I want to say there's an exception hook somewhere in the runtime. I just can't find it
each thread has its own uncaught exception handler
It's in Thread, right, thank you
or if it doesn't, there's the default one for all threads, but it can be overridden
Thread.setDefaultUncaughtExceptionHandler((t, e) -> {
});
(then yes, one per thread, that's just the default one)
Thread thread = new Thread();
thread.setUncaughtExceptionHandler((t, e) -> {
});
oh
Thread.currentThread() exists if that's all you want
bruh
what are you looking at
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
why not set the Thread's uncaught exception handler?
you want to return an http response when an exception happens?
then setting the thread's uncaught exception handler will do
like choco showed above
what does runtime have to do with anything
okay, it doesn't matter. We're a little confused about the language barrier, but thanks for the tip.
???
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
i don't know what you mean by "runtime"
A runtime exception is ANY exception which occurs while the code is executing
you can just check instanceof Error return;
I get it now. I was confused because I thought the Thead was some other kind of exception.
this was throwable
bruh
thread*
Yoo!
Is it possible to hide a command in tab?
If you give that command a permission Spigot will remove it
For users without that permission
I still want people to be able to run it though, just don't see it in tab
Why though
i got pinged 
^ you can use that but it just seems like a bad idea
my bad, sorrii.
Yeah they pinged you instead of me
Never forgive! Drawn and quartered
we are making a anti seedcracker plugin. if you execute /seedcracker the plugin registers that
?img
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
Client commands are usually intercepted by the client
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
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
I mean sure you can use the api ElgarL sent for that
alright, gonna look into it. Thanks! :)
How do I load YamlConfiguration files which contain player info async in between AsyncPlayerPreLoginEvent and PlayerJoinEvent
are u sure you shouldn't be using a database for that
Why do you need to do it inbetween those events
I should use CF more.......
meh
I have a dedicated collection class for that :)
basics is the best 💪
lol
Anyone else running into status code: 522 while building (packaging) with maven?
Not enough info, need log
?paste
https://paste.md-5.net/caropapuro.sql This is the problem I am having when building >.<
oh 1.8
nvm I think I found out the problem...
5xx just means that the server hosting the maven repo is shitting itself
Actually, yep no... placeholderapi is being a bum
Looks like the repo is offlince lmfao
yeah they're having issues
is there a way to use run task plugin for spigot or just paper
dont cross post
Thats kinda bad
And is that javascript??!!
.kt means Javascript
javascript 👎
meh
💯
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?
Use locks or threadsafe collection
i'm trying to serialize the contents of an inventory using: https://paste.md-5.net/gisasoqubo.java
every time it tries to write the file just contains [
this worked in a different project, why tf is it not working now?!
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?
Hey,
is there a way to send a Forward plugin message when a player joins a server?
PINK SHIOKU

is there any way to pop a totem without killing the player
Probably
do you just want to play the animation?
yea
but i want to texture it too
but give me ur idea
anyway
isnt there a player#playAnimation?
no
i actualy thought of that
but i think the pop up is a particle effect
literally does not exist
do per-world GameRules no longer work?
Should work
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?
yes
yes
(If they are in that world ™️)
is there any event to prevent that?
Don't give players permissions to change gamerules?
so otherwise it changes only the world they use that gamerule in?
Yea
I thought game rules were global
no, they are per-world
so a /gamerule only changes the gamerules of the very world it's executed in?
yes
Hello!
I want to change the minimum spawn distance for mobs from 24 to 8
is it possible?
what about console then?
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?
World/Player::setSimulationDistance on paper
the console is gonna use the default level
on Spigot it's not possible?
pretty sure, yeah
it's only configurable in server.properties otherwise
let me check
there's simulation-distance = 10
in spigot server.properties
which one of these bad bois will work with this?
like Arm won't
but what about Intel for example?
Both Intel and AMD works
okay
which one is said to be more compatible?
(we ain't talking about intel 8 & 9 slowly dying rn)
Both are fine
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:?]
first thing to do
is to switch to packet events
then we can talk
Can I send packets with packet-events?
Like forcefully send an update packet to the metadata? Or is that packet sent regularly by design?
you can
you can do even more than with protocol lib
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
not to mention that it breaks less
bump
bruh, amd and intel are limited to 1 CPU and 1 GB of RAM
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?
I always started up my vm with max ram so uh
will hope this can also be the case here
Not recommended
so how much should I allocate?
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?
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
huh thanks alex
ChatPaginator can probably help you there
And how would I modify all items that is shown to players?
Is there a packet that shows the item to the player
There is, yeah
Which one is it?
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?
Yeah
Alright, thanks
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
If you just move the item it'll actually modify it
Because the creative mode client has full authority on items
hi
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)
an if statement with lots of || isn't faster than a simple hashmap right?
If is faster lol
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
wat
A hashmap makes 0 sense as a replacement for an if with a bunch of or
Not even sure how the two are remotely interchangeable
Hashset would still technically be slower
It looks way nicer at a large scale tho
Well a hashset could be faster
compared to a lot of ||
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
all the java primitve wrappers
70k
only at 70k it is faster??
Oh my lord
8 || is not that much
Or was it 7 meh whatever
||ing a few variables together isn't gonna be the bottleneck that slows your server down 💀
can i get a list of all tamed animals of a specific player in the current world?
no, they are not linked to the player data
no like, sorry, the player does not know about them
it's very, very good at guessing
the game is smart
the entity knows its tamed by player x
yea
but player x does not know it tamed entity a, b and c
Yea you'll have to track that by yourself
I mean, you can iterate every entity loaded
but that would only yield the loaded ones
Could go through every region file
hmmm
speed
framerate-based physics 
Do it on startup
there is no way to have one method return all types of primitves right?
No
Primitives aren't object so
Ya kinda can't
:(
I smell meh design
just return a long
ok you can't unless you use wrappers
and do some fuckery
even better
can't believe chat is full of cowards today
LinkedList<Byte>
The real man's linked list
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
didn't he die a long time ago?
run for president
wtf
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
Any time I come in here there's like a 40% chance Emily wrote some cursed shit lol
tbf I like my cursed shit better
its efficient
yeah lynx is studying for it
pack every primitive into a long
big performance improvements
new paper patch incoming????
Yeah. Less objects on the heap 

IntPair for maximum performance
all the overhead of an object, all the discomfort of a packed primitive representation
i want to add custom blocks to my server. is it okay to use mixin or modifying the source code would better?
"but I'm running cardboard"
wtf is cardboard
fabric x bukkit
oh so they looked at mohist and went yes
tbf directly implementing the api isn't a terrible idea
porting server patches however
harold
paid actor
sponge did it but did it well
.offer(Key.WHAT).flatMap(this::suckIt).firstChild(Player.class).cause().wtf()
hold my RegistryAccess.registryAccess().registry(RegistryKey.ENCHANTMENTS).getOrThrow(EnchantmentKeys.UNBREAKING).supportedItems().contains(RegistryAccess.refistryAccess().registry(RegistryKey.ITEMS).getOrThrow(ItemTypeKeys.WOODEN_SWORD))
mohist i guess their development is unstable
What does the sponge version of this look like 
RegistryAccess.refistryAccess()
New Paper api coming soon??
Real I haven't looked at an api in years
perks of writing code on my phone
I feel like that was a bug that got fixed
By https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/commits/e54f39adca5d3f10e7ddc2113109f1645c586161 possibly? Some time last year?
If it's still happening, we probably have to set pluginRemoved in setLeashHolder() as well
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
that means synchronized block? sorry im just starting to learn it
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?
CarpenterPlugin is used in all the plugins depending on the Carpenter library
Carpenter is the main class of the library
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
the CarpenterPlugin class is used in another project
with its own plugin.yml etc.
it depends on the carpenter library to work
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
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
Extending a class that extends JavaPlugin also feels sketchy to me, especially if it's part of another class loader
Do you suggest making CarpenterPlugin a final public class
Which it seems to be, because you said it's its own plugin
like using composition instead of inheritance
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
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?
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
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
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
Looks like you're sending the wrong packet
What packet should I be sending?
Wait I'm an idiot
I forgot to change it
why are you sending the packet manually tho, I believe there's API for that
This is why u dont copy n paste code
I'm using ProtocolLib
^^
How do I pass LivingEntity to that
Cuz I'm spawning the armour stand using packets too
Just use ProtocolLib then
I am
I was wondering if there was a website or somewhere you could see all available packets
Yeah its called https://wiki.vg
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
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);
?mappings
Compare different mappings with this website: https://mappings.cephx.dev
I mean, even with mappings, if you don't know what name to look for you're kinda lost still lol
Ok so I see you can set if the clients tick rate is frozen but is there anyway to change the tick rate of the client to a number and not just frozen and not frozen?
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
declaration: package: org.bukkit, interface: ServerTickManager
Not sure I'm new to packets
Not sure what type of array though
I am trying to see if I can set a single players ticks so they would be in slow motion while others won’t
you can not
Ok
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
Got it
Certainly would be interesting
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
check client logs
no errors in client logs either
How do you use YamlConfiguration async?
????
In what way?
In a way that doesn't affect main server thread's performance
YamlConfiguration has negligable performance impact
No i meant are you writing, or are you reading or doing both concurrently?
YamlConfiguration is essentially a fancy map wrapper
I don’t think said map is concurrent
Its not
Then why does mspt increase by 4 when im doing it
Hm
Could it be blocking?
Or something like thay
IO always blocks unless its done asynchronously concurrently
I think they mean writing and reading it?
Yea
Right how do I do it concurrently then
which can probably be done asynchronously given you reach into the lower level stuff of whatever that YAML library is called again
Completable?
You can load or save it asynchronously just fine
Mhm
Meh
You just slap it all in one block and youre fine so like
🤷♂️
So completableFuture in minecraft plugins is legit recommended?
wasn't sure if bukkits methods were thread safe like that
unless you hate yourself
speaking of concurrent loading
Explain
have any of y'all nerds faced wonky issues with loading files async?
Havent tried yet 😏
I genuinely can't imagine life without CompletableFuture
Damn
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
💀
Right so since Ive only ever used it for runAsyn
Or suplyAsync
The basic kind
Where it just starts running stuff without blocking
I'd make an ExecutorService too so you don't use to many threads
How do I make a feature block the thread if it still isn't completed at an event
but yeah you don't really need much
It uses the common pool by default doesn’t it
Whats the default
Aint it like 16
yeah it does
Was about to say
So what happens if u run out of threads? It just queues up tasks?
It makes a new one
I once had some bad code that kept blocking threads forever
and eventually there were a lot
.
I was thinking of storing them in a hashmap
you suck !
But idk how to make a feature to store in hashmap so like
nope, at least gson has always done its job consistently
basic file io too
or do you mean smtn else
Whats gson guys
I dont get it
Is it like yaml configuration
google json api
But nor tly
I was wondering if google was a verb or a noun there
Oh
yea shoulda been more clear there
I thought it was built into bukkit as yaml?
What
bukkit has yamlconfiguration if thats what you mean

||



