#help-development
1 messages Β· Page 833 of 1
Ya listen to this
if someone registers it it needs to be passed through
Them issue
what needs to be passed through
u might recall the code elgar sent me
im making an interface between event handlers and the actual events to do some specific tasks easier
But should I check if it has the right PDC and just run cancel on the damage event?
yes
well maybe some are on lowercase
I had intended to make it so that the player does not take damage when it falls to the ground. Is it kind of easiest to do so that the player does not take any damage before the player has touched the ground and if the server closes etc. you just teleport the player back to the place the player started.
The context of this is in a gadget
er wtf
just cancel fall damage
The player should be able to take fall damage but not from this gadget
can anyone advise the best hologram library for 1.20?
I have used decentholograms
but now I am just making my own
also this is probably something for #help-server
What would the ideal packet abstraction look like 
Where I can send requests and get responses
a socket
decentholograms is fine and easy
it just adds a dependency
so if you dont want that you'll need to look into packets and spawning fake armor stands or display entities
whats the reason i cant make my own implementations of RecipeChoice? i would like to be able to use customized ingredients without having to write an independent listener for crafting
is this still illegal or just like a relic of the past
recipe choice has an item stack value iirc
Hello, i'm trying to intercept a BossBar packet with protocolLib (to insert TextComponent instead of a basic String) but the ChatComponent is empty when i try it π€·ββοΈ
If anyone can help me ! π
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(
this,
ListenerPriority.NORMAL,
PacketType.Play.Server.BOSS
) {
@Override
public void onPacketSending(PacketEvent event) {
PacketContainer packet = event.getPacket();
//System.out.println(packet.getChatComponents().toString());
WrappedChatComponent baseWrap = packet.getChatComponents().read(0);
if (baseWrap != null && !Strings.isNullOrEmpty(baseWrap.getJson())) {
String firstPass = ChatColor.stripColor(TextComponent.toLegacyText(ComponentSerializer.parse(baseWrap.getJson())));
baseWrap = ComponentConverter.fromBaseComponent(ComponentSerializer.parse(firstPass));
packet.getChatComponents().write(0, baseWrap);
}
}
});
This is what i get in console :
[19:09:56] [Server thread/INFO]: StructureModifier[fieldType=interface net.minecraft.network.chat.IChatBaseComponent, data=[]]
[19:09:56] [Server thread/ERROR]: [CECoreHUD] Unhandled exception occurred in onPacketSending(PacketEvent) for CECoreHUD
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) ~[?:?]
at com.comphenix.protocol.reflect.StructureModifier.read(StructureModifier.java:244) ~[?:?]
at fr.citeevent.cecorehud.CECoreHUD$1.onPacketSending(CECoreHUD.java:53) ~[?:?]
what do you mean? does that relate to it being supposedly illegal to make custom implementations of recipechoice
im just saying there isnt really a reason to make a custom impl if it can take an item stack
why not
the only available recipechoices are of the type alone or the exact meta
i would like to use a recipechoice that only checks some custom meta
the reason is mainly that i have custom items that use the same base type but that i would like to have different recipes for
and these custom items are also like weapons so i cant use exact recipechoices, and since several weapons can have the same type i cant use material recipechoices either
Pretty sure it just won't work if you make a custom one
You are welcome to try though
are particles thread safe?
depends what you are doing with them
I don't think the methods on World are thread-safe, but the ones on Player probably are
particles are only packets, you can safely send them async
is correct?
Have you tried testing it
I just want to know if the writing is correct
theres an error there somewhere, not in that screenshot
yes, i know
@remote swallow
dev.bedwars.it.bedwars.BedWars, right?
the writing is usually corrected if its wrong as otherwise it will not build the prject
unless you mean spelling mistakes
Maybe my English is bad, I just want to know if the concept of "BedWars" class is right or wrong.
seems to be your main plugin class so its fine
ok
the main class is not "BedWars", is "Game"
is multi instance so multi module
is it normal that the stacktrace for an error is being truncated in the console
its still fine for a class name
yes possibly
I did e.printStackTrace() and all that ended up in the console is [19:24:50 WARN]: java.lang.NullPointerException lol
might depend on the error
that is in fact NOT a useful stacktrace
oh oof
ah -XX:-OmitStackTraceInFastThrow fixed it thanks
π
looks like imma have to custom make this recipe shit
PrepareItemCraftEvent time
Hey, so I was wondering how'd I go about only having one word of a message have a ClickEvent, but instead of the text with the ClickEvent, it sends the entire data of the TextComponent as a string. Anyone knows how I could achieve what I'm trying to do?
Here's my code:
invClickMsg.setColor(ChatColor.YELLOW.asBungee());
invClickMsg.setBold(true);
invClickMsg.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/joingame " + sender.getName()));
TextComponent invPlayerMsg = new TextComponent(ChatColor.GREEN + "Click " + invClickMsg + ChatColor.RESET + ChatColor.GREEN + " to join!");
invPlayer.spigot().sendMessage(invPlayerMsg);```
(discord kinda formats it wrong because one line is too long, so just ignore that, the formatting is done correctly in my code)
how would I go about adding the first part, as it doesn't seem like I can add normal text infront, even if it's a texcomponent I cannot put another Component at the end, as addExtra only allows for strings
Use the component builder
Well it's an awful way to write minigames but eh it works
i didn't see the one with component bruh
it's 1.20.2
yea, just overlooked it xd
ty
How should I write them?
i see
when an entity dies, these particles are spawned? can i customize/remove them?
I don't think you can honestly
my plugin is an bedwars, not an minigame
you can add onto it, but remove them? Idk tbch
bedwars is a minigame
that sucks, I wanted to customize them
different particles per entity kind of thing
I mean just add onto the default particles no?
Yes, but that is for multiple minigames in one plugin.
Hi guys, I am trying to make a "lockdown" plugin which will basically free up as much CPU usage as possible when there are no players in the server. It should NOT stop the server, it should only lockdown it so a player can just join and make the server behave normal again. Is Unloading all chunks enough to do the job or is there still something else taking up CPU usage?
I don't like that
maybe you could cancel the entity death event (or if that's not possible, cancel the last damage event), then teleport them somewhere high in the sky and kill them there, then on their previous position add particles
That's an outlandish workaround π€£
and the items, you could just teleport them there afterwards, shitty as fuck, but ig
But if it works I guess
yeah lol
nice.. wait how about if I make them invisible? will their particles be invisible too? right after they die
idk how deaths work
I don't think so
Just have fun seeing how the dead body is interpolated to the fucking moon
The system is nice, I will try to use it
Does the BukkitScheduler.runTaskAsync queue tasks, or would I have to do that myself? (for example if there are multiple async tasks at once, it queues them up instead of them all executing at once)
just tested, no
Just add onto it bro ain't a big deal π
you could maybe do some packet stuff and instead of sending the death packet just send some kind of entity disappear packet which does not trigger particles. Or maybe the particles are send as packets and we are just doing shit rn
because killing them results in particles being spawned
You could theoretically cancel the packet event using protocollib
But you need to sort out where the particles origin from
Does Thread.activeCount() work in Bukkit/Spigot? (Get the amount of threads currently in use)
is there particle spawn event? xD
or anything
Probably not
?jd-s
you'd probably need to listen to packet events
and that either requires you to do some crazy nms shit or whatever or use protocollib
anyone?
its better to leave the server as it is idle, loading and unloading chunks is heavy work for cpu
as well as io operations
yea but once the chunks have been unloaded and it stays unloaded for about 12+ hrs it is worth it, isnt it?
stopping the server works
if you haven't had a player on the server for 12 hours, I'd even shut it off at this point and start it at specific hours
it should be without stopping
theres literally no point in that
ive also asked chatgpt and he said i should set the tickspeed to 1
is that true?
Hello,
I just set my plugin as FREE (was premium for a long time), but it seems that it is not working, it is not in the Premium category, but we cannot download it "SpigotMC - High Performance Minecraft - Error
You must purchase the resource in order to download."Does someone have an idea please ?
thanks
?support
how about you test it
Will slow down crops
alright ig
tickspeed is a gamerule im pretty sure
Bukkit.getWorlds().forEach(world -> {
world.setGameRuleValue("randomTickSpeed", "1");
world.setGameRuleValue("doDaylightCycle", "false");
});
?
thats what shitgpt gave me
idk why he wanted to disable daylighrcycle π
does anyone know what happens if you set the randomtickspeed to 0?
try it
hello
im getting a weird error
just see the if statements
its telling me that eco.getBalance() (that in my case is 202) is less than 10
what could be happening?
If there are no available worker threads in the pool when an asynchronous task is scheduled, the task is queued and will be executed once a worker thread becomes available. Bukkit will automatically manage the execution of tasks in a way that avoids overloading the server.
Is this true? -ChatGPT
guys i have a problem with my vps server
when i am trying to connect to the database
Which one?
wait when the playerjoinevent gets called and there was 0 players befoire the event fired, what will be the size() in Bukkit.getOnlinePlayers()?
i always forget
its so confusing
One more than before...
Ok
and what about PlayerQuitEvent tho?
One less than before...
where it shows 1?
inside the event when i print out size()
You mean the tick which this event is fired in?
In this case: The player will always be in the playerlist while he is involved in an event
I knew it!!!!!!!!!
Meaning PlayerJoinEvent -> He is already included in the playerlist
PlayerQuitEvent -> He is still in the playerlist
so u have to do size()-1 to find out if there is no player on the server anymore (if u do it in the event)
PIN THIS!!!!!!
*If he is the last player about to leave. Yeah.
Your balance is less than 10. π€·
@weak meteor I don't understand what you're trying to do
a discord bot
but its just a check of balance
with 2 integers
eco.getBalance() < 10
i mean if eco.getBalance < 10 evaluates to true, its fact that eco.getBalance is less then 10
also wtf
You've posted two different pieces of code so far.
Do a clean reset, gather enough information and come back with data that can actually be used to help you.
How would I limit my Plugin so its only able to create 1 thread at a time?
i would also suggest using jda instead of javacord
what is actual problem
Create a fixed thread pool with only one thread.
use int, not Integrer
provide some error ?
okay
doesn't matter, this whole piece of code doesn't make sense
no but i think the problem comes from my vps
i mean if u don't want to provide error
i doubt anyone will be able to help you
other from guessing
This is my code: https://paste.md-5.net/qavuzuyoqe.cs
Create a manager of some sort:
private final ExecutorService executor = Executors.newSingleThreadExecutor();
public void execute(Runnable runnable) {
this.executor.execute(runnable);
}
public <T> Future<T> submit(Callable<T> callable) {
return this.executor.submit(callable);
}
Just a minimal working example.
ok thx
guys what are all events that get fired when a player joins a server per order
Here i get the message:
and the debug value:
The second message is my Balance divided by a 100 so it isnt cents its euros
What is better for async:
Using the bukkit scheduled or the bukkitrunnable?
Bukkit Runnable is a task
?
AsyncPlayerPreLoginEvent
(PlayerPreLoginEvent)
PlayerJoinEvent
PlayerCommandSendEvent (Not 100% about order)
PlayerSpawnLocationEvent
Its your decision if you use Async or sync with the Scheduler
OMG tysm
difference is, one schedules tasks the other is the task to be ran
which one is before the chunk gets loaded?
however, the runnables don't require to be scheduled to run though
you could simply invoke their run method
this doesn't necessarily mean they are sync as you could just make another thread and toss it in there as well
also, runnables can be created via anonymous inner classes too
i guess AsyncPlayerPreLoginEvent
hope that clears up the confusion between those two things π
alr
ideally you should use the scheduler to schedule your tasks as it makes it easier
AsyncPlayerPreLoginEvent
(PlayerPreLoginEvent)
PlayerSpawnLocationEvent
PlayerJoinEvent
PlayerCommandSendEvent
pretty sure join is before spawn
whats the difference between AsyncPlayerPreLoginEvent and PlayerPreLoginEvent
Async
Thought so too
weird
is the same even if tested multiple times?
I wonder if they are just sent at the same time
or maybe they happen at the same time and at some point the order swapped somewhere
Cant really fire events "at the same time" if they are sync π
and when using the AsyncPlayerPreLoginEvent will the size of getOnlinePlayers.size be 0 or 1
That isn't what I meant
I just mean if they both happen within the same block code to be thrown
depending that it had no players
if that is true, then its just a matter that the order of throwing the events could have changed over time
all well, seems spawn comes before join according to your test
Just tried a bunch of times, even with removing the player dat
But i see where the notion comes from 
hermmmmmm 10/10 java doc
AsyncPlayerPreLoginEvent is fired before a player is even allowed to join the server.
There is no Player object and if you block a client in this event, then the server never gets to know the player.
This event is often used to load player data or enforce bans.
Well historically this was indeed the order of the events. So i think what happened is the code block responsible the events to be thrown were swapped so spawn is being called before join
I will have to do some tests. To see if this makes much a difference
what about PlayerLoginEvent?
It could be a slight over sight if calling spawn before join actually does present a slight issue
I perhaps want to use PlayerLoginEvent in my case
Playerlogin event happens on the network stack and the benefit of using it there is that you can make the player wait a bit of time without problems unlike the join the event
so will the playΓͺr show in the list?
No. They show in the list when they join
But they show up as connected if they make it past the login event
so Bukkit.getOnlinePlayers.size will show 1 after the event?
assuming no player was on before
Um connected players if they query the server should show 1 if they made it past login. Getonlineplayers should show 1 if they make it past join
But considering spawn is before join though its possible that it shows 1 before
Which i am still uncertain if spawn being before join causes issues lol
hey, are vanilla death messages broadcasted per world or is it seen by all players in all worlds?
Broadcast messages are not world dependent
That is not assured. It might be one more. But you dont know if it occurs 1 tick later, 5 ticks later, or never (when a player gets blocked from joining)
- 1.8 support was dropped years ago
- Are you developing your own plugin?
yup
Then debug why your database is not connected
listen
when i was programming my plugin on my localhost (database)
it's works great
but i changed the database connection info because im using vps now
Cool. Now go ahead and debug why your connection couldnt be established.
So this is a workaround I wrote awhile ago for disabling the "Respawn point set" message, when you interact with the bed, is there any other way to handle it? https://github.com/dmulloy2/ProtocolLib/issues/2472#issuecomment-1622663815
Paper has an event for that. but with Spigot the best you can do is cancelling the interaction and handling the respawn stuff yourself
now i kinda want to switch to paper
should I make a wrapper object for this
No, but wrap the code
Still is not wrapped
What's happening with the allocation of those objects
Idk looks wrong just allocating objects and not doing anything to them
Mhn kay
how can you rotate an entities head smoothly to make it look like it's looking towards a location? But not just teleporting them to look at it cause that's rigid
maybe teleporting them multiple times to the same x,y,z, with different pitch and yaw, but I'm manly asking about the math of getting the pitch and yaw
Basically interpolation
woah I remember smth about that in linear algebra
public double lerp(double start, double end, double progress) {
return start + (end - start) * progress;
}
Progress ranges from 0-1
would progress be smth comparable to the step?
No worries
ItemDisplay + TextDisplay + mathematics ?
Sometimes just creating the object is good enough. Forget there may be logic in those classes that do stuff once its created and thus nothing further needs to happen with the object after its created.
for a server like hypixel, is it like a different "server" for each gamemode
uh no
Hypixel has like 4 different "templates"
At least
They have their lobby servers, their "mini" servers, their "mega" servers, smp and skyblock
So
Due to the way their minigame engine works, they can actually just have all their minigames under 1 plugin
ya
So when you ask to join a bedwars game their matchmaking service points you to the "ideal" bedwars server
Then it asks the load balancer in case it needs to scale up or down
scale what
so
Basically they just have a bunch of templates that are copypasted across machines
ah so if I made a mini game server
my plugin would need like a
world management system right
Well, we'll get to that
because i dont think it's like
i'm not caching it
The load balancer is responsible for starting and stopping server instances from a template
so it is a different server for each gamemode?
Eh, yes and no
Their "mini" instances hold all the small-scale minigames like bedwars, skywars etc
Their "mega" instances hold all their large-scale gamemodes like mega walls
Their "lobby" instances (might be merged into mini) handle the player lobby
They also have "proxy" instances
And for skyblock I'm not too sure but I'd say islands are ran on mini instances and larger stuff are handled in mega instances
They could be their own templates
Regardless, the "mini" instance receives command from the matchmaking service to, let's say, "create a bedwars game with XYZ map"
It should be noted each instance can easily have 10 games going at once before another instance needs to spool up
Exactly
so is that where a world manager is put in place
I'm not saying each instance's lifecycle is tied to a game
Each instance can manage 10 game lifecycles (or more)
Worlds are all in-memory as we don't need persistence, so that's where SWM comes in
like for example in a bukkit server it's like a bunch of worlds each get their own folder
With hypixel's it's just all in memory with little to no file caching
Its not a world manager you need. You need a baremetal vm handler
yeah so
That's the load balancer
or as I call it "allocator"
how does each vm handle 10 games
Because the mc server in that instance is just dedicated to the minigame and can spawn however many worlds it can handle
https://github.com/IllusionTheDev/Minigame-Demo/wiki/The-basics-β-Phases
Their minigame engine (which follows similar principles to this) is built in a way that allows you to just define each game as a list of phases
So you don't need to fully build a whole world around this
You just need to do a bunch of networking
For example, "matchmaker" sends "instance-ab123" a packet saying "hey, ImIllusion wants to join game bedwars123, here's all the user data you need"
"instance-ab123" replies saying "ok, bring ImIllusion to bedwars123" and the player is sent
It's just networking
Vms can have templates they are created from which contains all the necessary stuff already. Therefore its just a matter of stuffing that vm image with a custom mc server and a couple of plugins so when it comes alive it attaches to the network automatically
When the vm is has no connections for a period of time it just shuts down or informs the master its idle and the master decides
I'm not a HUGE fan of making a VM for each instance as it has a bunch of overhead
If all the tech we're running is proprietary we don't need that much and we can share resources like game maps
Its not a vm per instance
Just a VM per machine?
i think i asked this b4 but why does this happen with bungee
how is that handled
No. More like 10 or so vms on a machine each vm handling up to 10 games at once
it gets stuck on that forever
I treat an "instance" as a minecraft server
So yeah that's a VM per instance
I'm structuring mine as just a controller per machine where each instance has its own folder
im so confused
It allows resources like map files to be cached per-machine rather than per-instance
so does each mini game server have a world manager
Yes
Let me make you a diagram
Obviously there is a few ways to do this
I'll make you one for the way I'd do it
That's a mega
It's just a minigame that has no "start" phase
Optic still wants me to create my proprietary system
Just a big eternal "playing phase"
I'm working on my own stuff
Started my own little allocation system last night
Just need to write all the networking and some of the client logic
Thats neat. Reason optic wants mine is because its already proven
it's just that im making a plugin and bunch of items got special abilitites, I dont want those abilities to be triggered in special areas
what's the best way to handle this
not the first time I'm working on one
should i interact with world gaurd api?
Make your own region system
Or piggyback off worldguard, sure
do you happen to know if checking if one location is in a region is a "fast" task
I didnt mean to say you dont know how to make one or yours isnt as good
and checking a flag of that region
because im assuming world guard stores its regions in memory
Eh it depends on the shape
And how many regions there are
a square
It can be O(n) or O(1) depending on the way regions are organized
how can it be o(1)
binary tree or chunk system of some sort
magic
maybe what it does is it registers regions to chunks
gets the chunk at the location of the region and loops through the regions in the chunk
so then it doesnt go through every single region
Hey! Does anyone knows how to remove the Spigot text when the client has an unsupported version? Like "Spigot 1.20.2". Just wanted to say 1.20.2 like the normal Minecraft servers.
This is the network structure
Each "allocation client" is responsible for keeping track of its own images and spin up servers when the master asks for it
okay
I'd split the spigot part into a few parts:
- Allocation agent (Responsible for sending heartbeats to its managing client saying it's alive)
- Matchmaking agent (Responsible for receiving user data by the matchmaking service and relaying it)
- Minigame engine (Contains all the minigame logic and games)
- World manager (could be merged into the minigame engine, loads worlds in memory)
That's a lot of work
indeed
hey does anyone know how to check for event id or the message of the packet? https://wiki.vg/Protocol#Game_Event
Yeah so
Look at the NMS class
And just use protocollib's packetcontainer getters
they do something funky here
that gives me StructureModifier<Integer>
question can i use a custom yml file instead of a config file
would they work the same?
A config file is just a yml file
Unless you mean reading your own config.yml file, that's also fine
oh so it won't matter
Pretty much
oh well thanks ^^
anyone?
hey guys anyone know how my return is out method i can't figure it out
https://paste.md-5.net/onideserur.cs
Your set call isn't valid
set("join_sound", "ENTITY_WHATEVER");
set("announcement", "whatever");
can i use get string to change an enum or is there another way for that?
getString returns you a string value present on your .yml
wrap it with valueOf and you have your enum value
hm i never did it like that before i gotta see what i can do
I wonder my, e.g., Bukkit.getPluginCommand("decentholograms"); always return null; That means I can't get PluginCommand of other commands
Is it registered in the plugin.yml
i couldn't figure it out do you maybe have an example you can show me fo
MyEnum value = MyEnum.valueOf(myConfig.getString("my-enum-value"))
is hte myenum called that or do i name it for the sound i am using?
thing is it keeps showing red on the MyEnum part constantly
You are meant to change MyEnum to whatever the enum you want is called
tell em
MyEnum? I prefer OurEnum 
that way when it shows up red you know it's right
This man gets it
Does anyone have an idea why this doesn't work?
ServerPlayer serverPlayer = ((CraftPlayer) sender).getHandle();
GameProfile gameProfile = new GameProfile(UUID.randomUUID(), "Frensor");
ServerPlayer frensor = new ServerPlayer(serverPlayer.getServer(), serverPlayer.getLevel(), gameProfile);
serverPlayer.connection.send(new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.ADD_PLAYER, frensor));
Other packets DO work.
look at your player tab screen
Bruh
I already did it
Nothing appears there
Why?
This worked for me before
Do you know how to do it then?
ClientboundPlayerInfoPacket playerInfoAdd = new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.ADD_PLAYER, npc);
ClientboundAddPlayerPacket playerSpawn = new ClientboundAddPlayerPacket(npc);
ClientboundRotateHeadPacket headRotation = new ClientboundRotateHeadPacket(npc, (byte) Math.floor(npc.getYHeadRot() * 256f / 360f));```
This is not for 1.19.4. Packets were changed in 1.19.3 if I remember correctly.
correct, but it's very similar
Why would this work?
uh, because thats how you do it
I already tried it with this one ClientboundAddPlayerPacket playerSpawn = new ClientboundAddPlayerPacket(npc);.
The NPC appeared, but the tablist didn't change.
for 1.20.4 its ```java
ClientboundPlayerInfoUpdatePacket playerInfoAdd = new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.ADD_PLAYER, serverPlayer);
ClientboundSetEntityDataPacket setEntityData = new ClientboundSetEntityDataPacket(serverPlayer.getId(), serverPlayer.getEntityData().getNonDefaultValues());
CommonPlayerSpawnInfo spawnInfo = new CommonPlayerSpawnInfo(
nmsLevel.dimensionTypeId(), // dimensionType
nmsLevel.dimension(), // dimension
nmsLevel.getSeed(), // Seed
serverPlayer.gameMode.getGameModeForPlayer(), // playerGameType
serverPlayer.gameMode.getPreviousGameModeForPlayer(), // previousPlayerGameType
nmsLevel.isDebug(), // isDebug
nmsLevel.isFlat(), // isFlat
serverPlayer.getLastDeathLocation(), // lastDeathLocation
(byte) 1 // keepAllPlayerData
);
ClientboundRespawnPacket respawnPacket = new ClientboundRespawnPacket(spawnInfo, (byte) 0);```
err
thats for 1.20.4
uses a CommonPlayerSpawnInfo now
Why this many things? I only need to update the tablist. I'm using 1.19.4 btw. I haven't used 1.20.2 and above before.
it's just how the protocol does it
This isn't appropriate for 1.20.1 and lower.
no its not
But I said I'm using 1.19.4. Why send something that doesn't work?
For updating the tablist? Why?
I don't think that major changes appeared one version behind
the respawn is sent if you are changing the players skin
mojang can rewrite the entire game in the next snapshot, there's nothing limiting them from doing changes
What if I only use these two?
Anyone any ideas?
Okay... Im gonna commit a crime: @remote swallow
what crime
Pong
ping
Pinging you. Do you know the answer perhaps?
havent got a clue
what are you trying to do?
I'm trying to add a new player to the tablist. This worked for me in previous versions, but now I'm stuck.
No
well the bitmask that needs to be sent is 9
which consists of 2 actions
add player and update listed
Oo so I need to do both now
yeah update listed is a boolean
which informs whether the player being added should show up on the list or not
wait my hero
How tf do you listen to packets without any external libs
you hook into the network manager
The whaa
and then you obtain the appropriate queue for whether you want packets for being sent or packets being received
I do not have a snippet at hand to show

