#help-development
1 messages ยท Page 1021 of 1
it can;t unless they fixed it
if anyone know's what the problem could be
yes, and when it's read, it converts the strings into non string objects (for the stuff that isn't actually a string)
so the Map that MemorySection wraps, doesn't have just strings
and that doesn't happen on "get" calls ever
however everything in Java can be converted to String, this is why I just use string because it literally will not fail
you can make any object in Java a string ๐
public DummyConnectionHandler(MinecraftServer minecraftserver, PacketFlow networkmanager, ServerPlayer entityplayer, CommonListenerCookie commonlistenercookie) {
super(minecraftserver, new DummyConnection(networkmanager), entityplayer, commonlistenercookie);
}
Right
it was a string at some point, but way before any get methods, it's been turned into somethign else
What does DummyConnection look like
valueOf isn't parsing either
And what does the super call look like
public class DummyConnection extends Connection {
public DummyConnection(PacketFlow enumprotocoldirection) {
super(enumprotocoldirection);
}
}
Pretty sure you need to override a bunch of methods to be empty
so do the same I did in the handler?
public class DummyConnectionHandler extends ServerGamePacketListenerImpl {
public DummyConnectionHandler(MinecraftServer minecraftserver, PacketFlow networkmanager, ServerPlayer entityplayer, CommonListenerCookie commonlistenercookie) {
super(minecraftserver, new DummyConnection(networkmanager), entityplayer, commonlistenercookie);
}
@Override
public void send(Packet<?> packet) {
// empty because we don't want to send packets as this is a fake connection
}
}
What spigot version are you doing this dummyConnection?
1.20.4
it will fail whatever you put in there, it won't fail silently
anyways I am done arguing with this as its pointless
point is, as I said initially this is why I use string as grabbing it as a string will never fail
ever
unless your path is wrong and you get an NPE
I was never ever talking about that. I was talking about the incorrect things you were saying about other things
I don't care anymore
This is a little old but the simplest way ```java
public class Npc extends ServerPlayer {
Npc(MinecraftServer minecraftServer, ServerLevel worldServer, GameProfile gameProfile, ProfilePublicKey publicKey) {
super(minecraftServer, worldServer, gameProfile, publicKey);
this.connection = new NetworkHandler(minecraftServer, this);
}```
I haven't looked at SnakeYaml's implementation in a while so I can't say what you are saying is correct or not
the NetworkHandler is```java
public class NetworkHandler extends ServerGamePacketListenerImpl {
public NetworkHandler(MinecraftServer minecraftserver, ServerPlayer entityplayer) {
super(minecraftserver, new Connection(PacketFlow.CLIENTBOUND), entityplayer);
}
@Override
public void send(Packet<?> packet) {
// Empty as we never want to try to send packets to a fake player.
}
}```
second the spec doesn't define how implementations can do stuff
I specifically mentioned MemorySection a couple times now, which isn't snakeyaml, that's bukkit
MemorySection just essentially wraps a Map<String, Object> where stuff is already parsed into non-String types
so getLong doesn't do anything except check if its already a number
why is it a flaw? it's better. It means that most gets on MemorySection are just doing a map lookup since the whole section is already parsed
because obviously it can't differentiate a long with a L
if it failed on it
if it did a valueOf java would accept it
it must be some other method I am thinking of that lets you specify L
anyways, just use strings ๐
won't hurt anything and you don't lose anything on performance and you can do your own type checking
That's just a personal opinion
I would just use strings when there's no other option
personal opinion on what?
Getting everything as string and parsing it on your own, when there's a method already done for the data type you want
That's not a good practice on my opinion
I already explained that file parsing is one of two things. It is either binary or it is a string. All objects in Java can be conveyed as a string. So there is literally no where you can go wrong with grabbing as a string
when its not reliable, it makes sense
just using getString always isn't good. You shouhld have it setup in such a way that it's already the type you want, number, bool, your custom type
then its just a map lookup instead of re-parsing anything
it doesn't hurt performance
if you can show that it hurts performance beyond a few nanoseconds I will believe you
ofc it depends on how often you are doing it
but its always good to have good practices even if it doesn't have any real impact in the specific scenario you are working with
it is good practice to not have it fail
and it wont fail
if you put a number into a yaml file, getLong will work, it'll just work
you are right using a string won't fail
which I guarantee all my stuff to always work
its not dependent on what an api thinks
I don't get it: when doing a lot write(s) on a lot of packets and then flush the minecraft client accepts the packets. But when doing so using the Channel.Unsafe and doing a singular write with the packets being in a single ComposedByteBuf the client disconnects (the packets are correctly formatted, I checked on a localhost, the disconnect happens when the server is a remote one).
Could someone explain what the hell is going on?
if it would fail early, it will fail later
elaborate?
the only way you can fail with pulling it in as a string is if your path is wrong
if its a number, it will be a number and the getNumber methods will work
if its not a number, itll be a string, and your parsing/valueOf you do on getString will fail
that didn't answer the question
that's delaying the failure
no
you just claim that "using a string won't fail", but if you need a long you inevitably will have to parse it, using a String to delay the parsing until you need the long won't avoid the failure, it will just delay it
well it won't if you want the config to load
What you are doing is just "ignoring" if the value you are expecting to be a number is not
it just depends why you needed the stuff. It also depends if you allow the ability of it to be fixed
Which is, in fact a bad practice
or error correction
As the user don't know that he has a bad value
If there's a problem, the user should know about it
So he can fix it
Not "ignore" it and do something behind it
and you can't do both?
does someone know Netty here?
fail-fast is a very common programming practice
you want to validate the user input is correct
what disconnect error?
yes I am aware fail fast is a common programming practice, but not everything needs to fail fast either
validating user input is important, but you can sanitize too or correct
no one said you couldn't nor is it against any standards
if you know something is a number, and the only reason its not accepted as one was because of a single letter
you would rather the entire thing failing?
even though that thing is not really all that important
um yes 100%. you're gonna try to coerce a string into a number using some vauge set of rules that aren't well known or described?
"what if thers a random a char in the number, its probably a typo, ill just ignore it"
well you already know what makes a number well a number
not only ignore it, but remove it
that is literally what sanitizing is
just because you choose to not do it, doesn't make it wrong
its a valid concept and standard
I do get the same error I sent above https://pastes.dev/JSMUwEsE12
absolutely nothing
just says "Disconnected"
no server-side errors either
does it show more in the client log?
well client log is no different then the server log
ok the issue was isLong() returns false but getLong() works even tho isLong() is false
would suck if it also didn't provide anything in the client log
so....whats with the custom identifier?
I have no idea
anyone why does isLong() return false even tho its a number
seems something is out of order
wrong path
that method just checks the type exactly, whereas getLong will turn the existing number into a long
minecraft:register is to register plugin channels if I am not mistaken
let me go look
nope, not necessarily
isLong only returns true of the value is an instanceof Long
but getLong will turn any Number instance into a long
from everythign he has shown us, yes
his isLong and getLong are both failing, so his path is wrong
getLong works
this is for a normal server
his getLong returns 0 for him
no this time it didn't
and isLong returns false. Both things point to wrong path
if in my yaml i have foo: 123, isLong will be false but getLong will be 123
I don't think they'd describe getLong as "working" if it still returned 0 when it was supposed to be another number
Then post some damn code and yoru config. People are fed up guessing.
well, the packet I send is about 600 ByteBufs or 16 000 bytes long
why such a large packet?
and I send it raw, so like this
it's 600 packets
translated into bytebufs
and then combined into a composite bytebuf
my project has 0 warnings!!! not even deprecations or unused imports it's legit just typos
wow first time this has happened to me probably
so the client disconnects when the server sends these 600?
yeah, but weirdly enough, it doesn't happen on my localhost
it's sent once
and when the client decodes it
he understands that those are 600 packets
loopback is not hardware coded, its an OS connection therefore not subject to the same rules
sounds like some packet size issue then
hmmm
but at the same time
the data sent when I was writing the bytebufs seperately and only then flushing
is matching in size
thus the os doesn't block anything
its quite possible that its either a packet size issue, or the timing of the packets is triggering firewall/anti-ddos related stuff
firewall problems can't be the case
cuz here
or he has an odd MTU between him an the server
it isn't about blocking, rather the OS doesn't bother to do some manipulations or filtering that your NIC or modem and other network stuff would do
the data size is the exact same
that would suck
well something is causing your hardware to shut the connection
server isn't disconnecting otherwise you would had an error that stated other end closed the connection
so its on the client side that the connection is just being terminated
I get that
then what am I supposed to do?
long longValue = this.getConfig().getLong("commands-config.punish.severity-level-value");
boolean booleanValue = this.getConfig().isLong("commands-config.punish.severity-level-value");
this.getLogger().info(String.format("value: %s, boolean: %s", longValue, booleanValue));
https://paste.md-5.net/ebeqayowef.bash <- config
lower the amount of packets you sent at once
not exactly the code, but this reproduces it
try sending half as many of them
how do I know what max readable bytes I can send at once?
where isLong shows false but getLong gives value
well common MTU is 1500
if your packet is larger then 1,500bytes or whatever the MTU is set at it will break up your packet into smaller packets anyways
the lowest MTU on the network between you and the server is what dictates packet being split
however its not common to have some device have a lower MTU size of 1500 although it is possible
but I don't think MTU here is the issue, just this is an answer if you were trying to send the largest packet without it being split up
yes, that number fits in an int, and so snakeyaml will create an Integer
if in my yaml i have
foo: 123, isLong will be false but getLong will be 123
I am thinking the amount of packets being sent at one time and then being received is the issue
so I'm wondering what I should set the byte split limit to
well it makes no sense to have it be above 1500
since the network devices and your nic will split at that
also MTU is the size of packett itself, not just the contents
so you minus TCP header from that number
anyone? how does isLong() actually work?
and you should get a general idea for content size
it's like 20 bytes
I'll try with 1000 and see how it goes, thanks
nnonoonoo
you don't get it
when I write them like in a for loop
and then flush
everything seems to be flushed
immediately
and the client interprets it as normal
and client doesn't DC?
yep
alright, so what are you doing now
As a test (to see if it is really the isLong failing) try severity-level-value: !!java.lang.Long 604800000In your config
U got an answer from emily
basically this:
where I just see what the server would normally send
copy it
ok but you are not looping anymore and you changed that?
and then send it from the lowest point in netty
yes
normally I'd do for(ByteBuf buf : buffers) user.writeSilently(buf); and then like user.flushSilently();
which just invoke a write on a ChannelHandlerContext
that is of the packet events handler (so that they're not intercepted)
ok so this updated way, does the client render anything or it just immediately DC's?
this way
it works
but it's too slow
yes but that is because the loopback doesn't interfere like your nic and other network related connections would
you are not understanding that devices actually have rate limits and other settings
loopback ignores such things
wait that's pretty cool
its quite possible that sending 600packets in less than a second
is causing either the network driver to think its an attack
and just severes the connection or something other that is similar
idk what unsafenetty utils does
either
YOO
WAIT A SEC
I just set use-native-transport to false
cuz on my pc it's windows
and that server is on linux
so it's NIO here
and Epoll here
nice, eventually we would have gotten there ๐
xD
this gives error
org.bukkit.configuration.InvalidConfigurationException: Global tag is not allowed: tag:yaml.org,2002:java.lang.Long
in 'reader', line 71, column 27:
severity-level-value: !!java.lang.Long 604800000
oh i didn't see sec
okies
but I can't just tell my plugin users "disable native transport" cuz that's stupid
well driver I guess
software
wait so if it fits in an int, isLong will return false?
that shoudl work for snake, but I guess no mor
yeah
no idea what driver is tho
so if you disable native transport on the linux server it made it work?
yes
crazy
this guy's got some brains
they said what I was going to say
UnsafeNettyUtils might be using NIO
but you are telling the server to use Epoll
that's my class and it's using supported netty methods
ok, but the methods you are making use of
might be making using NIO
how do i submit parameters from a html form? this is just a form that i use for testing my stuff, i need to pass parameters code and id and a multipart (file), not sure if i'm doing it properly
<form enctype="multipart/form-data" action="http://localhost:21247/v1/update_pack" method="POST">
<input type="hidden"/>
Choose a pack to update: <input name="uploadedfile" type="file" /><br />
Input the pack id: <input name="id" type="number" /><br />
Input the secret code: <input name="code" type="password" /><br />
<input type="submit" value="Upload File" />
</form><br>
apparently i need to use javascript which i would rather not... if someone could spoonfeed the code to me i would greatly appreciate it lmao
and not Epoll
I have actually no idea why that happens
why it's not possible to create custom recipe choice ? ๐ค
is it possible there is other methods?
for epoll specifically?
you mean netty's impl?
ok....I guess you are not understanding
there is different implementations that can be used in regards to network handling stuff. NIO is java's implementation
Epoll is another
then you have kqueue
and there is others
fortunately we only have to be concerned with NIO and Epoll and not some others
ye
netty's shortcut for better performance
I wouldn't say shortcut for better performance
there is times epoll sucks
and nio wins
like your example for instance
you may be sending packets quickly and jumping the queue
but what happens when 20 players show up while you have 50 trying to play?
that is 12k packets that jumped the queue
that is fine if you are prioritizing those who are new I guess, but NIO works best with this especially if you are only using a single thread
also note
for every packet sent, the client has to send one back
because in TCP an ack has to be sent that the packet was received
if the server doesn't get the ack in a timely fashion it will send a packet again depending on which it didn't get an ack from
and then if the client gets the packets out of order, it will wait to send an ack until it gets the order
all this sounds insignificant but they are important depending on the implementation trying to be used lol
I heard that Epoll's better because of native calls
in general yes. But epoll sucks if connections are long lasting, you are not making use of multiple threads etc
well you are not getting the benefits of epoll if that is the case
mmm, I would try investigating further why native transport is the issue here
and then if NIO I can use my unholy magic and otherwise I use the slower methods whilst giving a console warning?
I am guessing as I said earlier it just has to do with how many packets you are sending and how quickly as well as you jumping the queue it seems? Not sure if you are leveraging the threads that netty has
I will allow 10 packets and see if that works
yeah, I would just do a test with the number of packets first
and just keep increasing until it fails XD
I'll debug the number of bytes
btw
how do I check what is used?
statically
cuz dynamically I could check for the Channel class type
oh wait, I know, nvm
just checking the server Channel's type
if the player is sneaked, how i can get the block under?
get teh block under them when they toggle sneak (event)
I mean, when a player is skeaked and on the edge how can I find the block?
player location - 1
1300 is too big
bytes
sneaking allows them to overhang
that seems right
didn't you say 1500?
for the entire packet
ye
all you are doing is modifying content
which ignores all the other stuff related to TCP
??
975 is accepted
as more and more technologies add options to TCP headers, the less the content size overall gets
in your case though it seems you might have a network hardware that is set at MTU of 1300
at 1500, with most compatibilities, generally you could send 1380 bytes
is the limit
how do I check for that? xD
and can you even check that server-side?
you keep sending a packet until it fails
well you would't be able to check if it got split
just whether or not it was successful
but let me check
actually yes you can check sever side
how???
I knew there was, but how you will implement it in the application is a different story
anyways ICMP will inform you if a packet needed to be fragmented
uh
what's that?
its a protocol, most commonly used for pinging
Internet Control Message Packet?
if I remember right
anyways, when you use it for pinging you can specify the size of the packet to send the ping
and there is an option to have it inform if the packet was fragmented
so you either start at an arbitrary high value and lower until it doesn't fragment
or vice versa until it fragments lol
on windows you can use the ping command
ping www.google.com -f -l 1492
1492 being the size of the packet in bytes
so for me
1472 was the max I could send via ping anything higher and it fragmented
how did you check for fragmentation?
it tells you
it doesn't tell you the threshold, you just gotta keep guessing?
C:\Windows\system32>ping google.com -f -l 1472
Pinging google.com [142.250.113.113] with 1472 bytes of data:
Reply from 142.250.113.113: bytes=68 (sent 1472) time=16ms TTL=57
Reply from 142.250.113.113: bytes=68 (sent 1472) time=22ms TTL=57
Reply from 142.250.113.113: bytes=68 (sent 1472) time=18ms TTL=57
Reply from 142.250.113.113: bytes=68 (sent 1472) time=14ms TTL=57
Ping statistics for 142.250.113.113:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 14ms, Maximum = 22ms, Average = 17ms
C:\Windows\system32>ping google.com -f -l 1473
Pinging google.com [142.250.113.113] with 1473 bytes of data:
Packet needs to be fragmented but DF set.
Packet needs to be fragmented but DF set.
Packet needs to be fragmented but DF set.
Packet needs to be fragmented but DF set.
Ping statistics for 142.250.113.113:
Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),
also, is there any convenient way to get this in java?
cuz Runtime.getRuntime... execution
is rather slow
so notice that it didn't send the ping if it fragmented
so you could easily tell if it succeeded or failed lol
oh makes sense
btw for me 1040 was accepted xD
but keep in mind, this is ICMP and not TCP
on linux ifconfig| grep -i MTU UP BROADCAST MULTICAST MTU:1500 Metric:1 UP LOOPBACK RUNNING MTU:65536 Metric:1 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
that is to get the default defined MTU
don't tell me
that they can have different fragmentation thresholds
yep, but you could just go with 3/4's of what is found from ICMP
and the reason the threshold is different is because TCP has more data in the headers then ICMP
but ICMP is higher up on the level in the network then TCP
as well
ICMP is layer 3
where as TCP is at layer 4
is there an easy way to parse a component string to an item? (/minecraft:give's syntax)
you could probably check if it exists in the materials list?
?
i do not think that is whati need
ill look into it
please don't
there's probably better ways
dfu is just a pain when not using mods
๐ฆ
you want to turn what they specify in the command into an item?
with data components probs
the give command was just an example
data components are now a thing
i want to parse a component string into an itemstack
example from minecraft.wiki
minecraft:diamond_block[minecraft:can_place_on={blocks:"minecraft:dirt"},minecraft:can_break={blocks:"minecraft:quartz_block"}]
stick[attribute_modifiers=[{type:"generic.scale",slot:"hand",uuid:[I;547231302,-391626178,1591181916,1572689867],name:"",amount:4,operation:"add_multiplied_base"}]]
so you would get the material form of it, and create an itemstack with that material
please look at what i've sent above
does material even support components
i am NOT parsing that manually
Use the UnsafeValues method modifyItemStack
Bukkit#getUnsafe?
yeah, there's a method there that takes an itemstack and a string which is passed to the Itemparser
kk ty i'll take a look
and its not like you really have to parse much, literally need to find minecraft: and then anything after and before [
"anything before and after [" yes scroll through this https://minecraft.wiki/w/Data_component_format#Item_format and see how many things i'd need to support
You want ItemFactory#createItemStack(). You don't need unsafevalues
tyty
You could throw into it that exact string you sent above and it'll pop out an ItemStack
oh this must be new
It just passes it through the ItemStackArgument for commands (e.g. the one used in /give)
my mind instantly went to /give
I added it back in like 1.17 or something. It's a couple years old at this point
new to me ๐
Yeah. A little over 2 years https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/commits/c8c8331ec3599b5473c969decf42c427542ff367
its not like I read every commit >>
:p
but I am surprised I missed that
Also, it was 1.18.2. I was so close!
lol
soooo
they CAN have different fragmentation?
aight, nobody's gonna set it up higher than 1k, surely
WHAT
I meant lower xD
IPv4 allows fragmentation so packets can exceed teh MTU as they will be split and reassembled. IPv6 does not and will drop over sized packets
read Path MTU discovery https://www.cloudflare.com/en-gb/learning/network-layer/what-is-mtu/
nooo
amigo
NOOOOOOO\
MORE POTENTIAL PROBLEMS
lol
NOOOOOOOOOO
lmao, I totally forgot about this
I just assumed ipv4 since everyone seems to run their mc servers on ipv4
good news though
ipv6 mtu has to be minimum 1280
oh now we speaking numbers
IPv6 is annoying
yeah SCIENCE
they look garbage
well what I am saying is since the packet you send with ipv4 needs to be less then about 1300 anyways to ensure no fragmentation, you can just limit to the size of ipv6 minimum of ipv6
yeah
I was gonna assume 1280 for ipv6 and 1000 for ipv4
also
I just found out you can find out the fragmentation level with tcp
you just set the DF option in the header
anything along the path that doesn't support the packet size will drop it
DF = Don't Fragment
and returns a ping packet with the MTU
^
so in regards to implementing in your application in finding out largest packet you could send, is actually simpler
the only thing is you will have to implement the connection stuff for that yourself though and not rely on the netty stuff
unless there is something in the netty stuff that would allow you to create a netty connection separate from the MC stuff
uh
so I still need to figure this out by myself?
yes but no
instead of trying to figure out how to use ICMP
you can use TCP instead
you just have to initiate a connection somewhere and send a packet with the DF flag in the header set
just updated to 1.20.6 including remapped jar and am getting this, anything I am missing other than changing pom and downloading/selecting java 21?
yeh that is on 21 as well
yup done that
ah, found it, problem was I just changed the version from 1.20.4 to 1.20.6 but left the specialsource-maven-plugin version, and that needed to be changed also
anyone know if there's better way to prevent players from jumping? Because this cancels player's current velocity
wasn't jump boost 128 a thing
It was that or negative jump boost or something
hm lets try
wha
but tbh thats a wild way to cancel jumping
you could check for y level increase in move?
why should I? the statistic is much easier
place barrier above the head?
signed byte
:X
Target their spacebar with an ICBM
That fucks with stairs or slabs or anything else that lets you walk on it and increases y
not letting somebody jump also usually does
Nah you can still autostep with the negative jumpboost
bytes have a max value of 128, it rolls over to -127
is still buggy
No... It's not
visual glitches for me
I've made an entire game out of it
weird
You could try a player velocity event but without a dedicated PlayerJumpEvent like paper has, statistics might be your best bet
i can still manage to jump sometimes
Never seen that happen
i literally just jumped 400 blocks in the air
Maybe it's a 1.20+ thing then
am on 1.21
yeah its possible its been fixed
It worked fine a few versions ago
why can't paper's jumpevent not simply work D:
it's always gonna look buggy on the client
that's not the issue
ah i just saw the last bit
the issue is it doesnt detect jumps "off the edge"
i mean the client doesn't really tell the server "i am trying to jump"
thats true
it's based on the delta i believe
and is the reason we never added a jump event in spigot - because a "jump" event doesn't technically exist without making something hacky :p
and if you try to diy it's probably gonna be the same approach and suffer from the same potential false positives lol
Yepyep
Do you know off hand if Paper keeps dx/dz changes despite a cancelled dy? This is just the client being annoying?
i don't
it doesnt, it just teleports one back to the getFrom() pos
Yeah but is that what it actually does in implementation?
btw you can use nogui to hide that second GUI lol
but then I#d have to type nogui everytime lol
Well, yeah, but make a run script 
update ๐ก
I wonder why they opted to use the from position?
you are 36 builds behind
Surely using some delta x/z values would be better
not on spigot
How can I show the active player on the bot?
waht bot
Dude, I want to show how many players are active in that world under the NPC.
which NPC?
I didn't see
How do you make a packet listener for nms packets and not protocol lib packets?
Hello everyone i have a question, where can i found early components of a craftbukkit server?
Like org.bukkit.minecraft-server for version 1.5.1R0.2, early i getted them from nexus repository, are they erased now?
There was earlier
thats pretty bad, thank you for the help anyway
Can get calls to player inventories be async?
I don't think they can be ๐ค
but it might be possible with the latest versions though considering player inventory is always open
well there is
but I won't disclose where >>
Is there like a solid list of things that can be done async by chance, I imagine anything to do with outgoing packets can be async
But is there anything, say like chat that is 100% safe for async?
Well, I know that if it modifies the world in any way it can't be async
Yee thats about all I know as well too
which technically code created inventories can be async
since they don't actually have to be attached to anything
So I wonder if the inventory is attached to an entity if the world, if that would count or not 
yeah not entirely sure
you could test it out
worse that happens is you get a CME
well ok that isn't the worse
worse is you encounter some weird glitch/bug from doing it lmao
yeeeah this would be the main thing ๐คฃ
I was gonna think could just clone player inventory -> manage it off thread -> then shove it back on the main thread but any changes during that async awaiting to the player inventories would need to be taken into account or else you get a weird situation where dupes are possible just by existing ๐คฃ
yeah
and that is pretty much the premise in how you make stuff non thread safe, thread safe
ultimately you clone it
do some stuff, bring the result back to main thread
I really wish things like creating entities could be done async
That would be such a big help for some performance things, but Minecraft bitches about spawning entities async :c
Well technically spigot does
What im doing sadly isnt spigot, However i could possibly just bring it over to my environment
What method is it?
Or is it all entities in general are spawned async
What
https://pastebin.com/KCmQvfCT
https://pastebin.com/c8zDNwib
Anyone can help me?
?stacktrace
We cannot help without the full stacktrace; Please paste it here: https://paste.md-5.net
Hey, I am trying to make my plugin compatible with multiple versions (using nms)
How can I import with maven multiple versions of spigot (mojang remapped) and reobjuscate when compiling?
You could just not use NMS ๐
Okay but how else will I unfreeze registries
Thanks
Anyone knows a way I can basically do a T<V>?
I have a Property<T> interface and I want to make a PropertyHolder<T extends Property<?>> so I can do stuff like setProperty(T<V> property, V value) type deal
I guess I can do some abstraction for filtering but it's a little icky
Hm
omw to do a very funky cast
i'm like 99% sure that's what I ended up doing last time I did generics too lol
how's your chicken grease supplier doing? Has he bought a lambo yet from your degenerate eating habits?
what a national tragedy
guess he'd be able to afford a holiday after all the patronage you give him
how the fuck did I manage to specify a generic that I can't specify
fuck it unsafe cast
my man
You probs have to take the class in first
Since T<V> assumes the class has a type V aswell
Hm
I'm just tryna see if there's a generic way of achieving this
this is gonna get big
Like instead of taking ControlProperty?
Instead of the methods being hardcoded to take ControlProperty
I'd like to have a PropertyContainer<ControlProperty>
I could hm
HmmMMm
Split ControlProperty away from Property as just a tag interface
And then make a merged interface
just have to add a second generic to Property
Which is itself?
idk if that will work, but this is just a separate type that is just for the "property type" essentially
then your holder has that as the generic, and each method then requires a property of that type
What version you using
Any way I can do this without nested classes
well yeah, I just did that so its all on one screen
they don't have to be nested at all
1.20.2
also, no unsafe casts or anything jank like that
like do I need a different PlayerInfoData for every PlayerInfoAction?
I need to take like 5 looks at this
Does the PropType class need to exist
Or can I just omit it
I think you need it. That's what you use in the Holder generic instead of the actual Property type
its just an empty type
Because I want just generic properties for int and stuff
I mean you can have that?
you only need as many prop types as you have different types of properties, not different generic params for properties
the SomePropertyType and OtherPropertyType? yeah, you need one of those per types of properties (not per different generic param in the Property)
so if you've got Properties that only apply to like an entity, then you have an EntityProperty<V> and its got an EntityPropertyType
and then BlockProperty<V> & BlockPropertyType
and then the different holders for those 2 property types, and you won't be able to mix properties between the two
Are you using packet wrappers?
maybe it makes more sense if I use block and entity
so you can see that this prevents you from using some block property in an entity property holder
still gonna use an unsafe cast lol
I guess it can be made safe by inheriting
Well hmm ๐ค
hm
well yeah, you will need an unsafe cast there obviously. But that's to be expected so long as you guard against putting stufff in the map that doesn't match
you always need unsafe casts getting from a map when doing some generic "property" system
oh yeah, the generic on the get from PropertyHolder to just have Property<V, T> which you did
might make it clear if you still do <P extends Property<V, T>>, idk tho. up to you
I would leave the empty "type" classes as inner classes of the property types, just cause its less files and they are literally only 1 line
Yeah I'll do the same
this will end up as a bedrock JSON-UI wrapper thing so I might credit you once this goes public
Thing's heavily undocumented and the only public projects out there are written in php / some random shell script
Anyone here happen to ever work with CoreProtect? ๐คฃ I've been trying to get the API to work for weeks but never been able to use it
Using CoreProtect v22.4, Using the snippets for API v10, and logRemoval just refuses to work yet returns success
Bukkit.getServer().broadcastMessage(String.valueOf(getCoreProtect().APIVersion()));
CoreProtectAPI api = getCoreProtect();
if (api != null){ // <- works
api.testAPI(); // <- works
player.sendMessage("CoreProtect API SHOULD be working..");
// logRemoval(String user, Location location, Material type, BlockData blockData)
boolean success = api.logRemoval("Notch", block.getLocation(), block.getType(), block.getData());
player.sendMessage("Success?: " + success);
yeah
i guess my issue is
like, if I listen for packets which only have one of the PlayerInfoActions... how does that work with modifying PlayerInfoData?
packet wrappers was discontinued like 4 years ago
so uh, i'm making coding in minecraft for fun
what's a good input method that accepts unlimited lines
or at least ALOT of lines
the normal console output should be fine? Otherwise append it to memory and write it to a file
OHH you mean input my bad, books would be the biggest thing players can type in, other than that would just have to let them type in chat then cancel the message thats sent and use that as the input
what are you doing
^
pretty much
i already made the intrepreter but i want a way for them to write their code
another flaw with books is they don't allow tabs, i'm prob gonna make them write 4 spaces or tell them to write it in a text editor or smth
is it a good idea to give them java functions (including spigot)
can i limit them to only do stuff in their plot so they cant for example ban someone from the whole network but instead they ban someone from their own plot through the java functions
other than creating a subserver for each plot cuz that'd cost 2 kidneys
how do you disable commands
are vanilla commands registered through here too?
alright thanks
yo, i can't find the method which removes a command
it's not a method
get the knownCommands by reflection and do whatever you like with it
is knownCommands undocumented?
how do u view those
you can do
SimpleCommandMap map = ...
map.getKnownCommands().remove("msg");```
oh its simplecommandmap
you view the implemnetation
i see
theres about 10 different particles here
which one lmao
the cross one is crit iirc
alr
this is ancient code
ParticleEffect.WITCH_MAGIC.display(loc, 0, 0, 0, 0, 1);```
but what do these numbers represent 0, 0, 0, 0, 1
delta + speed + count?
the only thing i can think of is the first 3 numbers is delta, 4th one is speed and 5th one is amount
ah
hmm, somehow this isn't working
SimplePluginManager spm = (SimplePluginManager) this.getServer().getPluginManager();
Field f = SimplePluginManager.class.getDeclaredField("commandMap");
f.setAccessible(true);
SimpleCommandMap scm = (SimpleCommandMap) f.get(spm);
Field knownCommandsField = scm.getClass().getDeclaredField("knownCommands");
knownCommandsField.setAccessible(true);
Map<String, Command> knownCommands = (Map<String, Command>) knownCommandsField.get(scm);
did i do anything wrong?
Where's simple plugin manager from
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
SimplePluginManager spm = (SimplePluginManager) this.getServer().getPluginManager();
here
What is that packagge from
Field knownCommandsField = scm.getClass().getDeclaredField("knownCommands");
this one is the one failing
wdym
net.bukkit.api.server orwhere
net.bukkit??
what does the import say
ah import
Idk forgot the path
org.bukkit.plugin.SimplePluginManager
org.bukkit
Ye
basically im just tryna access knownCommands in SimpleCommandMap
Just get the command map from the server using reflection and then get the knownCommands (either reflection or using a getter if there is one, idk)
it keeps saying that knownCommands doesn't exist
Then you are not using Spigot
Bukkit.getPluginManager().class.getDeclaredField("commandMap");
oh you are failign on known not the map itself
My personal favourite way to debug it would be by printing getDeclaredFields
SimplePluginManager spm = (SimplePluginManager) this.getServer().getPluginManager();
Field f = SimplePluginManager.class.getDeclaredField("commandMap");
f.setAccessible(true);
SimpleCommandMap scm = (SimpleCommandMap) f.get(spm);
logger.info(scm.toString());
it shows its a CraftCommandMap
where do i get SimpleCommandMap then
You don't need to, CraftCommandMap extends SimpleCommandMap
If you cast a class it does not change its type
i havent really learned much about making animations with spigot, is the armor stand method the only/best way?
but then
Field knownCommandsField = scm.getClass().getDeclaredField("knownCommands");
this shouldn't fail right?
probably not
weird
Your issue is you are using the instance not the Class
Field knownCommandsField = SimpleCommandMap.class.getDeclaredField("knownCommands");```
This works```java
SimplePluginManager spm = (SimplePluginManager) this.getServer().getPluginManager();
try {
Field commandMapField = SimplePluginManager.class.getDeclaredField("commandMap");
commandMapField.setAccessible(true);
SimpleCommandMap scm = (SimpleCommandMap) commandMapField.get(spm);
Field knownCommandsField = SimpleCommandMap.class.getDeclaredField("knownCommands");
knownCommandsField.setAccessible(true);
Map<String, Command> knownCommands = (Map<String, Command>) knownCommandsField.get(scm);
System.out.println("KnownCommands: " + knownCommands.toString());
} catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) {
e.printStackTrace();
}```
i see, so that's another way of getting it
tho mine worked by adding getSuperclass() somehow
thanks anyways
No, scm.getClass() is not the same as SImpleCommandMap.class
what's the difference in those 2
sysout their name and you'll see
isnt commandMap is on the Server?
CommandMap commandMap = Bukkit.getServer().getDeclaredMethod("getCommandMap").invoke(Bukkit.getServer());
no he wants knownCommands from inside SimpleCommandMap
then get commandMap first
You seem to not be reading ๐
anyway, the reason his was not workgin was because he was using instanceOfCommandMap.getClass() instead of SimpleCommandMap.class.
System.out.println(SimpleCommandMap.class.getName());
System.out.println(scm.getClass().getName());```Returns```
org.bukkit.command.SimpleCommandMap
org.bukkit.craftbukkit.v1_20_R1.command.CraftCommandMap```
i see, thanks a lot
top one is the correct class to read fields from, second is not
Map<String, Command> knownCommands = (Map<String, Command>) knownCommandsField.get(scm);
tho is this one a reference? or a copy of map?
a reference
reference
so if i mutate that, the original one gets muted too right?
that's not how references work
huh
int original_value = 0;
int* ref = &original_value;
*ref+= 1;
printf("%d", original_value); // 1
doesn't it work like this?
then how do references work
That is exactly how the same reference works 
He probably thought mutating the reference not the contents
yeah
prints 2
wait
ye cant read, thought initial value was 1, smh going back to bed
Hey, so I'm working on a project with multi modules on maven to support different versions of nms. All versions work fine, except from 1.20.6 where I get errors when I try to compile:
cannot access net.minecraft.network.Connection
cannot access net.minecraft.server.network.ServerCommonPacketListenerImpl
cannot access net.minecraft.server.network.ServerGamePacketListenerImpl
cannot access org.bukkit.craftbukkit.v1_20_R4.entity.CraftPlayer
cannot find symbol
cannot find symbol
cannot find symbol
cannot find symbol
cannot find symbol
Does anyone have any idea how to fix that?
Fixed by changing jdk to 21
That would make sense considering 1.20.6 requires java 21
How are you supposed to do them now
Like idk how you are supposed to do listeners for packets for native minecraft nms instead of using the protocollib listenerโฆ which GIVES you protocollib packets
you can use protocollib just fine
just not with PacketWrappers itself, or update it to match modern MC packets
protocollib is nothing but a reflection accessor
Hi, I wanted to know, is it possible to make custom structures that are generated naturally with spigot or not? (I'm in 1.20.4)
It is possible
Usually data packs are used tho afaik
But it should also be doable with a plugin
Yeah you can do it with just a BlockPopulator
Or hack some stuff into registries, kek
ok
do you have an example or a lib that makes it easier to do this? (if it's not too much trouble)
look up datapacks that have custom biomes
and then I guess make a way to add datapacks to your plugin
You can do that
buttttt plugins run too late, so if you deploy a datapack it will be after the server loads them
So you then need to restart the server
ok
Quick question, how do you log exceptions from futures sensibly? I get the stack trace and print some of that, but that often leaves out the stuff I actually care about. Any suggestions?
CompletionException, or try/catch inside teh Future
Additionally, is there a way to not let lambdas consume exceptions? It makes debugging annoying/figuring out that there even is an error.
I now do:
...
.whenComplete((d, e) -> {
if (e != null) { Server.error(..., e); return; }
<doing stuff>
})
.whenComplete((_, e) -> {
if (e != null) return;
Server.error(..., e); // Just in case the previous future threw an exception for some reason
})
its not the lambda consuming the exception
its you not handling it
add a .exceptionally
What I meant with "consume" is that if an exception would have been thrown in a method or so, it would have raised it and I'd receive a stack trace in my console. Lambdas just don't do that
its not raising it because you are not processing it. You are ignoring the exception
.exceptionally((ex) -> {ex.printStackTrace()}
^
Ah, for some reason I always thought #exceptionally would raise an exception and not handle them
thx :D
You have to return a future when using #exceptionally, is it norm to return null if you don't use the future afterwards?
like this ig
yes
well you have to return T which will give you a new Future<T> thats how it goes
iirc, ye
true, but null should be fine ig
exceptionally is more of a recovery function, it takes an exception and returns a valid result; if you have it as a last step and don't care about chaining any more results or returning that, then that's fine
Yeah, though I see little difference in this example between using #whenComplete and checking if e is null or just doing #exceptionally
How do I make a delay in a command or anything..? example; I want to set a block broken to air for a few seconds, then set it to stone(just a exmaple)
?scheduling
schedule a task that runs for example for x ticks, and checks itself if it should stop and set the block to stone
Thanks
i mean ye, depends on what, most api interactions must happen on the main thread tho
it's just some stuff i need to register, the api stuff of it is fast enough
multithreaded != fast
Has anyone worked developing faction servers or plugins? im looking to add one to my network of servers and need people who want to work together
?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/
it will finish earlier if i split it up right as one thread is limiting on my end
Depends on what you're doing
I'm adding millions of entries to an arraylistm, well, not millions, but in the future it could lead to such an enormous amount so I wanna be prepared
๐คจ
and i think multithreading should fasten the process a bit
what are you doing
uhhhhhh
creating a whole lot of classes linked to a location in an map
sounds like you are the one solely responsible for all memory leaks on spigot
๐ค the fuck
I did work on scanning surfaces at work
Sounds like something related
In which case, multithreading can be beneficial GIVEN you know how to optimize it
(thread pool, making chunk snapshots, concurrent collections, caching, re-using values)
Hey,
I'm trying to spawn in a custom entity (using nms)
Is there a certain NBT tag or property I can activate so that it will not collide with players? (so when players touch the mob, they can walk right past it without any pushback)
I can't seem to find anything like that
and thats why i now start learning how to do it efficently haha
memory isn't a problem in our case, but it's really not something u should do ik. it, doesn't take up to much fortunately :)
idk i dont have any context
kek
Hey guys, I am genuinely losing my sanity.
In plugin.yml I specified soft dependency on another plugin from which I use it's API.
softdepend:
- 'AdvancedServerList'
I tried editing loadbefore in the ASL plugin.yml... Using depend, etc. But my plugin always loads first and straight up ignores any plugin.yml configurations. Any ideas?
You can make the task to await the soft depended plugin
Gotcha, I will do that. But what even is the purpose of that configuration in plugin.yml file?
From the testing I did it just looks like only depend is somewhat useful as it just force disables the plugin when the dependency is not found... And that's basically it.
add an s
actually i always forget if its softdepend or softdepends, try using [] for a list
you sure you got the right name tho?
List is a list.. It shouldn't matter if it's written like [AAA, BBB, CCC] or
list:
- 'AAA'
- 'BBB'
Parser will eat it...
In SpigotMC wiki there is only "softdepend" mentioned.. Without the 's'.
The name is written correctly, I even checked the plugin's plugin.yml to check the name, which is:
name: 'AdvancedServerList'
?paste the full server logs pls
Bump ๐
Location loc1 = new Location(Bukkit.getWorld("world"), 30, 72.0, 20);
Location loc2 = new Location(Bukkit.getWorld("world"), 30, 62.0, 20);
ParticleDisplay display = ParticleDisplay.of(XParticle.EXPLOSION);
display.withColor(Color.GRAY);
Particles.filledCube(loc1, loc2, 300, display);
Is anyone know why nothing gets spawned (Xseries)
tf is a particle display
I googled it, its called XSeries, nothing from Spigot
go to their server then
I think they dont have a server so I asked here if anyone knows
+= rate,
Its adding 300 every loop, so basically its instant done xd
The example rate is btw 0.3
Anyone know how i can make the players armor invisible but not the item they are holding?
Location loc1 = new Location(Bukkit.getWorld("world"), 30, 72.0, 20);
Location loc2 = new Location(Bukkit.getWorld("world"), 30, 62.0, 20);
ParticleDisplay display = ParticleDisplay.of(XParticle.EXPLOSION);
display.withColor(Color.GRAY);
Particles.filledCube(loc1, loc2, 0.3, display);
still no particles
Do you see fr no particles? Did you check the start point?
And why grey? Since when can have explosions a color?
So many questions. Copy the example code from them and try it
And try a cube please. Like 30 60 30
40 70 40
Are your minecaft settings particles enabled
public Material getMaterial() { return Material.getMaterial(material); }
this is serializable right?
why moyai ๐ญ
also material is a string
i tried it because i have issues with 2 same classes being different after serialization
material is not a String
Material is not
material is
its Material.toString()
thats how i save it
to get a Material from a String use Material.matchMaterial
aight ty
i always used valueOf lol
registry :nodders:
didn't they completely change vanilla/nms itemstacks to registries
the material registry is still there, and item types are unaffected by the change from nbt to data components
i meant like nms item stacks
?
like you can only init them with a reg entry
why bring up nms?
they just changed itemstacks to not have NBT in memory but strongly typed structs, data components, not really to do with registries or anything, like yeah it is semi related i guess since there is a components registry iirc but it's not like itemstacks are backed by a registry itself
hi , uhh i change all maven to 1.8 , and even Porject structure to java 1.8 , and Moudles to 1.8 but it still say :
C:\Users........jdks\corretto-17.0.11\bin\java.exe
how i can fix it?
install java 8 and configure your IDE to use java 8
make sure your JAVA_HOME is set to teh java 8 path
read and display info from the exception
mostly by catching exceptions and giving good error output
is there a way to make an item meta glimmer like it had an enchantment without actually enchanting it? I know about HIDE_ENCHANTMENTS but is there a way?
you already said the answer lol
just put a random entchant and hide it
Hi while using this code :
https://paste.md-5.net/wiqezatebi.java
how i can stop this?
?nocode
Itโs hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.
we need more code
1.20.6 has api for this
I forget the name but itโs in ItemMeta
this code ..
ah lol didnt see the link
replaceAll is for regex
I don't want that
Thanks I guess I found it: meta.setEnchantmentGlintOverride(true);
Yeah thatโs the one
any suggestions for how to make a textdisplay smoothly follow a player? i have this rn but its not smooth
@EventHandler
public void onPlayerMove(PlayerMoveEvent e) {
Player player = e.getPlayer();
ChatBubble bubble = chatBubblesHashMap.get(player);
if (bubble == null) {
return;
}
Location newLocation = e.getTo();
Location oldLocation = e.getFrom();
if (newLocation == null) {
return;
}
double difX = newLocation.getX() - oldLocation.getX();
double difY = newLocation.getY() - oldLocation.getY();
double difZ = newLocation.getZ() - oldLocation.getZ();
for (TextDisplay textDisplay : bubble.chatBubbles) {
textDisplay.teleport(textDisplay.getLocation().clone().add(difX, difY, difZ));
}
}```
textdisplays should be a passenger
then its 100% sync
im stacking them though i have multiple above the player
yeah then stack them too