#help-development
1 messages Β· Page 910 of 1
Basically he just means a minigame should have phases start game play end etc
technically states are finite to begin with, I mean even infinity in programming is finite
This is a fundamental approach to minigames
And doesn't require any fancy terminology
Each phase can have a million other phases after, depending on what happens
depends on the minigame really, but I mean organizing in this way may be beneficial
wait here hold up
oh so an if statement
Or if you're fancy a function map
I've always been a simple man myself though
nah actually function maps are really nice
Fr it's beautiful
unless the thing you are making can accept inputs, the states are finite as there is only as many as the program understands
Lol
You are not a clean code believer
Design Patterns: Elements of Reusable Object-Oriented Software and Clean Code, are bible for developers, so yeah finite state machine is a good idea and if your mini game is super complicated you can also go with behavioral pattern
yes
I think it is a bit misleading to say finite state machine
I need to rewrite my minigame guide I've changed so much since last time
because this implies there is infinite, when this isn't the reality
bro stop thats its name lol
can anyone help me use the correct registerNewObjective
method thats not deprecated, I dont understand what my issue is.. its ticking me off.
Check your type signature.
you are using registerNewObjective(String, String, String)
you should be using registerNewObjective(String, Criteria, String)
ah I see
π€£
thank you
I didn't understand how to set that type, never used it before but I see now
Criteria is an interface
Oh I see
declaration: package: org.bukkit.scoreboard, interface: Criteria
what's the best way of keeping track of fake players on tab?
59 should be at 0, 0
it goes different places everytime
in-house
im keeping track by doing this:
then
although its wonky and is different mostly every time
your wacky constructor aside
show setSlot
and also try to reduce it to a small number - reproduce it more concisely
which?
this
ah lol
return this? funny business
yes that is the correct way
anyways! Yeah idk why its wonky everytime
keep in mind HashMap is not ordered
let me 2x check
hash map is unorder and linked hash map is
yeah " This class makes no guarantees as to the order of the map; in particular, it does not guarantee that the order will remain constant over time. "
iirc
that may be it
i can just post my classes if you'd like
I'm actually about to sleep
yeah linked hash map didn't work either π
but do as you need
same column and slot but in a different spot
does this everytime
let me just post on github
ig
there ya go
Hello, how exactly does the bungeecord proxyproto listener work?
Im sending headers at the start of the connection and ive verified with other libraries it gets recognized as a valid proxyproto connection but when i try proxying a bungee it doesnt accept the connection
Nvm
im dumb
can somone give me a semi challenging beginner project for plugin dev
idk what to do
Landclaim is pretty decent
cool ty
ikr
Yes
kotlin is alright if you're not using bukkit and you aren't making a library/api
its obsession with preventing nulls makes it very ugly for bukkit dev imo
Whats so bad about null? 1 null check and its fine or why does kotlin do this?
I'm trying to do proper API design and one thing I'm doing is separating the API from the implementation using maven modules, now the implementation depends on the API, but how do I make plugins actually call my implementation? i.e. if I have a class GreetingGetter with a method getGreeting how do I redirect getGreeting to GreetingGetterImplementation
Thats the same problem someone had yesterday. You need a gateway. Look at how other libraries do this.
One example is ProtocolLib. You either need a gateway or use spigots services manager.
A Gateway?
GrassGetter someImpl = FloraLib.getGrassGetter();
Where FloraLib is your gateway. You can simply register implementations in it.
Its the same for PLib. ProtocolManager is an interface and ProtocolLib.getProtocolManager() returns you an impl of ProtocolManager
This is probably cleaner as it prevents some static fkery
same shit, but integrated into bukkit api
unless you want your plugin cross platform
Oh, but now I'm slightly confused:
How does the FloraLib return an implementation?
imagine you have
flora-lib-api
flora-lib-impl
modules, how does -api return an implementation?
you include implementation in the gradle project for the platform to shade?
Someone has to register implementations in FloraLib when the server starts
Something like that
Thank you :D It's my first time actually designing something proper lol
Example how ProtocolLib gateway is initialized.
oop thanks!
@lost matrix this conversation actually confused a bit, we know the plugins are loaded by separate class loaders, thus no class implementation details cannot be shared
how does public api implementation would get exposed to external plugin
if its loaded by separate class loader?
They all end up on the same classpath. Every implementation is exposed to every plugin on runtime.
but doesnt that defeat the whole purpose of a separate class loader for a plugin?
i guess separate classloaders are used for not to blow up the server when one plugin's classes fails to load
The PluginClassLoader are all parented by the applications class loader
while they are separate classloaders, they do perform lookups between each other
Hi , should i use mongodb for a plugin like this :
2 tables :
- user : uuid , faction_id , kills , deaths , points
- faction : faction_id , total_kills, total_wins, total_points
Doesnt matter what DB you use here
Literally could use OrientDB
Whatever you feel confident with
and less bugs?
i used to work with mysql but i think its kind of old , i think iam gonna use mongodb
I personally use MongoDB a lot. But only because it suits my design philosophy.
Its not a bad idea to learn new stuff.
?paste
alright thanks sir , iam gonna learn it and use it
iam working on new plugin , and i want it to be perfect as possible .
ofc but for now i will stick with mongodb
so basically if i compile my own plugin A with plugin's B api, it would access the instances that plugin B provides since classloader delegation would kick in, but if I lets say used Class.forName() to locate a dynamic class object from Plugin A class loader, it wouldnt work, since two classloaders of both plugins are distinct and isolated?
they are not isolated
while i don't know for sure, my guess is that the reason they are separate is so if a plugin fails to load, its CL can be closed and whatever is inside it won't affect the rest
How can i use UTF-8 on my plugin ? i tried this:
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
options.release.set(targetJavaVersion)
}
}``` and ```gradle
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
```but both did not work
Did you reload gradle, that works for me
Just reloaded, does not work
could the error be with the console?
Try typing something in chat and see if the console picks it up correctly
^
Well its your console then
what is this
everything worked fine a month or two ago
now when i got back to this project
You forgot to run BuldTools (with the --remapped flag)
hm
For the inventory click event here: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/inventory/InventoryClickEvent.html
I'd like to know, when this event is called, if the player clicked an item within the inventory without previously having anything on their cursor, does the getCurrentItem() method return the item in the slot they clicked before the item was taken out of the inventory, or after?
In other words, would this method return null if the player took out an item from the inventory? Thanks
declaration: package: org.bukkit.event.inventory, class: InventoryClickEvent
getCurrentItem() gets the item in the slot, yes
getCursor() would be null in this case
ah
Events are called before actions actually occur, so the actual click hasn't happened yet, but it's about to
So, would this return whatever was in the slot before they clicked the inventory, or after?
Right okay
Interesting
Thanks a lot then!

π
Actually, sorry, one more question with this then: If I was to do Inventory x = event.getClickedInventory(), would this return the inventory which was clicked before any changes were applied to it?
Yes
yes
Lol thanks both!
That inventory is nullable too if they click outside the inventory, so keep that in mind
Oh and thanks again @young knoll for implementing that sign side feature!
I wasn't aware, thanks. I'll make sure to check for that then
Got a question for y'all, what would be a good way to store tab slots? My system seems to be way off and inconsistent, each time its in a different spot:
technically that should be the top left
Slots are ordered alphabetically.
interesting.. So how would i keep track of these?
can't think of another way
cuz they are seperate classes, each column
Fill them all up and map each one to an index
I did something similar where i can simply select by row and column after filling all slots
Hi, I how can get name of yml file? This ios not working for some reason. Why im getting empty string?
System.out.println("Loading pets...");
File folder = new File(PetsPlugin.getInstance().getName()).getDataFolder() + "/pets");
File[] listOfFiles = folder.listFiles();
List<String> pets = new ArrayList<>();
for (File listedFile : listOfFiles) {
if (!listedFile.getName().endsWith("yml")) continue;
YamlConfiguration yamlFile = new YamlConfiguration();
yamlFile.load(listedFile);
System.out.println("listedFile " + listedFile);
System.out.println("yamlFile " + yamlFile);
System.out.println("yamlFile " + yamlFile.getName());
hmm, okay. So after i create the columns, i should index each slot? Although how would i get the order?
just grab all of them and use a TreeMap? Or what
listedFile.getName in this case
The order is determined alphabetically based on the profile name. The display name can be something completely different.
ohhhhhh
legit all of them are named "" π
i'll figure it out, lots of help though, thank you
So you could just make the name a number I assume?
why is there optiopn from yamlFile.getName() than lol. Im just sending to another class only yamlFile to get only string like suckAcoolName.yml and thats not possible fuck.. I will need to work with full path what will listedFile.getName returun. Thanks
oh, now I get it. I think it will get name of the file... I need in another class only yml file, but first I need to validate if file is yml file, so I will probably validate that and then start working with that. Just send name and yamlFile to next class. Thats will be probably best solution.
There is probably no way of getting that file name from YamlConfiguration right?
no
nwm than. Thanks a lot. Now it makes sens to me
hmmm, am i doing something wrong or?
wonky numbers but it ain't ordering them?
that is displaying its name atm ^
OH
i'm so dumb
nvm
π
π
lmfao
is there a way to make the columns fixed, cuz sometimes its 16, sometimes its 20, like bruh
its throwing me off
Should always be 20 honestly
this was the max columns set to 20, then i changed it to 16 and now its 20 π
What was EnchantmentWrapper deprecated for?
Deprecated.
only for backwards compatibility, EnchantmentWrapper is no longer used.
It's been replaced It's effectively useless it was originally used as bukkit registry but bukkit shouldn't really define its own registries it was moved back into craftbukkit and backed into the actual server registry
So, what's the correct usage now?
For custom enchantments l?
Yes
This code is not mine, don't ask those questions
I just need to get it fixed
lmfao
Id argue the nms registry hacking is better
But to each their own
Granted for this you have to accept your code will break
I'd argue that's fine lol :P
smh
I would probably also use the pdc. However hacking the registry might come with benefits like automatic support for discovered enchantments.
Drawback: The client wont be able to display the enchantments anyways because it has no translations for that.
Well, fuck me
Thanks for the help anyways, going to have a good time making this work again
Even if it does have translations sadly it won't work afaik
minecraft tab's are so scuffed why do they change column sizes on me π
Since the client doesn't understand the custom id
how do your register an enchant in 1.20.4?
Registry hacking
the old method seems to be gone
Hi , anyone can tell me how to fill this ? player.getInventory().setItem(1, );
Fill the inventory or fill the rest of this method call?
fill after 1
Create a new ItemStack with a Material of your choice:
ItemStack item = new ItemStack(Material.STICK);
And then pass it as the second method parameter.
ok
player.getInventory().setItem(1, new ItemStack(Material.STONE)); ?
can i use this ?
Sure. But i would recommend you to allocate a new variable instead of inlining it.
Makes it more clear and helps you expand on the code later on.
i've never realized how bad brigadier looks until now:
my eyes
ngl mojang's code sometimes looks like yandere dev's
Hello guys
I'm looking for a little help about NMS, am I at the right place ?
I saw some topics on spigotmc.org about NMS so I was wondering if I can talk about it here
If I'm at the right place, I'm trying to understand what is the method "a" from EntityLiving. I have a problem about this spamming an error in a plugin I don't own, and I'm trying to understand so I can talk with the plugin dev with good informations
?mappings
Compare different mappings with this website: https://mappings.cephx.dev
Are you sure the plugin is supposed to work with your server version?
?nms
You should use those mappings instead
It should yes
He's not the author, so he shouldn't have to worry about that.
Exactly :/
I'm not trying to modify the plugin, I decompilated the plugin and trying to understand what's the problem so I can give a good feedback to the author
I'm wondering if it's legal to decompilate a plugin without modifying it tho π€
Why do I can't find my entity using your mapper ? π€
I'm looking for "EntityLiving" and there is a "LivingEntity" π€
Yeah
EntityLiving isn't named that in mojmaps
LivingEntity would be the mapped name
Spigot calls it EntityLiving
Mojang calls it LivingEntity
Oooooh
But it's the same thing
yes
you can modify it for personal use too I believe
Anyway, there's a EntityLiving$a here:
https://mappings.cephx.dev/1.20.4/net/minecraft/world/entity/LivingEntity$Fallsounds.html
version: 1.20.4, hash: c2e22978a4
Tysm π
hopefully we get custom enchant support soon I feel like that's a pretty easy thing to sync comparetevly to other things
You could post the exception message you're getting
Tbh I already know what's the problem, I'm just trying to find how
When handling a EntityDamageByEntityEvent, MythicMobs lets Bukkit call the CraftEventFactory#callEvent method recursively (and infinitely)
Here is the stacktrace if you're curious :
Is your server version up to date? There were recent changes to those events.
(I didn't paste the whole stacktrace, it's litteraly calling himself so...)
Also make sure the plugin is up to date.
Ah, thank you for the information, wasn't aware of this
π And holy fuck are they some nice changes
bless Doc
finally I don't have to registry back my own DamageType API π₯²
Start by asking if the plugin version can be used with your server version.
ah yes
vs code lsp language server
using 90% of my 8 core cpu
glad i took my headset off
my pc sounded like its taking off
wtf language are you using?
?paste
a default constructor hsa no arguments
UUID can't be final in this case
likely whatever Pojo mapper you are using
creates an empty class instance and fills the fields
You are trying to put this object into an RMap or some other Redis backed object.
This wont work. Live objects are used differently
whys that?
my assumption is the object is being recieved from redis thus the error the POJO mapper can't use his constructor
No this is all fine. The exception is not for this class but an anonymous inner class
ohhh
Which was generated using an annotation processor
so how do i use liveobjects then
if they cant have a constructor, what can they have π
They can have a constructor and they dont even need a default no-args constructor.
The problem is that you tried to serialize the object by sending it to some remote collection.
Live objects are auto synchronized between applications, there is no need to put them in a remote collection.
i dont put them anywhere
this is the only thing and i have one other method that tries to read the data as debug
from the objectservice
Give me a min
First step: Dont use a raw RedisConnection. Use some RedissonClient implementation.
RedisConnection is my own interface
Thats a weird name and it shadows redissons internal class. Alright let me check what else it could be.
and here I was trying to avoid turning on the heater but it's just too dang cold, I hate the winter
I need to be toasty to do my very important programming work
Winter is the best wdym!! I love going outside and remembering holy fuck its only 10 degrees out i wanna die
it's 13c rn
it's been 21c+ for the last few weeks, it was great
and it's not going to warm up, this sucks
π bro is complaining about 13c
we're having a warm week at its 6c
I am wearing a sleeveless t-shirt right now and I'm going to be forced to actually wear a normal t-shirt
sad!
but i have new question of this , what is 1 ? why we put int ?
I hope you experience true cold temps at some point in your life π you deserve it
declaration: package: org.bukkit.inventory, interface: Inventory
I've been out in -50c I wanted to cry
That was probably stupidly dangerous
well you wouldn't be able to anyway since the tears would freeze in your eyes
yeah π₯² true
π₯Ά
Hm, this could be a more complicated problem involving spigots classloader.
Try a minimal setup in a normal java application.
I disagree highly. it should always be 24c with a slight breeze
27c is too hot
Something like 24Β° is better for hiking and cycling. 27 is alread a bit hot.
well, you're wrong + l + ratio
I love working out at 35c weather
classic american moment
you are a maniac
you literally sweat puddles, it feels like you're getting the workout of the century every single time
hmmm , so is means where the block put in inventory ? do i right understand ?
I bet it was hot π
Yes
I mean it's always hot anywhere I go but my surroundings were also hot that time
Ill try a simple setup for myself as well. Would be interesting to be able to use them.
How can I send someone a message with a clickable link?
imo working out is fine up to 40c, after 40c if you're doing it under direct sunlight it does get to be a bit much
but under 20c it's also unpleasant
my gym doesn't have heating, cooling and only installed air extractors this year
if it's 13c outside it's 13c inside
@ CHOCO ADD MORE COMPONENTS
18 Β°C is the sweet spot. A bit chilly, but not cold, but it is very far from being hot
Working out in 10-20 is great
ok
Hamedan now is -4C but always snowy :/ i can't go school at all
lmk if you got results i will brb
if you're doing weights and it's 10c in the room you're in you will actually get cold while between sets, it sucks
my gym runs hot water on every tap which I despise because I can't refill my bottle :/
wow that's like 3/5ths of a greasy chicken meal
Monopolies be lies
3/4ths
pizza is 5 bucks
chicken is 4
just squeeze the juices from the chicken into a water bottle and take the bottle with you to the gym for your preferred hydration method
I've never refilled at the gym
Showers got a cold temp?
Should be some eye washers
I actually have two water canteens, one that is 1l and one that is 2l just so I can take the 2l one when it's leg day
eh
gl trying to refill your water bottle without getting slammed by 5 naked dudes
I mean
I won't judge
Get @tender shard to do it
what's wrong with doing a little of both
he's going to that kind of gym, you know
can't wait to take tomorrow off work so I can catch up on work
hey I'd do it to π₯Ί
π
I'm trying real hard to ignore the offset bug visual entities are giving me rn
the life of a hustler
nothing nicer than getting 3 new maps 15 mins before the deadline
and each one taking an hour to config
I have it mostly figured out but I need to redo some of the scaling math
Ok, it was actually just a problem with the constructor. You need a no-args constructor because the auto synchronized anonymous nested class copies all constructors and needs one with no-args for instantiation.
ngl it really sucks to have both armorstands AND display entities working in tandem
but the upside is that it can do bedrock and pre-1.19.4 clients safely
@EventHandler
public void onChunkLoad(ChunkLoadEvent event) throws Exception {
Chunk chunk = event.getChunk();
for (CraftPlayer npc : manager.getNpcsInChunk(chunk.getX(), chunk.getZ())) {
for (Player player : Bukkit.getOnlinePlayers()) {
manager.showTo(player, npc);
}
}
}
@EventHandler
public void onChunkUnload(ChunkUnloadEvent event) throws IOException {
Chunk chunk = event.getChunk();
for (CraftPlayer npc : manager.getNpcsInChunk(chunk.getX(), chunk.getZ() )) {
for (Player player : Bukkit.getOnlinePlayers()) {
manager.hideFrom(player, npc);
}
}
}
@EventHandler
public void onPlayerLeave(PlayerQuitEvent event) {
Npc.ejectNetty(event.getPlayer());
}
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) throws Exception {
Player p = event.getPlayer();
for (List<CraftPlayer> npc : manager.getAllNpcs().values()) {
for (CraftPlayer n : npc) {
for (Player player : Bukkit.getOnlinePlayers()) {
System.out.println("show");
manager.showTo(player, n);
}
}
}
Npc.injectNetty(p, manager);
}``` can someone suggest what should be added here, my NPC plugin does not work stably and in many cases players do not see NPCs
I mean, in what cases do I send packets?
okay I've added one but i can still use a normal constructor?
I've never looked at the underlying code for this stuff, do clients even use packets with data sent from chunks they are well beyond the view distance from?
What is the reasoning behind injecting something into the joining players netty pipeline?
In older versions they keep the entities until they get the chunk. He is using 1.12
But there is soo much code missing. I think he is still mixing the idea of virtual and physical entities.
handling the event of clicking on the NPC, it works fine
So you are using it for packet listening
doesn't seem like a great idea at a scale
can any one code a plugin for me I dont know what els I am supose to do but ask lol
just joined
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
yes PacketPlayInUseEntity
I dont think he is writing this for actual usage. Just to get some experience with npc creation.
how do I get somone to code me a plugin???
is the chunk loading event not always triggered?
You ask for devs at the link we posted π
what is devs