what
Gradle or maven?
thats what she said
well it depends on situation π€£
maven
Ant
bazel
Is it possible to convert my maven project code to gradle?
why wouldn't it be
I mean, it will end up with some manual work
definitely
I would start with maven for spigot development and stick with it for a while.
Your build tool has no effect on the quality of your generated bytecode.
Its simply a tool to orchestrate additional steps for your building process.
The compilation is faster because some steps are cached. The initial compilation is usually slower.
public void execute(Runnable runnable) {
this.executor.execute(runnable);
}
public <T> Future<T> submit(Callable<T> callable) {
return this.executor.submit(callable);
}
@EventHandler
public void onBlockBreak(BlockBreakEvent event) {
Bukkit.getScheduler().runTaskAsynchronously(this, () -> {
//This code can only use 1 thread at a time
});
}
```Would something like this work? Or did I do it wrong?
Whatβs ur executor service doing
Single responsibility principle. Your class does too much.
Put the executor and its methods in their own class and treat it as a singleton.
ye this was just an example trying to understand how this works
no clue
You cant use bukkit tasks and your executor. Chooser either of those two.
I would stick with bukkit tasks for now and scrap the executor if you have no clue what it does.
ItemStack deneme = new ItemStack(Material.PLAYER_HEAD);
ItemMeta denemeMeta = deneme.getItemMeta();
denemeMeta.setDisplayName("ae");
deneme.setItemMeta(denemeMeta);```
This why dont works?
It gaves <identifier> expected and illegal start of expression
Show the exception pls
ItemStack(Material.PLAYER_HEAD, 1); maybe
Wait, you mean during compilation?
Yea
This means you have a simple syntactic error.
Show us your entire class or a screenshot of it.
Only create gui code but wait some second
package my.package.gui;
import org.bukkit.entity.Player;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
public class mainMenu {
public class testGui {
ChestGui gui = new ChestGui(2, "deneme");
ItemStack deneme = new ItemStack(Material.PLAYER_HEAD);
ItemMeta denemeMeta = deneme.getItemMeta();
denemeMeta.setDisplayName("ae");
deneme.setItemMeta(denemeMeta);
}
}```
Im using IF(Inventory Framework)
How come it always skips the hundreds, how could I make it not skip it?
Maybe ChatGPT misunderstood what I asked it
Thats not valid java code. You cant just throw code into a class body.
Wait yeah nvm chatgpt made a misunderstanding here
Why? I need fix what?
Oh no I just seen it
Learning the very basics of java would be a good start π
If number % 10 == 0?
ye chatgpt misunderstood me
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
You gotta understand what chatGPT gives you, but I guess times change
I wanted it to detect if its 1 number and then all zeros at the back for example 20, 90, 500, 9000, 30000, 80
Ah that is more effort
Rip
oke
but you can help me about fix it?
I cant figure out what your code is supposed to do.
So there is not much i can help you with.
Btw what happens if I make some java code to open a GUI (not minecraft gui, gui as in window/app) and put it on my server as a plugin
while (x > 9) {
if (x > 9 && x & 10 != 0) {
return false;
}
x /= 10;
}
return true;
Would be the code for that if you didn't figure it out already
thx
well the GUI if supported is opened on your server. Depends on your environment
https://paste.md-5.net/zalekehini.cs
anyone know what i did wrong in this code it says config needs to be an expression
Almost all servers are headless. So not much.
Worst case is you open a window on the servers host machine.
On are on a headless environment or on macos: crash
if (x > 9 ... is absolete, you can just remove that
Show more code
It needs create gui with IF and i need send this gui to player
But this need only creates gui
Oh yeah, though just the part before the &&.
yup, happens
Im trying to send gui in other file
I did the if first, then the while, so I did not realize
You have no variable called "config"
yeah I thought so haha
you don't need to convert
maven and gradle can be setup in the same project since both use different systems and files
in this manner if both are setup in the project it doesn't matter which you decide to use
Headless means no monitor right?
Haha, only you could suggest that
Because that is such a "well, actually" moment I can't expect from many
lol
It's right, but whyyyy would you do that?
if you don't know what build tool you use, how will your enemies
confuse them, trash your repo with multiple build tool files
Throw a makefile in as well
Although that gives me an idea for the moment I will invariably start migrating away from gradle
I'll probably keep both systems alive since realistically there is little maintenance cost to a gradle project once it is set up.
I cannot use maven in many of my gradle projects
whats possible with gradle thats not possible with maven?
Dependency generation on the fly
Imposing an artificial java version limit on your project 
Well with just maven it is possible, but IDEs say "nope, I'll parse the pom myself for deps"
lol. i also think gradle is less documented compared to maven
Also, conditional deps are a lot more restricted under maven
hmm
Myeah. I actually like the gradle user manual more.
But there is an abundance of maven related sources out there, simply because its more popular.
well if the project is open source it gives your users options
they don't have to be forced to use one or the other
Until the moment it only builds with one as the other silently broke and noone tested
btw, in a maven project, is output .jar compressed by default? or can you specify that somewhere
"forced to use one or the other" 
Probably yes
you would need maven shade plugin iirc
when I used to work in Eclipse, there was an option to compress the jar
well odds are it will break under gradle before you find some issue with maven
Nah maven jar plugin, installed by default
Things like changing dependency versions I meant
I can imagine that every IDE would really like having multiple build tools in their project directory.
Makes it easier for it to just commit unaliving.
Eclipse will only pick one
But you can add the relevant natures manually if you love duplicate suggestions
But given that the integrations work by registering their own containers, nothing breaks on that front besides code suggestions
Compression for jars require code analysis to check which classes are not
actually used on runtime. Afaik only the maven shade plugin has a minimizing option.
And even then I don't think so
That is minimize
it is actually quite common for projects to have more the one build setup to use
well it was in the past anyways as not everyone could use a specific one
is it called createDependencyReducedPom?
in <configuration> block
No
Then im not sure what he means by compressing
It's minimize
where
Compressing is STORE (no compress) versus DEFLATE (compress) afaik
add <minimizeJar>true</minimizeJar> into the configuration block
ItemMeta import is missing i think one of problem this.
notably, minimize can clap you in some fun ways
It's just that my jar is getting a little big in size. around 1 MB and I want to compress it
1mb is nothing
It's a big plugin
dependency reduced pom is just for removing transitive dependencies that are already shaded into your jar so that when another project depends on the jar it doesn't try to fetch those dependencies since they are already included
start worrying when its over 5 or 10
Uh, did you define some huge random dependency by accident
No I'm basically making a remake of essentials plugin
and its tons of classes
I think you mean 4
Yeah then no minimize
I don't like how essentialsx isn't so customizable so i wanted to create my own version
So, you are making essentialsy?
Minimize should only be removed to handle dependencies not being used to their full potential
no just Essentials
plugin for my server only
Hm
thanks
Interesting. I think you are the first developer to create an alternative.
I would also do a Kits plugin and a Bedwars one. 
it's a big project. one step at a time xD you can easily get lost in classes
Yes classes are scary 
You should use mvn clean package for building - takes less size (~10% at times)
I would guess there were other who did, but they most likely only included features they need or just never got past a certain point
Oh and use fewer classes if you want a smaller project
I think that was sarcasm
Beyond that, there is little to reduce size
shouldn't use clean unless there is a specific reason for it, this removes speed up advantages that maven provides
Yeah, I mean for creating the final jar
why don't you? xD
The size diff is real though
Idk
I'm not very good at understanding sarcasm, humour, etc.
the most exciting part for me is adding more stuff to config.yml
the more customizable it is the better it is
Because... there are like a million variations for each of those plugins...
when shading use minimize jar
it removes the majority of unused classes from dependencies and transitive dependencies
and understands your code to know this, however you need to do some testing to ensure nothing breaks
yeah but is there one that you actually like?
I dont use plugins, from other devs π
yes yes
I dont play minecraft either, i barely have time even for myself, i come home tired asf almost everyday
but coding is fun
Unless you code in some awful language
thats great. i dont either. if I wanted to i would code vault by myself too but since it cant really be customized and it does what its supposed to i dont feel like i should create my own version
an ideal server for me would only have my plugins installed
Vault would at least need CompletableFuture<Double> queryBalance(OfflinePlayer player) for me to be useful.
what do you use for economy? your plugin?
I think the best is what you do yourself, you know exactly whats happening
It really depends on how much time you have and if its worth it.
I wrote a huge library for personal use while on a summer semester break.
Included everything from holograms, NPCs to tablists, GUIs etc.
There is so much backbone in it, that i can write content on top of that with ease.
And it grew over the years. I think the biggest time saver was introducing the
Gson backed serialization model.
nicee
I was thinking of making a few util classes that would handle that sort of stuff too
it just that all takes time
almost too much time
you start to ask yourself if its worth it lol
but once its done, its done
usually the best stuff you want to code is hard to find and you have to do it all by yourself. think it out 
How to obfuscate nms stuff in codebase back when compiling? Like theres plugin for maven but I have gradle.
Okay so Ive been experimenting for a couple of hours now. I haven't found a single way to solve this problem. I also tried to use protocollib, but no luck. Can anyone help me please? version: 1.19.4
paperweight userdev or patrick choes remapper
What about spigot?
nothing offical
Remapper repo?
Thanks
I wonder how worth it would be to just maintain a spigot devbundle for paperweight
should be simple enough to setup and automate publishing
maybe that is my christmas obsession 
Favourite last words of every burned out developer
I got a few days off uni, gotta burn myself out somehow
Anyone? Sry for second reply
Uhm finals are in Feb... Dont you have to learn like the rest of us?
Finals are in March and August o.O
I have a single exam somewhere at the end of Feb
What county are you in?
Yeah, i thought we had the same schedule in Bay and BW.
Are you at a Universitiy for applied sciences or at a technical university?
π€·
smile please help me about this i dont find any problem in this code
But it doesnt explains problem totally
it does
it does
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
Having a cooldown for events/chat messages below 50 MS (1 tick) is useless right as its impossible to go that fast?
Pretty much
Well some events might happen more.often, e.g. async ones if they never have to sync with the tick thread
One tick might call multiple of the same event tho
Just, usually different context etc
Oh i think problem is related to expressions
btw what were you trying to do here
this make sense (for me :p)
You forgot ()
the problem is you have a class inside of a class π
(x&10)!=0
oh wait nvm i dont understand it
What im trying to do: see if a number is one non zero one in the front and the others are zeros for example 90 500 10000 etc
is it somehow possible to get the chat format for messages without having the chat event instance?
Isn't format set on event?
ah damn so i cant get around it?
I mean
You can fire a fake event or hook into the apis. First one might sent a message though
Some plugins cancel and broadcast so sadge
this may be a bit advanced for me to be asking in a discord server but how can i use my plugin to sture data even when the serevr restats???
You can store it in configuration files
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
yeah yml works fine
how can i change the name of the file
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
so something like
^/d0*$ I think
Let me test
Oh I can't post imgs
?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 can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org
I tested with these
9000000
9
10
1000
1009 x
1100 x
1010 x
1000010000 x
110000000000000 x
1
2
1000000000000000000000
I tested with these
ones with x failed
others passed
anyone that knows kotlin know what the fuck this means
First parameter returns
archiveDirectory as file or parentfile if archiveDirectory is null
Second parameter is much the name with archiveClassifier and archiveNamw
And archiveFile.name as last resort
rs.getString(1) is null pointer
0 too?
You forgot rs.next
thaks
cannot be converted to org.bukkit.command.CommandExecutor
getCommand("testcmd").setExecutor(new mainGuiTestCmd());```
How can i fix this?
executor has to be instance of CommandExecutor
mainGuiTestCommand must be ^
^[1-9]\d*
\d for any number, change it for your case
bruh what if it starts with 0
well idk if he wants that or not
non zero one in the front
Ok my bad
Regex is slow
ik
0 out of bounds rs.next moves pointer to next row which is empty
specifically what i meant is applying the translation the game uses
im p sure the game uses some translation key for chat messages

