#help-development
1 messages Β· Page 1073 of 1
send the text here @amber ferry
i love that gif
done.


i have send the whole text dokument to you per dm
Open jdk
lol
why dont you just use
?paste
as we've told you multiple times before now
i'm not able to change the console output
println("setting system out")
System.setOut(new PrintStream(System.out, true) {
override def print(s: String): Unit = {
super.println("Detected print")
super.print(s)
}
})
println("test")
[18:37:27] [Server thread/INFO]: setting system out
[18:37:27] [Server thread/INFO]: test
its just not changing the sys out
helps
xD
ok, so I was testing it out today
found the issue
spigot's logger is still using the old system out
and it seems like ItemFactory requires a string like /give
hm
not what toString returns ({STONE x 10})
I have this exception: Could not pass event CreateTeamEvent to BetterTeams_TokenEnchantBank_Addon v1.0.2 com.google.gson.JsonIOException: Failed making field 'java.io.File#path' accessible; either increase its visibility or write a custom TypeAdapter for its declaring type.
And this is my code:
Gson gson = new Gson();
try {
File file = new File(BetterTeams_TokenEnchantBank_Addon.getPlugin().getDataFolder().getAbsolutePath()+"/teams.json");
Writer writer = new FileWriter(file,false);
allTeams.sort(new Comparator<TeamBankModel>() {
@Override
public int compare(TeamBankModel team1, TeamBankModel team2) {
return team1.getTeamName().compareTo(team2.getTeamName());
}
});
gson.toJson(allTeams, writer);
writer.flush();
writer.close();
System.out.println("Bank Saved");
} catch (IOException e) {
e.printStackTrace();
}
}```
Can you help me figure out what is the problem?
use System.out.println instead then
it doesnt know how to serialize a File
could make it transient to ignore it
and please cache your gson instance
...
that wouldnt solve it either as all of the loggers were already initialized to the old sys out
i solved the issue by adding an appender to the root logger
Whats the purpose of the wildcard * in the plugin.yml file? For example:
Plugin1.yml:
permissions :
permission.node.* : (use of wildcard)
description: "This is a permission node"
default: op
children:
permission.node.child: true
another.permission.node:
description: "This is another permission node"
default: not op
Plugin2.yml:
permissions :
permission.node: (no use of wildcard *)
description: "This is a permission node"
default: op
children:
permission.node.child: true
another.permission.node:
description: "This is another permission node"
default: not op
Doesn't having the permission "permission.node" grant you full access to its child nodes?
Nope
How can i serialize it?
ok
Dont serialize File objects. There is no reason to ever do that.
Show us your code and we can point out where the error comes from
<repository>
<id>spigotmc-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/content/groups/public/</url>
</repository>
<repository>
<id>playpro-repo</id>
<url>https://maven.playpro.com</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.21-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.coreprotect</groupId>
<artifactId>coreprotect</artifactId>
<version>22.4</version>
<scope>provided</scope>
</dependency>
</dependencies>```
I'm getting this error when trying to get CoreProtect API:
```net.coreprotect:coreprotect:jar:22.4 was not found in https://hub.spigotmc.org/nexus/content/repositories/snapshots/ during a previous attempt.```
What am I doing wrong?
Why it is looking at the first repository and not the last one that is supposed to contain the file?
It looks in all repositories. This message simply means that it wasnt found at all.
I'm blind
And the credentials look the same as well
beautiful repo page
what awful font is that
Just whatever my browser spit out, no idea
https://github.com/PlayPro/CoreProtect I just copy pasted what they show here
Is it possible to just add repo urls into a single repository tag like u did
I mean does it work like that
wdym
Nothing phone formatting is just awful
π
If we modify a texture property's value, such as removing it's cape, can we keep using the same signature?
I don't think the cape is part of the signature or the texture
Cape is the part of the texture
But not sure about the signature, that's why I'm asking
It's included as a JSON object in the base64 encoded string, aka textures value
hmm, then not sure if you can remove it without altering the sig
but I mean you could just try it and see what happens lol
worse that happens you get some errors XD
is there any way agnostically for a implementation of specific plugin version to give its implementation without explicitly mentioning classnames of implementations in core part of the plugin?
basically implementation reports itself instead of core trying to find the implementation tiself
you could put the implementation details in the manifest
wdym
have you looked to see how spigot inputs the implementation stuff?
no
probably should, specifically look in the craftbukkit pom
it embeds the implementation details into the class file meta and manifest area
Hey the fact that the server thinks that the client is in spectator mode but the client thinks that he is in survival gamemode does it risk crashing the client? or is it risk-free?
this way you can use the JVM to get those implementation details
so whenever spigot gets built, it reads from manifest to get the class path?
wouldn't say it is risk free
and then loads it?
there is methods provided by the JDK/JVM to get implementation details
of a class
it doesn't have to be a specific class, just a class from the jar or you read the jars manifest file
what is the best way to save an object and all its data? (the object has arraylists of other objects and a hashmap<uuid, arraylist of itemstack>)
If you use what Craftbukkit has, you could use this to get the implementation details
https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/Package.html#getImplementationVersion()
declaration: module: java.base, package: java.lang, class: Package
you could base64 encode it and save it as a string
it would save all its data too?

