#help-development
1 messages · Page 1135 of 1
Memory leak confirmed
although depending on teh GC Java can use upto its assigned memory befor clearing it
gc being?
ah
but like
if you introduce no memory leak
ram usage now and after 48 hours won't change without restart
right?
it'll go up and down
fluctuation
yes but like
keyword "down"
but if you had a memory leak, it would keep going up gradually
well that's what I thought
or the total heap is just stuck at an amount and never adjusts to the used heap
or max heap
whatever
but at that point it will stay the same
until something in the heap reaches that limit and it goes to a higher amount
okay thanks
big misconception is that if it gets close to the limit there's a leak
the key is that the minimum, after GC cycles, keeps increasing, then you got a leak
I use a specific param to adjust the max heap close to the total heap, instead of it being too much
is it a big misconception that if it consistently reaches near the limit the ram you have left is running out
yeah I get that
or flag
also don't give the jvm heap the whole ram you got, you gotta leave room for the OS and native buffers
I just multiplied by 10 duh
I stg people are so dumb now adays
It's probably those 5g towers and tik tok
can spark show you your ram usage instead of just cpu?
does it have a ram button on the graph
I’d recommend spark in all cases
yeah it can
heap dump
profiling, heap dumps, tps, lag spikes
i don't remember the command
./spark heapdump
uh yeah something like that
will freeze the server for maybe a couple of secs but it’s just collecting all references and stuff
welp
alr
I read your mind
wassup
uhh I don’t think so
shucks
pretty sure blocks can hold pdc? I can’t remember if that’s a thing
oh?
?docs
tile entites can
dude no way
so I cant save data on a pressure plate?
?morepdc
You can create custom persistent data types on your own, or use one of the many libraries available which have implemented those which match your needs. Learn about more persistent data types here: https://www.spigotmc.org/threads/more-persistent-data-types-collections-maps-and-arrays-for-pdc.520677/
idk what that command was
ah no
yeah no
I forget the other command too
?blockpdc
Learn about CustomBlockData here:
https://www.spigotmc.org/threads/custom-block-data-persistentdatacontainer-for-blocks.512422/
thats the one
pass
is InventoryCloseEvent thrown if the player crashes or should I handle that separately?
(I assume not but still)
Tiles is better >>>
try it
hold f3+c in game with the inventory open
10s
wait there is no way there is a hotkey to crash mc
Omg thrre Is tho
Ain't that crazy
Hold f3 c
it is just a command to copy the command to teleport the player to its current position
but holding ctrl+c+f3 is a different thing?
that's only if you press it once
if you hold it for 10s it'll do a minecraft crash
ctrl f3 c is a vm crash
interesting tbh
alt f4 not relevant anymore?
Hey guys I made an Interaction entity the passenger of a ItemDisplay, but the interaction thing is above the itemdisplay, can like move it down somehow while its still a passenger?
I think you can set like a translation of some sort
anything in specific
Yeah and no location change either
idk what happens if you mount an interaction to a display and move the display
well interaction would have location, as its from entity
just translation to move it down
how
i dont see the method
its a passenger so any translation is relative
its in Entity
theres no setLocation
wdym
well you would use teleport
ill just teleport it to the itemdisplay
no no teleport
right, but thats not available on Interaction
so thats why I am wondering if its possible to mount interaction on a display that has a translation
Translate the item display instead
ill just teleport the interaction
… okay
teleporting would either just fail or move the enity regardless of mount
whats the method to translate
setTransformation iirc
Display#get/setTransformation
The first vector in the transformation is the translation
oh no not this transformation stuff, i was having problems with it earlier idk how to use it
just getTransformation() then edit the vec3f and setTransformation
spigot should require a CS doctorate degree to begin using it tbh
yeah it worked sound
disagree
For use -> Require IT Certificate
For contributions -> CS Masters or higher
I've been programming and in IT for 40+ years but no longer have any certificates 😦
no more y2k contributions 
noob
rip
I feel like if ppl were educated half of the spigot API wouldn't exist tho
ppl would just be debating the best approach
fabric :troll:
guys how can i turn a component into a legacy string
don't
just don't
i know this isnt the right discord
nah citizens doesnt let me pass in a component for the npc name
so im forced to
do u reckon ampersand or section for a citizens npc name
Use the working one
huh? ight
if citizens is worth their salt both should work
just did section and it worked
if u do ampersand u probably have to call ChatColor#longassmethod aswell
He’s probably trying to maintain spigot compatability
Cause some stuff like lores don’t have support for spigot api and the Bukkit platform doesn’t support it
Minimessage!
I would imagine you can find an example in citizens somewhere, I’ve never done that sorta thing
nah
completely different topic
just wanna set a new skin on a player
i have the textures i just need the method
Yeah I would think citizens has something related
how can I get ore veins on chunk generation?
Otherwise how would their npcs have skins
broo not on an npc
on myself for example
It’s the same concept for the most part innit?
doubt it
Spigot compat is NMS
Real ones use nms
real ones just use fabric
blue rad
Yo is Entity#remove() the right way to delete/despawn entities
Yes sir
I do that in the onDisable and they are still there
after restart
me poor
They're probably already saved to disk before you remove them
I'd check out doing it in some events
What event? PreServerShutdown?
if that even exists
Idk I'd do something related to entity unloading
That'd just be onDisable
override /stop command and save before executing Bukkit.shutdown()?
nah like if the server crashes/stops they HAVE to not be there after restart
That's shoddy
If the server crashes your onDisable isn't running
Ok then stops is fine
thats crazy work
?jd-s
actually i got it to work
turns out forEach() is just weird in java
did a manual foreach
the entities despawn but the NPC doesnt
L citizens
let me find out
Actually its so weird, sometimes it removes the entities, sometimes it doesnt
Why is that
it will only delete entities in chunks that are already loaded. It won't load chunks in onDisable (I believe0
public @Nullable Location getFixedSpawnLocation(@NotNull World world, @NotNull Random random) {
if (world instanceof ServerLevel serverLevel) {
return serverLevel.generator.getFixedSpawnLocation(serverLevel.getWorld(), new Random(serverLevel.getSeed()));
}
return null;
}```
I'm using chunk generator, any way to do the getFixedSpawnLocation async? or where is it stored in Spigot/Bukkits source code?
why do you want every possible thing async
becuase im making 3 worlds in a functino
and theyl lag the server
this is the last method I need async
and ill be good
you do know that async isn't the solution to every performance issue right
what is the issue at hand to begin with
a bukkit world will never be an instance of an nms level
were you the guy doing a speedrun server
ye
you should clarify that you're working on a fork so that people don't misunderstand what's possible and what isn't
you do have a fork though, don't you
i highly doubt that
assuming that's a bukkit world
im just reading the serverlevels code
I see, I misunderstood then
when I make it return null
the spawn location bugs out
so it has to be working
the massive lag spike
also plugman works
dont hate on me
do you want the spawn to be fixed or random
well that will always be laggy
how do rtp plugins do it
paper
finding a random spawn location is pretty expensive
oh i forgot im using paper
?whereami
ebic epic keeps doing that
ebic do be like that
i think the better way to handle this is not creating worlds per uuid but having X amount of worlds already loaded and existing then giving that world to a player and resetting it once they leave/finish
i forgot you were using paper but they do it without lag by using paper api on paper servers
^ that's a reasonable approach, though I don't know the cost of having idle worlds around is
i just went to my intellij workspace and my fucking macos container was open with intellij running in there
what was i cooking
I already recommended AdvancedSlimePaper for this purpose I believe
reallly? I knew it was more tailored for minigames but not to this extent
the reason I cant do that epicebic is cause i have seeds
random seeds
and set
thats the whole purpose
like i have it set up if a player chats while its active it will set the seed
why the fuck did i install all my jetbrains stuff in my mac container???
there is simply no way to do what you want to do dynamically, you can lessen the impacts on some fronts but in the end that huge lag spike is because of generation on the main thread, which I believe for spawn chunks, can't be avoided? Someone more experienced with the chunk system may correct me on that
I would implement a queue system that creates the worlds on scheduled restarts to make it work without interrupting the rest of the server
why did you do that
idk 😭
that is a paper feature, but that doesn't matter if what I said above applies
when I did a set spawn location
it was instant
like INSANT
insant*
omgf
instant
of course, because it doesn't have to look for a suitable spawn spot, so it doesn't have to preemptively generate the chunk
wheres the code for looking for a spawn location
I cant find it for the life of me
( for the overworld)
I mean, just find where getFixedSpawnLocation is used on the call stack
I tried but I only found the other chunk generator class
I can check later when I get home if you don't find it
I mean, for vanilla generation, the generator would be null, so you'd have to look at the code that follows that
NoiseBased something something
it extends chunkgenerator not implements, and doesnt have the spawn thingy
package net.minecraft.world.level.levelgen;
public final class NoiseBasedChunkGenerator extends ChunkGenerator {
thats the nms class, thats crazy
well im looking in purpurs source code
nms wont use the bukkit chunk generator class
you're really asking in the wrong place given you are looking at purpur lol
paper's (and by extension, purpur's) chunk load/gen is rather different from the vanilla one, to say the least
well, gen doesn't change that much, but loading definitely does
so you'd be better off asking in the paper discord or purpur's if that exists
it does, I'll ask their tyy
Hi, is the InventoryClickEvent fired when i click with the right/left button an item in the hand?
PlayerInteractEvent
also you won't get it triggered for right clicking air without an item
Ok, thanks you
Quick question to the more experienced nerds out there
Are movement packets sent before or after the nms entity updates its values
(can I get away with nmsEntity.location on ClientboundMoveEntityPacket or do I need to append the deltas)
Use their API
how
can you give a exampel
Hey guys i need few testers to test my plugin and check out code and let me know what you think about it
read channel title
I recommend asking in #1100941063058894868 and provide a direct link to the github repo
(For a code review, no one will actually download and run your plugin)
Can you give items damage multipliers using the attributes api?
Or do I have to implement that myself
No I think it’s add scalar
Does that apply to armor as well
Yes
lovely, thanks
what does spigot's World#getLoadedChunks actually do? when i use the method it says around 1300 chunks on the server are loaded, i find that hard to believe considering the server render distance is 10 chunks-- a 10 chunk square radius around the player would mean 20x20 chunks are loaded, that would at max be 400 chunks, so i'm a little confused on how so many more are loaded (im the only person on the server btw, its a local dev environment)
Spawn chunks, chunk tickets (portals, etc)
well regardless, even if you rounded up a bit, it still wouldnt come close to 1000
how does that add ~600 extra chunks to the count though?
sorry if that seems like a dumb question im pretty unfamiliar with chunk tickets and how chunk loading works in general
im on 1.21 though
also thats crazy i had no idea they were that big
Should only be like 3x3 in 1.21
Though idk at what level they are considered loaded
May still actually be like 7x7
19x19
Mmm the 23x23 was probably including the lower load levels then
Hmmm
Hi, anyone can pass me the API of Maven for the version 1.20.1? pls, it's for my pom.xml of my plugin
😔
hey, you know what is the API for 1.20.1 for input into the pom.xml?
what do yall do when you need to test your shit with another user? im so out of practice. i used to just start the client again and log in with my brother's account but now they got the m$ account bs and idk his details and don't want to bother him. so was gonna do offline mode but idk how to do that shit anymore lmao
You could use MockBukkit
It has its own caveats ofc
But there u can emulate a server and mock a player
There’s also some nms stuff for fake players, could be handy but unsure how compatible that’d be with the api itself
And if you don’t need an entire server emulation, a simple unit test might be enough
yea
spigot*
seems to hard require paper xD
but cool project
Hello. I would like to lock a database intentionally so I can simulate plugin behaviors in the case a rogue process locks my database. How can I do that?
if mysql, you can run this on your db
lock tables table_name write, table_name2 write;
then when done
unlock tables;
i guess? lol. do this in an admin console, then your plugin when it attempts to access the locked tables should get errors
Hi everyone
Can someone tell me
How can i rotate
this
for (double angle = 0; angle <= Math.PI * 10; angle += 0.35) {
double x1 = radius * Math.cos(angle);
double z1 = radius * Math.sin(angle);
double x2 = radius * Math.cos(angle + 0.05);
double z2 = radius * Math.sin(angle + 0.05);
double y = (angle / (2 * Math.PI)) * ySeparation;
Location tempLoc1 = loc.clone().add(x1, y, z1);
Location tempLoc2 = loc.clone().add(x2, y, z2);
final Location particleLocation1 = tempLoc1.clone();
final Location particleLocation2 = tempLoc2.clone();
new BukkitRunnable() {
public void run() {
player.getWorld().spawnParticle(Particle.FLAME, particleLocation1, 0);
player.getWorld().spawnParticle(Particle.FLAME, particleLocation2, 0);
}
}.runTaskLater(Main.getInstancia(), delay);
delay += 1;
}
``` I asked but i really suck at maths :c
90 runnables to rotate a couple of particles?
you are creating a new task every angle
90 runTasks for that one for loop
i want to rotate dat where player look
ok
oh , one question, is it true that asynchronously is more efficient?
no
while you are right, his question was how to rotate not how to schedule efficiently
well yeah but i mean he is helping anyways
while true, I'm not advising on his current code
lol
hahahah
how exactly do you want to rotate the particles?
I see you spawnign two, but how they rotate (or want to rotate) is unclear
Oh yeah u right sorry
gonna send throught imgur
It's an animation that's why it's 3 pics
yeah yeah i kinda copied thishttps://bukkit.org/threads/creating-a-helix-3d-spiral-out-of-particles.314312/
but it was kinda wrong cause it spawned particles till Y 27k in the world, lol,
That post looks fine, other than using packets. just use API as all it does is send a packet
you literally have all teh code you need in that tutorial
scrap the packet part and use API
do the whole thing in an async task
spamming each word is really going to encourage someone to help you
no
it is already rotating in the example
bro
but
I want to do something like this
player faces up, helix faces up, player faces left, helix does too
my code js spawns it vertically
it's like the hypixel Burning Souls ability
thats just getting the players location + his direction for each cycle
the code exactly the same as in the example, but where it gets the players location you use player.getLocation().add(...getDirection().multiply(2))
that offsets teh spawn location by the players direction x however much you want offset
i still cant get it 😭
is there any way I can register a world to the server when I already have the files
for example I copy a world and I dont need to waste time generating it because the files are the same, however I want to be able to access it with Bukkit.getWorld
createWorld is the only way and didnt generate unnecessary files if there available.
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/Bukkit.html#createWorld(org.bukkit.WorldCreator)
declaration: package: org.bukkit, class: Bukkit
guys is there any gui api? im trying to make gui for my plugin and im struggling to stop inventory moving, i have packetevents api but it won't help anything i can use or without api how to make it?
code is pasted, and to be honest im trying to make so i could move items in my inventory
It runs once every tick
i have this " public void onInventoryDrag(InventoryDragEvent event) {
Player player = (Player) event.getWhoClicked();
if (openReforgeInventories.containsKey(player)) {
for (int slot : event.getRawSlots()) {
if (slot < 9 && slot != 3 && slot != 5) {
event.setCancelled(true);
break;
}
}
}
}"
but like im just trying to fix moving item in gui but it affects on inventory too
And if delay is 1?
Wdym inventory moving
"but like im just trying to fix moving item in gui but it affects on inventory too"
i mean i made so i couldn't move items in gui but it affects player inventory when gui is open
so like i can't move items in my inventory too
i tried to use " } else if (event.getClickedInventory() == player.getInventory()) {
event.setCancelled(false);
}"
but it doesn't work
Hello!
delay or period?
delay is a one time thing before the timer is initially ran
but 0 and 1 are basically the same outside of a delay of 0 running in the same tick if scheduled from a scheduled task
I am trying to remove both recipes for netheriteingots via their namedspacekey. With Bukkit.removeRecipe(NamespacedKey.minecraft("netherite_ingot")) I can remove the recipe of netheriteingots out of netheritescraps and goldingots. What is the namedspacekey for the other recipe (out of a netheriteblock) or is there another way to get this recipe without iterating over all recipes?
no, either you iterate or you specify the keys
There is no "any recipe that leads to x item" lookup
Hasn't minecraft specified these keys with their own recipes?
(well there is, but that one just does iteration)
The other key is netherite_ingot_from_netherite_block btw
thanks, gonna try that
What do you mean with "inventory moving"?
i explained
.
InventoryClickEvent
Check if event.getView().getTopInventory() == your inventory
event.setCancelled(true)
Period
kinda works but now i can move anvil :/
Yea, period 0 and 1 behave the same
What anvil?
I would prefer using classes and using InventoryHolder tbh
Because if you work with many inventories or items you have a high amount of if else statements
https://www.spigotmc.org/threads/a-modern-approach-to-inventory-guis.594005/
oh
That thread explicitly does not use inventory holder
^^
why is your titlebar purple and how do i get that too
@EventHandler
public void onBlockBreak(BlockBreakEvent e){
Player p = e.getPlayer();
if (p.getGameMode() == GameMode.SURVIVAL){
e.setCancelled(true);
}
}
}```
why doesn't this work?
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
- have you registered your listener?
windows 10 primary colour
looks like
dark mode
im a light mode user sir
that could be it yeah
pain in the eyes helps to stay focused
aw naw
in exactly 6 hours im getting rewarded with dark mode until 6 am
thats my bounty system
no i forgot thanks
InventoryHolder on spigot is naive so be careful using it takes a snapshot of all tile entities every time
This can cause some serious lag at scale
Do you have something to read where its written? Now im curious why that happens and thank ya

Ill fix it don't worry
I just gotta figure out how to not make things explode 💪
I mean, inventory view is the better approach tbh
Oh def is imho but like people still use it 🥲
Yeah if only there were a good way to track a players open inventory and attach data to it with a constant hashcode and...
Oh hashmap that's far to complex
yeah my library literally has its owen MenuType kekw
That's how impatient I was for spigot
Lpl
Own***
I also have my own equivalent of InventoryView
And I registry back it all 
Please use InventoryView and a hashmap
I'll give you large sums of money
I dont need money tbh but im reading the article xd
You're such a sweetheart
Nah cuz like idk if it even works lol
Hey guys,
I have a problem with sending packet in foreach or for
SynchedEntityData dataWatcher = this.entity.getEntityData();
this.name = ChatColor.translateAlternateColorCodes('&', newname);
dataWatcher.set(new EntityDataAccessor<>(2, EntityDataSerializers.OPTIONAL_COMPONENT), Optional.ofNullable(CraftChatMessage.fromStringOrNull(name)));
dataWatcher.set(new EntityDataAccessor<>(3, EntityDataSerializers.BOOLEAN), visibleName);
ClientboundSetEntityDataPacket packet = new ClientboundSetEntityDataPacket(this.entity.getId(), dataWatcher.getNonDefaultValues());
Bukkit.getOnlinePlayers().forEach(players -> ((CraftPlayer) players).getHandle().connection.send(packet));
My real problem is the first player on this list he doesn't receive the packet but de rest is.
If player is single in the server the packet is sending, I don't understand
I use spigot remapped of 1.20.1
On second thought don't look at it I actually have to fix something
((CraftPlayer) player).getHandle().connection.send(packet);
for (Player onlinePlayer : Bukkit.getOnlinePlayers()) {
its exemple code my bad for this error
Dont send example, just send your real code
How do you want to help if we didnt get the code and look whats wrong xd
modified
i made npcs in like 110 LOC and they work great
same with location but if i want change name of entity doesn't work
The world if people used citizens for npcs instead of hand rolling their own crap
It's probably the most commonly asked question here
I Don't get it either custom npcs are not easy
Legit out of everything it makes the most sense to have a lib for
There is an outdated guide for it
Which people are copy pasting and wondering why it doesn't work
is not NPC is simple entity of armorstand spawn with packet btw
https://paste.md-5.net/elurufoduk.php it's shit but works
text displays + Entity.setVisibleByDefault + Player.showEntity 🙏
i fucking hate how mojank makes constructors beside the bytebuf one private
huh
all bytebuf ctors are private
and the other one(s) are either public or have a static factory method
I must not lie, I built out my own way to spawn custom npcs instead of citizens 😦
for the team one, that was the only public one 💀
oh wait, it had an nms team ctor
welp CraftTeam ain't public either
i think i added another ctor but just forgor to update my code
what are you talking about
private ClientboundSetPlayerTeamPacket(RegistryFriendlyByteBuf buffer) {
probably made it public then
i mean there is no need to make them public when you can just use the codec that is already public xD
if I wanna use npcs im just gonna use citizens, I cba with nms garbage
hi
best I can do is packetevents
hello william mods
anyone know how i can get started with coding plugins or have a video?
i dip
- Learn Java
- Read the guide on the spigot website https://www.spigotmc.org/wiki/spigot-plugin-development/
lmao i added a new one anyway
the great test of fate can I actually code an entire GUI without it exploding in my face on first open
I can't :(
?learnjava
For Beginners:
Codecademy - Learn Java: Interactive Java programming course from basics to more advanced concepts. Perfect for absolute beginners.
https://www.codecademy.com/learn/learn-java
JetBrains Academy - Java Developer Track: Learn by doing with projects and challenges. It covers Java fundamentals to advanced topics.
https://www.jetbrains.com/academy/
Udemy - Java Programming Masterclass for Software Developers: Updated courses that cover Java 8 to Java 17 features. Suitable for those who prefer structured learning.
https://www.udemy.com/course/java-the-complete-java-developer-course/
For Intermediate to Advanced Learners:
Oracle Java Tutorials: The official guides by Oracle for Java programming—great for understanding the depth of Java.
https://docs.oracle.com/javase/tutorial/
Baeldung - Learn Java and Spring: Focus on Spring Framework and modern Java technologies. Best for intermediate learners aiming to expand their knowledge.
https://www.baeldung.com/
Practice and Hands-on Learning:
Exercism - Java Track: Solve exercises and get feedback from mentors. Great for practicing coding skills.
https://exercism.io/tracks/java
LeetCode: Practice your coding skills and prepare for technical interviews with Java.
https://leetcode.com/
Free Resources and Documentation:
Java Programming and Documentation: A comprehensive collection of Java programming guides, tutorials, and API documentation.
https://docs.oracle.com/en/java/
Community and Support:
Stack Overflow: A vast community of developers. Great for getting help with specific problems or understanding concepts.
https://stackoverflow.com/questions/tagged/java
r/learnjava on Reddit: Join the community of Java learners and get advice, share resources, and discuss projects.
https://www.reddit.com/r/learnjava/
Remember: Learning to program takes practice and patience. Don't hesitate to experiment with code and participate in community discussions. Happy coding! 🎉
e.getPlayer().getInventory().addItem(new ItemStack(Material.OAK_LOG)); if (e.getBlock().getType() == Material.OAK_LOG);
why does this trigger whenever any block is broken?
Why does what trigger
That's not valid Java code
Also your if doesn’t have opening/closing brackets
it is?
Can't have a floating if statement like that
yeah
don't you need something post-if
or do I remember it wrong?
e.getPlayer().getInventory().addItem(new ItemStack(Material.OAK_LOG));
Well you have it above the if statement
it's like doing if (...) { ; } in the same way you can do if (...) println("foo");
So of course it always triggers
or have random semicolong anywhere
I love my System.out.println("hello world!");;;
is there not a way to do it in one line?
there is, but not how you did it
Thats like making sure the spider in your house is dead fr fr fr fr
ah right looks like I was wrong
;;;;;
the only place where you can't have semicolons is before the package statement if there is a package statement
what in the acutal sigma is foobar anyways?
how would i do it
you would do it properly
helpful
(after the if statement, not before)
oh alright thanks
Why do people insist on making it one line
actually, I wonder if
do {
// code
} if(statement == true);
``` is valid
Having an extra line for {} won’t kill you
no because do isn't valid in that context
steel is calling
souds like a sketchy shit js would support
it might
oy how sad
do you know about do {} while
lmao
do {} while (int i = 0; i < 1; i++);
classic
okay but https://doc.rust-lang.org/nomicon/
The Dark Arts of Advanced and Unsafe Rust Programming
isn't there a programming language called english or something
"set x to 15 when time of day is after 8pm"?
That’s just skript
that's just sql
I'm currently trying to update a premium plugin of mine but it just goes over the limit, I am aware that the mysql connector is in Spigot so was wondering if it's safe to use that or alternatively if I can upload the file elsewhere and use an external link?
I think you’re stuck with that driver version too for MySQL
I wonder if someone could make a gradle plugin to rename the JNI methods so they’d work for relocation
I was more worried that there could be issues with the driver on different versions and wasn't sure if it would be bad practice to use the spigot copy either
You can’t use different versions because the drivers have native methods with the names that direct to Java call
well, if it was unsafe it wouldn't be there to begin with :p
That's valid haha
You can only use the spigot version but it’s prolly somewhat outdated lol
i don't think the mysql driver uses native methods
Oh it doesn’t ?
afaik sqlite is the odd one out
Oh ic
When some dies to X whilst trying to escape Y, how do I get the Y in an on death event
declaration: package: org.bukkit.event.entity, class: EntityDeathEvent
declaration: package: org.bukkit.damage, interface: DamageSource
@glossy laurel ^
Wont damage source be the last damager
Also guys, can you create tables inside tabless in sql
there is no reason to ever do that unless you simply don't understand the rational of SQL
I dont indeed
I want to create like a
Map
what
And store it inside a table
(I have no clue what I'm doing btw)
Is there like a tutorial on how to approach sql
Like not just syntax
just add multiple entries and don't use unique keys??? SQL is literally a map though
e.g. if you want to store player homes ensure you aren't using unique keys
each home can be a different entry
But id need a table for just player homes right
correct
relational database
who
joe
the "relational" part of "relational database" turns out to be quite important :3
The players Id + the home name should be the unique key
You can have a unique constraint on multiple columns
Hold up
hehe I just use BSON :P
So basically
Instead of using a new table for each player's data
I use one huge table
And then store homes on player id + "home" + home id
?
Cuz like
Theres other stuff id need to save
Like
Playersettings let say
ID | HomeName | World | X | Y | Z
But wouldnt that be inefficient since sql would have to filter thousands of player before getting each value
Nvm im
Stupid
Fairly simple homes table schema
Okay but
What if I also want to save other player data
That is homes
New table?
Yes
Okay I more or less got it
And if I wanna get a list of all player homes
I do smth like
tables should be treated as a single collection of data rather than a "cram everything I can in here" kinda deal
SELECT * FROM homes WHERE id EQUALS <id>
SELECT * IN homes WHERE "id" = 'input uuid'
Well I almost got it
Not bad considering I first read syntax today
Not sure what that means but sure
= works apparently
Yeah ik
Ik there’s somewhere you have to use EQUALS
Aggregate functions?
Anyways tell me
How hard is it to use a db in java
External dependencies?
Or a bunch of http requests
Or something jaba has built in
Oh
💀
Sheesh
Now tell me it also has itemstack serializer included
Or whatever its called
paper has it builtin
Spigot will soon too™️
effective immediately
what is delaying that PR even
How
And how convert back afterwards
BukkitObjectInputStream and BukkitObjectOutputStream
fuck you
God no
Actually im pro
Ill just ask in paper
I'm always amazed at how many people that run paper come to ask questions here lol
Should serialize it fine
Dude paper sucks balls
I dont wanna use it
Bro just wants me to send everything in some damm components
And deprecates all string methods
Like who tf asked for that
I wouldve stayed with spigot but I needed to cancel death event
well, it isn't like we wanted it, but Minecraft changed and people have to adapt
You can just cancel fatal damage
blame Minecraft for making messages overly complicated
What
I cant
It didnt detect late totems
You can manually check for a totem
public byte[] serializeItemStack(ItemStack itemStack) {
Preconditions.checkArgument(itemStack != null, "The given ItemStack must not be null");
net.minecraft.world.item.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(itemStack);
NBTTagCompound itemCompound = (NBTTagCompound) nmsItemStack.save(((CraftServer) Bukkit.getServer()).getHandle().getServer().registryAccess());
return writeNBTCompoundToBytes(itemCompound);
}
public ItemStack deserializeItemStack(byte[] bytes) {
Preconditions.checkArgument(bytes != null, "The given bytes must not be null");
NBTTagCompound itemCompound = readNBTCompoundFromBytes(bytes, DataConverterTypes.ITEM_STACK);
return CraftItemStack.asCraftMirror(net.minecraft.world.item.ItemStack.parseOptional(((CraftServer) Bukkit.getServer()).getHandle().getServer().registryAccess(), itemCompound));
these are the methods in the PR
Didnt register totems equipped right before death
just yoink them in your code till the PR is merged
What pr
Seems odd
you can't see them if you haven't agreed to the CLA though
Real
I guess the totem procs before the event? Idk
I have no clue what youre trying to tell me
Oh well
No
I think death occurs later than damage
Or maybe death force updates inventory or sum
once the PR is merged, you can just use the new API
Guess what
Paper already has it
Im too cool
I am
And im in spigot
Cuz I hate paper
I'm holding myself from ?whereiam
Ik where I am
Fr
Spigot community more fun
Yk
;(
If someone suicides by ender pearl when being in combat with someone how do I check who he was in combat with
Last attacker?
Thats not a skript only thing right
LivingEntity#getLastDamageCause or whatever it was called
I'll always find it funny that it just stores the event itself
Will it be null if the death itself wasnt from a player
No
Sick
Now whats the skript syntax for it 🗒️
So if player tried to swim in lava whilst trying to escape X X would be the killer right?
Is this real
Nah thats defo not real
Not how skript syntax works
people still use skript in 1985?
What happened to 1984
Anyways
Yes or no
if only my PR got merged then it'd be in API
I agree
Yes
What
Thx
Guys, how to detect memory leaks
Like how do I find any leaks
If there are any
Like what causes them
heap dump
Hmm alr
Yes its
maybe you should use the gui
-petMyCat
I'll die before I use a gui
merci
yup
brat autumn rad
ew why does stash not show draft PRs by default
bitbukkit moment
bitbuckit
shitbukkit at best
bitusbucketo?
githuh better
just a redirect to gh
didnt even know you did that
@river oracle ```
[ERROR] /home/lynx/workspace/spigot/CraftBukkit/src/main/java/org/bukkit/craftbukkit/inventory/util/CraftMenus.java:[101,72] cannot infer type arguments for org.bukkit.craftbukkit.inventory.view.builder.CraftViewBuilder<>
reason: inference variable B has incompatible bounds
upper bounds: org.bukkit.craftbukkit.inventory.util.CraftMenuBuilder
lower bounds: org.bukkit.craftbukkit.inventory.view.builder.CraftMerchantViewBuilder
I request changes, make it compile pls
yes
skill issue
4 blocked messages
💀
Golang?
mad
Or godot?
xml
go dot like the char
code of dreams pronounced kubectl as:
||cubb cuddle||
Kub rectal
No its “guh doe”
Fellow Dreams of Code watcher 
dreams of autonomy 
yeah I just watched his most recent video
Dreams of what
i do that
case and point
I'll lyk when It compiles I forgot about that part, I'm doing all my homework for next week so I can code 😈
oh totally I can't wait to finish all my homework
not devoting your entire life to spigotmc? smh
geeeeeeeeeeeeeeeeeeeeeeeeoey
What about "jee you i"
Graphical User Interface 🤓
Just say user interface or something lmao
what in the holy name of fuck
There is no reason to say graphical
text user interface
but its in the name, G
Goddamn user interface
I have 2 and a half more years of this crap
great user interface
Godlike User Interface
Godforsaken Unusable Inventories
before I sell my soul to the devil and work at some heartless corporation
Fr
Fuck Minecraft GUIs man so annoying
God used IntelliJ

so no wonder some of us look like exceptions
how do I get a Statistic from a namespacedkey
(without iterating over all of them just to compare the keys...)
PR a getByKey method like some of the other classes have 
Registry.STATISTIC has entered the building
hi how can i code my listener to prevent doing /give or /summon commands?
What?
public class GiveListener implements Listener {
@EventHandler
public void onPlayerChat(PlayerChatEvent event) {
Player player = event.getPlayer();
}
}
I want to cancel /give or /summon commands
isnt there a command event
Idk im pretty new to coding so im testing a lot
you need the preprocesscommand event
aight, I was looking at RegistryKey
what? 😄
I tried this and this didnt work
public class GiveListener implements Listener {
@EventHandler
public void onPlayerChat(PlayerChatEvent event) {
if(event.getMessage().equalsIgnoreCase("/summon"))
event.setCancelled(true);
}
}
like this? PlayerCommandPreprocessEvent
and what should i code to prevent commands then?
event.setCancelled(true);
you'd also have to check if it starts with summon
instead of checking if the command is summon
how do i do this?
Can’t you just remove the perms for it
you can get the message the payer wants to send with getMessage
and the rest is string magic
public void onPlayerChat(PlayerCommandPreprocessEvent event) {
if(event.getMessage().startsWith("summon"))
event.setCancelled(true);
}
this still dont work
the command might contain a slash
what? i cant run it in intellij
to debug just means to find out why it isnt working
i.e. print
and also you can but its a pain to set up
I mean, you can run it in a debugger, you'd just have to setup a run configuration with the necessary flags and then run a server on the side also with the necessary flags
it worked now 😄 the / was missing
or use something like run-task, but that's beside the point
yeah the point is to find out why something doesnt work
I strongly recommend setting up a proper debugging environment in your projects nonetheless