are you 100% certain you are passing a discordID that is in your database?
I'd suggest not, or you are reading from an empty database and not the one you showed
also you can;t use your discordID as the Profile name. It's too long
pretty sure names are still limited to 16 characters
i use user id
user id?
in your code you use discordID
which is supposed to be the one from your database, which is 18 characters
yes
so its fine
no
ohh
your limit is 36, your discordID is a length of 18, names are max 16
column name? or what do you mean by name
Profile name
new Profile(uuid, name)
you pass in a length 18 String (discordID) as teh name arg
ah ok
in that case you are passing in the wrong discordID or using the wrong database
fun
someone threw it?
implements CommandExecutor?
?tas
Yes. It.
Now it gaves this in compilation
is not abstract and does not override abstract method onCommand(org.bukkit.command.CommandSender,org.bukkit.command.Command,java.lang.String,java.lang.String[]) in org.bukkit.command.CommandExecutor
learning java can help
look at your IDE warnings. it's telling you what is wrong
can or will?
if something is underlined, hover over to see what it tells you
both
To getNearbyEntities on the exact same coordinate do I use 0 or 1?
Use 1 and filter those out who are not on that coordinate
Given that the edges of a block are nearer than the corners
www
.
hey for the new enchantment stuff do we just return the key we had used in the constructor in the getKey method instead of passing it in startup?
Player target = Bukkit.getPlayer(targetName);
if(target!= null) {
Inventory inventory = target.getInventory();
if(inventory.contains(drop)) {
inventory.remove(drop);
}else{
player.sendMessage("Β§cWe attempted to remove the item from the player's inventory, but it was not found ("+ MaterialConverter.convertMaterial(drop.getType())+")");
}
}else{
player.sendMessage("Β§cWe attempted to remove the item from the player's inventory, but they were offline");
}
}```
Issue, if the item stacks ontop of another item (for example the 1 torch in my inv goes onto another one and it becomes 2 torches) this code will recognise as there being no torches in the inventory (cause ItemStack 2). How could I make it so it notices it even if it stacks ontop of another one?
compare the material
or iirc there might be a way to compare disregarding the count
or you could make a copy, change the amount, and then see of its equal
but like
thats kinda expensive
its not possible to define any mutable fields in interfaces or fields that are pre-defined, right?
Yeah, interfaces cant have fields. Best you can do is
default int maxCount() {
return 20;
}
only constant field
Ok I assume I did something wrong because I checked, the array isn't null and the block is definitely a sign
The sign doesnt get the lines updated ingame
Force an update on the blockstate
ok epic, how, since setBlockState does not exist
you can specify variables if that helps
little bump π
Pretty sure the legacy converter shoves it all in the extra section
are there clean ways of automatically getting fields based on conditions. Except naming them the same every time and using reflection? (i heard reflection isnt considered clean)
You can get fields based on their type, annotations, name and declaration order.
But you shouldnt.
Unless its for serialization.
im not quite sure what serialization means, i just want that when i create new enum entries in a certain enum the fields and methods associated arent as tideous to update
not sure what would require updating if you add an enum entry?
can you give a better example?
i have added a stat enum based on events stats need to change in the player object, i create a method taht switches stats (i dont know what stat will be changed) and for every stat something special happens and the field taht describes the stats value is changed
if i add a new stat i would need to add a new case all the time
but when i could somehow get the field tied to the stat it could be easier
so that i just need to create a field with a closely related name to the stat
sounds like a general design issue
a simple idea for stats is an enum for the stat type, then a map of maps for players to stats to values
Map<Player,Map<Stat, Integer>> is just a super basic example
then you just increment the value for a stat key
how could i forget that xd
keeping a separate field for each stat's value sounds not good
whats the difference between a hashmap and a map?
Map is the interface, HashMap is one implementation of that interface
there are lots of implementations, IdentityHashMap, LinkedHashMap, TreeMap and plenty more
okay
Map just defines the methods and their general contracts (what the method is supposed to do)
an implementation like HashMap actually contains the logic to do what the Map interface contract says
like if you look at the source of Map, you see that there's no actual logic, just methods to be implemented
Does anybody know any 1.19+ plugin that uses NMS to create npcs and custom entities with multiple versions support? I want to check their code to learn how to do that.
should I use world guard or just make my own region manager
cause the worldguard ui looks horrible
make your own worldguard plugin
Light weight region manager
anyone have an idea how worldguard gets the region given a x,y,z location
their dev said it's "as optimized as it gets"
using a tree
For years and years they just iterated every region
They use some sort of structure now, idk what. Check the source code
There is actually an O(1) approach to regions instead of their current O(log(n)) one.
You can do that by initially calculating all chunks intersecting your region and then mapping the chunk x, y to your regions.
What if there is two regions in one chunk
like the chunk completely surrounds the region
Both regions
can you make maven increment your plugin version build number each time i recompile the project? i want something like 1.0.0.b<build>
Its O(n) for that because a region could only slightly intersect a chunk and other regions can overlap.
You need to decide if overlapping is ok. In that case you need a priority check as well.
i mean that strategy kinda goes sideways with verticality and checks finer than a chunk, then you need to start iterating or add some extra mapping, which is very pepega in terms of memory footprint
it is a trade-off, but "most optimised" does not tell you what it's optimised for
Ah, i actually didnt think about a more granular mapping. You could easily have a discrete value for which parts of the chunks are overlapped as well.
I usually just iterate if multiple regions overlap the same chunk (which is pretty much always 1 or 2 at max).
looking at it right now xD
if i want to save a decent amount of data to a file, should i do it all in a seperate thread? also should i read and do stuff with the data in a seperate thread?
Yes
https://paste.md-5.net/ayegacogat.cpp
question is this correct code?
Isolated i would say that this is fine. What does hasPlayerJoinedBefore actually do?
Also loading your values from a config should be done when the server starts and not every time you need them.
to check if the player joined before
cause if not it'll run for new players only
i am still new so i am doing my best
isnt it just player.hasPlayedBefore()
oh it is xd
this is it so far is this good?
https://paste.md-5.net/redewacera.cs
if (player.hasPlayedBefore()) { is missing a !
Why are you creating an anonymous Listener class?
It is common practice to create a concrete class implementation for your Listeners.
i just want it to only run for new players who haven't joined before since i am new this is the best way i can do if there's another way i don't know how to do it
Create a new class
Let it implement Listener
Create a new instance of that class
Register that instance in your onEnable