i want to save LeilaoManager
LeilaoManager:
ArrayList<PlayerLeilao> player;
ArrayList<Leilao> leiloes;
Map<UUID, ArrayList<ItemStack>>
PlayerLeilao:
UUID player;
int maxLeiloes;
Leilao:
UUID uuid;
UUID owner;
ItemStack item;
int bid;
int price;
int duration;
ArrayList<Bid> bids;
Bid:
UUID player;
int value;
what would be the best way to save LeilaoManager?
ServiceLoader?
or what are we talking about
if base64 encode, how could I do that?
Kinda like ServiceLoader i guess, is it a good approach though, im trying to decouple loader from version specific classes, its going to be shaded alongside loader itself, and there would be bunch of jar files for each version specific version with loader built in
these do not provide a way to include classpaths from what i see
basically i want to load a class, that loader itself doesnt even know the path to
ServiceLoader seems to do that
ok, but you wanted a way to check version without knowing a specific class?
no
i wanted to get a class path for a specific implementation to load it
but without explicitly constructing it in source code by declaring imports
reflection shit i guess
or ServiceLoader
ok, well I was under the impression of something else due to what you said here ^
ServiceLoader does reflection probs itself
"specific plugin version" phrasing really caught you here i guess π
i'll try using ServiceLoader i guess
well there is in fact a way to check version of something without knowing much about it XD
hence I provided what I did lol
now you must wait till they are not busy π
fortunately they will respond to you when they are not
would simply make the jar provide a loader itself
can i somehow access the contents of webui from Common.java ?
this is the decompiled jar
Anyone have an idea on how I can teleport a player the same way that an end portal does?
I dont really want to create an end portal block on the player then destroy it
But I also dont see any way to emulate what the end portal does
even teleporting players to Bukkit.getWorld("world_the_end")?.spawnLocation doesnt work
seemingly this just puts them on the end island somewhere random
ok, I almost got it, but I'm getting this error:
java.io.NotSerializableException: org.bukkit.craftbukkit.inventory.CraftItemStack
which means that ItemStack does not implement Serializable (ig)
how could I fix that?
Serialize it using the bukkit way
Yeah it's ConfigurationSerializable, not Java Serialize
my head hurts
How dod I get a jar with gradle on Intellij?
plain java or bukkit
run the build task
Gradle > Build > Build?
I have only done it with Maven
yes
the gradle task named build is the one you want
you'll get your jar in build/libs/
One message removed from a suspended account.
"the bug"?
lol
One message removed from a suspended account.
Other languages use their version of "the" much more liberally than English
One message removed from a suspended account.
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
stop using gradle
how could I get the score of a certain player on certain scoreboard?
I'm using maven
guys do yall think it would be possible to make this effect of different gravity directions in a plugin, I've only seen it in mods, and if so how?
it would be possible using block entities and shulker boxes, just a huge pain
I am currently competing in the procrastination olympics for making this command structure
I've had the file open for 12 hours and have written maybe 3 lines
Wouldn't you need to fake literally everything wasting a fuckton of processing power and that all will only be visible on one client?
Hmm...
Shader to change the vieport orientation/location (takes care of blocks and entities)
Making a box where you would copy part of the world and rotate it, would take care of some block hitboxes, most would still have to be faked with shulkers tho (you can resize them since 1.21)
Making that box invisible with shaders too.. somehow
Using interaction entities for entity hitboxes
All would have to be client-sided tho, so that means taking care of block hitboxes by your plugin.
I think it would be doable, but incredibly difficult.
does anyone have a really, really nice command class structure for me to look at for inspiration, I'm trying to figure out something that will nicely deal with both fixed and variable arguments and their autosuggestions
similar to how cloudcommandframework does it in a sense
Brigadier ? :D
Lol
they use that I am pretty sure
Brigadier is built into minecraft so use that
oh I don't really know what it is or what it does
Uhhh... I think NMS/reflections if you want to create commands on spigot server ?
It's made by mojank
one thing I wanted to make sure of is that this is reload-safe which cloudcommandframework was not
And it does not look the pretties when writing it I think
You can make it reload safe, I've done that
yeah I forget why ccf wasn't
the Brigit class takes care of registering and loading/unloading the commands when /reload ing
might have to do with how they weren't using the plugin.yml to register commands
hmmmm
commands are always kind of annoying to set up
I kinda like teh Bukkit command API, but I dislike having to add them to plugin.yml
do you guys know how I could get the value a certain player has on certain scoreboard?
it's what I was using, I don't mind it that much
the equivalent of /scoreboard players get <nick> <scoreboard>
it's just finding a good way to do tab completions for fixed and dynamic arguments plus good error handling and messaging of bad arguments to users is a pain
yep
especially if you want something that will scale without becoming annoying
which uh I definitely need, this is probably going to be over 100 commands
Lol they were never seen again
is there an event for when tnt gets dispensed by a dispenser?
where you can like actually get both the tnt entity and item
BlockDispense event doesn't allow me to get the entity
Did you try ProjectileLaunchEvent?
no, I'll try
actually I don't think this will fire for tnt
since getEntity() only returns a Projectile, which TNTPrimed doesn't extend
also I don't think I can get the item
BlockDispenseEvent it is
declaration: package: org.bukkit.event.block, class: TNTPrimeEvent, enum: PrimeCause
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/block/TNTPrimeEvent.html#getPrimingBlock()
declaration: package: org.bukkit.event.block, class: TNTPrimeEvent
not sure if that would work for the dispenser
but could try it
EntitySpawnEvent
TNTPrimeEvent gives you the entity
and TNTPrime event doesn't give me the item (and also I'm pretty sure it only fires for tnt ignited with a flint and steel as stated in the javadocs)
then how do I get the item
what item?
the tnt item
I think you'd be best of to completely take over the tnt spawn logic
I know
what does that mean
not sure why you need the item and entity
I have a custom tnt item that does smth special when it explodes
and I want it to work through dispensers as well
Revolutionary idea πͺusing multiple events to achieve your goal
ok, well when primedTNT is spawned, look for a dispenser within like 1-2 blocks
still not sure why you need the item though
To identify if the tnt was the custom item..
then they can do that from the dispense event
Well, it is a bit ugly because you need two events
or, as I said, maybe just spawn the tnt yourself
what if there are multiple dispensers...
sounds like a you problem at this point making excuses why you can't do something
oh wait you're right
all we can do is provide you solutions
tfym excuses
fact of the matter is that none of those things work
but yea, the item you get there is a mirror
and I've explained why for each one
so you setting its count to count - 1 would work, even if you cancel the event
spawning the tnt myself should work tho
well just know kids have already accomplished what you are wanting themselves without the api π
ok
always go raw
about to ask on paper discord if they have an api for it
ok thanks I guess
but yea, spawn own TNT.
Then you also need to manually reduce the stack in the dispenser
it is a bit ugly
they will need to cancel the entity spawn event
Or just the block dispense event
well, that gets a bit funky with other plugins e.g. on monitor
XD
Entity#getOrigin
oh wait that's paper but you said you're using that so
Hey, i was wondering if caching the connection for database is the proper way of perserving performance in spigot plugins development
hikari
I'm using mongo btw
you will never get a performant db connection
why ??
too many variables cause them to be unstable
big servers use mongo, and they have high performance
so should i cache the connection field
or just fetch the connection each time I apply an db-operation
to be performant you need a connection pool
MongoDB has a connection pool i think
you then fetch a connection from the pool as needed, returning it when done
MongoDB is web scale
The java driver for mongo handles pooling for you afaik
they need to use unix sockets if they want performance
this eliminates connection pools and tcp over head
and java 17 has native support for unix sockets π
I have a question, right now should i create "MongoClient" object each time i want to do some operation to my database or just cache it
because im still confused about the right thing to do
recreating mongo client each time means i will have to cache the connection string
Create the client once
Connection pool should do it for you.
If you cache, dont forget check if connection is lost.
ok so what about the MongoDatabase object ?
should i do the same or just get it everytime
Because i find that running "client.getDatabase()" everytime is annoying
guys have you ever seen code this bad to maintain that's open source that you would love to contribute but decided not to
i've found a mod which concept is so cool
but the fabric mod insides are sooo bad
statics everwhere
code for parsing config is like:
static void readConfig()
static void writeConfig()
static void saveConfig()
i mean its so bad
that it really screams for a rewrite
not even talking about public field
protected fields everywhere
well, write and save being static makes sense, but not the read really
as long as it works it works
this is good?
without inheritance
private and protected should be utilized the most and only use public when necessary
i avoid protected since it can be manipulated from the same package
Yeah protected isn't great for field 90% of the time
protected isnt only for inherited?
my rule is that if you need protected instead of private 99% of time you're doing smth wrong
yea?
protected is if you want it only accessible within the same package
mainly why i hate protected is that you can access them from the same package
if it was only for inheriting it would be great
it is the entire purpose of them
is theer no keyword for only inherited?
no
sadge
Even with only inheritance it ain't great
it saved time writing pointless functions
and helps defining what should be done by subclasses and what can be done by the outside
Also same class is technically incorrect due to nest hosts and members
Just slap an @Internal to it :p
i prefer getters and setters with private fields, with composition
usually if you need protected you need to split your code into multiple fragments
for quick slaps its a time saver sure
but its like c++ you can shoot your foot with it in a long term imo
I am trying to make it so ravagers can't destroy blocks in specific area. Any idea which event is that or how to do it? (ping if you respond)
@EventHandler
public void onRavagerBreakBlock(EntityChangeBlockEvent event) {
if (event.getEntityType() == EntityType.RAVAGER) {
event.setCancelled(true);
}
}
I already tried this
but it doesnt work
public class rtp implements CommandExecutor, Listener {
private final HashMap<UUID, Long> combatLog = new HashMap<>();
private static final long COMBAT_COOLDOWN = 10 * 1000; // 10 seconds
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (sender instanceof Player) {
Player player = (Player) sender;
UUID playerId = player.getUniqueId();
if (Banton.getInstance().blockedbycombatlog(playerId)) {
player.sendMessage(ChatColor.RED + "You cannot use this command while in combat!");
return true;
}
Bukkit.getLogger().info(ChatColor.GREEN + "Hugo rtped");
World world = player.getWorld();
Random random = new Random();
int x = random.nextInt(5000) - 5000;
int z = random.nextInt(5000) - 5000;
int y = world.getHighestBlockYAt(x, z);
Location randomLocation = new Location(world, x + .5, y + 1, z + .5);
player.teleport(randomLocation);
player.sendMessage(ChatColor.GREEN + "Successfully teleported!");
}
return true;
}
}```
my blocked by combatlog does not work
use worldedit plugin
Well, I wanted something programmed by me, also I have Fast-Async-Worldedit, does that one has it too?
Well kinda makes sense, I was like "What"
oh right
I need something I have a full control over
did you forgot to implement the listenes
And ideally programmed by me
...
...
yes
this happens ALWAYS!
the code should work
now i am confused
I always forget to link the listener into the main class
and always forget that I am always forgetting it
lol
public class rtp implements CommandExecutor, Listener {
private final HashMap<UUID, Long> combatLog = new HashMap<>();
private static final long COMBAT_COOLDOWN = 10 * 1000; // 10 seconds
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (sender instanceof Player) {
Player player = (Player) sender;
UUID playerId = player.getUniqueId();
if (Banton.getInstance().blockedbycombatlog(playerId)) {
player.sendMessage(ChatColor.RED + "You cannot use this command while in combat!");
return true;
}
Bukkit.getLogger().info(ChatColor.GREEN + "Hugo rtped");
World world = player.getWorld();
Random random = new Random();
int x = random.nextInt(5000) - 5000;
int z = random.nextInt(5000) - 5000;
int y = world.getHighestBlockYAt(x, z);
Location randomLocation = new Location(world, x + .5, y + 1, z + .5);
player.teleport(randomLocation);
player.sendMessage(ChatColor.GREEN + "Successfully teleported!");
}
return true;
}
}```my blocked by combatlog does not work
public void putintocombatlog(UUID player) {
Bukkit.getLogger().info("UUID " + player + " in combat with another player.");
Long timestamp = System.currentTimeMillis();
combatLog.put(player, timestamp);
Bukkit.getLogger().info("Number of players in combat: " + combatLog.size());
}
public boolean blockedbycombatlog(UUID player) {
boolean blocked = false;
if (combatLog.containsKey(player) && (System.currentTimeMillis() - combatLog.get(player)) < COMBAT_COOLDOWN) {
blocked = true;
}
return blocked;
}```this is in the main onenabled
public class EntitydamagedbyEntity implements Listener {
@EventHandler
public void manageCombatLog(EntityDamageByEntityEvent event) {
Bukkit.getLogger().info("DEBUG: EntityDamageByEntityEvent fired.");
Entity damager = event.getDamager();
Entity damagee = event.getEntity();
boolean damager_is_player = damager instanceof Player;
boolean damagee_is_player = damagee instanceof Player;
if (damager_is_player && damagee_is_player) {
UUID damagerId = damager.getUniqueId();
UUID damageeId = damagee.getUniqueId();
Banton.getInstance().putintocombatlog(damagerId);
Banton.getInstance().putintocombatlog(damageeId);
}
else {
Bukkit.getLogger().info("Not Player got damage");
}
}
}```
hello if any of yall are connfident in packets...
https://paste.md-5.net/imasatetiw.java
tell me why my event.setcancelled() is not working
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
Slow bot
And that is
i wanna block people from rtp if they are in combat.
oh okay
summary of this codehttps://paste.md-5.net/imasatetiw.java
is basically whenver player opens advancement tab it will close the advancement tab and just sends a command instead
using packetevents API
and yes i have asked the packetevents discord and wasn't given a response
I don't see anything closing the inventory
event.setCancelled(true)
Also does the listener trigger
yes listener does trigger
That won't close it
would i have to send a closing advancement tab packet?
You're just stopping the server from knowing about the advancement tab
player#closeInventory should work
alright let me try
does anyone know why classes like GameMode or Material dont seem to exist on 1.20.6 spigot
Update Intellij
ight
worked thanks!
question for a public and free plugin is it best to save player data in a json file or a mysql data base?
Ideally youβd offer both
But having local storage (json, SQLite, etc) is recommended
alright thanks
didnt work btw
Guys I need help implementing a polar function into minecraft
Sure what are you trying to do
so the polar function is r = cos(5ΞΈ) + 5 from 0 to 2pi
for (int theta = 0; theta < 180 * 2; theta++) {
double rads = Math.toRadians(theta);
double r = Math.cos((5) * rads) + 5;
double x = r * Math.cos()
d(x + r, y, z + r);
}
``` just not sure
how do I actually derive x/z offset from it
my precal teacher wouldn't be proud
So you just want to convert it to cartesian plane?
soo is there any work around since like material and gamemode classes just dont exist on spigot 1.20.6
yes
oops alt account
to spawn in in world you know
Update intellij
i did still doesnt work correctly
sec havent done polar in a while
try invalidating caches
what does that even mean π
how many display entities start to lag a client?
depedns on the server
depends on what type of display
depends on teh client
Block display
File > Invalidate Caches
text displays? a lot. block displays? less
server, connection
Like 500?
impossible to set a number
π€· never needed that much
oh i didnt even notice that was there π
really dependso n the client
why do you even need to know that
because I dont want the experience to be unplayable for users
then don't spam display entities
it really depends on the client and their computer
the emphasis on really helps your point honestly
Well, what do you want to do with them
didnt change anything
?nms
any app that helps explore the nms code?
explore?
like view it
?mappings ig?
Compare different mappings with this website: https://mappings.cephx.dev
IJ
don't
but it doesnt support the newer java versions
IJ has all that integrated lmfao
press double shift
yeah I know that
but what about method in a class
like now I am trying to understand how the PlayerFishEvent works
what
nms is not documented or anything
it's internals, glhf
well I learned nms and more about the SpigotAPI that way
you could just run build tools to get the decompiled classes and what not if they are not already in the spigot.jar
place them in some project and now you have them loaded
if i have a class (A) which extends another class (B), but i get it from a list of (B), and it has method (C) which overrides method (D) in B, and I don't cast it as class (A) when i get it from the list
will it use the original method or the override method
depends hwo your List is defined
it's a list of class (B)
if it suffers type erasure and you don't cast, then you call the super method
creative variable naming there
Yes. Always
Generic types do not matter at runtime. It's unlike C++ where the type actually matters when it comes to inheritence
public class Animal {
public void speak() {
System.out.println("*animal noise*");
}
}
public class Dog extends Animal {
@Override
public void speak() {
System.out.println("Woof!");
}
}
// Somewhere
List<Animal> animals = Arrays.asList(new Animal(), new Dog());
for (Animal animal : animals) {
animal.speak();
}
Assuming this is the paradigm you're referring to, you will get an *animal noise* and a Woof!
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
ask the deluxe-menus discord
and also format it
its hard to read like that
One message removed from a suspended account.
One message removed from a suspended account.
your indentation is messed up
One message removed from a suspended account.
362, 363, 364, 367, 375
Validate, Verify and Reformat your YAML documents, optimized for Ruby on Rails
paste your config in this and it will tell you whats wrong
One message removed from a suspended account.
Anyone know what tag a material would be if it can be interacted with (i.e crafting tables, furnaces, buttons etc etc)
just anything that if you would right click it, it would not place a block (unless hifting)
What about Material#isInteractable? https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/Material.html#isInteractable()
i swear i l ooked in Material lmao
thankyou
Is there a way to check whether an item has a furnace recipe?
Or can be smelted?
I looked on the javadocs and almost everything is deprecated
Hey! Is there a semi-easy way to save an inventory between server restarts? I have a variable with an inventory in it for a backpack plugin, but I need it to keep its contents exactly the same between server restarts, etc. Is there a way to do this? My code so far:
GiveBackpackCommand.java: https://paste.md-5.net/juleniwuci.java
do most plugins only support mysql database or do they offer others as well
Bukkit.getRecipeFor(), then you check if the recipe is instance of FurnaceRecipe https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Bukkit.html#getRecipesFor(org.bukkit.inventory.ItemStack)
Please ask in #help-server
wdym help-server I am a developer here
and want to know if it's ok that I implement just mysql support
Your question is related to existing plugins
Mhhhhh, then it really depends on yourself
If you are not sure, start by making a database interface so you can implement multiple kind of database in the future
(and ofc make the MySQL implementation)
ok, that sounds good
Thanks
There are plenty of ways. If you search on the search bar of this channel you might find many methods. I'll cite one from lynxplay:
"Convert either the inventory or stash to ItemStack[].
Create a BukkitObjectOutputStream.
Write the length of the array
Write each item in the ItemStack[]
Grab the bytes the from the OutputStream the BukkitOutputStream was based on
Profit
I don't know of a better method on spigot
"
does lynxplay give a snippet example
I'm not sure
You should try to make it by yourself and ask for help for this in here!
okay
can I just save an itemstack to config?
Yea
https://gist.github.com/graywolf336/8153678 is a rather prominent gist for this kind of work
when changing a player's name using their GameProfile. Will this change the return value of Player#getName?
Can i somehow change drops on BlockBreakeEvent like set custom drop for exact block or i need to give the Item to player inventory when block was broken?
BlockBreakEvent#setDropItems(Boolean) and then just spawn your item
Thanks
You should use the BlockDropItemEvent for that
Thanks
Hey, question
because server are monothread
if I call
p.setGameMode(GameMode.SURVIVAL);
p.setGameMode(GameMode.SPECTATOR);
between these two call I'm sure nothing else will happen on the server? so no entity will move, no block will be broken etc? (requests for this broken block will be called afterwards)?
everything that runs on the server thread will surely either run before both method calls, or after both method calls
single threaded stuff is always sequential and runs linearly to code flow declaration
good
however ofc there are netty threads, and other threads that may do stuff between the two method calls
yes threads who listen packets I suppose that join main thread to call listener but it wait listeners are available (for example, it waits until there is no running listener)?
yea a lot of the times packets are intercepted initially on some other thread and then the server queues the actual logic onto the server thread
TextComponent confirmation = new TextComponent(color("&eClick me!" + team.getTag()));
confirmation.setClickEvent(new ClickEvent.);
``` It is possible to return true from this click event without creating a new command?
Or is it another way to make clickable confirmation on chat?
iirc u need to run an additional command w click event
oh, thx
oh alright thank you. idk how i didnt find that before kekw
oh wait ppl are saying both things
Then try it and see
but ig this is meant to show that when changing the name in the GameProfile Player#getName does indeed return the fake name huh
i couldnt before. it's something that popped into my mind fsr when i was busy. now i can, lol
mamma mia
I am coding up a mean command code pasta
just like grandma used to make
there may not be a best way to make commands but I am definitely on the search for the worst
Hey, I'm trying to use PDC to store integers but for some reason i'm getting this error
why does this happen ?
It says that it cannot store Integer but I thought it could?
that cannot be
In this case the item doesn't even have the key
Where you did set the value?
it doesn't have the value
intellij does not recognize lombok
someone know fix?
where was Enchantment#isTreasure() moved in Minecraft 1.21? I can seem to find how to access such info about an enchantment anymore
im interested in NMS only
Did you install the Lombok plugin
yes
recognizes it in the code but it doesn't recognize it when compiling
tags
does any1 know if it would be easily possible to auto update my plugins?
for example i run a couple " game servers" they restart after each game is concluded. so i would love to just be able to check if a plugin update was pushed and automatically download it. i do have a maven repository to which i push these updates. maybe its possible with that. any1 any ideas?
Yea but how can i access it
i have a git repo which acts as a base to every game server which each server pulls from on boot
i just push the new plugins there
EnchantmentTags seems to hold i need
yea thats exactly what im looking for rad
but i cant find Enchantment registry
how does it pull
you need to grab the registry from a reg access via its key
some kind of script?
it's a docker image
given that 1.21 made ench reg non-built in
ah i see
just made a fork of itzg/docker-minecraft-server
well mine run on pterodactyl ;/
need to make a new one, pleas edon't fork itzg as it uses up all your gh org resources
Are you using maven?
you could make an egg?
yea i tried itzg/docker-minecraft-server but got dissapointed that i cant just compile the server files
without running the server
thanks for the ideas will try that
pterodactyl's architecture naming scheme is one among the weirder ones
MinecraftServer.getServer().registryAccess()
.lookupOrThrow(Registries.ENCHANTMENT)
.get(EnchantmentTags.TREASURE);
Registries.ENCHANTMENT doesnt exist
i mean you can just do this
what version?
it 100% exists
ptero has a built in egg creator
wrong mappings?
?mappings
Compare different mappings with this website: https://mappings.cephx.dev
not sure how i would incorporate auto updating my stuff in there though
Tho yarn apparently also calls it ENCHANTMENT
you could just clone the repo
version: 1.21, hash: fb9f23b1ab
(could just switch to mojang mappings and not suffer)
Yea that is their name for BuiltInRegistries
you did check what we typed yea?
the class name is different on yarn
.
why is it even separated in a first palce
hm?
why there's bunch of objects of type Registry inside Registries but when i need to access Enchantment registry i need to use the key to access it
those are only still there because they are not synced
The more registries are moved to be data driven, the less constants in that fun yarn class
Not necessarily legacy. Just "this registry doesn't need synchronization with the client" :p
but they're moving to almost everything to be synced approach
Yea
But yea, you cannot have a static reference to a registry that may just reloaded/re-created
gradle
let me see
compileOnly 'org.projectlombok:lombok:1.18.34'
annotationProcessor 'org.projectlombok:lombok:1.18.34' i have this only
spigot have integrated lombok right?
@grim hound Are you absolutely sure that ConcurrentInt62Set is faster in a synchronous environment compared to LongOpenHashSet? My benchmarks would say that it is 20 - 30% slower (and that is with the overhead of the other parts of the algorithm used in the benchmark so the raw performance difference of the collection may be even more drastic), see https://github.com/Geolykt/fast-async-starlane-triangulator/commit/2d75582378dcfc7798bf479ef418c2d47327108c.
since minecraft is changing their item system in 1.21, is there a breaking speed stat for pickaxes or something?
My gradle is acting weird today. It's buggy and taking 2 minutes to compile.
ToolComponent#setDefaultMiningspeed
i change .32 to 34 butno works @chrome beacon
thanks
or the respective tool rules
What exactly do you mean with 'integrated' here?
if you want to edit stuff for specific blocks
if lombok packages
are integrated
on spigot
shadow yk
Yeah
no
it can make teh IDE run like shit, but not a final jar
just use the gradle plugin
Why do you consider it to affect stability?
Newer versions of java will refuse to run the lombok annotation processor
Well what lynxplay is suggesting is a gradle plugin, not a standard dependency layout
Gonna save you some hastle with configuring things correctly
yes
plugins {
id("java")
id("net.minecrell.plugin-yml.bukkit") version "0.5.1"
id("io.freefair.lombok") version "8.6"
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(22)
}
}
π
Does lombok take long to compile? It's taking a long time
no
I usually compile in 10 seconds. Today it's taking 1 minute
what exactly is taking long here
and it still doesn't work
Dependency resolution or something else?
lombok bug
Giving gradle log outputs, the build.gradle and more may be of help
You know what: Just get rid of lombok
remove the getters from 100 classes lombok ?
It's eyecandy anyways and if you think it doesn't work correctly there is no point in trying to fix it
what do you want
delombok exists
but I find it very practical
The entire project is usually the easiest to work with
I mean, just post the ./gradlew build log
ok
additionally, full build.gradle.kts would be nice
Oh, kotlin gradle -.-
gradle build doesn't say anything, it just says as if lombok doesn't exist. It gives an error in getters saying that this getter doesn't exist, etc.
I really need to find that "only help, no information" comic one of these days
did you run ./gradlew build
You need to add the annotationProcessor
ok
shouldn't the plugin do it?
Still needs to be explicitly defined in gradle
annotationProcessor 'org.projectlombok:lombok:1.18.34'
i added the plugin
I had this before
but i remove and i add the plugin
The ide plugin or gradle plugin?
gradle plugin
both
this would work the same right?
Objects.requireNonNull(Registries.REGISTRIES.get(RegistryKeys.ENCHANTMENT.getValue())).containsId(EnchantmentTags.TREASURE.registry().getValue())
im working on clientside fabric mod actually, so i dont have an access to MinecraftServer instance
any suggestions?
Registries.registries?
a registry registry, good lord
that's mojang for you
delombok would be mine, albeit rather intrusive.
If it isn't your project then I'd just nudge the person who wrote the buildscript to fix the buildscript
Don't big developers use lombok? Do they do the getters normally?
it depends
i dont use it, but corpo's really like it due to how it allows you to write simple bug free getters, setters, equality checks
its double edged sword
if you use it for simple stuff it works so good
but then you need to change smth in a getter or setter
and now you're fighting against a problem that wasn't before
I wrote the script
I mean, this is Java 22 - Records have LONG been invented
and the setters?
Immutability β¨
The client registry you get via minecraft.level.registryAccess()
record has no setter
In some cases this is not possible
Thanks for the info
Records gens ctors too. Otherwise, IDEs are capable of generating all these things
So yea just, use the client level
Does the ide simplify the constructior design too?
this would work too right, ik this looks ugly and probs this static field will be removed in later versions, but still
just use kotlin
For getters and setters eclipse has this window. For constructors there probably is a similar feature somewhere else too
And IntelliJ will definetely be more capable on that front
eclipse lul
alternatively, ClientPacketListener has it too
Yeah, eclipse can generator a constructor, too
you know where this terminology stems from
why if I reload my plugin that uses packetevents it bugs?
Oh I have, every time I restart the plugin with plugman I get kicked from the server and can't log in anymore until I reload the server
oh dear plugman
??
wait
i've used wrong method
that returns registry key itself
not the enchantment tag id
i guess .get(RegistryKeys.ENCHANTMENT).get(EnchantmentTags.TREASURE.id()); is correct here
im porting 1.20.6 code to 1.21
and it made whole lot of code regarding enchantments broken
Yea but what is that piece of code supposed to be doing
it should check if given Enchantment is of TREASURE Type
before 1.21 there was Enchantment#isTreasure() method
oh....
now its gone since now tags is being used apparently
could have said that sooner 
βοΈ
MinecraftClient.getInstance().world.getRegistryManager().get(RegistryKeys.ENCHANTMENT).getEntryList(EnchantmentTags.TREASURE)
ok this seems right
since they introduced EntryLists for tags
in 1.21
yea good enough.
if you can, instead of passing around Enchantment
pass Holder<Enchantment>
makes your life a lot easier
yea ik, its not my code, im just trying to contribute to porting it asap to 1.21
its a shitty code ngl
Minecraft.getInstance().getConnection().registryAccess()
.registryOrThrow(Registries.ENCHANTMENT)
.wrapAsHolder(enchantment)
.is(EnchantmentTags.TREASURE);
exists too
lombok gives an error when compiling. Does anyone know what it could be? I added the annotation processor etc in gradle
i guess that in yarn translates to:
MinecraftClient.getInstance().world.getRegistryManager()
.get(RegistryKeys.ENCHANTMENT)
.getEntry(enchantment)
.isIn(EnchantmentTags.TREASURE)
Maybe xD
Show ur build.gradle
I mean its a lot clearer what it is for me
its just hard to map from one to another
RegistryEntry is wrong tho
Holder can hold onto values defined in a registry and values that are defined inline and not registered in a registry
well maybe you're right
Try doing skip tests and see if it works
Since you dont have the test dependencies
what is skip tests
i have all depends
but the compiler give me getter errors etc because not see the lombok
I wonder if there's some kind of diff checker just like it was with cs go files
is there any way to detect when mace was used with fall damage to boost dmg?
but for minecraft versions
How to hide command from console?

