#help-development
1 messages · Page 2067 of 1
how do I give a player effects after it consumes(eat) something
But would it be possible to know the Block?
Like the material
Player#addPotionEffect()
yes but I am asking how because I do not know how
It would if you are checking against a location.
Ok
Listen for the playeritemconsumeevent and apply the effect if it's the correct item.
how do i make it detect a specific food?
Compare Material Types.
I want it to be the recipe I made
Or use the PDC
whats a pdc?
If you are making a custom recipe. Add some value in the PDC. That way you can use it for comparisons in the future.
PersistentDataContainer. It's an easy way to add custom NBT data to items.
pls note that I dont have enough wifi to open other browsers than discord that is why i am asking in here without using google :)
ouhh
It also persists after a server restart. hence the PersistentDataContainer
this is the updatet versjon
Is this working?
yes
no
Did you register the event?
can you help a bit? idrk how to even use it can you maybe show some examples
what? do i need to do that?
If you want it to work yes. 😛
Register the event in your main class using JavaPlugin#getServer()#getPluginManager()#registerEvents()
i have registerd command like this ``` registerCommand("Freeze", new Freeze(),"f")
That's the command. Not the event listener.
Your event may be inside the class, but it still needs to be registered.
how`?
So you would have two registrations for that class.
- 1 for the command
- 1 for the event
^
where?
Somewhere in your main class.
An instance of your main class that extends JavaPlugin.
Which if you are already writing code in that class, you can just use the this keyword.
what how?
but way do i get wrong on Freeze
it's like this
getServer().getPluginManager().registerEvents(Freeze, this);
is there any feasible way to block the "Respawn point set" message?
and thats it?
Basically. You could also make one instance of the freeze class and pass it through if you really wanted to.
how
no, on java edition it shows up in chat
The same way you make any other instance.
// obj is a variable name referring to this specific instance.
Object obj = new Object();
How you use it is up to you and your needs.
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
cheese
oh
lemon
but i can't now but i can learn it in some weeks
Well yea. It'll take some time to learn the language. It's not as if we are expecting you to learn everything about it overnight. 😛
getServer().getPluginManager().registerEvents(new Freeze(), this); just wonder what does this. Does it do so i get a command like /freeze? or?
That registers the event code that you created in the Freeze class.
It ties that code to your plugin.
but how does it fix it? so that work? if i don't have /freeze and don't make players stand still?
To go into more detail.
You are telling the server that you have something that you want to listen for. The server needs to know what event you want to listen for and an instance of your plugin so that it knows who all to send the event to. You also need to indicate where the listener code is. Hence the @EventHandler annotation above the method. All of this combined together is what makes the listener.
Now, that is only for the event part.
Commands are similar though.
so that i did was make it send messages and not make player stand still?
All you did was make a command that puts the player in a list. The code that utilizes that list is never called because you didn't register the listener.
So the server has no idea that you wanted to listen for that event. That's why the code does not run.
ok, getCommand does so i can do /freeze and getServer().getPluginManager().registerEvents(new Freeze(), this); Makes it so the server knows what to do?
is there any way to make an entity such as a skeleton, look in the direction of the player, but per player, with packets? so no matter where you go, the skeleton always looks at you?
More or less.
i need to update this to 1.18.2
import net.minecraft.server.v1_16_R3.BlockPosition;
import net.minecraft.server.v1_16_R3.ChatMessage;
import net.minecraft.server.v1_16_R3.DataWatcher;
import net.minecraft.server.v1_16_R3.DataWatcherObject;
import net.minecraft.server.v1_16_R3.DataWatcherRegistry;
import net.minecraft.server.v1_16_R3.Entity;
import net.minecraft.server.v1_16_R3.EntityHuman;
import net.minecraft.server.v1_16_R3.EntityPlayer;
import net.minecraft.server.v1_16_R3.EntityPose;
import net.minecraft.server.v1_16_R3.EnumGamemode;
import net.minecraft.server.v1_16_R3.EnumItemSlot;
import net.minecraft.server.v1_16_R3.ItemStack;
import net.minecraft.server.v1_16_R3.PacketPlayOutEntity.PacketPlayOutRelEntityMove;
import net.minecraft.server.v1_16_R3.PacketPlayOutEntityDestroy;
import net.minecraft.server.v1_16_R3.PacketPlayOutEntityEquipment;
import net.minecraft.server.v1_16_R3.PacketPlayOutEntityMetadata;
import net.minecraft.server.v1_16_R3.PacketPlayOutNamedEntitySpawn;
import net.minecraft.server.v1_16_R3.PacketPlayOutPlayerInfo;
import net.minecraft.server.v1_16_R3.PacketPlayOutPlayerInfo.EnumPlayerInfoAction;
import net.minecraft.server.v1_16_R3.PacketPlayOutPlayerInfo.PlayerInfoData;
import net.minecraft.server.v1_16_R3.PlayerConnection;
import net.minecraft.server.v1_16_R3.PlayerInteractManager;```
The second one.
what is the 1.18.2 corrispettive?
It should be possible with packets. You just need the ones for location. As it should have a direction field.
I prefer
public boolean method(@NotNull Player player) {
// ...
}
Final parameters are just pointless and add to code noisiness
(They also increase the amount of time you spend typing)
and itll work for every player online if i do it that way?
getCommand("Freeze").setExecutor(new Freeze(Freeze));
this does not work?
NMS changed signfigantly in 1.17 and 1.18 due to the mojang mappings. You are going to want to find the new names.
As long as you send the packets to every player in close proximity, then yes.
pog thanks
ill look into it
I'd recommend looking into how Citizens does it. They've had that feature for a long time.
is that a server?
No, it's a plugin.
ohh ok, thanks
That's because your Freeze class doesn't have a constructor that takes a parameter. This is where learning the basics of the language would come in handy.
Depends on the use case.
so what do i need to do now?
I thought that wasn’t an issue? How are you setting the armorstands visibility?
Huh, that’s odd. I’m pretty sure that’s what you are supposed to do to hide the armorstand. Although I don’t know why it would hide the items. Even using the vanilla command still makes the items visible.
or are the items just not being put on the armorstand when you try turning it invisible?
if i wana run this do i need to putt eventhandler in another class file? and use this? getCommand("freeze").setExecutor(new FreezeCommand(this));
You need to do two things in order for what you want to work.
- Register the command
- It seems like you already have this done.
- Register the event listener
- The code for the listener can be in any class you want.
- You just need to make sure that you are meeting the requirements in order for the event code to be fired.
- Those requirements are the
@EventHandlerannotation above the method. - For the event to be registered.
- Those requirements are the
is there an easy way to detect if a player built a structure
were i find the javadoc??
i want to specifically check if the player constructed a tier 1 netherrite beacon
You are not going to find Javadocs for NMS. There are community made wikis for changes. Minidigger has something for it called Mini's Mapping Viewer https://minidigger.github.io/MiniMappingViewer/#/
thx, got it to work now. Keep going 😄
how to push a player backwards to 4 blocks
Like teleport them back 4 blocks or launch them back 4 blocks?
Change the player's velocity. I think multiplying it would work, but I haven't worked that much with Vector math. It's probably not as simple as that.
Would anyone know of a way to ignore processing a packet that you just sent? I only want to listen to packets not sent via my plugin
does anyone have a list of everything that can prevent a player from sprinting?
if player.isSprinting()
player.setSprinting(false)
Asthma
no i mean like ingame stuff
I want a player to essentially be able to right click and riptide through the air, but without it raining
What event(s) could I use to achieve this because I'm really lost right now 😂
Then do something like “player.setVelocity(player.getDirection().multiply(NUMBER));”
Make “NUMBER” negative and play around with values
cant i just do -4
No because multiply isn’t based on blocks
nah 0
PlayerInteractEvent and mess around with velocity
What about the spin animation
You'll likely have to do it manually. Listen for the PlayerInteractEvent, check if they have a riptide trident, then send the animation packets.
Would anyone know of a way to ignore processing a packet that you just sent?
in or out?
a mix of both, I take in a chat packet, process it (cancel it) and then send out another chat packet, I need to ignore the next time the event is triggered on the one I sent out
why sending another chat packet ? Just modify the message of the current chat packet
I need to process the packet asynchronously cause Im accessing a website and waiting on a reply before the packet is sent to the player
if I process it synced it lags the server hard
AsyncPlayerChatEvent
Hi, how can i check if an inventory is full?
without counting the armor
like is there a way to get how many free slots are there?
can't cause that only manages player message, I need to manage every message sent to the player like server messages and such
oh so you're using a packet listener
you can do inv.firstEmpty() , you should get a result of -1 if its full
not a chatEvent
yeah using protocolLib
ty
then idk
you think protocolLib has a discord?
idk
can't you set a scheduled task in async?
I can, but thats not the issue, I need to fully ignore the resulting packet I send out, apparently using the packet.equals(packetPreviouslySentOut) doesn't work for some odd reason
the uuid thing I saw was a good idea, but the uuid that shows up is just 00000000-0000-0000-0000-000000000000
well kinda, there is a Set of UUIDs
try use this then
access to packetCOntainer from the packet and use getId
but that's a deprecated method, probably doesn't even work anymore
bah yeah its deprecated
try, may still works
if doesn't, idk, i usually don't use ProtocolLib cuz i don't use packets
eh, it just returns the id of the event id
oh
PacketType.Play.Server.CHAT returns 15 when you get the id
then its useless, sorry i can't help you
lmao, no worries mate, thanks for trying
good luck trying to find the solution
for (Box box1 : this.boxList) {
boolean inMaxLocationBounds = false;
boolean inMinLocationBounds = false;
if (x <= box1.getMaxLocation().getX() && z <= box1.getMaxLocation().getZ())
inMaxLocationBounds = true;
if (x >= box1.getMinLocation().getX() && z >= box1.getMinLocation().getZ())
inMinLocationBounds = true;
if (inMaxLocationBounds && inMinLocationBounds) {
box = box1;
break;
}
}
Does anyone see something wrong here? inMaxLocationBounds && inMinLocationBounds seems to never return true...
because the conditions are not met/
So its possible to get current spigot and bungee netty isntance?? Because i didnt find the getters
So... That would mean box1.getMaxLocation() and/or box1.getMinLocation() is wrong, as x and z are definitely correct
Hello ! it's possible with gradle to import multi version of spigot-api nms?
i use ```compileOnly 'org.spigotmc:spigot-api:1.18.2-R0.1-SNAPSHOT'
compileOnly 'org.spigotmc:spigot:1.18.2-R0.1-SNAPSHOT'
compileOnly 'org.spigotmc:spigot-api:1.17.1-R0.1-SNAPSHOT'
compileOnly 'org.spigotmc:spigot:1.17.1-R0.1-SNAPSHOT'```
im checking player move event to check when player enters a region
im doing a for loop in it
and checking bounding box
is that fine
or is it laggy
With a lot of players that could cause a fair bit of lag I imagine
What should I do?
how many regions do you estimate to have?
🤷♂️ sometimes there is no better option
Not sure
it's not my server
it's the server owner choice to have any amount of regions
what you could do is instead of registering the player movement event, take the areas and save two opposite corner locations, then in a loop once every 20 ticks check if theres a player within any of the two locations
nah im using boundingbox
im not a legacy freak :) (well i am sometimes depends on the customer)
?
That why its you should use World edit cuboid
Because worled edit cuboid its used for to keep server perfomance
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/util/BoundingBox.html what difference does it make how you create the box
declaration: package: org.bukkit.util, class: BoundingBox
its a different approach to know when a player enters a region
yes
No, regions set in config
when a player enters a plot and you get the "you entered X's plot"
yet again, what difference does that make
I need some help with that. I created a protection plugin based on block. So instead of having 2 corners i just have one location (the center location of the claim)
save regions in memory, and loop the corners, check if player is within those two numbers
thats what I do haha
I dont have to do math
BoundingBox abstracts it away for me
theres always two corners (asuming you have normal areas)
@EventHandler
public void onPlayerMove(PlayerMoveEvent event) {
if(event.getTo() == null) return;
if(event.getPlayer().getInventory().getArmorContents().length == 0 &&
ArmoredPVP.getArenaSet().stream().anyMatch(arena -> Arena.contains(arena, event.getTo()))) {
// entering a pvp arena while naked
event.getPlayer().sendMessage(ChatColor.DARK_RED + "You are not allowed to enter PVP Arenas " +
"when not wearing a single piece of armor, please wear armor.");
event.setCancelled(true);
}
}```
always starting with cheaper checks B)
No i just have 1 center location and then i caculate the 2 corners
yeah
Because the claim get protected using a radius
thats just the way of generating the corners
doesnt work guard have an api for that? to check when a player enters a region
it isnt a world guard region lol
its an arena?
ye
like a pvp zone or smth
He is doing an hcf claim system
no
But without using world guard or world edit
You are doing a cuboid location that the correct name
i dont ask questions
thats how you create a something that doesnt work lool
if you are so confident then why are you asking for improvements?
what are you expecting? choco to come here and help you with your 10$ plugin?
lmao
cuz we keep giving you ways of doing it and you reject them
cuz ur ways arent possible for my case
And why you are being mad with him?
If you dont have patient dont help its simply
lmao
You look like my teacher he argue when we have to correct homework but he is the one who sent them
You're not even that amazing lol
According to your github that is
Dont listen him
Whats with choco tho
omg bro fuck off
He just shiting you when he dont even have experience
What is this even about?
The man is being mad with 2Hex, when the man doesnt know how to code its amazing
Imo if you come and ask for help with a paid plugin idgaf the only stipulation is you either share the code you need help with or heck off
Well there is always a room for improvement, whether its paid or not
"paid" doesnt instantly remove your human rights of learning
Yes like I said. I don't care as long as you're willing to share the code. Some people think they can just ask a question without sharing the code and that's a facepalm
I shared the code sir
(what does "idgaf" mean ?)
code relevant to my question
Means: I don't give a fuck
(something that would get you fired if you work anywhere representable)
Oh lamo people its so mad these days
can i ask for smt or ya'll already answering sm1?
I only get mad if you have the audacity to ask for help with a paid plugin but you don't want to show the code you need help with
ask dw
end.setX(original.getX() + (end.getX() - original.getX()) * Math.cos(Math.toRadians(rotation)) - (end.getZ() - original.getZ()) * Math.sin(Math.toRadians(rotation)));
end.setZ(original.getZ() + (end.getZ() - original.getZ()) * Math.cos(Math.toRadians(rotation)) + (end.getX() - original.getX()) * Math.sin(Math.toRadians(rotation)));
end.setY(original.getY() + (end.getY() - original.getY()) * Math.cos(Math.toRadians(rotation)) - (end.getY() - original.getY()) * Math.sin(Math.toRadians(rotation)));
```I do believe this is wrong... however I don't really know how to do this (FYI: rotating a point around another point in 3D space)
that seems like pain
yes
I am willing to learn how to do it, don't need the code
I just wanna know if there's a formula for it and it's wikipedia page (I am not really good at finding this stuff)
I don't believe you can without a lot of reflection and NMS
But doesnt the spigot server have a getter for it?
?kick @sharp bough aggression
Done. That felt good.
No i dont want player handler i want to inject my custom channel
Oh thanks
why you kicking me lmao
what
Didnt you see the reasoN?
for what
what do you need it for
.
How do you set a custom name with Protocol Lib?
@grim ice not everything is a competition btw
I need it for doing a simple pub sub without using an extra prot
I do not know what pub sub means
3 messages 3 tags lmao
to who
and where
Why github copilot doesnt work on intellij
it does
I use it constantly
to players?
you need to be in the preview program
and link your github
How join to preview?
it might take a couple of days, up to months
I already have a access
I just dont know how to set up it on intellij
On vscode already works
hmmmmmmmmmmm
there's your prob
forget about github copilot
So its possible or not to inject a custom channel handler to spigot server?
how do i set the explosion size of a firework
why do you need that
To send and receive custom packets between spgiot servers
And without needing a player or extra port
I have heard that you can get the netty instance and register custom channels
And its possible, but i dont know why the spigot doesnt have the netty getter
because internal api bad
Its so extrange that
Because im connecting a socket to a spigot server. I send the client handshake and login packet. The fake client get connected to server. But my issue is that after some seconds it get disconnected
I was told im not asnwering a packet that come from server
you need to keep sending keep alives
and receiving keep alives
yes
Do you have the values?
Because the wiki just said for example a number but a number can be any
Do i explain?
so
whenever a server sends a keep alive
you get a clientbound keep alive packet
you have to just send it back
Oh wait i can send code?
how are you handling packets rn
Yeahj that what im going to send
yeah do that
?
uh i forgot
im looking at fireworkmeta
do you want bigger particles?
i don't see anything about explosion size
well no
more explosion damage range
you know how you can add a fire charge to a firework star
like bigger AOE damage
that's what im trying to do
nevermind i found it
https://paste.md-5.net/xalehunoxo.java - That my code voodo
.addEffect(FireworkEffect.builder().with(FireworkEffect.Type.BALL_LARGE).build());
you need to keep reading as well
so once you established an outputstream
also get an input stream
and wait for packets
(usually its an int with packet id first)
get the input stream from the socket
Yeah im done
and wait until a new int
And them i do
while (true)?
yeah in a new thread ofc
How?
and do in.read()
I never managed threads
No i never fixed
No no sorry i get confused ithought you were talking about the protocol
so just do:
new Thread(() -> {
while (true) {
Integer integer = input.read();
}
});
That what you mean?
yes
but
don't use Integer
use int
and between }) and ; add .start()
should work
I tried and didnt receive anything
Is it because im not parsing the int from protocol format?
kk
https://paste.md-5.net/oyimizucot.java
This mob doesn't want to follow me in game. I'm using a repeating task to set the target. Is this the correct method of doing it or should I adjust the yaw and pitch and move it on player move?
Yea, that came to my mind too because it is not a hostile mob right?
ah
How would I go about doing it then? The second way I stated, because I haven't found a pathfindergoal to follow the player
Let's try that
uuid
okay thanks
np
wait the UUID will always be the same after a server restart right?
alright
You’ll have to dig through nms, but the way I did this was by getting the nms entity and using a method to make it walk to the player’s point when it was outside of a certain range of the player
does it work btw
what method makes the entity move? 😳
No...
Because teleporting wouldn't look natural, I want the walking animation
is it bad to use the same EventHandler in two different classes? or should I try to only use it once in one class for an entire plugin and call my different classes from there..
making only one class with all your eventhandlers is usually a bad idea
NavigationAbstract#a
you can get it through EntityInsentient#getNavigation
or if that's obfuscated, look for the method that returns NavigationAbstract
If you're using Paper however
there's a getPathfinder() method on newer versions
public static void makeEntityWalkTo(LivingEntity entity, Location target) {
((Mob) entity).getPathfinder().moveTo(target); // Paper
((EntityInsentient) ((CraftEntity) entity).getHandle()).D().a(target.getX(), target.getY(), target.getZ(), 1.0D); // NMS 1.18.1
}
I have different classes for different event handlers. Im saying is it okay to have an event such as PlayerInteractAtEntityEvent being used in more than 1 class in my code. or should i keep it to 1 class an call the other classes where I want it from there
If you teleport in small increments the walking animation still happens. But yes, navigating would be the correct way to achieve what you want
@rough drift its sending random numbers to console
Anyone know how top stop my fake client being disconnected from spigot server?
Depends
People told me that im not answering a packet
but i odnt know which packet im not asnwring
To connect fake client im sending handshake and login packet
UUID of player FakeClient is 9ea4ad3a-e505-324a-8eec-a6d5be9da656
[19:18:49 INFO]: FakeClient[/127.0.0.1:50433] logged in with entity id 189 at ([world]237.5, 67.0, 259.5)
[19:19:15 INFO]: FakeClient lost connection: Disconnected
[19:19:15 INFO]: FakeClient left the game.
That what console said
That wiki its shit lmao, it say a number but a number can be any of them
Oh
Each type of packet has an ID
Im reading socket input and send random numbers
Alex do you have experience with protocol?
Yes
And before I had source access I pretty much exclusively used wiki.vg to do multi-version support
I will send full code on paste md4
I don’t remember, it was several versions ago. It was a method labeled “a” if I remember correctly
Because if not it mess to ask for help
Make your own path finder goal
does anyone know the current best way to have a piece of armor confer an effect (eg like speed boost) when equipped?
I would really have to look into that, because I have never done that before
I'm using the mojang remappings...
Listen to InventoryClickEvent, death, etc for when the armor gets put on or taken off
That’s the best way to do it
I'll look into it, thanks
https://paste.md-5.net/higohoyito.java - That my full code
Teleporting an entity small distances is the same as it moving
Lemme try that first
It’ll even play the walk animation
What client version
You’ll also want to check for things like obstructions and whatnot
All of which is why pathfinder goals are better
alright, Ima look into that now
1.18
But the player direction is just Entity#getLocation#subtract(Player#getLocation)#normalize
It might, it might not
You’ll have to compare the 1.8 protocol to the 1.18 protocol to see if it’s different
The protocol has changed significantly over the years
Why are you using 1.8 at all if you want it to be 1.18
Just for testing
And because my laptop its not so powerfull
Im currently not at home
And i dont have my pc
You mean to 758?
yeah
I read that the random numbers i received i have to sent them back to server
They aren’t random numbers
You’re getting back packets
You have to process those packets and respond with your own
Oh allright
Go to the link I sent you
Ok
That’s the login procedure
I already have handshake and login packet
Lol
There’s 34
all that>?
Yes
But i dont need a functional client
That’s not a functional client
That’s just the login
All of that is just to log in
Well it will eventually if you don’t do the keep-alive
this is what you need for a functional client
Yeah
But you haven’t gotten there yet
The randoms numbers come from server
Also that wont stop you getting kicked for flying or anything
So i have to send that random numbers back to server?
i already do login 🤔
You have to do all 34
I got a solution! I gotta inject a random UUID into the packet using the packet.getUUIDs().write() and just check if we sent that uuid before
what was he doing=
check the messages
.
trying to ignore a packet I sent out after processing an incoming packet
Oh ok
Im receiving this random number
What’s the packet ID?
You’re not receiving random numbers
9783
-6720885865635674370
-2872182536071555489
-1515049538550797621
7943598964305392838
3717606306607967019
-1029057608648320701
-4251591123670143769
-7123551701480720475
2590281037082944399
-254437462174330985
-6975290412891477074
-8225930841019027112
386851663906764627
9054916108658622950
-1492152040813417339
5677764234305073562
-4740355608672339880
571169791944419014
-2766222604636435847
-6091975346377233351
3993771747546666686
-3182435462612713593
7810331203703269278
-734298120557228083
-8165026422402125325
-3478688765184661833
-2551898662575015226
-594099067337672740
-5694892160023462700
-5675039433514904482
2823191252383239350
4627864840581915399
9126452892468965909
-253964690211398929
-3178846671983704593
-7702936916218357857
-940939251298788978
-7533897710054311220
2857064993874845871
-7068562884860056475
-8092422504159056566
-5574572059812073218
-1731350453854962325
-6759983271497187499
8681846510485286232
4309746907462484746
-8084788878993680434
3270116568233125363
-5490799802015113273
5827586868297197975
-866100016527914502
-913848820164300889
1969163620840017869
-4590719930314583578
7428593161257066391
-1514659195407709242
-7980493738159129367
-898328948557230163
-2312891804950928979
4971854126967401182
-2712048242715308095
-5551926267243193377
-993529155018585329
-5280753911065266625
8033359881023711103
5467358908350667339
-6991775548809195745
-28509492255031811
-1733476918860470373
-2595561278150521627
-1322050243390674589
-5267612018938054757
8028773268176928750
8499333407467302860
And still sending and sending
Are u sure that are packets?
I dont think
Anything the server sends is a packet
If it’s a keep alive packet it will have a random number in the packet body
But the server isn’t just sending you numbers
I don’t think you understand how this works
Every type of packet has an ID
Every packet is comprised of this structure:
0x0F its a format or what?
VarInt Length (which is the length of ID+Data)
VarInt ID
ByteArray Data
The ID tells you what kind of packet it is and how to decode the data
Ajam?
What?
So how i get the packet id?
It’s the VarInt after Length
Im just doing: socket.getOutputStream().read()
Yeah that’s not gonna work
Ah allright
How i read a var int?
Now i understand why the random numbers came from
Because im not reading in the correct format
keep alive key isnt random :(, its like System.currentTimeMillis or w/e
It’s documented as a random number
It may be System.currentTimeMillis() in the current implementation but it isn’t guaranteed to be I imagine
its been a time-based key for a pretty long time iirc
i can only vouch for as far back as 1.8 since thats where most of my work in mc was but its probably been that way since 1.6 or 1.7 or earlier
I’d have to check to verify if that’s the case, all I know is what it’s documented as
and ive seen the source 😎
also where is your documentation from? checking something like wiki.vg also says its based on time @ alex
What?
“The server will frequently send out a keep-alive, each containing a random ID. The client must respond with the same payload (see serverbound Keep Alive). If the client does not respond to them for over 30 seconds, the server kicks the client. Vice versa, if the server does not send any keep-alives for 20 seconds, the client will disconnect and yields a "Timed out" exception.
The Notchian server uses a system-dependent time in milliseconds to generate the keep alive ID value.” @buoyant viper
The notchian server uses system time you are correct
But it’s not guaranteed to be that, it’s just an arbitrary value
I dont know how read the packets i receive
That what happens
I felel so idiot lmao
Each packet needs to be decoded
The ID tells you what packet it is
I know but how in code?
The way Mojang does it, each packet is it’s own class
I just have my data input stream from the fake client socket
You use the ID to know which class it is, then decode the data byte array
the id its a byte
The structure of that packet is a 20 character string, a VarInt, a byte array, a VarInt, and a bytearray
So to read that packet you’d read those data types from the stream
This is what getting on console
3
3
256
50
0
2
36
57
101
97
52
97
100
51
97
45
101
53
48
53
45
51
50
52
97
45
56
101
101
99
45
97
54
100
53
98
101
57
100
97
54
53
54
10
70
97
107
101
67
108
105
101
110
116
19
0
1
0
0
1
103
0
All of them are packets?
No
So?
I dont understand without examples
then a byte array which is the packet data
Then another packet length
Then another packet ID
Then another packet byte array
Think of each packet as a box of stuff
Each packet has 3 things in it
It has a length, an ID, and data
And it sends those things in the stream one by one
It doesn’t just send a bunch of IDs
Oh that why the first system out its a number 3?
That number 3 means the leght?
Can u please send a code sample
Because im so idiot that i cannot understand
I don’t have a code sample I’m on my phone
I don’t think you understand networking in general enough to do this
To be honest with you
wiki.vg is some of the best documentation I’ve seen, if you can’t figure it out with that then I’m not really going to be able to help you
It’s not even about the byte buffers
You can’t grasp the concept of a packet
Yes
It’s not just a number
You can’t just read once from the stream and get the whole packet
allright so i first read my input stream?
You have to read from the input stream a lot
Wiki.vg tells you what all the packets are and what the structures of those packets are
All you have to do is implement that
Ok
Then i will ask u for help if you ant help
And thanks for trying to help
really thanks if was another already it ignore me
Hello i need someone who know polish and can translate some plugin. write me on pv if you want to help
how can I tell if a player is sneaking in the PlayerInteractEntityEvent
By reading the docs
so i took a item and changed its texture with setCustomModelData to make a custom item but that item can still be used in the cake recipe but i dont want it to how could i remove it from that recipe but still be able to make custom recipes later on with the custom item?
You might be able to check for that item in the grid in the PrepareCraftItemEvent and cancel the event
Its 1.12.2
why does Inventory Framework add this
PublicBukkitValues:
backpacks:if-uuid: '[B;-97B,-50B,-21B,-111B,-114B,10B,73B,-75B,-99B,-55B,41B,-36B,57B,-20B,-128B,110B]'
when closing an inv and saving it, current code: http://pastie.org/p/3vqLOybvgLMlwi0kH0qwH1
okay, but still think the issue is the bad material.. the SKULL is for blocks
1.12.2 still use the method for bytes? if so.. maybe you can check this https://www.spigotmc.org/threads/tutorial-get-player-heads-without-lag.396186/
i dont remember many things for old versions
to the item?
yea its an NBT tag
yeah the PDC..
the main problem is, when you add that it stops stacking with other items of the same material
yeah because are not the same nbt for stack.. what is that framework?
is that like an obvious thing im missing?
its inventory framework, https://github.com/stefvanschie/IF/wiki/GUI
hey am looking for something but am not sure if its even possible am confused
is it possible to access a class of a plugin on a different server if both servers are connected via bungee ?
like to get main instance
idk if am dumb or thats possible or if its even useful
@sharp bough
ok in code show the framework add a PDC for a GuiItem for know where is placed...
https://github.com/stefvanschie/IF/blob/ab366c159709a420ec1b21f9747c3b28000ea17f/IF/src/main/java/com/github/stefvanschie/inventoryframework/gui/GuiItem.java#L31
if the player take the item maybe you can try read all the PDC and delete all the customs PDC for allow stack
do you know if the pane.addItem(new GuiItem(item)) requires the NBT tag to be there?
what i was thinking is once its done loading the gui, take each item and remove the nbt tag
How can I get the server the player is on with waterfall api?
hmm not sure in the source when you create a GuiItem run and applyUUID where the nbt is change...
only a comment with //remove this call after the removal of InventoryComponent#setItem(ItemStack, int, int)
just casually comment line 147?
yeah you can make this.. not sure the effect for make this.. if the UUID is used in another place
but file is read only and the solution for this is to have access to the file for example: https://stackoverflow.com/questions/44265670/how-to-change-read-only-status-of-files-in-intellij#:~:text=To toggle read-only attribute of a file%2C open file in the editor%2C or select it in the Project tool window. Do one of the following%3A
if i make a custom event, fire it, does it pass to other plugins or?
yes
woo
so i just have to remake the event class for all the plugins?
no
they have to use ur plugin as a dependency
oh..
how do i do that?
Maven/gradle, plugin.yml
Looking for something to detect if a player/entity is being rained on or not.
I thought I had something good for a while, but just realized that glass lets the full sunlight value through so my code will think you're wet when standing under glass.
You could get the highest block at the player's location and check to see if they are above it.
So build a scanner that starts at buildheight and works until it hits something?
No, there is a built in method. World#getHighestBlockYAt().
Oh wow. Didn't know that was there. Thanks!
Oh, whoops. You'd actually want to use getHighestBlockAt instead of getHighestBlockYAt. One returns a block and the other returns an integer. (The highest Y coordinate)
I appear to have misread what you typed initially and used that one by accident anyways 😆
Works like a charm now 👍
How do I fix this?
Paper or Spigot server?
That's a paper server. The stacktrace exposes that.
Can you share your code? Line 81 of Main.
Nevermind :D
.setOwner to set the skull doesn't work in 1.18 so like
what do I do
works fine for me
I know it can be done, but could somebody point me in the right direction to display a scoreboard only for specific players, not tied to a team color?
Hello, I have a java program that allows admins to connect by password, how do I protect it so nobody can edit the code and remove that validation?
Then every program in the world can simply be edited and everyone can be identified as admins?!
Believe it or not
If it was that simple... the world would be collapsed at this point
Not every program is written in java
But many are
And reversing exists in all languages
It’s much more difficult in C
But yes, with enough effort you could remove the authentication from anything
you can claim to be an admin all you want, but youll have to be able to prove that to the host server
if the program is only client side, then yes, everyone can technically be an admin
I'm trying to teleport my armor stand (with a shulker as a passenger) but it's not really working out. What would the easiest way be?
I've tried something like
en.teleport(new Location(en.getWorld(), en.getLocation().getBlockX(), en.getLocation().getBlockY() + 3, en.getLocation().getBlockZ()));
but doesn't work
You can't teleport entities with passengers
Nms limits it
Try it and see
Probably not
Dismount, teleport and remount each individual passenger
If you reallllly want to be that person and assuming of course that you're willing to put in the effort you can store most of the valuable classes/updates on a server and reflect them in on runtime. Sadly java is quite difficult to prevent piracy which is why Mojang gave up on it.
Oh yeah you can edit bytecode at runtime with bytebuddy or whatever
You can reflect in sensitive classes and what not from a remote server
But someone is going to reverse engineer it eventually so 🤷♂️. Imo just do what Alex does and require legit owners to prove the ybought it before giving support. You can't prevent piracy but you can prevent helping those who steal
Terrible idea though
Yeah but I've inspected a bunch of premium java libraries and they do it. They ask for 150 a month too
There are tools to dump classes from memory
when i try to register
Ouch
idk i think theres a bug with loading resource packs
How so?
ive asked about it here several times
might be able to find one of those messages
I highly doubt you've found a bug with Mojangs stuff that hasn't already been reported
.
i might be able to at least get help with my issue
That's not what the Mojang issue tracker is for
Who cares? It'll get answered.
Maybe lol
So what's the issue? Could you explain again or link the message with it
here
i think it might have something to do with the encoding, but i remember reading on the bug tracker that all json files are read as utf8
and im writing it in utf8
Message could not be loaded ;/
Thanks discord mobile
bruh
Could you copy paste it
not with the images
one sec
why doesnt this show the texture?
the file on the right (generated by the code) is located at assets/minecraft/models/item/redstone.json, the custom model file is located at assets/example/models/item/ruby.json and the texture for the ruby is at assets/example/textures/items/ruby.png
there
the order sucks
yes
colors are fucked up
here is the full resource pack
i use filebin to host it automatically
Blocked on the network. Will try later when I get home
ok thanks
yes
Alright
you will need the test mod too
both plugins
just put them in the plugins folder
I'm confused why not add the item to the mod?
the mod adds the item
the base plugin does all the heavy work
like building the resource pack
behaviour
item states
saving shit
loading shit
etc
its not loading the model
the resource pack is fine
everything is there
it just doesnt load it
Send the github I'll fix it
but theres nothing wrong
Somethings deffinetly wrong since it doesn't work
i can try a different encoding
yes but it should
Wait this is a mod that doesn't require mods?
It's not a mod
It's a plugin that emulates mods
Oh jeez
I'm magic
how tho
I made it myself
That's not the problem
but the generated one doesnt
Yeah I've got to rewrite some code. Gimme a bit
Ugh gradle.
Love the gradle error messages
did u clone the repo
Yeah
because it has the gradle settings that should work
oh
use java 17
for gradle
yeah
lmfao
forgot to remove the json tests
were for my own attempt at making a json engine
I don't feel like compiling everything I should be able to replicate the issue by making a unit test no?
idk maybe
not really
you have to compile it and load it on the server together with the test mod
the resource pack will be at server/carbon/resource_pack/src
wait until the number is 0x21 you can compare it like readNumber == 0x21 and then send that packet back as packet ID 0x0F with the same data you received
Have you tried just building it within the MC dir instead of it's own?
So the structure looks like this?
{
"parent" : "minecraft:item/generated",
"textures" : {
"layer0" : "example/ruby"
}
}
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "minecraft:item/redstone"
},
"overrides": [
{
"predicate": {
"custom_model_data": 1
},
"model": "example/ruby"
}
]
}
how can I tell if a player is sneaking in the PlayerInteractEntityEvent
I'm not having the issue here lol
player.isCrouching() iirc
yeah was asking them
but idk if they are online
kinda wouldnt work because i need to copy the assets directly from the mod jar
and in the guide im following they use different namespaces too
how do you apply your texture
ohhhhh my godddd, I tried that earlier... It was isSneaking() 😦 I was looking for it for so long and just gave up. Thank you tho it helped me find the right one
?
np
player.setResourcePack(downloadURL, byteHash)
?paste
use dat
for what
put your listener class there
?Command
might make more sense
but i know it is applied
Idk I feel like if you just built the resource pack the better way it'd work
i have it
i tried it by moving files still didnt work
and changing the text
Got an example of it where you built it where it's setup the way I described?