#help-development
1 messages · Page 1263 of 1
have you tried Player#setPlayerListOrder(int)
what, that exists?
yeah
TIL
How do I put in an anti-xray?
Sounds like a question for #help-server
did setPlayerListOrder get added in 1.21.5? its not available for me in code
yeah prob
You can check stash to see mc’s impl for perlin I forgot what it’s under tho
just havent updated yet
im using the bukkit perlin noise generator
tbf minor versions mean nothing for MC now with feature drops lol, may as well just change it to calver
wdym
that there's enough changes/additions on each minor release now that it's more justifiable to not be running the latest minor version, though I'd still hope people upgrade sooner or later
Thats what I meant, sorry, not mc
oh for sure
ok
i lost my java project, and i only have the jar of the project, how could i recover it using that
Search for a Java decompiler. Add spigot API to the decompiler. Decompile your plugin.
No piracy please.
And in future you might want to compile your plugin with source code included, that way you will just have your source in the jar and won't need to decompile...
Or upload it to GitHub or GitLab for backups
That too
I've had to decompile my plugins so many times. I have source on GitHub now, but it's v2.1 and that plugin on Spigot is v2.2. Going to have to decompile again if I ever plan on updating it.
what decompiler do u recommend
I honestly don't remember which decompilers I've used in the past.
This one should do the trick though
https://java-decompiler.github.io/
JD Java Decompiler
Scared you lost your code?
scared to start again
How large is your codebase (one you're scared to lose)
250 classes
Not everything decompiles perfect but it gets the job done
is it a minigame or smth ?
just upload it on github as a private repo
its a survival that every day it gets harder
i made every difficult change on a separate class
ye i see
ill do it now
For example Int.Maxvalue translates to literally 2147483647
Oh, 250 is a bit ugh, over engineering ?
I mean , difficulty changes should be based on POJOs
you can make a system where DifficultyAdapter is a simple object with constructor values, these values determine the difficulty in your survival difficulty processing algorithm
unless your adapter is pretty complex
What is a POJO?
Java objects
Plain old java object
Gotcha...
I rarely overengineer my projects, unless there's no other way to achieve what i have in mind lol
I have only 1 public project that i have over engineered , which is kinda good for my portfolio
If I'm trying to get field that is not available in config, what value will it give?
I try not to over engineer, but then I end up doing so trying to handle all these edge cases.
null
Will it make an error?
no, unless you use that null in some operation
if that happens it will throw an NPE
Okay thanks
I mean it depends really
getInt won't return null
it will return 0
You should see the javadoc for the methods you're using
Well yea obviously, numeric primitive return values should return 0
im pretty sure any other return value would return null
If you use the get method that returns an object it will first return the default if set
and then null if not set, yes
is it me or spigot-api 1.8 can't be used because its also resolving bungee-chat for that version which has been deleted or moved
nvm my bad it just needed sonatype lol
NEVER BACK DOWN NEVER WHAT?

how do i use build tools to get spigot api
I have no idea how people are going to figure out running a server if they can't figure out buildtools
its just that the api i got its bugged
i think
bc i put it on the plugin and doesnt let me do any bukkit related things
You need to use the spigot-api.jar for your plugins, or do like md_5 said and set up maven.
I think it's in Spigot\Spigot-API\target\
Shaded jar has more features, like Gson and others...
1.21.4 uses jre 17 right?
Java 21
https://imgur.com/a/a7JLqhzo idk what im doing bad when puttin spigot api on build path, but every related to bukkit its error, what should i so
I got the same thing. :p
Lightshot uploads ftw rn
Hello! I am looking for a developer who is willing to work longterm for our medieval minecraft server. Your duties will require working on items like playerskills, abilities, and races that will be mainly used for combat and pvp on our server. We work using Model Engine, Mythic Mobs, Oraxen, Mythic dungeons, and other affiliated plugins.
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
Go to #verified since its less active, and maybe ping resource staff? iunno
since when is itemframe rotation based off yaw and pitch on 1.8
I've been blaming retrooper for like 2 weeks
I did recall testing something like this forever ago
and apparently it's pitch based and not yaw based
unless retrooper's scamming me
didn't
fire
it's a thing, apparently
it took me like 2 weeks of just slacking off
to remember that
because when I tried I think around 1.16.5 it worked
I thought it was packetevents
it started using the data in 1.17 as per that PR states, so fairly recently
so I did this
and it didn't work until I passed that yaw value
but in retrooper's case I need to pass it as pitch
scam
this will def break on like 1.9 but I'm not bothered
just fix it if someone ever reports it kek
are you still doing that one map image commission you showed me ages ago
😭
is this actually a thing
like server displaying ads in games
There used to be a plugin out there that posted ads every however many minutes in chat and the server owner would get paid out
so wouldn't be surprised
Rent cannot be this high 🥀
Imagine a google ads library in spigot API. Hilarious
weird request but can i make a specific enchanting table be max level without adding more bookshelves?
i got this design but it's only 22 rn, and i can't think of any other design
are you asking if you can do that with code or are you just trying to minmax the amount of bookshelves
i want it to be level 30 with code but on the outside i don't need to add more bookshelves
yes it is a thing to place ads in games
I meant like, in minecraft
I at least don't think I've ever seen that done before
unless it is like, an ad for an affiliate hosting or something
@quaint mantle what's with the ghost reactions
well pool of potential ads is like very small really, however pay per click is still a thing and doesn't require javascript and rather someone to just click a link
you can even open external links with the client
I just imagine someone freezing a player in waiting lobbies and force them to watch ads on a map lmao
however pay per click doesn't pay all that well though and really you are wanting the conversion instead
conversion pay is significantly higher and its when someone clicks your link and also signs up
they've been reacting to a lot of messages today
with an interesting choice of emojis too
they've reacted to two of mine with a ghost so I just assume it is a bot
zero messages too
I got thrown for a loop since I couldn't find where the heck the enchantment table was handling the bookshelf counting for enchantments
i've been looking for it as well
I was under the impression it did it whenever a bookshelf was placed but turns out it does every time the inventory opens
damn imagine making like a pvp arena and putting a shitton of ads on the walls
profit
Hi, What's the best way to spawn holograms on all chests in a world?
Probably on chunk load
I believe you can get all tile entities in that chunk inside that event
public void spawnHoloInWorld(World world) {
for (Chunk chunk : world.getLoadedChunks()) {
for (BlockState state : chunk.getTileEntities()) {
if (state instanceof Chest) {
Location chestLoc = state.getLocation();
spawnHologram(chestLoc, "Test Hologram");
}
}
}
}```
I'm doing it this way but it seems really inefficient
okay, can it cause lag under high player counts?
Anything can cause lag under high player counts
I was looking to squeeze out some extra performance
I mean, it shouldn't be too bad
If you use the event at least you’re not iterating over every chunk in a world, that already in itself saves some performance
@EventHandler
public void onChunkLoad(ChunkLoadEvent event) {
Chunk chunk = event.getChunk();
for (BlockState state : chunk.getTileEntities()) {
if (state instanceof Chest) {
Location chestLoc = state.getLocation();
hologramManager.spawnHologram(chestLoc, "&aTest Hologram!");
}
}
}```
```java
public void spawnHologram(Location location, String text) {
if (holograms.containsKey(location)) return;
Location holoLoc = location.clone().add(0.5, 1.5, 0.5);
ArmorStand stand = (ArmorStand) location.getWorld().spawnEntity(holoLoc, EntityType.ARMOR_STAND);
stand.setVisible(false);
stand.setGravity(false);
stand.setCustomName(text);
stand.setCustomNameVisible(true);
stand.setMarker(true);
holograms.put(location, stand);
}```
This looks good?
Yeah I'll work with it ig
When spawning an entity that you want to modify like that use the spawn method that takes a consumer
You can use display entities 1.19+ btw
That will sure it's modified before being spawned
um I might get bombed but im on 1.8 😭
haha, I like DisplayEntities btw makes life so much easier
Why tho
Kidding ofc, I mean it’s not a bad thing just don’t expect many to help all that much here… we hate on outdated software but for good reasons I assure you
I see
Same thing applies to display entities, but whatever your case should still modify with the consumer
I am trying to make the click to deposit thing that hypixel has on bedwars
That doesn't explain why 1.8
cuz the server is on 1.8
💀
and why is that
1.8 pvp can be replicated fairly accurately with data components on items
Yes, stuff will be different like swim, sneak, hitbox size. But better than being on decade old version
?howold 1.8.9
Minecraft 1.8.9 is 9 years, 4 months old.
It's a setup that i have i didn't make it so yeah
Use 1.8 if you want torture
If you're working for someone then it's understanable a bit
Yell at them for using an awful version obviously
Yep
did you just say using 10 year old versions isn't bad
Yes and I only say that because of how many people still use it, not just devs, my point being 1.8 still has appeal but other than that the impl was worse just as the api… so as a dev it will never be a good thing but again regular people/server owners etc still want to so
I will always find it weird just how the view of people using older software warped from something undesired yet acceptable to something completely outrageous
it's just like using a different platform, it isn't bad or wrong to do, just different. While there's always the ongoing joke about how people should update and stop using 10 year old software, it's no more than a recommendation, if they want to stick to whatever versions they want, then that's fine. I'd understand more if this was a certain competing platform's discord were they explicitly forbid help for older versions but that isn't really the case here
it's a version full of bugs and exploits that does not get any support nor fixes and you're pretty much just on your own. in terms of the API, it was very lacking ten years ago
that's the problem of people who use it
anyone using it is plenty aware of that
That's correct
besides, it isn't like there haven't been attempts at modernizing older software, there's forks out there which bring new API to older versions where possible
There are things in older versions that are just more appealing for a lot of people
mb I didn't read the rules
For example I find modern modded mc to be completely boring, but 1.7.10 - 1.12.2 completely amazing
there was a free one out there, I don't remember the name tho
it's the first result when you search spigot 1.8.8 fork anyway lol
panda spigot
Hi im trying to make a fake player appear in the tablist, how can i do that? im pretty new with packets... some suggested PacketPlayOutPlayerInfo but I don't know how to implement NMS, I'm using Maven btw
is there a good documentation about this
No it's NMS
so you're mostly on you're own
You can look at mappings and the protocol wiki
but other than that take a look at how it's used in nms and do that
?nms
?mappings
Compare different mappings with this website: https://mappings.dev/
?protocol
thanks, i can already feel that it will be a pain in the ass
yeah if you've never worked with it before
how to make an action happen every week at the same time? like friday 8 pm
you could just use a plugin like TAB tbh
it has an API
what does TAB stand for xd (or is it just tab)
idk but you click tab to see it
oh yeah i've found it
by default
the plugin, TAB
oh
thx
sorry
Hello everyone, I would like to know what is the best NPC plugin for Minecraft in 1.9 if you have any advice.
are you looking for a plugin to use as library for NPCs or just a NPC plugin? Because if it is the latter, then that's more of a question for #help-server
that said, probably Citizens. Or if you want a library then Lib's Disguises
it was just to have skins with specific skins for some sort of ranking
thanks you very much 🙏
Hey, does anyone know of a good weapon or gun plugin for Minecraft? Looking for something that adds guns with custom features like reloading and aiming mechanics. Any recommendations?
currently using 1.8.9 right now
Crackshot is pretty good iirc
i've been using that plugin for a year, i want to try another plugin
Any recommendations?
i love this kind of texture pack
This isn't 1.8 based tho
bois halp i added fawe as maven dependency and it builds but my IDE does not recognize the imports 💀
is there a guide on custom events? eg how to create one? and use it in other plugins
as an api
eg.: i've made a permissions plugin and i want something like PlayerChangeGroupEvent
with custom parameters
im eclipse enjoyer 🥲
ty
of course you are
ah it didnt point to the correct maven config
its been a while since ive worked with a bs language
yeah xml does suck
do you have to always call new? is that a bad thing?
y-yes you have to create an instance of your class...
its been a while 💀
do I have to batch block changes myself or how do I let fawe handle it
Does anyone know a good guide/tutorial for custom world with the plugin?
WorldCreator
ja but im wondering if I can say change 100M blocks in one edit session and have it be batched by FAWE to not overload the server, or if I have to manually flush 100 1M block edit sessions.
also if working with FAWE can I build the edit session and call EditSession#flushQueue() async and can I keep reusing the same edit session.
You can do it in one batch asynchronously just fine
Is there a specific way i'm supposed to store NamespacedKey(s) so that I can access them later on?
For example consider this class (a subclass of my plugin's "main")
final class PDCLocationKey {
public final NamespacedKey ITEMSTACK_ITEMKEY_STORAGE;
public final NamespacedKey ITEMSTACK_UID_STORAGE;
PDCLocationKey(final @NotNull FoxutilsItems plugin) {
ITEMSTACK_ITEMKEY_STORAGE = new NamespacedKey(plugin, "fox_item");
ITEMSTACK_UID_STORAGE = new NamespacedKey(plugin, "item_uid_storage");
}
}
and then
public PDCLocationKey pdcLocationKey;
@Override
public void onEnable() {
pdcLocationKey = new PDCLocationKey(this);
....
}
This was the best way I could think of doing this , but then I run into an issue when trying to access it later on, where I either need to grab it by the plugin's name from Bukkit which seems jank, or store a static instance ( x#getInstance() ) which seems to be frowned upon
{
final PersistentDataContainer persistentDataContainer = itemMeta.getPersistentDataContainer();
final PDCLocationKey pdcLocationKey = FoxutilsItems.getInstance().pdcLocationKey;
// Stores the item class's itemKey (The key that identifies the created
// ItemStack as an ItemStack of whatever Item-class (template)) at the foxutils-items:fox_item location
persistentDataContainer.set(pdcLocationKey.ITEMSTACK_ITEMKEY_STORAGE, PersistentDataType.STRING, key.toString());
persistentDataContainer.set(pdcLocationKey.ITEMSTACK_UID_STORAGE, PersistentDataType.STRING, UUID.randomUUID().toString());
}
(how I am currently accessing it)
WEAPONMECHANICSSSSSS
the myth the legend
especially if its with the premium addons
where is this resource pack? i want it
Is there any good example of making good command TabCompleter?
Can i also ask about ProtocolLib?
use
packetevents
under no condition should pl be used
legacy
Can packetevents be used also to create fake players on tablists
rewrite it
yes it can
it's a better protocollib
https://docs.packetevents.com/getting-started did you add the repo
yeah i've taken it from the same website
and did you replace PLATFORM with your platform
public final class PDCLocationKey {
public static NamespacedKey ITEMSTACK_ITEMKEY_STORAGE;
public static NamespacedKey ITEMSTACK_UID_STORAGE;
private static boolean keysInitialized = false;
static final void initializeKeys(final @NotNull FoxutilsItems plugin) {
if (keysInitialized)
return;
ITEMSTACK_ITEMKEY_STORAGE = new NamespacedKey(plugin, "fox_item");
ITEMSTACK_UID_STORAGE = new NamespacedKey(plugin, "item_uid_storage");
keysInitialized = true;
}
private PDCLocationKey() {
}
}
¯_(ツ)_/¯ man im clueless
is this considered static abuse? i guess i just need a better definition of it
that's not static abuse no
Is there a specific definition of it so im not needlessly questioning myself and "scared" of static
this
thanks
How do I discard a fawe edit session before flushing
do any ASM nerds know if i still need to call super.visitCode() if im using a MethodVisitor and effectively replacing the Method body
right now i override visitCode and just call visitInsn(RETURN) in it and it works, but it feels wrong
You’re setting it to null right?
When you override visitMethod(), you should return the original method visitor (super.visitMethod()) for methods you don't want to modify. For methods you do want to modify, you should wrap that original visitor. Looks like your code is returning null for methods that don't match
That’s just a bit of advice ^ but to answer your question directly. In this specific case, you don't need to call super.visitCode(). All that is in MethodVisitor is just a notification that the code section of the method is about to start. If you’re essentially removing that part of the code, there’s no point in doing it.
the javadoc for visitMethod had mentioned returning null if my ClassVisitor isnt interested in said method, so thats why i return null until im actually editing a method
declaration: package: org.objectweb.asm, class: ClassVisitor
Oh nah you’re good then bro
Also didn’t check but are you using VisitEnd? Good practice
i wasnt sure if i needed to use it since there was like an "order of how things are called"
I'd just use the tree api
and there was a lot of stuff between visitCode and visitEnd i didnt want to get missed
funny u mention that
i was using it previously, but i wanted to see if i could shrink file size down bc of shaded deps
it's only a few classes
yeah but it was like 50kb more
(im probably forgetting to use minimizeJar or something idk)
i got really anal last night about how large my final jar was lol
you got what?
https://asm.ow2.io/javadoc/org/objectweb/asm/MethodVisitor.html class javadoc made me uncertain abt calling visitEnd lol @mortal vortex
declaration: package: org.objectweb.asm, class: MethodVisitor
i do not in fact use minimizeJar
that probably explains a lot
girlllll idek
you got this no matter what queen
i mean it works in its current state
defunct by now since i think mojang updated their libraries across the board to use either newer or a patched log4j
but i like touching up old projects
Guys i decided to do smth very evil
u switched to Paper?
no
🙏🏻
Well i like paper and i sometimes use it for clients that requires it
apart from that,
I decided to override bukkit's original command map
and integrate it with my command framework
i almost asked why would a client require paper and then i realized u meant People, not the game itself
now make it work with Brigadier
Lmao, I do some freelancing when im free
WAIT, IT ALREADY DOESN'T ?
i mean bukkit commands dont natively work with brigadier iirc no
thats why uhhh commodore exists i think
Technically, my command framework automatically integrates with brigadier of all mc versions
it even works on legacy versions like 1.8 (except that any ver below 1.13 doesnt integrate with brigadier)
obv, game didnt ship with it 
Im gonna make it an option to override the whole server's command map
Does anybody have an idea on how to erase all vanilla commands from the server?
but why
rip /gamemode, gamerule, etc
a permission plugin
More like a no permission plugin amirite
true true
i want to say theyre handled internally by NMS but im not sure, since permission plugins can grant/revoke them (citation needed)
minecraft.command.<command> 🙏
I have found out they are handled by CraftServer class and part of it is handled by NMS internally too
I found out that bukkit has smth called VanillaCommandWrapper which extends bukkit command and wraps around its fields giving them the values of a vanilla cmd
The only way i can think of rn is to inject (somehow) an executable that removes the commands after they are being registered
(I discovered that vanilla commands are always registered again AFTER a plugin enables)
@quaint mantle if you're so smart, why don't you suggest a way to achieve this ?
other than creating a wrapper for the CraftServer obviously
?kick @quaint mantle automated reactions
Done. That felt good.
"rage bait master" lmao
Emily is his successor now lmao
https://imgur.com/a/uBrcrqf i dont know what i did wrong with the build path, but everything i put related to bukkit it shows as an error
Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.
Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163
im already doing this
The question is, which build tool are you using?
Maven or Gradle ?
I don't see any build tool file
That likely means they aren’t using one
Which means he didn't follow the bootstrap jar instructions
That’s not what that means
If you're not planning on using any build tool, just depend on the jar directly as an artifact (I DO NOT RECOMMEND THIS)
neither
well
its on the build path
so i think im using it
The default build system in eclipse is just ant
Iirc
You really should use maven or gradle thoufh
Okay i found out that luckperms does it using CommandPreProcessEvent which i don't wanna end up using :((
then just use luckperms??
I'm not making a permissions plugin, I'm making an option in a framework of mine
https://imgur.com/a/9D5Iz8i i put both on build path but its still the same
it literally does not
luckperms has an API
it does now
source: trust me bro
yes, and check what it does in there
its for OP commands only
op and deop
which LP lets you disable op's entirely
it isn't for op commands
you can be deop + permission for, like, /tp
you were talking about "all vanilla commands"
with LP just deny the permission for the commands, minecraft.command.<command> and you won't be able to run 'em
fortunately LP can ignore op status if you so desire 😄
I meant "/op and /deop" here
I stated that luckperms has an option for disabling THESE commands, through the CommandPreProcessEvent
Again, I'm not planning on using LuckPerms since im working on a third party framework that is Public , not everyone uses LP
I desire to ignore all vanilla commands, which unfortunately have no other way around other than using CommandPreProcessEvent
Will it stop me from getting my grubby hands on the operator items tab in creative
Ignore the fact that creative mode lets you do pretty much whatever
99.99% of servers do use luckperms
genuinely have never seen a server not use it
I mean the project is a command framework.
it should be associated with commands not permissions.
Man, is it that good ?
I haven't read its full src code tho , so i dont know
in my opinion, yes its that good
it has everything you could want for a permission plugin, its fast, intuitive to use. not much else any1 could want.
are the messages configurable ?
of course
if i start to use maven as build tool when my project have a lot of things it will create errors?
Something in this code: https://paste.md-5.net/unagucebaf.cs (specifically inside the for loop, I checked by commenting it out)
causes this error: https://paste.md-5.net/axivojotux.php
and disconnects the player from the server
Caused by: io.netty.handler.codec.EncoderException: String too big (was 36 characters, max 16)
seems like there is a string that is too big for some reason, but I'm not sure what or why its an issue. I'm using strings for player UUIDs... Am I doing something wrong?
“A lot of things” doesn’t exactly tell us what might go wrong, just make sure to include dependencies
I’m guessing you are trying to use offline players with names longer than 16 characters
Same guess
Names shouldn't be even longer than 16 characters or no ?
Imagine UUID.fromString(String.of(uuid))
I think you could make a verification check on the name if its even valid
@earnest girder
ok
smth like
if(memberName.length() > 16) {
// ignore OR throw an exception as you wish
}
okay, thanks
I think im using the method getPlayer(name) and inputting a UUID as a string by mistake
np
also if you're planning ignore just do
memberName.length() <= 16
start commenting out each line that edits meta one by one and see what causes the issue
That is exactly what you are doing
but yeah also defensive programming like Mqzen said
Also fully arbitrary but that could be a foreach loop
wtf is a toString
Idk you tell me kotlin nerd
I mean String.of(Object object) uses object.toString() internally, so no big deal lol
Extra cpu cycles. Fired
Micro Optimization nerd alert !
Rad go to bed already btw
are you wanting to delay my execution by 0.00001ns
I am I just can't sleep
Melatonin
don't have any
It isn't the only cause of sleep btw , it's one of the many factors that lead to sleep
This introduces extra cpu cycles too

true
Why do this when you can do "" + object
now that's ugly asf
haha
so true
Me when i see this
String.format("%s", object);
Stop, you're killing me 😭
that's just unnecessary
Rad did you fall out of your Harry Potter phase yet?
spigot help-dev coming up with all possible ways to get the string representation of an object
nope :)
still working on that spells plugin
Take this bomb: String.format("%s", String.valueOf(object.toString() + "") + "")
Where’s the second kaboom then
Ok I’ll make it… in my mind then tell you what to do
would tracking a specific WrittenBook be a pain in the ass? also.. can it be a virtual book? so that player doesn't actually get it in their inventory? I'm just trying to get some input, and when the book is closed, I want to read from it.
how do i download better internet
Where do I download thread safe spigot
https://papermc.io runs
is this better internet?
no answer me
this is not internet this is something else
is it geometry dash?
its minecraft web version
naw, they sell paper for your printer
i dont have a printer.
Well now how about a printer for your paper
how about a printer for your printer for your paper
how about printer for your printer's paper
Twice printed paper
how about not printing
how the heck do you open a book but not store it in the players inventory
isn't there like Player#openBook or sth
have you tried not opening the book?
or was that an adventure thing
i love adventures
kyori adventures?
well, it's merged into the paper project now
JVN 063
?
number platep
???
JVN 063
Agreed
if I'm allowing players to create a gang/faction with a name, and I save their gang to a file that stores the owner, members, and other info:
should I use an integer as a "gang ID"? Or should I use a string (the gang name) as the ID? Players wont be able to create two gangs with the same name.
Should I just use the name for keeping track of which gang a player is in/the name of the gang file, or should I create a new integer field?
Why not use a UUID
well, thats extra data i have to store. I could just use the name as the UUID
right?
What if they want to change the name
The problem with int is ofc that its not very friendly if u expose that to end users
which event triggers pressure plates
I update the data (but first check if the new name is already in use)
Interact iirc
PlayerInteractEvent with the PHYSICAL action
Ass-pressure™️
tf is action
players will only see the name on their end, the int ID would be behind the scenes
You’ve never used Action.RIGHT_CLICK_AIR?
nope
Or LEFT_CLICK_BLOCK
nope
intactions such as clicking blocks or air (or physically trampling crops or stepping on pressure plates) trigger PlayerInteractEvent, from there you can check which kind of action triggered it with Event.getAction
If u want to ensure unique gang names, then making it a part of the id is obviously quite smart, but else you can like go with a uuid, if u wna incorporate timestamp when it was created u can do sth like
new UUID(Instant.now().toEpochMillis(), someUniqueIdGeneratorForLongDataTypeIfSameMilliscond)
randomly generated UUIDs will make everything generally easier if you need to adjust or expand your logic later
okay, but there wouldn't be any problems using the chosen name itself as the ID as long as I ensure they are unique, right?
Isn’t there a uuid version that includes the time
Tho using numerical incremental ids is a common technique, tho usually u bind
NumId to UUID in a table and then u have another table with UUID to DataAttributes or somethinf
an ID is generally assumed to be immutable; if you use the name as the ID, and then you realize you want to allow players to change the gang name, you've painted yourself into a corner
ofc not, I’d suggest making sure u properly guard those strings
using a numerical incremental id is fine but it adds some extra complexity in having to somehow track the next available id
this is generally undesired redundancy and can easily be normalized in a sql table anyway, so it's scarcely worthwhile
i dont see how thats a problem though, I can just update all the places the name/id is stored after ensuring the new name is unique
yea usually ur database is where those numerical ids stay
exhaustively enumerating every reference to the gang may not be easy or even viable
suppose for example another plugin that uses your api to refer to some gang
how are you going to update the string they use as the id?
this is why id's are expected to be immutable
I'm using YAML files
previously I was generating a new int as the gang ID and using that as the file name, as well as the data field in each player (gang member)'s file
I mean tbh, ids being just names is fine, you can do some tricky stuff where u create a new gang and copy the old gang data if u wna change name of the gang
whilst getting that immutability
And tbh, renaming gangs won’t happen very frequently right?
nope
i'd avoid it out of principle but yeah name as id is doable as well, i just wouldn't recommend it
Means you gotta create a new file and then yeet the old one to rename
Doable but just kinda meh
okay, no way to just rename a file from the plugin?
^^ if u do pick strings, encapsulate those in a class and properly restrict instances of that class so u can’t have a name of some weird characters like tab chars, random ascii chars etc
Isn’t there a method in Files to do it atomically at least?
Ye
the tricky thing with using an int as the ID is that I have to map IDs to names
and when a player creates a new gang I have to figure out what the next int is based on the gangs that already exist
I thought u were using sql
just curious, how does UUID#generateNewOne know its unqiue?
If not, then yea, avoid numerical incremental ids, just a hassle for u
It’s technically not
It’s very very unlikely for it to be a duplicate
yeah
its just a very small chance to generate a duplicate
But technically you can just add a check for that
But @earnest girder this will give a unique one tho
If new file(ourNewUUID).exists() then buy lottery ticket
or well, until we run out of space, only 64 bits
Isn’t that in like 2038
okay, ima use a UUID
Sooner than expected!
i mean chance of duplicate uuid happening is like 1 in 5.3 × 10^15 on 1 trillion uuids
so pretty unlikely
128 bit w uuid, but if u do it with epoch time for the MSB its 64 bits
what the heck
Caused by: java.lang.IllegalArgumentException: ItemStack Material (WRITABLE_BOOK) must be Material.WRITTEN_BOOK
doesn't uuidv4 use like a local timestamp and the mac address or something to make it unique down to the current millisecond and more or less unique to the machine? it's practically impossible to get a collision because of this, unless you generate millions of them per second on the same machine
obv u can be freaky and use like 64+32 bits for epoch time
Yeah with 64 bits we’re good for 290 billion years
i remember this being brought up at some point because the uuid's generated by like microsoft word allowed people to fingerprint the machine the document was written on, as they hashed the mac address or some hardware serial number
not sure if they're still used
tl;dr no you're not going to have a collision
By specification? Unsure if Java upholds that
secure random
just
Very slow
does minecraft not have an api for editing an open book? without the need to place it in the player's inventory???
^ (jisho)
Don’t think so
That’s basically client sided no?
Versions 1 and 6 (date-time and MAC address)
Like when u edit a writable book on the client
okay nevermind, v4 is just random bits
Oh yea but does java support those
not out of the box i don't think
fair then
this is a dumb question but can I store null in a YAML file?
with ints I was doing -1 for no gang, can I just store it as null if I switch to UUIDs?
Version 7 also includes timestamp
Hello, did someone made a utility class to compare minecraft versions that is robust ?
Like java Version.getActual().isPost("1.17.2")
or smth like that ?
well that is weird... but with signs that's possible? you can put text in a virtual sign and then close it andread from it
yes, yaml allows nulls
Yea
thanks
iirc the tokens for it are ~ or just NULL
I assume you have a bidirectional relationship @earnest girder
Doesn’t spigots yml system just remove the key if you set it to null
i don't remember, i don't think it does
could very well be the case, u might be able to configure that w the options thingy
usually it's not desirable to discriminate between an absent mapping and a null mapping anyway
w/o calling snakeyaml
declaration: package: org.bukkit.configuration, class: MemorySection
Yeah it removes the mapping
either way, when you do get for it later it returns null
yea
Tough not to use a relational database
Mongo >>
Yeah but no, they kinda have different use cases if you really have to scale and need to care about that, with sql u can define nice invariants also on queries which is super useful when your data types start to have relationships
What are the use cases for mongo ?
when stuff are simple(no relations) ?
when the data you’re storing is unstructured
Obv you can still use nosql for relational data
Its just that its more bug prone and ur middleware now has to act on data invariants to hold at all times
nosql is nice for unordered stuff yeah
something like a grocery store is nice on sql because it's all "product" | "price" | "amount"
But something like bukkit's PDC system is inviable with sql
Unless you json it
That’s why I use NoSQL to store me life 😩
yaml
Understandable
I'm still learning some advanced sql concepts like JOIN, UNION
There's a weird concept i still don't comprehend till now
The OneToMany and ManyToMany or ManyToOne
My brain goes brrrrrr when i try to understand them
Flatfiles
i love gson
oh that’s basically the “why” to sql’s power mqzen, M-M, 1-M, M-1 and then ofc the normalization forms
its basically just object oriented, where each table is a class (i don’t know if its a good analogy?)
oh so it's not a sql statement ?
just an ORM based concept i suppose ?
^
Time to spend some months on mastering Hibernate
Obv u use sql to define these things
Like creating a table where certain attributes (columns) are associated with other attributes (columns) from other tables
Okay , but for example
What sql statement i can write to apply the concept 1-M (an example concept)?
Like how would i construct the idea
im just going to store it as a string instead of a UUID, so storing "" wont remove the entry, right?
and converting the UUID to a string for use isnt a bad idea right
A pet can only have one owner
What if a couple owns the pet
Im sure u know how to create this in code (Object oriented specifically)
OHHH i have been doing this for a very long time without knowing the concepts behind it lol
but in sql, the only main difference is that we need to give pets and humans identifiers also
a unique id column ?
Yea, ofc u could use mongo and just store an array of pet ids etc, but u may compromise on the invariants (for example the invariant could be that if a pet is deleted, then the owner no longer owns that pet), and then the only way to guarantee this invariant would be through ur middleware, java code as an example
Yea
so let's assume there are 2 tables, one for the pet-owners(humans) and one for all the pets owned by people
the pet-owners has the following columns:
ID | NAME
thats without doing that concept
but when we apply for example the One To Many concept
the pets table should be like this
PET_ID | PET_NAME | OWNER_ID
where the owner column has the ONE owner to that pet
and can have duplicate values SINCE one human can have multiple pets
while guranteeing that pet_id is unique
then maybe we can construct a relational column between "ID" in the pet-owners table and the "OWNER_ID" in the pets table
to load the rest of the human's data for constructing a human/player data object
Yes so usually when you deal with one to many relationships iirc a common strategy is to define this relationship with a new, third table
Okaaay, I think i began to understand it
yea and then you can have a compound primary key
So for example let OwnerId | PetId serve as the unique key
I should really practice this , its really interesting
Alr continue
Or sometimes you will have an id on the relation table itself so RelationId | OwnerId | PetId
(Underline = primary key [means unique also in this case])
and then the Pet table, as well as the Person table both refer to the relation id instead
Why third table for 1-m?
just as an example, there are different techniques to this, and there is this entire abstract relational algebra as well
Interesting indeed
Thanks for the explanation, really helped
More to explain, but yea u ofc dont need it (edit - introducing a third table/scheme is usually for m-m)
@clever zephyr ^^
Okayy, so a third table in m-m cases is basically to flatten down all the related columns into 1 table right?
one to many for simple reasons is fine w just like
Human(Id)
Pet(Id, OwnerId references Human(Id))
yea
the way we learned this at school was with a supermarket supply chain
Sounds like a good way to represent and solve it relationally tbh
each product can only have one brand
each brand can have multiple suppliers
each supplier can supply for multiple supermarkets
but each supermarket for one product can only have one supplier?
weird constraints
I don’t think that’s how it works
yeah not that last one
My school didnt teach me any real useful programming at all
Only VB and some HTML xD
I have learned coding all on my own, I'm a self taught dev and I'm proud of it.
every kid in 10th grade has uh
computer class
and we learned how to use MS access on it
which is basically sql
Well you also have stuff like inheritance in this kind of domain, for example
Post(PostId [primary key], SenderId)
ImagePost(PostId [foreign to Post(PostId)], Url)
TextPost(PostId [foreign to Post(PostId), Text)
so both TextPost and ImagePost inherits Post, ofc u can have one big fat table with nullable columns (attributes) but its bad cuz now u lose these invariants (conditions and relations that always have to be true)
also in the database world, we call tables for data schemes, i don’t know why but yea
annoying
my actual comp sci course was VB and SQL and i think? Java near the end of it
not in egypt man xD
my course was also comp sci related which means we did python, php and C#
i wish i remembered the SQL stuff but i havent had something ive made that needed to use it
and yeah we also did sql at the end
and nosql
mongo n shit
I skipped half my lessons I don't remember much
i wish it was C#, i ended up teaching myself c# a couple years later anyway, and who the fuck uses VB in enterprise
Ye vb is crazy
we also tinkered with arduinos
around the end I realized my course was webdev oriented
and they released an iot focused course that actually does java
VB is pure shit
and they want me to host a workshop next year
i think we also did webdev in.. adobe dreamweaver?
:,)
Bro the application cannot close automatically, you NEED TO SPECIFY THE CLOSE SCRIPT When the user clicks on the CLOSE BUTTON
OMG
skill issue
triggering (the Close event)
Lol alright, but liiiike, the close button is fake anyway
Usually just an event no?
And then the app has to terminate gracefully by listening to that event
i speaking in general ^^
Like why the fuck should i do everything by myself from scratch in that language to construct a SIMPLE UI
frrr
That’s true
Never try VB
😃
Swing is wayyy better compared to VB
Good for your mental health
just plain old fuckin C# >>>
is VB worse than like JavaScript or webserver PHP?
Even JS is better
PHP , idk i didn't use it much
🥹
now dogging on JS was just uncalled for
Lol
but yeah VB is just
TypeScript >>
theres no reason it needed to exist
I'm amazed they haven't deleted it from existence yet
its literally backed by C# IL bytecode iirc
like for all intents and purposes im 90% certain its a subset of C#
😅
C#? pfft I do programming not music
F# then?
I did VB 6 back in highschool
One day🙏
Which is oddly fitting because VB 6 came out the same year I did
Out of the womb that is, not the closet
yeah wikipedia literally says they compile down to the same kind of bytecode
C# and Visual Basic (.NET) are the two main programming languages used to program on the .NET framework.
That’s kinda nice tho?
I’d rather use C# tho
I thought you were a musician
VB may be in second place, but why bother with second place when you can use first place
the only thing i hate about C#
is that they don't do the same naming patterns as java in methods
tbh they used to back in the days when C# had just skidded entirety of Java
Camel case >>
then to avoid getting caught, they switched some stuff including those naming conventions (lore accurate 97%)
my issue with C# is generics but its bc 1. theres no type erasure like in Java (iirc) and 2. im just kinda Stupid (skill issue)
C# also forces you to prefix your interfaces with I
erhmmm Haskell
excuse me what
Well, not forces, but visual studio will get angry with you
okay nvm
Does it force you, or just convention because u cant see the difference when u implement/extend?
oh, thats just VS being ass as usual then
I mean it must be part of conventions then
You will I your interface and you will like it
gonna write a Java compiler that enforces that
🤨
Make it enforce UpperCamelCase too
I totally don’t write methods in normal camelCase and then wind up with visual studio going “UwU I smell a naming rule violation this method must start with a capital :3”
you would never
It’s a habit!
Hi; so I'm trying to code better (even if it's not really required because my plugins are small) and i'm currently trying to have a better solution for gui's, i'm an old-school getTitle person, but apparently it's been long-gone, but i found confusing answers on the forum (about getHolder mostly), so what's the "good" way to do simple gui's now?
?gui
InventoryView iirc
Map<InventoryView,Blah>
Where Blah is additional menu data
I would personally recommend you to use my simple GUI lib which works for all versions
https://github.com/Mqzn/Lotus
You can also try and make smth similar from the scratch by following the link Jishuna provided.
and then u add the entry on inventory open, and u remove it on inventory close
I don't do it that way tho
I cache the uuid to a view
oh yea that might work too
i'll check those three out, thank you ! 👋
it does seems a lot compared to the old ways tho lmao x)
old ways is basically inventory holder right?
but yk, the view constructed is not actually from InventoryView it's a custom class called MenuView i made
or just map some inventory instance instead of inventory view
The menu view i made wraps around the inventory instance and some other data
Honestly i always hid data i needed inside items data containers, so i just used getTitle, and that's it x)
💀
It's the worse way possible, but it worked (and it wasn't laggy)
Flashback to that one anticheat
Well tbh titles are like, doable, but its quite obvious what the issues are w them
Best meme
if it works it works mate
That’s fair, was more thinking if u wna have an inventory per player, or one static shared inventory for all players for a given menu ^^ - being able to pick
Until someone renames a chest
an inventory per player is less error prone ngl
It depends
Static ones can save a lot of footprint
that's why there was always an item i checked first with a metadata specifically created for it, never had a problem honestly
Of course the moment you want to update something based on the players permissions or whatnot, you probably want them seperate
From my personal experience , I have tried both approaches, an inventory per player is less error prone in all cases
Static ones are really prone to bugs when the inventories are changed alot yk
tbh in most use cases, the per player would win
How are they bug prone
true, but my menus are so simple, never needed it.
Like static ones are kinda like when u have a static web page and u render it server sidedly - once
I remember that i encountered some weird bugs while Updating the menu contents for all the gui players
That’s not static
In my case I meant static contents
Okay that's not bug prone
What i meant is, creating the API design based on 1 menu for several players
for example a set of menus to view online players
instead of per player view entries
Wait if I wanna find a dev where do I look?
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
oh bet
Yes that’s what we’re talking about
and its not bug prone per say
maybe it was like back in some early snapshot version of some spigot/paper build
You gave me a great update idea to my lib
😅
i will make a static menus API without the player context
saves performance for static inventories instead of always making them dynamic
don't try 1.8
For example we have static menus for auction house pages, and we also pool it since usually some specific sides (like the first couple of pages) will tend to be opened by lots frequently

