#help-development
1 messages Β· Page 1060 of 1
there is no fucking way that that isn't handled client side
but ganerule is server side
it is
but for some reason
this command can handle
this
Well mods can overcome almost everything
otherwise it doesn't know where to put the chunks
lol
then if there's a gamerule use it
mhm
something like this? ```kotlin
class Husk(world: World) : EntityZombieHusk(EntityTypes.HUSK, (world as CraftWorld).handle) {
fun spawn(loc: Location) {
this.setPositionRotation(loc.x, loc.y, loc.z, loc.yaw, loc.pitch)
this.bukkitEntity.persistentDataContainer.set(NamespacedKey(MobWars.instance, "custom"), PersistentDataType.BYTE, 1.toByte())
world.addEntity(this, CreatureSpawnEvent.SpawnReason.CUSTOM)
}
or its probably just all relative
yeah
is it possible to store Player objects in mutablelist?
yes
Don;t store Player objects unless you have no other way to do it.
i have some classes that use player as field but the underlying structure is held in a map via uuid that are then cleaned on quit / leave
my boy using kotlin π
!
Ideally use the Player's UUID
If you do have a leak the scope gets minimized
custom player objects π
allows for more leaks in case of a leak
(i store way too much shit in there)
This reminds me of when I did not clean up my buttons in my mod after removing some objects that were inside of those buttons causing mc to go crazy lmao
Idk why I forcefully removed objects tho, some dumbass shit
just use extension properties and functions atp
p much yeah
Wait a minute, how did I even do that
fun Player.sendPacket(packet: BedrockPacket) my beloved
oh finally a packet to give a player some bedrock
!
new job put me doing 2 very different things at once:
- Java -> kotlin
- Java Edition? Nah we doing bedrock boy
hehe
Yeah kotlin extension functions or whatever they called are handy as fuck
fr tho
reified my beloved β€οΈ
tf is reified
basically every call to the method results in the method being copied to the caller class
Meaning you can do shit like
is it possible to use just nicknames with the method getplayerexact?
val components = entity.getComponentsOfType<MyComponent>()
Not reliable
what nick names
those are not a thing in vanilla π€
I think they mean usernames
Any reason for living in fear of Player UUID's
yea uuids >>>
brb making a pizza before my dough turns sour
I remember I once wrote a plugin for a friend and it had some websocket stuff, for auths and sessions I used UUIDs kek
Are you italian
i thought he was portuguese
I am portuguese but have some italian influence in my life
understandable
I was given an italy gold chain when I was like 1 years old that I still wear to this day
wow
wtf
why this happens?
cuz you initialize it again somehwer else?
Store players in barrels if your basement is full
i see the allargsarguments after
i forget final
thx
Guy was arrested 4 times and now runs a pizza shop
are you talking about your family
Yes
I knew it
the greasemaster is in the pizza business
also explains why you dodge taxes
Just took one out of the oven right now
put pineapple on it and become a target for your own family
does anyone here know a bit of blender?
a bit
Does having fucked up a good working rig count as knowing a bit
I indeed do know a bit, a bit about how to fuck up stuff
Looks like a sphere to me
decimate
like if I have a detailed shape like on the left
I want to get the rougher one to the right
imagine giving the answer but people don't know enough blender to know that it is the answer
use a modifier to decimate it
I've just downloaded it
there's a bunch of different methods for it
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
class Husk(
world: World, val plr: Player,
) : EntityZombieHusk(EntityTypes.HUSK, (world as CraftWorld).handle) {
fun spawn(loc: Location) {
this.setPositionRotation(loc.x, loc.y, loc.z, loc.yaw, loc.pitch)
this.goalTarget = (plr as CraftPlayer).handle
this.bukkitEntity.persistentDataContainer.set(NamespacedKey(MobWars.instance, "custom"), PersistentDataType.BYTE, 1.toByte())
world.addEntity(this, CreatureSpawnEvent.SpawnReason.CUSTOM)
}
public override fun initPathfinder() {
goalSelector.a(0, DefaultPathfinderGoal(this, 1.0, plr.location.distance(bukkitEntity.location).toFloat()))
}
} val husk = Husk((map as CraftWorld).handle, p)
husk.spawn(positions.blueMobSpawn)
````still won't spawn)
Is that π€’ Kotlin?
What exactly is making you sick?
well, if you read their message, it's quite obvious it's kotlin
Why do you hate kotlin?
i think people would appreciate that when you're using kotlin, people wouldn't start talking shit about it instead of just helping
so can someone help me with the problem itself? I'm not asking about the Kotlin language, but about the api
Pretty sure that isn't the api, but rather nms
but I can't add pathfindergoals to entities if I just use world.spawnEntity
phpmyadmin
xampp
mysql
bro is using the 2005 stack
I mean mysql isnt too bad right?
emm not really an answer
if so whats the 2024 stack?
I think there are like a billion
who can help me to write an algorithm to check whether it is possible to add items to the inventory in the range of slots 28-34? the list of items has different amounts, so you need to check it with getMaxStackSize().
name me one then
idk im not a stack person
Are you expecting spoonfeeding or what
you should be asking rad since he seems to know more about this stuff
my maxStackSize is 1
do you know?
try root password, maybe the permissions arent set up correctly or smth
what
whats a better stack to use
really depends on what you're making
I just need a sql database
maybe the location is wrong?
then why do you have php
i mean you are free to use mysql and that stack, i just pointed out that that stack is pretty old
its the control panel idk
I mean I just use it fro testing
regarding the password you set up
password in mysql config and xampp's are the same
but its broken
How do I fix
Source option 5 is no longer supported. Use 8 or later.
Language level is invalid or missing in pom.xml. Current project JDK is null.
am I allowed to post my question again if it's been like 12 hours?
lol yes
ok sweet
yeah you;re good, most people repost after 2 mins xD
I'm working on a plugin that has particle wings. I'm trying to keep the rotation relevant to the player's -body- not the head. I've tried some math and vectors and rotations, I even tried packets. the body rotation is not handled by the server. The idea is to start rotating the wings when the body begins to rotate which it does after the head rotates a certain amount. I've been trying the math to figure out that angle. I tried with movement listener, packets, vectors, and math but I can't quite get it
The players body facing (yaw) is on teh Player.getLocation().
yaw refers to the direction a player is looking in
you cannot get the body's yaw though location
yes you can
ugh, please go check your facts
ok you do you and don;t listen
are you kidding me right now?
look, let me explain
the body and head have their own rotation, right?
Yaw of head and Yaw of Body are two different Locations and yaw
we're wasting so much time arguing
Player#getEyeLocation() has a yaw which is of the HEAD
and player.getLocation also has yaw of the head
no

says the unverified
I mean, elgar sadly is not correct
here is some things you should note of who you been conversing with. ElgarL has helped maintain or worked on towny, and is the author/maintainer of Group manager and some other plugins
well thats new to me.
but, that said lynx is correct here before I could say anything XD
at least we all learned things today 
is there a way to disable the anti cheat for paper?
Then I apologize. I was absolutely certain body kept its own Yaw
π
honestly, I am so disappointed in all this
I just printed the position through the logger and teleported there, I can also spawn husk manually through the summoning egg
it does but for client only most likely
In which case, what you want is impossible as it's client side
hmm, let me look more closely then
they could go with a mod on the client that can converse with a plugin via plugin message channels
they could, If they use mods
it sounds like its just client extrapolation, like walking
however, the body rotation though I don't think is shown to other players
I think that is just a view only you can see
what about world, is it the same?
?whereami
this is the third time i've used this today
yes
wth is going on
Welllll
?stash
for me
how could I set e.g. a player with nick "Test" a value 3 on the dummy scoreboard called IDs?
is there a way to disable it on spigot?
let me quickly grab my paper salesman outfit
Spigot has no anti cheats
oh fr?
Only anti spam and anti flight that is a vanilla thing
that's good
it seems that since 1.14 no need to register entities?
if you are on paper, there is https://jd.papermc.io/paper/1.21/org/bukkit/entity/LivingEntity.html#getBodyYaw().
but yea, beyond that, reflection time
You should ask on the Paper discord if you use that
in previous versions you had to register your custom class before adding entities
and enough paper selling
hmmm, well if its very granular in what the client reports, I suppose its time for someone to make a pr
if the server has body yaw then you should be able to get it via nms as well
Yea you can
I have a worldguard region, but it shouldn't block spawn since I can still spawn manually
should is the keyword till you hit something private >>
So its just an API issue? Probably be breaking to fix it
I tried messing with nms but I'm still a beginner with that
Well, you can't just update the yaw on the locations no
which is why paper has it as its own method
which is kinda ugly
it would be easy to just add an api method without changing how location api works
but yea, would break too much otherwise
weren't eyeLocation and location using different yaws or am I tripping?
I thought so too, but it seems I'm wrong
So what could be the problem?
I dunno, the code looks okay to me
they were saying it wouldn't be an issue to use reflection
idk seems like that, since its implementation, it was just a location + eye height
Try spawing a non modified nms husk @sterile flicker
mandela effect I guess
what do you mean by non modified
As in a husk from nms without you extending it
spawning via a player action is not the same as spawning from a plugin or world code. WorldGuard does block entity spawning in non-default regions by default, however if you tried to test this using an egg, keep in mind if you are are opped, you have all permissions. But this isn't how it works from a plugin lol.
try addFreshEntity
I think addfresh is md mapping
nope
He has addentity spawn reason
I had one more idea for the body yaw. It updates and aligns when the player punches. Is it possible to send that packet without the player actually moving or hurting something?
I don't see such a method in 1.16.5
Send packet animation aligns it
yikes 1.16.5
If you don't send it to the player in question is fine
so region.setFlag(Flags.MOB_SPAWNING, StateFlag.State.ALLOW)?
Have you tried calling spawn manually outside of initPathfinder?
It could be that it gets called when you add it to the world
difficulty peaceful?
For a second, then i saw there is the spawn method above
Yeah but it can be that initPathfinder only gets called when you call addEntity on the world
And addEntity only gets called when you spawn
which gets called on initPathfinder
which means it never gets called
I need help with pathfinding, I want to have a wither skeleton mob where there will be 4 skeletons following him and whenever they see a player they all start attacking him
I tried
this.targetSelector.addGoal(1, (new HurtByTargetGoal(this, new Class[] {magmaMinions.class, magmaCaptain.class})).setAlertOthers(new Class[0]));
this.targetSelector.addGoal(2, new NearestAttackableTargetGoal(this, Chicken.class, true));
this.goalSelector.addGoal(3, new FollowMobGoal(this, 1, 3f, 10f));
But they just follow the leader until the leader dies and then they attack me
You might want a custom goal
how do I make a custom goal
extend the goal class and do stuff
Either that or use the same goal selector for everything
how could I set e.g. a player with nick "Test" a value 3 on the dummy scoreboard called IDs?
without calling a command on console with "scoreboard players set Test IDs 3"
?jd
How do I automaticaly export the jar to my server plugins's folder?
Change the ouput path
yes but how
Go to maven tab then package then edit configuration
Project structure should have the option
no I dont find it
I thought he meant project specific, but yes go to your maven options if you want every other project to also follow that path by default
Yeah
how do I set the output in the pom.xml
I'm not sure if you can?
yes I've done it long time ago
Alex has a guide for that
Idk I don't see any information (at least in my pom) that relates to compiler pathing
I don't remember the command
So you might have to add your own stuffs I dont actually know, emily if you can grab that guide...
you'd be the best
If youβre using maven for your Spigot plugins (which you should do), itβs easy to make maven automatically save your pluginβs .jar in your plugins folder. Thereβs two ways of doing this: 1. The lazy way (not recommended) If you only work alone on one computer, you can just directly declare the output location in...
thx
or look into sym link
you can basically link the jar location onto your server and act as if it exists in 2 places
You can just modify it in the maven settings
I think its better than adding it to each project
^ this is the best option considering you might not want to add this configuration to every single pom for every single project
I mean yeah thats true
No reason to manually add a compiler path to your project if it's only every supposed to compile to one place
Just define that in the proj structure or like we've said maven settings
this doesn't work that well in regards to plugins being developed. The moment the jar is modified the symlink is lost. Instead it would be better to make a central location where you can symlink the plugins directory instead.
^^
even on windows?
i think it worked well for me
For me it works
yup
and since i have multiple server versions, many folders, i symlink packetevents
and it works perfectly on all of them
reloads work well
yes
thereβs two options in the synlink thing
one is file path
and one is something else
but ik what i do works
what is this error ? Caused by: java.lang.UnsupportedOperationException: Not supported yet.
any more context?
there is two types of symlinking. Hard linking and soft linking
i haven't tested but the link is basically a shortcut only more real to apps
Im making an anvil GUI
ok
to the errkr
A full stack trace would be nice
hard linking, is where what happens to the file from the other directory it is linked, applies to the original file
as long as i don't delete the file the link is there even if i delete the og and recreate it
soft linking is where it won't alter the original file
however for either, if the original file is altered the linking is removed and needs to be re-applied
it works
for me
it doesnβt need to be reapplied
iβve done it for a year probably
and still do
public void openAnvil(Player player) {
Inventory anvil = Bukkit.createInventory(player, InventoryType.ANVIL);
player.openInventory(anvil);
}
}
why is This not working
like it opens the gui but I can rename items etc
As far as I can tell you never populate this inventory with any items
Oh it's an anvil
What exactly is not working?
I cant rename items apply enchanting books etc
I can only put item in the anvil but the reset themselves automaticaly
Do you get any errors in console when putting items in / trying to rename or enchant or wtv
oh I know
when I open the gui its only says Repairing but with the normal one it says Repair & Name
That sounds quite odd
how do I make it Repair & Name?
class Husk(world: WorldServer?, private val plr: Player) : EntityZombieHusk(EntityTypes.HUSK, world) {
fun spawn(loc: Location) {
this.setPositionRotation(loc.x, loc.y, loc.z, loc.yaw, loc.pitch)
this.goalTarget = (plr as CraftPlayer).handle
bukkitEntity.persistentDataContainer.set<Byte, Byte>(
NamespacedKey(MobWars.instance, "custom"),
PersistentDataType.BYTE,
1.toByte()
)
(world as WorldServer).addEntity(this, CreatureSpawnEvent.SpawnReason.CUSTOM)
}
override fun initPathfinder() {
goalSelector.a(
0, DefaultPathfinderGoal(
this, 1.0, plr.location.distance(
bukkitEntity.location
).toFloat()
)
)
}
}val husk = Husk((map as CraftWorld).handle, p)
husk.spawn(positions.blueMobSpawn)``` Cannot invoke "org.bukkit.entity.Player.getLocation()" because "this.plr" is null
[22:23:00 WARN]: java.lang.NullPointerException: Cannot invoke "org.bukkit.entity.Player.getLocation()" because "this.plr" is null
[22:23:00 WARN]: at com.sumeru.mobwars.entities.Husk.initPathfinder(Husk.kt:29) why?
I am sure that p is not null until the moment when I passed it as an argument to the husk class
should I use AnvilInventory instead?
From what I just researched, it's not supported in 1.21 apparently for anvil operations through a non placed anvil ig?
Hey i try to catch when a player rightclicks a armorstand but i dont get any output in the console:
@EventHandler
public void InertactEntity(PlayerInteractEntityEvent event) {
System.out.println(event.getRightClicked().getType());
if (event.getRightClicked().getType() == EntityType.ARMOR_STAND) {
ArmorStand entity = (ArmorStand) event.getRightClicked();
String Name = entity.getName();
System.out.println(Name);```
You registered your listener in main class yes?
yaa i have a other event in this class with PlayerInteractEvent and that works
And it doesn't even print the first sout?
nope
lets see the other playerInteract method
@EventHandler
public void RightClickEvent(PlayerInteractEvent event){
Block block = event.getClickedBlock();
if(block!=null) {
ItemStack itemInHand = event.getPlayer().getInventory().getItemInMainHand();
switch (itemInHand.getType()) {
case SHEARS -> {
switch (block.getType()) {
case LARGE_FERN -> {
Bisected bisected = (Bisected) block.getBlockData();
if (bisected.getHalf() == Bisected.Half.BOTTOM) {
block.setType(Material.FERN);
ItemStack weed = new ItemStack(Material.FERN);
ItemMeta weedmeta = weed.getItemMeta();
if (weedmeta != null) {
weedmeta.setDisplayName("Cannabis");
weed.setItemMeta(weedmeta);
block.getWorld().dropItem(block.getLocation(), weed);
RegenerateFarm(block);
event.getPlayer().playSound(block.getLocation(), Sound.ENTITY_SHEEP_SHEAR, 1, 1);
}
} else event.setCancelled(true);
}
}
}
default -> {
switch (block.getType()) {
case PLAYER_WALL_HEAD -> {
String headid = Main.headapi.getBlockID(block);
System.out.println(headid);
switch (headid) {
case "4570": {
block.getWorld().dropItem(block.getLocation(), new ItemStack(Material.APPLE));
RegenerateFarm(block);
Main.headapi.setBlockSkin(block, "445");
}
}
}
}
}
}
}
}```
I'm really not sure on this one to be fair if one of them is working, but this one isn't I can only assume it's not registered or something... The first print should at least output something...
ya like i have registerd it in the main and i have a EventHandler
Idk try a simpler print statement ig? Like just a basic "" output
See if it will actually output something
Why'd you println "" when you can just not pass any args
Well put something inside
I just don't understand how the first print isn't outputting anything
But at least to verify the listener is being called, then "something" will hopefully verify that
could it be that a plugin that i use for costumatiation armorstands catches that event somehow ?
Btw why is the method name not in camelCase
Anytime the event is called if a plugin is listening to that event then something will probably happen
wellllllll...
i removed the plugin but still nothing
try this maybe?
i tryed System.out.println("s"); now but still nothing
and i changed something in the other event and that worked
Alright then I guess just separate the events to a class per listener
even if they are the same
well i kinda did since the other event in the same class worked π
most random question but, what is the maximum amount of packet that can be processed in one tick?
if that makes any sense
but like yk
It depends on like server performance and the connections of the client -> server
lets say 0ms ping
Still not a fixed number bud
how many packets can a vanilla client send per tick at max?
I mean as many as needed
dependent on factors ofc
such as?
.
now it is seperated, but still no change the class is named farmingEntityEvent is registed in main pluginmanager.registerEvents(new farmingEntityEvent(),this); and has a Eventhandler
How many packets are you trying to send?
no
i wanted to calculate smth
i just wanted to know
the highest limit kind of number
per tick per player
Again, theres no fixed number
dawg how many times I gotta reply to myself here
Packets can be sent as needed
as i sad no change so still not working not eaven System.out.println("s")
So you're saying that a vanilla client is able to send 100000000 packets in a tick?
event priorities maybe?
in the normal default conifugration
(i wanted to know some kind of predicted hard limit)
package de.zyrox.farming;
import de.zyrox.Main;
import org.bukkit.Material;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.EntityType;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.inventory.ItemStack;
public class farmingEntityEvent implements Listener {
@EventHandler
public void inertactEntity(PlayerInteractEntityEvent event) {
System.out.println("s");
System.out.println(event.getRightClicked().getType());
if (event.getRightClicked().getType() == EntityType.ARMOR_STAND) {
ArmorStand entity = (ArmorStand) event.getRightClicked();
String Name = entity.getName();
System.out.println(Name);
switch (Name) {
case "Apple":
event.setCancelled(true);
String headid = Main.headapi.getItemID(entity.getEquipment().getHelmet());
System.out.println(headid);
switch (headid) {
case "4570": {
entity.getWorld().dropItem(entity.getLocation(), new ItemStack(Material.APPLE));
RegenerateFarm.regenerateFarm(entity);
ItemStack greenapple = Main.headapi.getItemHead("445");
entity.getEquipment().setHelmet(greenapple);
}
break;
}
}
}
}
}
I don't believe there is
alr
This is to prevent clients from malicious behavior such as sending too many packets too frequently, that being said there's still no hardcoded limit to how many packets can be sent by a client that'd be kinda dumb considering the client/server need to send as many packets as needed which is hard to determine a "limit" for anyway
okey lets try PlayerInteractAtEntityEvent
you see that code and you think its fine?
I mean hey if it works it works kek
We're actually trying to get the less confusing method to work which is... odd to say the least
if (event.getRightClicked().getType() == EntityType.ARMOR_STAND) { paper?
logs say spigot iirc
Maybe thats the issue
using paper lib instead of spigot
i thought it was a different event kekw
i dont have paper in my pom.xml only spigot
that worked
i dont know why spigot only tiggers on that event for Armorstands but okey π
how can i get the nul error in line 34 if im checking if the player is null in line 24?
declaration: package: org.bukkit.event.player, class: PlayerArmorStandManipulateEvent
org.bukkit.command.CommandException: Unhandled exception executing command 'tpacancel' in plugin ZenTP v1
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:47) ~[paper-api-1.20.1-R0.1-SNAPSHOT.jar:?]
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:155) ~[paper-api-1.20.1-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_20_R1.CraftServer.dispatchCommand(CraftServer.java:987) ~[paper-1.20.1.jar:git-Paper-196]
at org.bukkit.craftbukkit.v1_20_R1.command.BukkitCommandWrapper.run(BukkitCommandWrapper.java:64) ~[paper-1.20.1.jar:git-Paper-196]
at com.mojang.brigadier.CommandDispatcher.execute(CommandDispatcher.java:265) ~[paper-1.20.1.jar:?]
at net.minecraft.commands.Commands.performCommand(Commands.java:324) ~[?:?]
at net.minecraft.commands.Commands.performCommand(Commands.java:308) ~[?:?]
at net.minecraft.server.network.ServerGamePacketListenerImpl.performChatCommand(ServerGamePacketListenerImpl.java:2354) ~[?:?]
at net.minecraft.server.network.ServerGamePacketListenerImpl.lambda$handleChatCommand$21(ServerGamePacketListenerImpl.java:2314) ~[?:?]
at net.minecraft.util.thread.BlockableEventLoop.lambda$submitAsync$0(BlockableEventLoop.java:59) ~[?:?]
at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768) ~[?:?]
at net.minecraft.server.TickTask.run(TickTask.java:18) ~[paper-1.20.1.jar:git-Paper-196]
at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:153) ~[?:?]
at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:24) ~[?:?]
at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1338) ~[paper-1.20.1.jar:git-Paper-196]
at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:197) ~[paper-1.20.1.jar:git-Paper-196]
at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:126) ~[?:?]
at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1315) ~[paper-1.20.1.jar:git-Paper-196]
at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1308) ~[paper-1.20.1.jar:git-Paper-196]
at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:136) ~[?:?]
at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1286) ~[paper-1.20.1.jar:git-Paper-196]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1174) ~[paper-1.20.1.jar:git-Paper-196]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:317) ~[paper-1.20.1.jar:git-Paper-196]
at java.lang.Thread.run(Thread.java:1583) ~[?:?]
Caused by: java.lang.NullPointerException: Cannot invoke "java.util.HashMap.containsKey(Object)" because "tpahere" is null
at eu.zenaria.zentp.commands.Tpacancel.onCommand(Tpacancel.java:34) ~[ZenTP-1.jar:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[paper-api-1.20.1-R0.1-SNAPSHOT.jar:?]
... 23 more```
thats the error im getting
?paste
For the love of god
because "tpahere" is null
tpahere is null
not p or ptp
Cannot invoke "java.util.HashMap.containsKey(Object)" because "tpahere" is null
emily read up
no
private static int nextSb_ID() {
int N = 0;
File file;
do {
file = new File("plugins" + File.separator + "clanSB" + File.separator + "clan"+(++N)+".txt");
} while (file.exists());
try {
file.createNewFile();
} catch (IOException e) {}
return N;
}
```anyone knows why this could not be working?
Let's see
no errors though
Negate file exists
I'm also quite new to that, so sorry
you dont do anything with the exception is why theres no errors
what the fuck
Also your do while seems to be out of place
most likely it gets an npe on the first run attempt and doesnt create the file
Use a while instead
my goal is to create a new file with clanN.txt name each time next_Sb_ID is called
wdym?
not quite getting it
var file = new File(plugin.getDataFolder(), "clan" + n + ".txt");
file.createNewFile();
return file;
shouldn't this just be enough
N is id
nextSb_ID is called for the first time
ig
but each time nextSb_ID is called it needs to create a new file on the plugin folder
with the name being: clan(prevID+1).txt
if it's called one time, clan1.txt
two times:
clan1.txt
clan2.txt
your N is local variable
it will be reinirialized every time you call that function
so it will be 1 every time
but wouldn't it only fall on createNewFile() if it doesn't exists?
because of the do while?
as shown in here
but it's simply not creating anything
and doesn't give me errors too
private static int nextSb_ID() {
int N = 0;
File file;
do {
file = new File(MyPlugin.getInstance().getDataFolder().getPath() + File.separator + "clanSB" + File.separator + "clan"+(++N));
} while (file.exists());
try {
file.createNewFile();
} catch (IOException e) {}
return N;
}
```this is working, just needed to create clanSB folder first
You don't need that File.separator thingy
What are you calling this on
a List of byte
That'll be a list<Byte>
Java introducing primitive collections when
Or, better yet, Java supporting primitive generics when

Hell they're introducing Markdown Javadoc comment support. Literally nobody was asking for that
JUST GIVE US PRIMITIVE GENERICS
meanwhile in kotlin there are no generics
what
They're not "generics"
In the same way that C++ doesn't have generics. It has templates
https://bugs.openjdk.org/browse/JDK-8046267 Created > 10 years ago btw 
dude im gonna cry
why cant i do a basic javascript task in java
aka making a array
Valhalla when
stop using java π£οΈ
you are so right rad
Well a Byte is not byte
i should use rust
You can make an array just fine, but JavaScript's arrays are very different from Javas :p
use rust and kotlin combined !
Idk if Apache has some util
JS arrays are akin to ArrayList
The fuck is that supposed to be
generate bindings !
i just need a array of byte, that i can add stuff to at the beginning
no fucking clue
A weapon of war to burn out the eyes of the victims??
just use groovy bro
just use whatever the fuck this is https://github.com/GabrielMajeri/kotlin-rust
I don't think spigot exposed fastutil does it
So, well, rip I guess
Idk maybe apache has conversion tools
nope, but [redacted] does 
That does not allow you to write at the beginning tho?
ByteArrayOutoutStream only let's you append, not pretend
Prepend
CabernetMC aka KryptideMc aka Orbit MC
well
i just rebuilt it
aka MilesMC aka Y2KMC aka LynxPlayzMC
ByteArrayOutputStream x = new ByteArrayOutputStream();
for (let i = 0; i < in.length; ++i) {
x.write(in[i]);
}```
If you want to write at the beginning, don't you just want a Deque of some sort?
why am i not mentioned smh
irrelevant issues you've made
what ones
Honoured to be on that project Titel
you gave me great advice "your name is too complex"
when I topple the bukkit ecosystem you are to thank
I mean, I think they'd be fine with a Byte buffer
Let's goo ππ gotta position myself in the new fork hierarchy
me rn
@eternal night OrbitMC aka CabernetmC aka KryptideMC aka LynxPlayzMC aka Y2KMC aka MilesMC in a nutshell
Iβm not sure thatβs how it works
yes it is
cc @shadow night
kek
Photoshop legend XD
Gimp***
krita >>>
Hi, someone know how spigot 1.21 source work, bcs, i want to edit class block but it doesn't exist like 1.8
why does java print 255 as -1 in byte form
?nms
Yes
But dont want to do minecraft plugin, directly modify spigot source, to run my own server jar based on spigot
yay another spigot fork
Oh he asked why lmao
?stash
follow the steps in Spigot repo
you need to use BuildTools to generate work/decompile/decompile-latest
so you can run applyPatches and rebuildPatches
With the link, i dont see anythings...
But with that, i dont see any registry of block, but in 1.8 it is, so i dont know how to do
for 1.8?
you're on your own
you aren't getting help or support here
well thats a lie someone might help, but I guarentee a vast majority won't
I did something super cursed
If you are to translate the bits to an int literally you get 255. However the most significant bit is the sign. So a byte in java has a range of -128 to 127.
So if you exclude the most significant bit you get the right number
Well keeping in mind if its set it should be negative of course
would love some help :D
https://mcpaste.io/ddbb7b24a53b3fa2
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>net.mandomc</groupId>
<artifactId>MandoMCRemade</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<name>MandoMCRemade</name>
<properties>
<java.version>17</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>17</source>
<target>17</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
cant show respositories and dependencies due to discord space limit
plugin wont compile due to
org.bukkit.plugin.InvalidPluginException: java.lang.UnsupportedClassVersionError: net/mandomc/mandomcremade/MandoMCRemade has been compiled by a more recent version of the Java Runtime (class file version 66.0), this version of the Java Runtime only recognizes class file versions up to 65.0
?paste
forget it
do u need the repositories and dependencies?
i have a pastebin of the console above
how do i get a player's action bar
You canβt
Itβs not something that the server stores
I guess you could use a packet listener to read the outgoing packets
how long do action bars last
A few seconds
Last I recall looking at the code I think it's 1s fade in, 3 seconds stay, 1s fade out
i dont know what id've done without that
so 4?
5*
Yeah
Donβt you love accidentally shading world edit so it outputs a jar 47,000 kb large
I do because it makes me feel like I did more⦠a lot more
it makes me feel like I fucked up somewhere xD
do i need to lsiten for system chat or chat packet
actually 47000kb isn't exactly 47mb π€
player.sendActionMessage I think
i need to listen for when i send an actionbar
or when any action bar is sent
47000 is bigger than 47 so like to express exaggeration, I went with the bigger number
so i can know if the player has an action bar now?
it's not always me
I dont think you can just grab the contents of the action bar
Apparently 2 packets can be used to send an action bar
you would have to snipe the outgoing packet from the server
probably both
thats what im doing
My prebuilt structures system is getting there π finally got the visual indicator working but still kinda bugged
The api uses the system chat packet
Granted other plugins may be special and use the set action bar text packet
Hey, I'm currently making a SMP and I wanna know, how can I stop people from entering spawn in combat. I added PvPManager plugin.
You can check if a chunk is consider spawn using method:
Location spawnLocation = world.getSpawnLocation();
and extropalating that over the distance of blocks you want to look for.
World world = chunk.getWorld();
Location spawnLocation = world.getSpawnLocation();
int spawnChunkX = spawnLocation.getBlockX() >> 4;
int spawnChunkZ = spawnLocation.getBlockZ() >> 4;
int chunkX = chunk.getX();
int chunkZ = chunk.getZ();
int distanceSquared = (chunkX - spawnChunkX) * (chunkX - spawnChunkX) + (chunkZ - spawnChunkZ) * (chunkZ - spawnChunkZ);
return distanceSquared <= radius * radius;
What do i do with this
what ever you want I guess,
I didn't understand, how does this help me
OH.
I added PvPManager plugin.
I thought he was making a plugin, because this is that channel.
but which channel do i go to if I want to develop my gains?
I was wondering if it's possible, with something like ProtocolLib, to inject shader packets to the client?
to force the player into using a glsl shader
you can distribute a rsp that has a shader in it
sending packets to it based on triggers is an exercise left to the reader
Ah
I was looking at this repo and was trtying to implmenet the scoreboard shader into a plugin.
Yeah just send them a resource pack
Or update to 1.20.6 and use the built in feature to hide scoreboard numbers
I have no experience using resourcepacks, I understand how to do it, but I'm more concerened if they can be stacked?
A plugin on a server I'm developing already uses it's own resource pack provided by another plugin (not the server), so can they both be applied, or do they need to be merged?
That's possible now?
Yes
I can't believe we have the technology to do that
what's next, a round cube?
heresy
Spigot
Got a link? I couldn't find anything about it
tysm
I always knew col was a russian plant hired by paper to spread misinfo about spigot docs
real
It is possible though somehow right, and you arne't mistaken?
objective.setScoreFormat(ScoreFormat.blankScore());
yanked from here
Thatβs it
oh what.
check the class I linked to
It was never merged
LOL
I blame @worldly ingot
Real
I swear it was merged and I used it
Anyways, for now, packets seem to do the trick:
@Override
public void onPacketSend(PacketSendEvent event) {
if (event.getPacketType() != PacketType.Play.Server.SCOREBOARD_OBJECTIVE) return;
WrapperPlayServerScoreboardObjective objective = new WrapperPlayServerScoreboardObjective(event);
objective.setScoreFormat(ScoreFormat.blankScore()); // BLANK NUMBERS
}
But I guess Iβve gone insane
Hey, if it's true that you're dreaming this, I've been in this same boat before π
I could've sworn I used a method for something once and turned out it never existed. Spent days hunting for it
Well at least packetevents means you can avoid NMS for it
Which was what I was hoping to do anyhoo!
Thanks though, you pointed me in the right direction!
Maybe in experimental build?
this is fine
maybe too short actually
there we go once every three days seems good
https://gyazo.com/dc4a2d79ed35f982be0787676e3106b2
Still a bit buggy but getting there lol
Why the offset?
Unintentional, it's based off what the player is currently looking at hence the left corner starting at the players current view
The paste was supposed to be within the particle box but I think that's a bit obvious
Why not using displayentity?
Because you just now mentioned it and I just now remembered these are a thing psh
public void displayStructureOverlay(Player player, Location targetLocation, int width, int height, int depth) {
Location[] corners = new Location[]{
targetLocation.clone().add(0, 0, 0),
targetLocation.clone().add(width, 0, 0),
targetLocation.clone().add(0, height, 0),
targetLocation.clone().add(0, 0, depth),
targetLocation.clone().add(width, height, 0),
targetLocation.clone().add(width, 0, depth),
targetLocation.clone().add(0, height, depth),
targetLocation.clone().add(width, height, depth)
};
drawLine(player, corners[0], corners[1]);
drawLine(player, corners[0], corners[2]);
drawLine(player, corners[0], corners[3]);
drawLine(player, corners[1], corners[4]);
drawLine(player, corners[1], corners[5]);
drawLine(player, corners[2], corners[4]);
drawLine(player, corners[2], corners[6]);
drawLine(player, corners[3], corners[5]);
drawLine(player, corners[3], corners[6]);
drawLine(player, corners[4], corners[7]);
drawLine(player, corners[5], corners[7]);
drawLine(player, corners[6], corners[7]);
}```
The fuckery I am doing with particles lol
what the fuck mate
i have a plugin which is thorwing error when compiling so is the url changed for repository?
<repositories>
<repository>
<id>spigotmc-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
</repositories>
<repositories>
<repository>
<id>spigotmc-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.14-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>```
honestly for that corners shit you could probably do a for loop with x y z and make it for x = 0 x < 2 x++ for each one, and then multiply the width, height, and depth by the x y z values
its a very old plugin, i need to update something in it
dev didn't set correct perms for it
if ((!player.hasPermission("fastplace.max.5") || amount > 5) && (!player.hasPermission("fastplace.max.10") || amount > 10) && (!player.hasPermission("fastplace.max.15") || amount > 15)) {
player.sendMessage(Fastplace.getInstance().getConfigHandler().getNoPermissionMessage());```
spigot isnt in a repo, you need to run buildtools locally. spigot-api is in the repos
ah ok
hi md
i never coded any plugins, i just wanted to update those perms
public void displayStructureOverlay(Player player, Location targetLocation, int width, int height, int depth) {
for (int x = 0; x < 2; x++) {
for (int y = 0; y < 2; y++) {
for (int z = 0; z < 2; z++) {
Location corner = targetLocation.clone().add(x * width, y * height, z * depth);
drawLine(player, targetLocation, corner);
}
}
}
}```
Yeah that doesn't look so fucked
you're going to get particles originating from the corner to the other corners now lol
https://gyazo.com/dc4a2d79ed35f982be0787676e3106b2
This was prior lol
is there a buit in function to combine 2 ItemStacks[] together
Wdym? Array copy?
Create a third array and use system array copy
Did you run bt for the appropriate version?
like some sort of function that combines 2 ItemStack[] together properly
(I am 30 mins late sorry lol)
fun spawn(loc: Location) {
this.setPositionRotation(loc.x, loc.y, loc.z, loc.yaw, loc.pitch)
bukkitEntity.persistentDataContainer.set(
NamespacedKey(MobWars.instance, "custom"),
PersistentDataType.BYTE,
1.toByte()
)
if (loc == MobWars.positions.blueMobSpawn) this.setGoalTarget((Bukkit.getPlayer(MobWars.blue.shuffled().first()) as CraftPlayer).handle as EntityLiving, EntityTargetEvent.TargetReason.CUSTOM, true)
else if (loc == MobWars.positions.redMobSpawn) this.setGoalTarget((Bukkit.getPlayer(MobWars.red.shuffled().first()) as CraftPlayer).handle as EntityLiving, EntityTargetEvent.TargetReason.CUSTOM, true)
val provider = p().a(GenericAttributes.ATTACK_SPEED, 0.5).a()
val base = AttributeMapBase(provider)
val map = CraftAttributeMap(base)
try {
val attributeMapField: Field = EntityLiving::class.java.getDeclaredField("attributeMap")
val craftAttributeMapField: Field = EntityLiving::class.java.getDeclaredField("craftAttributes")
attributeMapField.setAccessible(true)
attributeMapField.set(this, base)
craftAttributeMapField.setAccessible(true)
craftAttributeMapField.set(this, map)
} catch (ex: Exception) {
ex.printStackTrace()
}
for (p_ in MobWars.players) {
val p = Bukkit.getPlayer(p_)!!
val packet = PacketPlayOutSpawnEntityLiving(this)
val packet2 =
PacketPlayOutEntityMetadata(bukkitEntity.entityId, this.dataWatcher, false)
val connection = (p as CraftPlayer).handle.playerConnection
connection.sendPacket(packet)
connection.sendPacket(packet2)
}```` is it possible to spawn an entity in this way instead of world.addentity, why does it just hang in the air?
what are you trying to do? What you're basically doing there is only spawning the entity on the client's screen instead of the server, so the server has no idea that the entity actually exists. Only the client does.
no the thing is, these 2 itemstacks might contain 2 items that are the same but has an amount that is less than 64
I'm pretty sure that's what I'm getting from this anyway
I want to handle the entity spawn packet on the client side and replace it with an npc
huh?
addEntity will send the packet PacketPlayOutSpawnEntityLiving?
basically adding an entity to the world, normally, will add it to the existing entities inside of the server, including game ticks, ai execution, movement handling, cross world teleporting, etc. Basically making it so it can be interacted by players.
Doing it with just plain packets will tell the player there's an entity where you specified it should spawn, with what type it is, but the server doesn't know about the entity at all, because all you're doing is sending the information to the client and no information about the entity is being stored inside of the server.
how do I find out the bat id in 1.16.5?
it's stored in the entity types no?
actually by the looks of it, there's no longer an id associated with it
i think the id in this case is 'bat'
minecraft:bat to be specific
well there you have it
which function handles the exp amount calculation in CraftBukkit
Has anyone here ever tried hosting a react site on a mc server similar to dynmap but with react
Ig node modules would take too much space
just use spring bro
?img
Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.
Here's some screenshot utilities that you can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org
Spring is backend
Unless you use some shit like thymeleaf
No ty
doesn't need to be concern
why tf is that plugin enabled
wtf
private void setATM(Inventory inventory, double balance){
List<String> lore = new ArrayList<>();
lore.add(Banks.format(""));
lore.add(Banks.format("&2&oIstituto Bancario NovaCredit"));
ItemStack one = createCustomItem(0, "&fβ¬1", lore);
ItemStack two = createCustomItem(0, "&fβ¬2", lore);
ItemStack five = createCustomItem(fiveModel, "&fβ¬5", lore);
ItemStack ten = createCustomItem(tenModel, "&fβ¬10", lore);
ItemStack twenty = createCustomItem(twentyModel, "&fβ¬20", lore);
ItemStack fifty = createCustomItem(fiftyModel, "&fβ¬50", lore);
ItemStack hundred = createCustomItem(oneHundredModel, "&fβ¬100", lore);
ItemStack twoHundred = createCustomItem(twoHundredModel, "&fβ¬200", lore);
ItemStack fiveHundred = createCustomItem(fiveHundredModel, "&fβ¬500", lore);
ItemStack money = new ItemStack(Material.GOLD_NUGGET);
ItemMeta moneyMeta = money.getItemMeta();
assert moneyMeta != null;
moneyMeta.setDisplayName(Banks.format("&6Credito residuo"));
List<String> moneyLore = new ArrayList<>();
moneyLore.add(Banks.format("&eβ¬" + balance));
moneyMeta.setLore(moneyLore);
money.setItemMeta(moneyMeta);
inventory.setItem(10, one);
inventory.setItem(11, two);
inventory.setItem(12, five);
inventory.setItem(19, ten);
inventory.setItem(20, twenty);
inventory.setItem(21, fifty);
inventory.setItem(28, hundred);
inventory.setItem(29, twoHundred);
inventory.setItem(30, fiveHundred);
inventory.setItem(24, money);
}```
in this code i set CustomModelDatas but his not works π¦
why would that make problem
have some precompile script to compile react to uber js into your resources folder
Only thing you need to do is give bundled content to user
okay but hear me out
None of this code is setting customModelData
Whats in createCustomItem
π¦
I have no idea how to use kotlin lol
?paste
https://github.com/eirslett/frontend-maven-plugin u have this to precompile ts
Your resource paxk is incorrect then
Try retrieving the actual itemstack via itemadder's API, then cloning it to change for the GUI.
https://github.com/LoneDev6/API-ItemsAdder/blob/master/src/main/java/dev/lone/itemsadder/api/CustomStack.java#L67
What's the best way to support custom enchants across different versions? Just PDC? (Yes i want to give support to old versions xd)
Yeah pdc gives you until 1.14
Yea, that's more than enough
If you hate yourself use NBT for before that
na na, just for 1.16.5 support
Already way to early now qdays imho
Supporting 1.20.4 plus gives you 60% of the market share
Supporting 1.20.1 plus gives you over 75%
how do i copy an entity without it mirroring its nbt to the original entity?
full code
Why copy an entity then?
Just spawn a new one
u didnt understand what i meant
^
if i copy an entity, then change the nbt of the copied entity, it mirrors the new nbt to the original entity
are you sure inv is not null?
Every player shares the same inventory
It's not going to be tailored to each player
How can one damage an entity with a damage cause?
.damage(1.0, Cause)
i believe
Further I'd say it's likely the equality changes probably
Noo, it says it needs a source and not cause
Use damage source api
?jd-s
oh
declaration: package: org.bukkit.damage, interface: DamageSource
okk will try to underst
oh i forgot to build it, nvm
Damage cause is an archaic and doesn't cover every case
Hi with NMS how I can get all packets sended by the server? there is packets listeners?
soo now it just gives me an error...
p.damage(40d, DamageSource.builder(DamageType.FREEZE).build());
Hi guys, got a question!
When my players type a command /level they open a custom GUI that works perfectly. I have listened to the onClick and blocked it / made it do things, and that all works fine. I just added it to my public server and we figured out that as soon as someone else types the command, your inventory is just that, a inventory. It no longer has any functionality for the person that first typed the command.
I believe this has to do with the way i store the inventorys but i cant rap my head around it. Its been a while since i coded spigot plugins.
Can someone help?
Code below:
RuneMC.java (Main Class)
public class RuneMC extends JavaPlugin {
@Override
public void onEnable() {
LevelCommand levelCommand = new LevelCommand();
getCommand("level").setExecutor(levelCommand);
File f = new File(this.getDataFolder() + "/");
if(!f.exists())
f.mkdir();
}
}
LevelCommand.java
public class LevelCommand implements CommandExecutor, Listener {
@Override
public boolean onCommand(CommandSender sender, Command command, String s, String[] strings) {
LevelInventory levelInventory = new LevelInventory();
Bukkit.getServer().getPluginManager().registerEvents(levelInventory, RuneMC.getPlugin(RuneMC.class));
Player p = (Player) sender;
levelInventory.SetupInventory(p);
p.openInventory(LevelInventory.inv);
PlayerData playerData = new PlayerData();
playerData.CreateNewPlayerSaveData(p);
return true;
}
}
LevelInventory.java
public class LevelInventory implements Listener {
public static Inventory inv;
public void SetupInventory(Player p){
inv = Bukkit.createInventory(null, 27, "Level");
InventoryTools.InitializeDefaultInventory(inv, 27);
String LeftClickMessage = ChatColor.GREEN + "Left-click to open skill menu";
InventoryTools.SetupPlayerHeadItem(p, inv, 4);
InventoryTools.SetupSkillItem(p, inv, 10, Values.MiningIdentifier, Material.DIAMOND_PICKAXE, " ", LeftClickMessage);
}
@EventHandler
public void onInventoryClick(final InventoryClickEvent e) {
if (!e.getInventory().equals(inv)) return;
e.setCancelled(true);
}
ArrayList<Map<String, Object>> items = new ArrayList<>();
event.getPlayer().getInventory().forEach(itemStack -> {
if (itemStack != null) {
var item = itemStack.serialize();
items.add(item);
}
});
MongoDB.getCollection("inventories").insertOne(new Document("uuid", event.getPlayer().getUniqueId().toString())
.append("date", TornadoCityBuild.getInstance().getTimeUtils().getFormattedTimeNow().replaceAll(" ", ""))
.append("items", items)
);
items with itemsmeta or with enchantments wont be saved, somebody knows a fix?
Because youβre using a static variable
And reintialising it each time a player opens the inv
Should that not be bypassed because i create a new instance of LevelInventory when the command is executed?
No
Static is shared between all class instances
Thats what static means
And btw creating a new listener per player will cause lag
Make a singleton manager class
Removing the static should fix it if youβre making a new instance, but you should definitely refactor the structure of it
?
Hi with NMS how I can get all packets sended by the server? there is packets listeners or a like this thing?
Use a library like PacketEvents
yes yes I use it, I am asking that because I am curiouse, it's obviously better to use a lib
so you wanna intercept packets without anything?
like you wanna know how do it raw?
yes, how to intercept outgoing packets in the same way as protocol lib, but directly with NMS
well there are 2 main ways
depends on whether you wanna intercept ALL packets (handshake included)
or just packets the player sends after joining and spawning in the world
for ALL, how it work?
first of all you need to find the server Channel Handler
that's what's responsible for injecting other channel handlers
into the Channel of the user
a Channel is basically the worker object that allows reading and writing in the connection
channel is a communcation client/server?
ah yes I know
this is how I find the server channel
it's positioned in the ServerConnection nms class
as a ChannelFuture
it's only a List because of reused code from singleplayer
you can get the server's channel by doing
ChannelFuture#channel
getDeclaredFields are a list of all channels?
nope
fields are variables held within the class
in this class we search for the "f" one
but since it's name isn't static we search it by type
the future here is the future that's completed when the server is ready to accept connections
so pretty much you always get it already completed
guess they never heard of static variables in unloaded inner classes
yeah, Lazy init is just
pretty useless
kotlin has a by lazy delegate :)
if I understand, there is a list who store all registred channels (for all players) ?
yes
here
the most bottom one
it stores the nms object
that contains the Channel
as I don't think netty stores all of the channels in an accessible way
ah yes
then, after having get channel, how to listen packets (outgoing and incoming)?
you need to inject a channel handler into the player's Channel
for the most useable way you do it with one handler
into?
this way: Channel#pipeline().addBefore("packet_handler", handlerName, handler);
before packet handler as only there are the packets in the form of NMS packet classes
later they turn into ByteBufs
it's best for the handler to be a ChannelDuplexHandler extension
and listening for incoming is per channelRead and outgoing write in that very object
ah channel have some method to handle passing packets, we need to add our handler?
just remember to add this AFTER channelActive
we need to inject our own handler
that's the API
spigot api do this?
is it easy to inject?
yes spigot does packet stuff too, to function
I sent it
here
ah yes
(this is the user's channel)
in the server channel you might wanna look at this https://github.com/ShadowOfHeaven-Me/AlixSystem/blob/master/src/shadow/systems/netty/AlixInterceptor.java
well not really specials
never said that
you mean this?
yes
well what I meant is that handshake is the very first packet sent by the client
so handshake included meant all, all packets
ah so channels are not again initalized
well there's more to that
they are relocated during compression set
(some of them)
kind of
when compression is used plugins need to relocate their handlers when the compression set packet is sent and indicates that compression will be used
I imagine that all connections arrive via a global entry point that divides them into channels?
as then another channel handlers handling compression (for outgoing) and decompression (for incoming) are added
no
or maybe
uh depends
on where you are asking
like as long as you have a connection
you will have a Channel
so a channel is associated with an IP the moment the connection is accepted
but each channel channelRead and write only handle the packets that are related to the connection of that very player (when speaking of a player's Channel)
but in the server Channel, all player Channels arrive in the very same handler
I thought that when a client contacts the server he doesn't actually specify his channel, he gives an id or something like that and it's the server that defines that such id corresponds to such channel
he doesn't
a channel is just a class that allows for communication
it simplifies sending and receiving bytes
yes
so at the "entry point connection" channel class are not defined that's what I thought
depends on what you are speaking exactly
like what entry point?
a server internally associates a Channel to an IP
a client also internally associates his own channel when connecting
first method called in nms when the server got connection I don't know exactly how it works but there is probably a first method
I'm sorry, I'm going to have to leave. I'll let you know as soon as I get back, if that's okay
you mean when the client connects?
aight
yes
here
first channel handler in the server channel's pipeline
Hi, is it good practise to run SQL queries async when they can be, or not?
it is
Would i use bukkit scheduler for that
How would u do it
not their async or their sync
how often will you update?
I'd either create a ThreadPoolExecutor
or a ForkJoinPool
although
this one is supposed to have a work divided input
If you run a modern java version u might be blessed w a virtual thread executor
whaaat
nice
π
what version is that?
which packet is used for when the player clicks on air or a block?