oh ok do I got to pay
Depends. Sometimes there are devs which code smaller plugins just for fun.
Cough cough bukkit.org plugin requests
I am confused could you join the vc rq
it may be due to the fact that the chunk is loaded on the server side and not the client, or because it may already be loaded?
Nothing we said is confusing
Ask your question
no but I dont know what to do when I am on the site
Read the guides or important pins
so in what other cases should I send packets?
When they come in range
how do I check if the NPC is within range, to use the distance?
The proper way (which would also be used in newer version) would be to listen to outgoing chunk packets, and simply send your NPCs afterwards.
Same for unloading.
Paper has events for that iirc. Something like PlayerUnloadChunkEvent
that is, to replace the chunkloadevent event with listening for packets that I already have?
(injectnetty)
I can then delete the chunkloadevent and chunkunloadevent code?
and which packets should I listen to
PacketPlayOutMapChunk and PacketPlayOutUnloaddChunk
?
Spigot 1.18.1 added the new PlayerProfiles class, which finally allows us to use custom heads without needing any reflection! You can obtain them as normal items, or actually place them down into the world. Iβll show you how both works: Creating a new PlayerProfile First, we gotta create a new PlayerProfile object. To do so,...
Hey guys, I last worked on my plugin in 1.19. I am trying to update it to 1.20, but am confused why this bit of logic has stopped working. Has something changed with handling PlayerInteractEvent and its relevant Action?
@EventHandler
private void onRightClick(PlayerInteractEvent event) {
Player player = event.getPlayer();
Action action = event.getAction();
if (action != Action.RIGHT_CLICK_AIR || action != Action.RIGHT_CLICK_BLOCK)
{
// This seems to always trigger now, even if I am right clicking a block or air
}
}
that will always be true
It seemed to not be true before in the case of intractable blocks like doors and trapdoors
That was the reason that strange check was put in, I wonder if maybe its not necessary now
gonna try just removing it π
Ahhh interesting, it does indeed work. Let me try this same build in 1.19 and see if I was just hallucinating haha.
try and instead of or
How can I make an AutoBroudcast that sends messages every 2 minutes? Message1 should come after 2 minutes and then message2 again after 2 minutes up to message6.
Have a runnable that runs every two minutes and interement one in some counter variable, then choose a message depending on the current counter ig, or there are also like 5 other ways to do it from what I remember
Is it fine to change the name of a open container or should I close it and reopen it with a different name
Changing the name of an open container technically closes and opens it again
oh for real? So are the items persistent between containers or what?
does it remove all items?
The details depend on what protocol version you are on
PlayerListener.java:
@EventHandler
public void onJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
String arena_id = plugin.getSqlManager().getPlayerGameID(player);
plugin.getLogger().info(arena_id);
GameArena arena = plugin.getSqlManager().getArenaFromID(arena_id);
plugin.getLogger().info(arena.toString());
arena.addPlayer(player);
plugin.getSqlManager().addplayertoArenaMap(player, arena);
}```
```java
SQLManager.java:
public String getPlayerGameID(Player player) {
ResultSet games = getAllGames();
String gameid = null;
try{
while(games.next()){
String uuids = games.getString("player_uuids");
String[] uuidsList = uuids.split("\\.");
plugin.getLogger().info("uuidsList: " + uuidsList.toString());
for (String uuid : uuidsList) {
String playeruuid = player.getUniqueId().toString();
plugin.getLogger().info("uuid: " + uuid);
if (uuid.equals(playeruuid)) {
gameid = games.getString("game_id");
return gameid;
}
}
}
return gameid;
} catch (SQLException e){
e.printStackTrace();
return null;
}
}```
The issue seems to be that the UUID in the database (which is the correct UUID for me) is not equal to the UUID my game server is returning in the onJoin event. I have tried to figure it out but can't for the life of me, does anyone have a fix?
I tried to switch to paper, but there is no playerchunkloadevent and nms in 1.12.2, and PacketPlayOutMapChunk does not listen correctly
do i need another packet to listen load the chunk for the client?
Oh yeah, 1.12 is pretty outdated at that point. You need to manually listen for packets then.
Check equality for UUIDs and not Strings. Convert your UUID String from the DB to an actual UUID.
What packets?
can you please name it specifically
Idk. You need to look at the old protocol. Some chunk packet.
hmm, why wont this work when i add the viewer?
private fun hidePlayersInTablist(player: Player) {
val uuids: List<UUID> = Bukkit.getOnlinePlayers().map { it.uniqueId }
val connection = player.getConnection()
connection.send(ClientboundPlayerInfoRemovePacket(uuids))
}
override fun addViewer(player: Player) {
if (viewers.contains(player)) return
viewers.add(player)
val entries = slots.map { it.packetEntry }
val enumSet: EnumSet<ClientboundPlayerInfoUpdatePacket.Action> =
EnumSet.of(
ClientboundPlayerInfoUpdatePacket.Action.ADD_PLAYER,
ClientboundPlayerInfoUpdatePacket.Action.UPDATE_LISTED
)
val connection = player.getConnection()
connection.send(ClientboundPlayerInfoUpdatePacket(enumSet, entries))
updateTablist(listOf(player))
hidePlayersInTablist(player)
}```
although it works here:
private fun updateSlots(slots: Collection<Slot>, players: Collection<Player>) {
val entries = slots.map { it.packetEntry }
val enumSet = EnumSet.of(ClientboundPlayerInfoUpdatePacket.Action.UPDATE_DISPLAY_NAME)
for (player in players) {
val connection = player.getConnection()
connection.send(ClientboundPlayerInfoUpdatePacket(enumSet, entries))
hidePlayersInTablist(player)
}
}```
I don't quite understand exactly what the packet is called in nms
check nms mapper
I thought nms had documentation?
Never had, never will be.
Ah that's why everyone hates it
nvm i fixed it.
I mean its mojangs code. We basically have to dig through that and make sense of it.
Surely there are lots of public nms examples?
not rlly, if you know where to look ig
but
and nms wasn't really made to be expanded on so half the stuff you use you gotta recode yourself
Oh how lovely
cuz they put wacky stuff in the methods
Hmmm maybe I should actually try to work with nms... never touched it in my 4 years haha
net.minecraft.network.play.server.SPacketChunkData
net.minecraft.server.v1_12_R1.PacketPlayOutMapChunk
?
I would hide the actual players before sending the fake slots.
Or even better: Dont send the actual players in the first place.
how would i stop from ending the actual players doe?
here's what I found by "ChunkData" query
By registering a packet listener and filtering out real players
But that's probably not what I need.
Anyone got some advice for getting out of a coding slump?
I've lost the motivation and I don't know how to get it back D:
Tried that and it still doesn't work
public static void injectNetty(final Player player, NPCManager manager) {
try {
Channel channel = (Channel) channelField
.get(((CraftPlayer) player).getHandle().playerConnection.networkManager);
if (channel != null) {
channel.pipeline().addAfter("decoder", "npc_interact", new MessageToMessageDecoder<Packet>() {
out.add(packet);
}
});
}
} catch (Exception e) {
e.printStackTrace();
}
}``` I figured out what the problem is, how do I change the code so that it also handles packetplayout packets and not just packetplayin
Put it down for a bit.
Find likeminded people that hype you for new projects.
Explore exiting new features or completely new languages
Print out the UUIDs and check if the player is in any of those game lists.
Make sure that you didnt mix up the player and the game id when writing.
would there by chance be a way to check if the player has their tablist open?
no
you just send the info and the client holds it there for whenever the player presses tab
damn, alr
how do you detect snow weather at a certain block? also is this rendered by client or is it some sort of invisible block.. idk?
or is this done by getting the chunk and weather or biome and so on?
that is just set by the biome and weather
and elevation probably, for the non snowy mountain biomes
Ok thanks!
how i can move this character left?
that Internal Exception: net.minecraft.server.v1_12_R1.CancelledPacketHandleException mean?
Custom font
Need more info
public static void injectPlayer(Player player, NPCManager manager) {
ChannelDuplexHandler channelDuplexHandler = new ChannelDuplexHandler() {
@Override
public void write(ChannelHandlerContext channelHandlerContext, Object packet, ChannelPromise channelPromise) throws Exception {
if (packet instanceof PacketPlayOutUnloadChunk) {
LOGGER.info("unload");
PacketPlayOutUnloadChunk unloadChunkPacket = (PacketPlayOutUnloadChunk) packet;
Field xField = unloadChunkPacket.getClass().getDeclaredField("a");
xField.setAccessible(true);
Field zField = unloadChunkPacket.getClass().getDeclaredField("b");
zField.setAccessible(true);
int chunkX = xField.getInt(unloadChunkPacket);
int chunkZ = zField.getInt(unloadChunkPacket);
for (CraftPlayer npc : manager.getNpcsInChunk(chunkX, chunkZ)) {
for (Player player : Bukkit.getOnlinePlayers()) {
manager.hideFrom(player, npc);
}
}
}
super.write(channelHandlerContext, packet, channelPromise);
}
};
ChannelPipeline pipeline = ((CraftPlayer) player).getHandle().playerConnection.networkManager.channel.pipeline();
pipeline.addBefore("packet_handler", player.getName(), channelDuplexHandler);
}```
I suspect that there is error happens in this part of the code
how do I get the coordinates of the chunk that is unloaded?
this should send packets about the removal of NPCs if there are NPCs in the chunk that is being unloaded on the client side
Look up "AmberWatt negative space font"
Another task is likely using it or something
it should create 3
Sqlite databases only support 1 connection so it's likely some other task owns the file lock
You're code is likely fine see above
It's highly likely another task has the lock file or the lock file wasn't properly cleaned up
Why are you loading everything and are not directly trying to get only what you want?
Thats besides the point atm but a fair criticism
Hi
well , its a 3 factions only .
then why have a db?
it should save the data
Okay we are just going to ignore my point π’
sorry, I made the convo sway, do as you want :D
how to cancel a packet and send my own?
hmm and what i can do ?
yeah its weird to query all factions, but get just first one
.
this is how its should looks like
If the database is busy from one connection it just executes your queries in a queue like fashion
?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!
Im tryna send a pic
?img
Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.
Here's some screenshot utilities that you can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org
bruh
ok ill verify in a bit
basically im getting an out of bounds exception
and the packet is sent correctly with the correct lenght prefix
but it still shows that for some reason
is there an event for when players change the entity type of a spawner?
Not specifically no but PlayerInteractEvent should do
ah yeah that'll do great, thanks
\x19\x00\x7b\x22\x74\x65\x78\x74\x22\x3a\x22\xc2\xa7\x62\x53\x69\x6d\x70\x6c\x20\x54\x65\x73\x74\x22\x7d
HOW IS THIS PACKET NOT VALID
π
why is the spigot update checker returning always the same version eaven if the resource was updated? When accessing the api from the browser the resource version is the correct one
are you using the old API?
which URL are you using?
that's the outdated one
witch one is the new one?
UpdateChecker for your Spigot plugins with only one line of code needed in your plugin! - mfnalex/Spigot-UpdateChecker
Thanks
it returns json though - you can just get it as JsonObject, then get "current_version" as string https://github.com/mfnalex/Spigot-UpdateChecker/blob/master/src/main/java/com/jeff_media/updatechecker/VersionMapper.java#L41
what is the new method to hack enchants with nms
adding to BuiltInRegistries.ENCHANTMENT throws java.lang.IllegalStateException: This registry can't create intrusive holders
shouldnt bwe https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/EntityDamageByEntityEvent.html ?
declaration: package: org.bukkit.event.entity, class: EntityDamageByEntityEvent
duo to some stuff unfortunately no i can't use that event
i'm handling some other damages which its not caused by an entity
and i can't split this into 2 events
Hi, do you know how to set Persistent Data Container values on chunks? When calling "set" and "has" on the next load it does not seem to be saving the values.
can you extend the minecraft anvil limit? even if i have to use nms
what anvil limit
yea that should do it, i found a way to use this event along the other event, thanks
text limit
i could send fake data to client
^
rip
aka even if server accepts longer values, client will refuse to input them
is there any other way to get input text in a gui
chat conversation
best way to get longer input is just chat i g
bukkit has api for that
wdym?
If i want to make a pvp system, should i save the data like, if the player is in pvp or who he was last hit by in a database or just save it in a simple list.
when the server restarts everything restarts so players who were in pvp wouldnt be in pvp, save it to a list, a database is for persistent data
what about a book gui?
book guis are client side too iirc
dang
i dont mean setting the book limit, i mean getting input from a book
it should work just fine
are you sure you're not checking a different chunk?
or did you disable world saving?
what about PlayerEditBookEvent is that called when you sign a book
declaration: package: org.bukkit.event.player, class: PlayerEditBookEvent
k thanks
Ok noted
Here is my code. There is a bug that when you jump and right when you are about to hit the ground press double space(double jump) then you get put into fly mode. And i cant figure out why/ lmk of you have any questions.
I have tried this bug multiple times. And you will be either floating about 0.3 blocks above the ground or 0.17 blocks.
Is there some simple way how to convert this (4*25) from string to number?
Integer.valueOf(String)
hmm I used Integer.parseInt(effectStringSplit[1]); and get this. Gonna try that.
valueOf is stricter
iirc
Actually i might be seeing things
return type is the only major difference, woops
Im doing like this...
String[] effectStringSplit = effectString.split(":");
System.out.println("effectStringSplit " + Arrays.toString(effectStringSplit));
System.out.println("effectStringSplit.length " + effectStringSplit.length );
System.out.println("effectStringSplit[1] " + effectStringSplit[1]);
int mult = Integer.valueOf(effectStringSplit[1]);
System.out.println("mult: " + mult);
Still error.
ah I didn;t notice the *
Not so simple to parse an equation
you could use teh Javascript engine, depening on how bloated you want your jar
Not to be used if a user supplies input though
or maybe try to cast it to int? lol I mean.. it should work just if you type
int lala = 25*5
it will work lol
user need to imput thinks like this in config... thats my issue
so long as teh server owner inputs it, it will be fine
You can;t use the JS engine if the end user inputs the string as it will be parsed as JS
ScriptEngineManager mgr = new ScriptEngineManager();
ScriptEngine engine = mgr.getEngineByName("JavaScript");
String foo = "25*5";
System.out.println(engine.eval(foo));```
input look like this: 'INCREASE_MOB_DAMAGE:(4*25):60' so it will be string
Thanks anyway I will figurate something out
Cus im stupid. Thank you for the advice. Still the problem remains... :(
If you only want to check when the player jumps use teh statistic increase event for JUMP
I was currently using this: if (e.getTo().getY() > e.getFrom().getY()) {
using the statistic increase your code only runs when the server believes they jumped
what bug? you are the one putting them into fly if they double jump?
If they double jump close to the ground
Redempt has an actually strong library for this called "crunch"
Wait, what is a boxbeam. @waxen plinth Redempt why u do this?
if i want to teleport player its good do it async?
You cant do anything async to live objects.
just use player#teleport and dont care?
Paper has a method to async request the chunk on that location first.
On spigot you just call this method and load the chunk sync if it isnt loaded.
changed my username
redempt didn't feel like me anymore
think I had to get away from every aspect of my old identity after realizing π³οΈββ§οΈ
you say "actually" like it's surprising π
I only write perfect code
Alrighty. My username is from an email i created when i was 10 XD
Not much attachement to it
I needed to specify because of spigots eco system. 
See, they are following the pipeline
lmao true
but you gotta write a lotta shit code to start writing good code
most people, by the time they're writing good code, no longer want to be writing spigot code
to a t
it's kinda dumb how well I fit all the stereotypes
What does that even mean?
Aah, i saw that a few days back. Tell me when you write C++ C# box 
Presumably the far far right is just raw binary
Soldering transistors
C# -> kotlin, C++ -> rust and yeap
and add 1 to each year counter
boy I wish I had started my transition 5 years ago and looked like that now
Why is skin displayed differently for different players?
On my own screen I see as it's supposed to be, and from my alt account the skin looks different (the right player in the ss)
Why might this be so?
ah that's why
Well I modify player's skins with gameprofile
how would I force clients to update cache?
reshow the player
do we not talk about the generic type parsing
this is posted at least once a day every day
We need a bot to post it daily clearly
i added PaperLib to my project for teleport but give me classnotfounderror here my pom.xml https://pastebin.com/VDkv4gFX
honestly I don't think that code was that bad
don't get what the fuss was about
hey how do you get an advancement message? on PlayerAdvancementDoneEvent
it was a bit strange, but whatever
ok looking at it one more time
this is actually pretty straightforward, I don't get what the fuss was about this code
it has a very specific purpose that's not exactly explained well, but that's because it's an internal function
Did you sync
it splits on commas while ignoring nested types
if you mean reload maven, yes i did
Full error pls?
yes it can be kind of slow for extremely deeply nested types
it's technically O(n^2) with n being the max generic depth
but who the fuck is using 10-nested generics?
it doesn't need to have a good runtime complexity because this is not an input that scales up
Me when Map<Map<Map<String,String>,Map<String,String>>,String>,UID>
I think you mean IUD
that's only 4 layers of nested generics, to make it take any substantial amount of time you'd need a type the jvm probably wouldn't even allow you to write
it'd most likely have to be over 100 layers deep to make any kind of difference
it especially doesn't matter because this is a one-time cost at startup
I forget who complained about this code initially but there are definitely far worse examples in redlib if you look
much of the code is pretty old and shows it
actually I'm looking through redlib and can't really find any egregious code
I did go back and rewrite most things that got old and bad
at this point the only bad part left is redcommands which is shaded
this entire file is full of horrible code
Iβve seen worse
the equivalent in ordinate https://github.com/boxbeam/Ordinate/blob/master/base/src/redempt/ordinate/command/Command.java
π
I still have a lot of magic numbers in there, unfortunately
but otherwise all-around far better designed and less buggy
rewriting something enough times is the only surefire way to get a good design imo
I mean good design at core is hard since different aspects of good design sometimes compromise each other on a fundamental level, which can be hard if you in certain modules favor one aspect, but in other modules happen to favor the other, now youβre also compromising consistency on top of that for the sake of each individual module just to satisfy design at some degree
I think that is kind of too vague to be useful
it's true you have to make tradeoffs but there are often designs that are better in every respect
I think rewriting something repeatedly is the only surefire way to get a well-designed product because it's impossible to predict every challenge you're going to face
you can spend as much time as you want designing the thing, as soon as you start implementing you're going to hit a snag
when you rewrite, you're doing so with a much better understanding of the problem space and will most likely come up with a far better solution
but then it too eventually outgrows its boots
and so on and so forth
Imo the goal of design is to make it look cool π
true
What's the point of my plugin if I don't have an API no one will use
And it's not multi module with a large inheritance structure
Like why even code if above isn't the result
Until your boss says to stop messing with it and to get back to work.
yeah, well my point was that you can only get is that much right before its wrong, there is little point in perfection
that's the problem
businesses never prioritize rewriting and refactoring
as a result, all enterprise code is garbage
No, the problem is engineers who can't stop fooling with stuff. There are some brilliant people who can never finish a project.
If it works and it meets the requirements, you're done!
youβre done for now at least
Until they want u to extend, stretch and modify what is working in every way to suit the new requirements u get in 6 months or whatever time
Then the requirements are faulty. Do better writing requirements. Did you have a requirements review in writing?
I think you mean the original requirements the client just forgot to tell you
So then you modify the requirements and charge the client for it.
Yeah Iβm sure the customer relations team will approve of that
Well requirements can change at random as well for no reason at times, additionally sometimes you get more requirements because you couldnt predict the insights youβd get from finishing whatever u finished
Never give the client extra stuff for free!
Look I just forgot to mention it has to work with java 5
there is also functional and non functional requirements
Itβs not that big of a deal
(Unless it's a cost-plus job.)
Its not always so easy to make non functional requirements into functional ones
Sure you can blame the person who wrote the requirements for phrasing them poorly or so, but its not like that relates to the requirement ever being so static, when they change just so often
If the software engineers aren't doing the requirements review, you're doomed.
And they better consider testability.
yep ofc
Anyway, I'm just trying to say if you're continually rewriting stuff, you're doing it wrong. At some point you have to say you're done and to move on.
Don't fall into the trap of making it perfect.
You'll get a reputation for not finishing things.
Of course it helps if you get things right the first time. π
I already have that reputation:D
Of not finishing things? Then work on getting a better view of the overall picture and how you can determine that it's good enough.
Talk to other people and ask if they think it's working ok.
I worked with two very smart people who could never finish things. They just kept tinkering because they thought they could make it better.
did they make it better at least?
Not a big enough improvement to make it worth the additional cost.
how do you properly subtract two doubles
I'm making a /balance command, need values to be exact, I don't want to have overflow and other stuff
i limited numbers to 2 decimal places (in /pay you can't use more than 2 decimals)
is it fine doing
double v1
double v2
double result = v1 - v2
well it caaaan fail
in terms of making result + v2 = v1
if you really really wanna ensure the integrity of that operation
Iβd advice going with BigDecimal
yes
.1 + .2
how do you use it
the bane of floating points
I wish
My project folder has 98 projects
no lmao
stuff needs to be fucking rewritten sometimes
otherwise you end up with pure legacy
requirements and priorities always change
technical debt tends only to increase
BigDecimal.valueOf(v1).subtract(BigDecimal.valueOf(v2)) @umbral ridge
nvm xDD
thanks conclube xD
I said "continually".
U have BigDecimal.ROUND_xxx
I rewrote many of my libs over the span of years
if u wna choose mode
average was like a year or two between rewrites
and I was actually using them in between
not just sitting around fucking with it forever
yea
OK, that's not "continually".
only 32 64 and unlimited?
lol, my github has 300 repos on it in total
most of them unfinished
it is a continuous process
every now and then software just outgrows its original requirements and needs a rewrite
Dang
you can delay it with good future proofing but it will happen eventually
you want it to integrate with newer systems, the client has new demands, there are new features, bugs have to be fixed, security holes patched
at some point it makes sense to scrap the whole thing and start over with better tools, because the larger a codebase is, the more difficult it tends to be to work with it
All original or are some forks
I think what bobcat is getting at is like, sure we need to write and put effort into code thats maintainable and extendable in the long run, but thatβs not an incentive to sit all day and refactor your code and make it perfect - perfect
and if you can make meaningful improvements with a rewrite, it will often yield a massive increase in productivity
ultimately the requirements change sooner or later
I find it better not to put in bugs or security holes in the first place.
And then u need to rewrite
but you get it done with the expectation that it won't last forever
yup, how many you got? Lol
that's arrogant
obviously you aim to not write buggy code
but everybody makes mistakes
in both the logic and the design of the code
It was a joke, partially.
rn I work at a company that takes refactoring and design seriously and it's already making a big difference
Same
But I have snippets I sometimes need
There are a lot of people who are unable to do that.
I convinced my boss to let me refactor all of our db code by switching out a library for a far more ergonomic and powerful one
So good enough of a reason to keep them there
and our code is now significantly better because of that
96
I'm constantly pitching refactoring tasks that I think would make the code easier to work with
I'd say I probably spend 10-20% of my time refactoring, and I think that's a good target
sometimes you will need a major spike for it, but in general, you want to just be making small improvements as you go, at least until it reaches a critical point where you need to just rip something out and rewrite it
gotta catch em all, dont we?
Mayhaps
rewriting the database code took roughly a full week
I just keep getting new ideas before I finish old ones xD
all I'm saying is companies are almost never realistic about refactoring and re-engineering, they don't budget for it and they don't prioritize for it, but I think it's the only way to make sure the code stays maintainable
Oh I see, so wyd rn?
whats the current project
Uhh
Add the refactoring as part of a new project that someone is paying for. Don't pay for it out of overhead.
Messing with large vehicles made of display entities
nah, I would charge people for refactoring
Is it going well?
like of course you can't expect me to make a perfect design the first time, and so I will want to improve it - if you don't let me, then my work will dramatically slow down as the code becomes tangibly more difficult to work with
esp when the code base grows
refactoring is part of the job of software engineering, and I won't do it for free just because it's not directly a feature
right
Yeah, within what the game is capable of at least
been wanting to mess around with stuff like that
are display entities low overhead?
SHOW US!
I remember people doing that kind of thing with armor stands or falling blocks in the past and it would lag out the server and client alike
pleaaaaaseee coll lol
Do you have to manually check if a player has the * permission?
I believe so
that's not really a permission node
spigot doesn't handle it by default to my knowledge
π
I'm pretty sure it's a special case handled by permission plugins
so you should only have to check for your specific permission node
I mean some systems, assume it to be the parent permission of every other permission
and they will use wildcards to determine which permissions apply
but like, wildcard permissions are evil
because it's not just *, you can do things like essentials.*
and you don't want to be checking for *, myplugin.*, myplugin.subcommand.*, AND myplugin.subcommand.permission
XD
kinda copied and pasted the whole thing from withdrawPlayer and am now changing stuff
I love dealing with it XD I wanna make a lot of stuff
yes it does
it sucks
its pretty deplorable imo
BigDecimal is mediocre at most
I wanna make banks where you can go in and open an account and all sorts of stuff
make it hardcore
but need a perfect plugin for this
so i have to do it myself
because i believe noone else is capable
XD
Somewhat, spawning them in seems to be the big overhead
hmm, well spexx I made an economy plugin that works on multiple servers (like through a proxy), then dealing with stuff like high availability, scalability and data consistency becomes a real pain
esp when u need to synchronize on transactions etc
ahh across servers?
yea
yea
Like, spawning 1500 of them at once will hang the client for a bit, but after they are all spawned it runs fine
im making this for one server only, for survival
OMG
Coll
this is revolutionary
OMG 
in my eyes
Lmao
how do you do this?
move blocks so smoothly
Would it be possible to make large blockbench models w animations with what uβre doing?
aa animations and models
Assuming u got a resource pack ofc
Coll the chef
go crazy go mad go crazyyy
he be cooking
I wouldnβt know where to find the people haha but thank you
coll the animator
coll the coll
coll the resource pack