That’s fair, and on click/open u can still track it
like the clicker
:P
ye exactly
I tend to always build my inventories when needed
Idk if it would be better to keep them in memory mapped to the owners uuids
Worked for me perfectly
Yea, well having a variety of cache policies can be nice
Like avoiding to rerender contents is always nice
but ofc, if its truly helping w performance by any significant means
Agreed
btw, I want your opinion on my pagination system that i made months ago
Here's the package
https://github.com/Mqzn/Lotus/tree/master/src/main/java/io/github/mqzen/menus/base/pagination
If you're free ofc
Am I allowed to talk abt it here
crzy
no and no
shi mb then
its okay
For pagination, I assume you paginate over an indexed list of items?
ye idk cuz I Js joined
yea i do
oo we're talking about menu libs
Ye
gotta get some inspiration
welp, after checking out everything, i am absolutely lost lmao, i'm too bad/dumb to understand anything
also it seems to be very complicated just to do 2/3 menu when the only thing that changes are some lore x)
menu.subscribe(MenuAction.CLICK_SLOT, (action) -> {
....
})
https://github.com/Mqzn/Lotus/blob/master/src/main/java/io/github/mqzen/menus/base/pagination/PaginationImpl.java
this is the main class for it
i have 2 modes for pagination
one for automatic pages (dynamic pages)
one for manually made pages by the user.
I like it, unsure if it scales well with lets say 10k items, let alone if u wna allow ascending, descending etc
well I’m not necessarily trying to learn, I’m just making a smp server like donutsmp but I need the dev for it and will pay too. I like my chances cuz I have a server w 5k members so I see potential
But ye delete my message if it’s not allowed
But looks like u got it quite nice and fitting w the rest of the menu api
tried it on 25K once , went smooth
go to spigot page and send a request
job announcement or something it was?
Where it at
Ah nice, how do you deal with rendering if I frequently add and remove items ?
What do I search
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
I still haven't made dynamic rendering of added/removes items/page-components
but planning to do like very soon
i could probably do it but im busy for the next few weeks with a project. you can ask questions in my dm tho
That’s fair, well its a good start, obv some feature are TBA then I presume? Sorting modes and rerenderability etc, but very nice
Yea, I already have these two on my TODO list for the lib
I have a custom respawn screen where players choose whether to spawn at their bed, their house, world spawn, etc.
On PlayerRespawnEvent, they are teleported to a dummy location and presented with the custom respawn GUI
The problem is that whether or not gamerule doImmediateRespawn is true, they always spawn at their bed spawnpoint and see themselves there for a split second before they are teleported and taken to the custom respawn screen
Is there a way to prevent this? Can I skip the automatic bed respawn entirely instead of teleporting them after the fact?
i think eventpriority.high would fix it
ah lemme try
You’re a dev?
The most useful feature i find is the FillRange for the pages
Which lets you determine the filling of items per page, where it starts and where it ends
I don't really like doing my menu filling stuff like that ngl
mye useful utility
At least for my use-case menus should always be configurable
there's also the default-contents per page
which is separated from the page's items
yes
best use case for the default-contents would be fancy panes for the pages
writing a nice API to hardcode menus is an approach but most customers actually like to mess around w the layout
Given its you illusion, I’d assume u got some interesting business and technical requirements as per usual?
They always need to be configurable and flexible enough to do whatever you want
my lib also provides a serialization api
currently rewriting my lib because the other business req I need is the ability to do per-slot logic
tell me if it fixed it
Like this slot only accepts this item
and then it changes this slot to confirm it's inserted type shit
Ah I see
I'm also considering adding menu animations
Could I dm u or nah
Making the entire menu customizable sounds annoying
yeah go ahead
It's not THAT crazy
That’s a lot of information you’d have to provide
iirc i also added buttons animations system
?kick 1266183754989305867 use ?services as aforementioned
Done. That felt good.
Well said babe
Item type, item amount, item name, item lore, all the various fancy item components, etc
btw is it possible to make dynamic menus configurable ?
Or do we just pull a DFU call w bukkit config DynamicOps :000
what does your lib do?
It’s possible to make anything configurable if you’re dedicated enough
well, Im sorry if I scared away ur customer, just not the place to be begging yk
yo
It doesn't need to be crazy crazy crazy
I just use an item builder that has like
config codecs as I call em
Wasn’t begging but ye
Feck it, just implement jshell and let the user program the entire menu themself
Current (OLD 3+ year old) API