how do I hide tax fraud from the gvt? asking for a friend
Marry a Clinton
also, unrelated, how do I hide the body of a taxman from the police? asking for a friend
also, unrelated, how do you get out of a police chase with a helicopter? asking for a friend, this one is kinda urgent
get a bazooka
hey again unrelated how do I become a sovereign citizen
and is there anyone who wants to join my friend's militia
depends on the fraud
with me always comes at simplevoice voice voice chat not connected what do I have to do
lol I want to hide user password when user type it by login {password} so admin can\t see it....
all of them
technically if you live in a sovereign country everyone is a sovereign citizen. However, if you mean how to be sovereign from the country you are in, you would need to battle said country or have the ability to defend against said country XD
well for some fraud easiest way is setting up false things that make it appear legit for tax. Other times its just staying below certain limits
i setup bro
gradle in this case
the project always worked. today it decided to bug this shit
I didn't even touch the damn build.gradle.kts
have you considered not using Lombok?
I considered it but it was out of the question
delombok is also bugged
I used it a few times but I found it too annoying
and I'm not going to take the lombok by hand 300 classes
im seeing
sorry I take that bad that was mean
YES, THAT'S RIGHT
if you think it's bad you're DEFINITELY a bad person
You are the one who is drawing conclusions from your only personal experience LOL
I just found it laggy and annoying
you stinky
I do need a shower. Wife says I shoudl shower more than once every six months. What does she know anyway
Since Lombok is very good, solve my damn problem.
YES AHAHAHA
I'll build a wall with a method that uses lombok to get people in, keeping the bad people out
also I'm pretty sure my project would be 120k lines without lombok
bigger is always better
that's why you're a bigger bad person
If no problem happened to you, it doesn't mean that it won't happen to others. With all due respect, but are you playing dumb?
fuck this shit...
this.getServer().getLogger().setFilter(new CommandFilter()); and // Inner class for filtering log records private class CommandFilter implements Filter { @Override public boolean isLoggable(LogRecord record) { String message = record.getMessage(); if (message.contains("issued server command: /login")) { // Log a message before filtering out the command log getLogger().info("Komenda '/mycommand' zostaΕa ukryta."); return false; } return true; } }
badass alert 
probably still is, just you are not looking at it
those all updates from 1.20 to 1.21 to minecraft code makes me suspiciously think that enchantments are now server based primarily
yea kinda
that'd be cool for us
well... you know what time it is
that's right it's gym time
better lose those cops...err your friend had
oh we resolved that amicably
I mean
he did
just had to trade in some favors with some russian friends
he did, that is
so they made custom enchantments native
neato
I see this being abused
only issue with that is it being incompatible with bungee I believe since bungee doesn't use the transfer packet
there is a packet to transfer to another server without the player hitting disconnect or reconnecting
eh but its kinda useless imo
proxy servers are more lightweight
and scale better
also phishing attacks?
wouldn't say light weight, but what they allow is the ability to not have your mc servers all exposed to the outside directly as well as not taking up pulbic ip's
well they take much less resources than the whole another mc server
unfortunately current proxies and implementations are incompatible with the transfer packet exception being it being used to transfer from one proxy to another
is there any restriction on where the player can be sent to
isnt this succeptible to smth like CSRF on web
not that I am aware of
you could put any address and port in there to transfer them to
imagine server pretending to be some kind of hypixel server
and player joins it thinking that its legit
inputs whatever it needs
and it pushes him to the real one
and the player wouldnt even know that was not a real server
well, the transfer packet is analogues to a disconnect and connect
sure IP and domain names would give away
without the player having to do those things themselves, also not sure if it asks permission for it to happen or not. Haven't really tested it
but knowing that even till this day phishing attacks are succesful im quite worried here
I am not worried about the transfer packet, I am more worried about the cookies thing being combined with transfer packets
well it depends what can be stored there
also whether or not the client does anything beyond just simple storing and sending
well storing some kind of static data onto player's machine sounds cool
session data which does not change often
well its only static as long they don't hit disconnect
apparently the cookies persist if a transfer packet is used
but they don't persist if the player hits disconnect
name is kind of bad
its not equivalent to web cookies
those persist even after communication has ended with the server
right, I was just stating how they do persist
i just struggle to find a proper use for such a feature in a first place
communicating back and forth for couple kb of data that could be stored on the server really sound not optimal
I can see it being useful to share data about the player between servers or networks but beyond that I don't really see the use. Also how can we be sure it hasn't been tampered with? lol
if they did persist after disconnect, that would be interesting
and bunch of things would pop up
probably first the sessions for offline mode authentication
I don't really care about offline stuff
FUYCK U LOMBOKKKKKK
JWT
and well, the packet is for routing to geographically closer servers
or switching proxies if you are shutting down a proxy in your pool
how i use delombok
I am not talking about the transfer packet lmao
talking about that cookies thing
I don't really see it being useful, and how would you know it hasn't been tampered with?
that was already possible with geoip and proxy server
JWT
Yea but now it is easier xD
And I mean, cookie usefulness is okayish
you can achieve the same with a KV store
but it is easier to just throw a JWT into a cookie of a player and be done with it
JWT will be good for offline mode servers
is there a point of jwt token in a first place if its not persistent across disconnects anyways
you use JWT because it allows you to verify things haven't been modified by the client
just because they don't disconnect doesn't mean they can't tamper with the file
i just feel like that you will be probably sending more packet data to read and store that data in a first place
its small af
I can't really think of many uses at the moment for it, but I could see it maybe being useful to store some stuff like preferences
Well, the cookies are mostly to be used in combination with the transfer packet





