#help-development
1 messages · Page 755 of 1
if(entity instanceof LivingEntity livingEntity)```
yuh
okay so right now I am checking
if the entity that's damaged
is made from "recipe" that's premade in class for living entities
so a pig would be made form this recipe but with assigned attributes
like its not hostile and has this amount of max health and such
do I get it right?
recipe..?
primitive name for instance
oh
very simplified
it sounds awful
but kind of helps me understand it

if the pig is a living entity (yes) it can have attributes (max health) and a health value
so yes
hostility has nothing to do with this
zombies are also livingentities
basically any entity that can take damage is a living entity
though keep in mind armor stands are also considered livingentities, presumably because they can wear equipment
hi ! I was always used to ChatColor. and then the color, but they say its outated, and this wont work, what should i use?
its not outdated, its just deprecated on paper
use spigot api or use components on paper api
how do u use those components?
i'd just make a utility method that translates color codes to colors, no need to dick around with hacky enums like that
the proper chat color isnt an enum
the blue and yellow they use there are right
oh thats awt color, yeah probably
What's awt color
java.awt.Color
public static String chat(String msg){
return ChatColor.translateAlternateColorCodes('&', msg);
}
Isn't the translation method just msg.replaceAll(arg, "§") or what is it
I have one problem
whenever I deal damage to entity
it always shows it's name with previous instance of damage
i mean maybe that works idk
no, it ensures that the following letter is a valid colour code
Oh. And what does it do if it's not valid
leaves it as is iirc
delay this code by 1 tick or subtract currentHP with event.getFinalDamage()
you could do it better by just doing reverse
if(!(entity instanceof LivingEntity livingEntity)) return;```
events essentially occur before the thing actually happens
ah
Well, it kinda makes sense
i mean yeah it makes sense
how are you gonna cancel something thats already happened
oh no many events are fired after the thing happened
even cancellable ones
it's a mess
Bukkit: we'll give you 4 events for when the player is joining so you can control them
Forge: 1, and it might be a bit inconvinient in some cases.
anyway i got me a multi module maven project and when i package it up the modules that contain my code arent actually there and i dont know why
parent pom: https://paste.md-5.net/isomomadas.xml
and if necessary
core pom: https://paste.md-5.net/fabugikeqe.xml
dist pom: https://paste.md-5.net/igoyotibul.xml
Are the classes being used anywhere?
Outside of reflection
used anywhere? wdym?
You have minimize on
It will strip unused classes
so if you're not using your nms classes they will get removed
i mean you could do, AFTER, BEFORE stages for events lol
can I make switch of int x and check for cases:
1 - x > 5
2 - 5 > x > 3
3 - 3 > x > 0
use as in directly calling
or should I do it with else if
nms classes are being initialized with reflection so maybe i gotta look at that
but like even core isnt there
nothing i made is there
um, if you use the switch from java 21
nvm
whatever
I mean I know its not correct syntax
it was more of conceptual
if cases need to exactly equal to something or can be like "greater than this but smaller than this"
ok
does this work now?
yeah i was about to say i didnt know you could do operations on switch cases
the first 3 executions are exactly the same minus the color for health
the only way you could do it better is using switch Statement from java 21
how else do you want to do it then
one sec
😩
uh don't do that you'll pause the server
you want to create function just to change the color or something?
this also stops the server it is just fancier
if you dont use multi threaded version
it will change nothing tho
You want the scheduler instead of the wait
why not?
it can be reused too
Hello, i m using commands, and i want to get the player that sent it. I can use the COmmandSender, but how do i get the Player?
Check if the command sender is a player
for instance here "Online()" needs a Player class
?conventions
how?
ohhh thx
also read this
i will
oh, you would not adivse it starting with O but rather with an o correct?
it doesnt change name of entity to dead, how can I resolve it?
no not really cuz im trying to make the code work, then ill work on optimization
is there really no way to just tell it to work like 1ms after registering event?
well if you're doing that on a damage event
then the entity will never be dead
because an entity cannot take damage if they're dead
if you want to check if damage would have killed the entity
check if their health - event.getFinalDamage() <= 0
does anyone know how to resolve this
what am i doing wrong
nvm, it was the jar minimalizing that did it. tho its 9mb now lol
hello, this is a command registered in another class than my main, but however, it doesnt work. Like it doesnt register the command. When i put the code in main class it worked, so i m gessing i should register this Command_Main in my main class, but how?
okay now it works
but still
first instance of damage is not registered
if I hit 10/10 hp pig for 1 hp
its still 10/10
then next hit its 8/10
show code
like this?
event.getFinalDamage() returns the damage value taken from the event considering things like armor and other damage mitigation sources
thats why its fine in your use case to check if a damage instance would have killed something
setExecutor(this)
custom damage systems will break this though
yeah its kind of my point in future
in future I should make on entity damage by player cancel the event and set my own damage formula?
and then just use whatever is returned?
in my experience, no
but with your level of programming i wouldnt even think about implementing a custom damage system yet
work on simpler projects in the meantime
would adding level of mobs be easy?
or like when I equip armor that has protection X it gives me a certain potion effect?
also not difficult, but easy to make poorly
easy to make poorly?
like a beginner might think to loop through every player on the server every tick and getting their equipment and getting their enchantments and then doing something to implement it
sphaghetti code
that can be quite intense on the server
does any of you know what Packet ID is used for?
looking at wireshark i cant seem find the 0x00 as the first byte in tcp data segment
so im kinda confused
there's little documentation other than this
well uh my main point of plugin making was to make mmo server
well you can
you just cant yet
rather, it would be a poor idea to try that right away or soon
you need practice
a decent grasp on java and oop
oop vewy difficuklt
if you ignore that and try to make one anyway, you'll find yourself struggling a lot to maintain it all and rewriting your project several times and lots and lots of bugs and performance issues
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^]]
many characters to highlight the importance
oop is difficult but it'll come as second nature to you if you have enough practice
practice is my #1 emeny
it's used to identify the packet?
tcp is a data stream, data needs not to align with any particular start/end markers
the thing is that
I honestly learn java the best by just making plugins
I mean
thats fine
it just makes me understand the ideas way more
you just gotta do the simpler ones first
cuz they are immediately put in practice
i think spigot is a fine way to learn programming
dont make big projects
but just dont bite off more than you can chew
learn how to make your mouth big first
like you gotta acknowledge that as a beginner you'll make very very bad plugins at first
using them on a server you want players to have fun on might not be the best idea
Is there a way I can make the ray size on World#rayTraceEntities not get a hit on entities that are clipping through blocks like this
How does people run minecraft though intellij?
do they?
mcp or fabric
i thought they just copy the plugin onto a started server and reload
assuming we're still talking server here
i don't think you can do it beyond some tests that don't involve mc
There’s a gradle plugin that runs paper from the ide
but i cant seem to find it in the datastream itself
nvm i think i found it
its not the first byte, but the second one
well it might not be the second byte, for that particular packet it'll probably always be but the entire payload is prefixed with the length as a varint
dude that's so useful
thanks i wouldn't have knew
but why do they include it in the first place, when the tcp protocol already tracks the payload length
?
you only receive a set of bytes that might contain multiple mc packets or less than one, there is no framing, there is no "complete packet", you need to take care of framing, that's what the length prefix is for
how would i go about to make a friends and party system
like, any ideas?
so basically its used due to inconsistency of bandwidth and the ability to send multiple packets
like where to store stuff n shit
i dont use netty
in my case
ok, the size of the packet is not determined, due to how bandwidth works, right, but is the ordering of the packets guaranteed or not in this case?
at least you can then defragment them by the order i guess
Hello guys, can i talk with someone who have high mc developing knowledge ? i have lot of question for my project
well i feel like i unlocked new chapter in my knowledge
i knew how to send packets via NMS, but never took a look it in raw form
it isn't really to do with bandwidth, for example a udp datagram is sent and received in full, but it's an entirely different transport with its own advantages and caveats, udp sends "messages" as a whole, tcp is just a continuous stream, so you need to implement a framing mechanism yourself (or use an existing one)
but udp is not guaranteed to be received
correct
can you switch from tcp to udp in minecraft?
without any modifications of the server/client code
by playing mc bedrock yes, lol
ah ooff
but yeah, not possible to "just switch"
yeah its not possible, both server and client would need to be changed, and the whole netcode reworked, just because how different tcp and udp are in terms of handling
?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!
i thought it was just a way data is sent so it could just switch
i mean technically speaking you could switch the setup with some fair amount of work
if you're fine with out-of-order and dropped packets :^)
one TCP connection to send packets that need to be in order, one UDP connection for move packets and entity data packets
let's go
achieved with microsoft word 😂
oh yeah about that
that server is... for me
best case scenario for a few friends
even me
so im thinking of making it work and came up with it:
on player equip it checks if player has equipped an item, then checks for conditionals (lets say if it has protection X), then it sets player-specific bool for true and then it loops for applying potion effect every 10 seconds, unequipping would set that bool to false
is it resource optimal idea?
right, how do you check for player equips
spigot doesnt have an equip event
i think paper does so if thats something you wanna do you might want to consider paper api instead
Hello, did anyone maybe know cool libraries/utils for time in minecraft like days, hours, minutes in minecraft time? I want to make plugin that will spoile/rotten food after some time past in and don't want to make things like runnable with deelays 💀
There’s a library for it
check for a PlayerInteractEvent
playerinteractevent only accounts for clicks, so equipping armor by right clicking in hand would work
in-inventory equips are not accounted for
just subtract previous time from current Time
is that not what he meant by equip
there's multiple ways to equip armor lol
using that lil resource from alex would work
something that wouldnt need to loop for all players
Hello, I wanted to make a command that the player's food recovers completely, but it seems that it is not working. could anyone help me with what's going on? https://prnt.sc/GgXpoe0EpwKv
are you new to java?
Yeah
are you importing a Sender class
he capitalized Player right?
he just didnt put a variable name
he's capitalizing Sender
well in this context Sender is also the variable name
he's got a variable player (lowercase) but then he sets Player = (Player) Sender
oh i thought it was a class, my bad
you shouldnt be using uppercased variable names at all anyway
Sender should be sender
yea and now give your Player variable a name
@Override
public boolean onCommand(CommandSender sender, Command command, String s, String[] args) {
if (sender instanceof Player p && command.getName().equalsIgnoreCase("food")) {
p.setFoodLevel(foodLevel);
p.sendMessage("message");
}
}
you can use pattern variables too
he already has a Player variable, and he named it player
but then he tries to set Player to something else
if my man is using a sufficient language level that is
mhm
my code does everything he wants tho
in 3 lines
so
https://prnt.sc/uOEkfNHKcgCD
Do you know how fix this ?
why are u using java 8
Idk, It was the first version I installed when I formatted the computer, haha! What is the recommended version?
the latest probably
why does the server send two packets which are empty after Server Handshake?
oh i think i know why
after the packets i sent, for every packet server receives it sends back an empty packet confirming that it received it
it seems
its called an ACK
unless the sent packets expects data back so instead it sends payload of data
ok, so it seems ACK packets are being sent for each packet
Hi, I have a very strange bug.
I have this line of code which will be fed when a person sends "[inv]" in the chat
public static HashMap<Long, ItemStack[]> inventoryPlayer = new HashMap<>();
//code
PlayerInventory inventory = player.getInventory();
long invId = System.currentTimeMillis();
inventoryPlayer.put(invId, inventory.getContents().clone());
and I retrieve this value via a command /intecativechat inv <invId>
try {
long invId = Long.parseLong(args[1]);
ItemStack[] inventory = InteractiveChat.inventoryPlayer.get(invId);
if (inventory != null) {
new ProfileGui(sender, inventory);
return true;
}
} catch (NumberFormatException e) {
return false;
}
I have no display problem as long as I don't open inventory to remove my items
but I don't understand how this value can be modified when I never edited it once created
everything is replaced by ItemStack{AIR x 0}
MC is odd. Its unusual for ACK packets to be used at all when it's over TCP
as a TCP connection is synchronized and error corrected
how can I create compatibility of object serialization/deserialization between plugin versions (potential additions to the object)
are you listening to raw data?
yea, im just looking at wireshark output
every time i send a packet i get ACK packet back
then its fine
those are not generated by MC itself, rather the protocol
the TCP protocol
so what's the concept behind that
its to confirm a packet was received
if no ACK is recieved in sequence the last packet is requested to be sendt again
because TCP does all that under the hood. ACK packets are usually seen in UDP connections not TCP
you shoudl not be be seeing the TCP actions
well wireshark does allow to track tcp protocol frames so its nothing unusual
You are copying the array not all the items in the inventory
yea i got it
bump
I see, thank you
Time for the DFU ||/j||
Pretty much
why is this happening
MainCommand class is somehow not present in jar
what build system are u using
u use gradle ?
yes
there is also PlayerInventory#getArmorContents
so?
nothing
PlayerInventory#getArmorContents returns an array of ItemStack
it's not an event that you can listen for
"use PlayerInventory#getArmorContents to get a list of the player's equipped armor, then loop over them and use ItemStack#containsEnchantment to check if it has the enchantment, if you want to simplify your code you can also use Arrays.stream and .filter and anyMatch"
can i check for multible values in mysql like this?
Use the AND keyword?
Yeah, WHERE xCenter = ? AND zCenter = ?
nowhere
wdym
it cant find this
Wuh here
wdym by this?
If you're talking about normal jar files, then yes, they can easily be decompiled.
A jar file is legit just a glorified zip file
You cab probably open it with your file explorer
finally
after so many tries
i've managed to ping the server via powershell 😄
works pretty well, it even retrieves the icon as you can see in base64
Yeah if you can decompile a plugin if you only have its jar file
if you can obey the obfuscation
premium resources often have pretty strong DRM's (for example in builtbybit plugin store, not sure about spigot)
fafawgaignaenghioqewangh
discord just restarted and played the "discord up" sound
it scared me to death
it was so silet
What does translationKey return
?tas
yk how much effort that is
to compile this thing
just print it out ig lol
what??
takes like 10 seconds to compile a plugin
tf you building
ill try it for u
oke?
I kid you not it uploads 15 modules to artifcatory, compiles and reobuscates 10 modules
my game is starting
that normally takes longer then compiling my plugins xd
give me a min
I really appreciate your help ❤️
@quaint mantle here u go
i changed a value in my shop plugin so ignore the rest
hmm
what do you need it to return
if you need that just do material
and its not blockTranslationKey right
nope
oh I guess that would be the same
itemstack#getType()
so it would just be that
and then lowercase it ig
uh I mean, Material implements Keyed so you can just getKey
material it self returns the readable name
so you gotta do .key
dont do material only im stupid
Yeah I switched it to be that
whats wrong with my class names :/
u happy now
I couldn't be hapier
thats greate
great
now back to seeing how horribly i failed
oh
that smol
[Islands] Es konnte keine Verbindung zur DataBase hergestellt werden: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'int xCenter, int zCenter, creationDate DATETIME)' at line 1
i checked the manual and it said datetime is a thing :-:
oh wait i stupid
ignore
you could toss this in a translatable component and call it a day
date wasnt the problem
i wronte int name in the wrong oder
it shouldve been name int
home -> HomeCommand
island -> IslandCommand
Database -> IslandDatabase
whyIsland database what other database would it be xd
ok given a NameSpacedKey like (minecraft:stone) how do I get a Material from it
it's a really ambiguous name
p sure there's a way with bukkit
//its stone
}
``` just keep going for the other 1200 items
lol no
its obsiously a joke
I sometimes can't tell the difference between sarcasm and borderline insanity
never in my life have i seen someone use that word
Ah
put 2 plugins with the same name and you'll see it on the exception
Material#matchMaterial
Like non speciifc, a class name should tell the person what it does p much without having to look at it and read methods and stuff
And what if u made like a ProfileDatabase RankDatabase
i know what it means
just never have i anyone see use it
it loaded without errors
that something ig
now lets see if it works
except for some reason it doest get the version when compiling

u making a skyblock plugin?
yeh
damn
love it when i use & insteaf od §
i do that like 50% of the time
for no reason
my brain just tricks me
something something your message util sucks
true
im on my knees begging for help on this
is metrics in your pom?
i like ChatColor
looking to hire a spigot dev to help create a plugin, dm me 🙂
?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/
Thank you! @river oracle
You are not using Spigot then, I can't help you
i am
you can use gradle with spigot
You can but little point. I don;t use gradle though so can't help with that
If I am seralizing my itemstack can I deseralize it in php
any help on this?
is metrics in your build.gradle dependencies section
yes
then no idea
I mean ofcourse you could as long as it's data php can process
I tried but it’s just a big string of giberish
if you know how it was serialized then anything can deserialize it as long as it has the ability
you can't deserialize unless you know the specifics of how it serialized to begin with
Had anybody got issues with IntelliJ IDEA CE not authenticating github anymore?
how can I hide everybody from the tablist (so just header+footer are visible) but be able to see them ingame? my current code is this:
static void hideAllPlayers() {
CraftServer craftServer = (CraftServer) Bukkit.getServer();
MinecraftServer server = craftServer.getServer();
// Get a list of all online player UUIDs
List<UUID> players = Bukkit.getOnlinePlayers().stream()
.map(Player::getUniqueId)
.collect(Collectors.toList());
// Send a packet to remove all those players from the tablist
server.getPlayerList().broadcastAll(
new ClientboundPlayerInfoRemovePacket(players));
}```
but that also hides their skin and stuff
You are right. By mistake I opened the URL that Maven logs and attempted to log in.
My assumption is that if you don't authenticate correctly (through browser), it will cache/dirt your computer until you manually (through browser) attempt to access that address and log in successfully
😭
why are you using a 10 year old MC version
It has support for it
Can someone remind me what euler angles are measured as
is it radians or degrees or can I just toss a vector
anyone that knows a course for NMS and multi version plugin? I'm very interested to learn that
There isn't much of a course as there are just basic ways to do things you need
Most of what you need is already available through bukkit
If you're going into NMS you've obviously gained some confidence already
If you have mappings even better, just read and figure out as you go
a setting for items donated from GM1 like /ssearch <player> itemGM1 ask for mod'
could someone tell me whats the thing called that lets us draw stuff on the map? draw pixels or smth?
I created a few years ago for /satlas <player> GM1item# (only OP)
but now it's not working
Ay yo brother I need ur help
Ok
https://media.discordapp.net/attachments/869977636045213776/976297111421341747/unknown.png?ex=6541ab8a&is=652f368a&hm=a67128c4d82f0acef4e95f737a2957971c3633a3dc1cd16e104a05a3ce896f86&=&width=415&height=398
If I would like to do something similar to this could someone tell me how it would work?
dang
no embed perms
cant really help much could you explain a bit more about what it should do
a plugin , like search item from gamemode 1 donate for player gamemode 0
brotherhood of admins
for <player>
like donate item's from gamemode 1
Configuration for Staff Mode
Added /gm info command
Added /gm reload command
like' this
hi
re
Explain what im seeing here. Im seeing some contradictions. Why are some of the squares connected?
Other than that, this should be fairly simple
figured it out just need to generate a dungeon and represent each as relevant blocks
oh those are connecting rooms
That makes little sense to me. What do you mean by "generate a dungeon" and how can your represent a dungeon as relevant blocks.
If you want to generate dynamic dungeons from a set of rooms/corridors then use the wave function collapse algorithm.
Maven 🥸
is a double chest the biggest ui there is or is there a way to make a bigger one
You can have it 1 row extra
Nah thats pretty much the limit
But you need a custom resource pack for it
Is that still a thing? I was under the impression that it got patched out
How does the extra row work
Is it actually registered as a clickable region in the game
Interesting
But i don't know if it still works
don't you remember how we discussed how to make an inventory larger?
obviously you can't do it from code alone, you do in fact need a resource pack to make it possible
54
plus 1 row
So 63
yes that is the maximum amount of rows unless you use some trickery of course
I did math yay
im making a parkour generating plugin where you can create parkours by combining jumps and you can search for jump schematics based on theme,difficulty,... should i use mysql or sqlite to store and acces all the schematic files or is a few json files enough
I just remember it 63 slot invs existing until a version and then vanishing as the slots wherent recognised by the client anymore.
I like to use sql for storing player data rather than other data
Json is great for this and even a new format
But sql has the advantage of being able to reuse schematics between servers fast
As in you just set mysql
that does sound pretty useful
uh
help
(java.util.EnumSet,java.util.Collection),
(net.minecraft.network.protocol.game.ClientboundPlayerInfoUpdatePacket$a,net.minecraft.server.level.EntityPlayer),
(net.minecraft.network.PacketDataSerializer)
These are the constructors for the ClientboundPlayerInfoUpdatePacket. In the docs, is says that
(net.minecraft.network.protocol.game.ClientboundPlayerInfoUpdatePacket$a,java.util.Collection)
should also be present
yet it'
s
not
oh wait nvm
am blind
Seems like bedrock
probably a mod
Or a client mod
It’s bedrock
You could make something somewhat similar in java
No scrolling though
you'd need a texturepack though right?
you could do up down button
And neither an x to close
Yeah you can have buttons for up down
And for close
You can detect clicks outside the inventory but sadly not their location
That would be cool
imo this is possible. you can implement it by using villager trade gui with custom shader to have scrolling and options textured at your own will
you can detect clicked trades too
True
But only within the bounds of the trade
Which is a small column on the screen
Geyser has an API for this
Bit of a design question, let’s say I have an api class with a bunch of static methods to interact with parts of my plugin
I assume it would be bad to make use of those api methods in the implementation
Since that would couple the implementation to the api
u can use this plugin https://www.spigotmc.org/resources/crossplatforms.101043/
using a single enum Object
EnumMaps have to be preped
EnumSet<Material> materials = EnumSet.of(Material.STONE);
For example.
the thing is
Or
EnumSet<Material> materials = EnumSet.noneOf(Material.class);
is that I can't use the "Material" keyword
ClientboundPlayerInfoUpdatePacket
is what I want to create
but I don't have the mojang packet lib
so
What do you mean by that?
I just kinda
Are you trying to reflectively create that packet?
use reflections
very much
they're suprisingly quick
Then cast your object to enum
Enum<Action>
But they don’t have the action class
I just said
No they are not. Reflections can take over several dozen ms and just tank your performance randomly.
I cannot use that class
Wait right
Hey if you cache everything reflections aren’t that bad
whatever, that's not the point
JIT will also optimize them if they get used a lot
right!?
Yes if you cache them
yeah
I only use the newInstance methods at runtime
the rest is cached
anyway
help
cannot cast
but the packet needs an EnumSet
I also cannot create my own EnumSet because these mfos just decided to let all of their classes be package-private
and their abstract methods
Yeah, they have private implementations
Single and jombo
Or something like that
For when there's need for more than 1 long
Maybe try Enum<Object>
Might be a problem with the?
@SuppressWarnings({"rawtypes", "unchecked"})
public void someHackyStuff() {
Enum reflectedEnumObj = ...;
EnumSet enumSet = EnumSet.of(reflectedEnumObj);
}
wait
Or raw enum works too
Dont bother using types when doing reflections
Im guessing you dont like ProtocolLib?
very much
correct guess
it always broke down for no reason
I find reflections more readable than protocollib
I would use it over reflection fkery any day
and was more complicated than doing it raw
ok this is so weird, can someone explain? I have a minecraft in my server list which has open port 25565, but the thing is whenever i open wireshark it uses a different port, and not the default one (25565) to query the server, even though i've inputted 25565 manually, what voodoo magic is going on here?
it refuses to connect via 25565
but agrees to connect via 5001, even though i've inputted 25565 in my server list
so what's the problem?
what is happening in this case?
no idea
how does it resolve a different port
but you can connect to it though, right?
im thinking about dns trickery, but i can't find any dns records
yea
so no problemo
that's not what im achieving, i cant connect to the server from my custom client, just because this server magically changes port like chameleon
i've written custom micro client for minecraft to retrieve server status in powershell
and it works great
Guessing NAPT
but for this server i need to manually find the port from the client via wireshark
in order to use it
my client with port 5001 works just fine
so can't just use that port?
Is it an external server? Because in that case im assuming its bc of NAT/NAPT
yea
i can but it defeats the whole purpose of allowing to ping random servers
fair enough
i just implement minecraft server status checker
but in powershell
since i have an university assignment
of working with powershell
and i have right now course on UDP and TCP packets aswell
so i thought this would be a great opportunity to learn both
how can I hide a player just from the tablist and not their character as well?
i really need to do that i asked at least 2-3 times here, never gotten a useful response
i think its not really possible, since all player data is tied with tablist, well according to wiki.vg
i just want the header and footer to be visible
setting the username to null, "", " " doesnt work
how would that look with NMS?
even citizens plugin used some kind of trickery to get around flickering in tablists
Send a Player info update packet with the Udate Listed Action and a false boolean as value
ClientboundPlayerInfoUpdatePacket?
This was added fairly recently. 1.19 or something
might be since PacketPlayOutPlayerInfo was removed
well thats great, no more flickering tablists near npc's
ClientboundPlayerInfoUpdatePacket
how do i get all the sounds a player is listening to? i want to like fade it out
my hypthosesis was correct, minecraft searches the ip through DNS which return SRV record with the port, and that's how it retrieves that port
i've removed filter from wireshark and got this
its just weird that even if you specified the port, it still tries to resolve it via dns
sorry for spoonfeeding but I don't quite get how I can add the action with the toggle. something like this?
ClientboundPlayerInfoUpdatePacket packet = new ClientboundPlayerInfoUpdatePacket((FriendlyByteBuf) player);
packet.actions().add(ClientboundPlayerInfoUpdatePacket.Action.UPDATE_LISTED);```
instead of using the specified one
A DNS is only needed if you have an actual domain. If you connect to an IP directly then its useless.
Unless your server provider has an internal namespace and DNS that resolves internal domains.
yea i get that, but this server is external, its not even mine, its just that i didnt knew DNS servers can also retrieve port numbers (well atleast with SRV records)
Player bukkitPlayer = ...;
ServerPlayer serverPlayer = ((CraftPlayer) bukkitPlayer).getHandle();
ClientboundPlayerInfoUpdatePacket.Action action = ClientboundPlayerInfoUpdatePacket.Action.UPDATE_LISTED;
ClientboundPlayerInfoUpdatePacket packet = new ClientboundPlayerInfoUpdatePacket(action, serverPlayer);
Not 100% how the byte fields are constructed internally. I would have to look that up.
i thought how minecraft omitted the port numbers is that they appended 25565 as a default while trying to resolve the hostname
afaik NMS had some kind of classes to construct varints, bitmasks etc but cant remember which ones are
thank you!
Yeah their FriendlyByteBuf, although I can't remember what Spigot maps it to
PacketSerializer
You need to construct an Entry and add it to the Entry list
That's the one
i've discovered it back like 2 years ago by myself, it was all obfuscated but with wiki.vg i've managed to find what does what 😄
is there any way to query SRV records from dns server in .NET framework?
I've used System.Net.Dns package to query the hostname but it only queries the ip, not the port
Player bukkitPlayer = ...;
ServerPlayer serverPlayer = ((CraftPlayer) bukkitPlayer).getHandle();
UUID uuid = serverPlayer.getUUID();
GameProfile profile = serverPlayer.getGameProfile();
boolean showListed = false;
int latency = serverPlayer.connection.latency();
GameType gameType = serverPlayer.gameMode.getGameModeForPlayer();
Component displayName = serverPlayer.getTabListDisplayName();
RemoteChatSession.Data chatSession = Optionull.map(serverPlayer.getChatSession(), RemoteChatSession::asData);
ClientboundPlayerInfoUpdatePacket.Entry entry = new ClientboundPlayerInfoUpdatePacket.Entry(
uuid,
profile,
showListed,
latency,
gameType,
displayName,
chatSession
);
ClientboundPlayerInfoUpdatePacket.Action action = ClientboundPlayerInfoUpdatePacket.Action.UPDATE_LISTED;
EnumSet<ClientboundPlayerInfoUpdatePacket.Action> actionSet = EnumSet.of(action);
ClientboundPlayerInfoUpdatePacket packet = new ClientboundPlayerInfoUpdatePacket(actionSet, List.of());
packet.entries().add(entry);
oh boy
Tags
shortest NMS code
Oh yeah thanks
This also shows you how to edit the ping, tablist name, gamemode etc in the tab list for any player.
Or even add fake entries in the tab list.
Does anyone have an idea how I can check whether a block with a rail has been connected to another rail next to it?
Im actually not sure if you need all of those parameters for just removing the player from the tablist.
A few can be null
saved by the annotations
In class Tag there is no dyes group ,_,
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/block/data/Rail.html
I would check the shape of the rail and if there is another rail in this direction having a viable shape.
I dont think there is a notion of connections between rails in minecraft.
declaration: package: org.bukkit.block.data, interface: Rail
doesn't it give you an option to specify the type of record you want to resolve?
Any specific reason why a spawner doesn't show the entity inside when I do setSpawnedType()?
i dont seem to see an option
Thanks
this is like 10 year bug iirc, but i dunno actually how to fix it 😄
uhm
there should be a solution
ok
You need to force update the TileState
🙏
Something somethig
CreatureSpawner spawner = ...;
spawner.update(true);
i think
why doesnt craftbukkit do it for you
ye
testing rn
Then you should use a real DNS client library
im limited with powershell my friend 🥲
The System.Net.Dns class seems to only do IP resolving
ok yea, i asked chatgpt
and he suggested me to open UDP client and send the packet by yourself :DDdd
lol
what a trash package System.net.dns is
and SRV records are old
why doesnt it support it lol
it isn't, its only purpose is resolving ips
it never was meant for querying other record types
Worked, thanks 🙏
DnsClient.NET is a simple yet very powerful and high performant open source library for the .NET Framework to do DNS lookups - GitHub - MichaCo/DnsClient.NET: DnsClient.NET is a simple yet very pow...
i get an error: https://pastebin.com/jmpcSQ2F
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
yeah, I used (actionSet, Collections.emptyList())
Are you... hiding all players on player join?
ah, f*ck it its only uni assignment im not gonna add a whole dns client just for retrieving a port
Just intercepting the packets in the first place might be another idea.
Anyways. Let me check if there is a way around using the byte buffer...
Nope. Two options: Construct the packet via a FriendlyByteBuf or replace the entries collection via reflections.
probably intercepting it might be better. do i need protocollib?
singular fork
I always forget, go to purpur discord this is spigot blah blah blah
?fork
SpigotMC maintains the Spigot server. If you are using a fork of Spigot (such as Paper, Airplane, Purpur, or other derivative works), you should seek support in the appropriate Discord servers.
oh ok
?whereami
@quaint mantle
yes ?
.
what ?
go to the purpur discord
they already got told that
is there a way to get color of a dye item?
like i have item x and i know that x is one of the dyes, how to get it's DyeColor?
i think you need a switch for this
I think Map would be better
either way
Yeah afaik you can only map it
There isn’t a built in method
although I bet there could be
yeah, probably the crafting table has some information somewhere
I imagine the dye items themself do
Player bukkitPlayer = ...;
ServerPlayer serverPlayer = ((CraftPlayer) bukkitPlayer).getHandle();
UUID uuid = serverPlayer.getUUID();
List<ClientboundPlayerInfoUpdatePacket.Entry> entries = new ArrayList<>();
entries.add(null);
ClientboundPlayerInfoUpdatePacket.Action action = ClientboundPlayerInfoUpdatePacket.Action.UPDATE_LISTED;
EnumSet<ClientboundPlayerInfoUpdatePacket.Action> actionSet = EnumSet.of(action);
ByteBuf directByteBuf = Unpooled.directBuffer();
FriendlyByteBuf buffer = new FriendlyByteBuf(directByteBuf);
buffer.writeEnumSet(actionSet, ClientboundPlayerInfoUpdatePacket.Action.class);
buffer.writeCollection(entries, (proxyBuffer, writer) -> {
proxyBuffer.writeUUID(uuid);
proxyBuffer.writeBoolean(false);
});
ClientboundPlayerInfoUpdatePacket packet = new ClientboundPlayerInfoUpdatePacket(buffer);
Ok i decyphered mojangs nms and applied some black magic fkery.
This can only be used for a single player at a time and only to hide him from the tablist.
Try this out
Isn't there api for that
why r u doing this
why r u adding null to the list
what the hell is this code
So that the collection writer has one iteration
A packet to remove a player from the tablist
@lost matrix did you not include serverPlayer.connection.send(packet) or do I not have to call that?
That only sets the initial capacity
also you can just use List.of if you dont mutate the array list
List.of uses varargs so i cant use null there
What about an empty list?
Nah you need to send it ofc
was confused lol
Doesnt trigger the list writer
I see
My guy... varargs parameters
It does work
Tho the ide does give a warning
List<ItemStack> list = Arrays.asList(null);
it works
varargs parameters accept nulls
idk where you got that it doesnt
how old your java version needs to be to not support null in varargs
Its an ambiguous call because both a single object and an array can qualify as null
the issue is that, varargs is short for {null}
therafore passing null will result in array with one value that is null
That are internal semantics and depend on the jvm impl you are using.
I dont do ambiguous calls. You can use them all you want.
also what about using final var
i mean var isn’t ambiguous it just infers the type
yeah
i mean, update your jdk or something
also instead of using varargs you can do
new Object[1]```
and then put it into your ArrayList
Bit of a design question, let’s say I have an api class with a bunch of static methods to interact with parts of my plugin
I assume it would be bad to make use of those api methods in the implementation since that would couple the implementation to the api
final var bukkitPlayer = ...;
final var serverPlayer = ((CraftPlayer) bukkitPlayer).getHandle();
final var uuid = serverPlayer.getUUID();
final var entries = new ArrayList<ClientboundPlayerInfoUpdatePacket.Entry>(new Object[1]);
final var action = ClientboundPlayerInfoUpdatePacket.Action.UPDATE_LISTED;
final var actionSet = EnumSet.of(action);
final var directByteBuf = Unpooled.directBuffer();
final var buffer = new FriendlyByteBuf(directByteBuf);
buffer.writeEnumSet(actionSet, ClientboundPlayerInfoUpdatePacket.Action.class);
buffer.writeCollection(entries, (proxyBuffer, writer) -> {
proxyBuffer.writeUUID(uuid);
proxyBuffer.writeBoolean(false);
});
final var packet = new ClientboundPlayerInfoUpdatePacket(buffer);```
i would do this
Alright here is the solution without the list dispute
@EventHandler
public void onJoin(PlayerJoinEvent event) {
Player joinedPlayer = event.getPlayer();
Bukkit.getOnlinePlayers().forEach(online -> hideFromTabList(joinedPlayer, online));
}
private void hideFromTabList(Player target, Player playerToHide) {
ServerPlayer serverPlayer = ((CraftPlayer) playerToHide).getHandle();
UUID uuid = serverPlayer.getUUID();
ClientboundPlayerInfoUpdatePacket.Action action = ClientboundPlayerInfoUpdatePacket.Action.UPDATE_LISTED;
EnumSet<ClientboundPlayerInfoUpdatePacket.Action> actionSet = EnumSet.of(action);
ByteBuf directByteBuf = Unpooled.directBuffer();
FriendlyByteBuf buffer = new FriendlyByteBuf(directByteBuf);
buffer.writeEnumSet(actionSet, ClientboundPlayerInfoUpdatePacket.Action.class);
buffer.writeVarInt(1);
buffer.writeUUID(uuid);
buffer.writeBoolean(false);
ClientboundPlayerInfoUpdatePacket packet = new ClientboundPlayerInfoUpdatePacket(buffer);
((CraftPlayer) target).getHandle().connection.send(packet);
}
What fking final var?
here
Go write C#
already done
Nice. Then keep your vars there.

