#help-development
1 messages Β· Page 640 of 1
right well i do know how it works so stop chatting shit honestly
you sure?
But putting a shitty drawing of 3 circles into 1 big circle isn't going to explain it well
yes π
will there be lag if there are more than 100 or 1000 queries per second in the database? how do i get past this?
i made it in like 5 seconds
epicebic was explain this but i wanna hear this from you
guys please put some effort in your explanations
Only if your connection is extremely slow. MySQL can handle hundreds of thousands of queries at once.
Especially with a pool of connections
although inalmost every case with spigot stuff never needed
yes there will be if the server isnt powerful enough. Try your best to cut down on the amount of queries. So like when a player joins, get the stored data and put it into a list. Preferrable a HashMap or HashTable
if your server is really so massive that there is 1000+ queries a second then you can hire people to help scale the servers
wdym for that
and how much ram and cpu am i need for this ?
Very recently as part of our library for example we've set it up that on enable it will grab data from a db and initialise an "sqlTable" class which is essentially a cache that periodically updated back to the dB (every few mins) the big changes.
Or if ur not a masochist, learn redis and implement a duel system of SQL and redis
A database is a piece of software written with the objective of managing data. It provides an easy solution to manage your data at a large scale, across multiple machines.
Depending on the type of database (SQL vs NoSQL), data can be stored in different ways:
-
In an SQL database, the data is stored in tables which consist of columns you write ("PlayerID is a variable character array of length 36"), which are then indexed by the DBMS (Database Management system, such as MySQL for example) so you can do queries like
SELECT money FROM player_data WHERE PlayerId = '...'; -
In a NoSQL database (Let's say mongo), the data is stored in documents, that look like "json" files (In practice it's actually bson, a binary version of json), where each document has an internal ID and is also indexed for queries.
To operate a DBMS, you must establish a connection with it. Most DBMS software is designed to handle multiple connections from multiple sources, and have safety checks such as internal locking and read-only views to deal with concurrent requests, so things don't become desynchronized.
Don't forget that your DBMS instance isn't made of iron, and you want to cause as little load on it as possible, so you need to have a balance between keeping data in cache on your program (plugin), and hitting your database with queries.
Once you achieve a huge load, it's important to shard your database, which means that segments of it are kept in separate instances and it all acts as one, with shared indexes. This allows you to hit different instances at the same and retain functionality while spreading the load.
If there are 1000s of data in a haspmap, how much ram will it consume?
not much, its mostly hard drive space you need. If youre using a server hosting provider then they should have MySQL support already
depends on teh data being stored
It's a very varied answer unfortunately.
It will 100% depend on the data being stored. E.g storing 1000 into would be be less ram than storing 1000 strings that are all 3 sentences long
you can cut down on it by storing stuff like the player UUID instead of the Player object (usually very bad pratice to store the player object)
*1000 ints
This is mostly done to avoid memory leaks
Leave the java GC alone! It's doing its best π€£
And it also demonstrates how you don't know how java's memory structure works π
and because the data in the Player object can change
me?
Yes
why ?
im doing for offline btw don't hate me :/
anyone else wanna try say i dont know how something π
Putting an object in a hashmap won't create a new copy of the object, but instead just add the memory address to its internal container
Because storing the player object leads to memory leaks
Noone is gonna hate you for learning bro
You're plainly giving bad advice
It's incorrect
I'm not saying to not try, just saying that the way you're explaining doesn't match reality
Yeah. That Player already exists. Putting it in a collection doesn't change that
Same amount of memory is used
I should get a teaching degree
minus the overhead of the collection itself, but y'know
so I can school people
it's really not bad advice
That's called being a redditor
ackshually
no its called mansplaning
Respectfully. Don't. You don't have the patience for it π€£
what do you think I'm practicing here
Being a bad lecturer?
yeah
Lol
how else is illusion gonna hire 9 year olds to work for 1/3 minimum wage
I already tested my patience by getting my basic programming degree while already knowing how to code shit
sry about that why i need storage player uuid ? not name ? for offline
please tell me you understand how pretentious this is
in my defense every single person I've ever hired is older than me and receives over min wage
Because player names can change.
Because names can change
In offline mode, so can UUIDs :D
:D
So you're fucked either way, really
So ill be the good student and actually ask, how come a player map can cause a memory leak? If the overhead is only in setting up the collection? Never actually encountered this explanation and I'm genuinely curious
Do color codes count as charaters in the spigot charater limit?
wait
Only attempt to explain something if you actually understand exactly what it does
Β―_(γ)_/Β―
in offline mod names is uuid ?
Depends on the API you're using
I'm not here to argue but at least know your shit
I thought there was a way to reliably calculate offline uuids for players?
the player object doesnt exist after they log out
It keeps refrence to the player object, but if you fail to remove it then it won't be GCed
Sorry I meant to say the scoreboard
There is. They're based on names
In offline mode it uses UUID v3 which is based on strings
Yes. But scoreboard limits were removed in 1.20.1
Ahhh I see. Makes a lot more sense
It's UUID.nameUUIDFromBytes(byte[] bytes)
they said would it store alot of data, i said if its a problem they can cut down by not storing the whole object. respectfully stop being pretentious
Wait really?
Yes
You can however use a WeakHashMap
For the prefix, score and suffix?
Yes
I just wasited a crap ton of time then
they can at the same time
:D
alright thanks
Can't wait to see plugins with scoreboards that go across the entire screen
1.20.1+ change though. Limit still exists in prior versions
So if it's a public plugin, at least be mindful of that
If you understand java's memory structure, you'll understand that literally everything (with the exception of primitives) is pass-by-reference and not pass-by-value. When you're storing an object in a collection, you're storing the reference of that object in the collection and there's a sort of "reference table" that assigns references to objects in the JVM.
Yeah. I still got to support those, but that explains a lot.
unless of course you duplicate it
Then you're just passing a new object with the same data
yes i know. I still dont understand how this goes back to my point though youre just trying to bring up something random to seem smart.
data which can now be changed indepndantly from the original object
how is that not true?
What I'm saying is that when you're dealing with players, there's usually only 1 instance of each online player, and the same reference is being passed around EVERYWHERE, including your map
Because they are both just a refrence to an object
I mean preventing a memory leak is saving ram. Check mate atheists
And refrences are all the same size
oh i see
alright i see my mistake my bad
When you put players in a map however, you're still holding a reference in that map which prevents the object from being garbage-collected. When the player then leaves and rejoins, the old instance is not GC'd because it's reachable by your map, but the new instance is also put in your map which results in a memory leak
Unless you use a weak map
^
I am gonna jump in and say what coll said could of been explained in like 3 sentences and we could of saved ripping the shitnout of this poor lad lmao
is there any like real reason to use runtimeOnly inside gradle projects if you're loading your libraries manually via the classloader? (provided runtime class path doesnt matter in that case, no?)
yeah thats what im sayign. Java isn't my main language there was no reason to make it seem like im giving bad advice when im just trying to help out. Illusion couldve just said what Coll did and then i wouldve corrected myself
?
I did the most technical explanation that resulted in same conclusion my dude
I'm not here to be pretentious and say that I'm better than everyone
Because I'm not, frostalf is more experienced than me
no you didnt. you literally said i was giving bad advice and that it just doesnt reach reality
and that i dont know how java works
over a minor mistake
π
Β―_(γ)_/Β―
You insulted him and said he was wrong.
It took like 5 mins to even give a reason bro.
He was wrong and a muppet. But my man take the L
Gotten π
lovely jubbly
classic help-development
youre still arguing. I was simply trying to help someone who is a beginner and instead you did all of what Raziel said all because i made a mistake then sent about 3 technical paragraphs overexplaing how java works rather than just telling it to me in one sentence
There wasn't one. You insulting someone and everyone else eyerolling is not an argument π
hows my copmmand wiki https://the-epic.github.io/docs/docs/simplechatgames/commands.html
me π€
How heavy of a task is ChunkSnapshot and if so how should I make sure I don't lag the server while taking (I forgot the work dist command)
Does a bunch of array copies, not that intensive
?workdistro
Uses a bunch of ram though
chatgpt says that you dont need to use runtimeOnly in gradle if you're using custom class loader
Looks AI generated.
please follow this guide
Looks a bit too beginner friendly
i wrote it but got chatgpt to formalize it kekw
If I had a dollar every time one of my students has said this π
docusaurus better
Like it just looks too.. beginner
If I use the spigot api but only use bukkit classes, etc, can my plugin also work on a bukkit server or no?
I'd asume not
Is it possible to send the text with a Custom Color via ItemDisplay Packet, because then you have to convert the string to a Component? I can't find a solution. :/ (ver. 1.20)
If the bukkit server is spigot maintained bukkit then yeah
Isn't Bukkit just an API, I haven't seen a bukkit server in a while
It is yes
craftbukkit is the server implementation
You need CraftBukkit to run
Everything is usually spigot, paper+ or some off-brand minestom/glowstone platform
You've probably never seen a Bukkit server
i mean its pretty much plug and play so it wouldnt surprise me if end users didnt understand halfof it
Given that, y'know, it's not a server π
Yeah so why write a guide
i mean. whatβs the difference lol?
do you not run cb to test prs
Looks too formal imo
idk, i was bored
oh no, the .spigot() is gone
VeinMiner has a few
run the command accordingly
Yes but you will never see me do it
Can be simplified
Spigot adds a few events and methods
Subsequently
doesnβt chocos PR add more of those .spigot() piles of garbage
i hate the spigot interfaces
I'd replace it with a "Once ran"
Great PR though
Fun fact though, the current Spigot interfaces aren't actually interfaces. They're classes
I'm adding interfaces now though
Why is that? Is there absouletly nothing that can be done to not put it under a submethod?
Not without giving it a stupid name
I mean we could use weird names
e.g. getNameComponent()
Or make it take a param for no reason
You're welcome to PR a replacement in Bukkit π
We're trying to move out Spigot-exclusive API tbh
hmmm, weirdly I missed this debate
doesn't matter anymore
maybe not, but I still missed it lmao
anyways I am just going to assume you are correct regardless then
https://paste.md-5.net/hosazorexe.md this is somewhat less formal i think
can't bother reading that
there is plenty here who are not staff that are very experienced
Sure maybe it brought those 2 people to my DMs
which is better https://paste.md-5.net/xewewocure.md me writing it or me writing chatgpt formalizing it https://paste.md-5.net/hosazorexe.md i feel like it may read better me writing it it just looks bad to me though
But we're just here to help each other
and to guide the lost and teach the new
I'm only here because I was asking for questions a few years ago and now I'm experienced enough to be able to guide others
is my connection right and hikari works like this ? i set config and equalize with connection after change some datas with statement method ?
and where can i find properties like maxpoolsize or more ?
I am here because bukkit died
boomer
and also to give us the moneys
speaking of moneys can I have 2 grand I wanna visit the states
Weren't you a prominent member on the bukkit forums?
ππ
Not my fault the staff abadoned ship. If I had known ahead of time they were going to this, I would have stayed XD
I was a bukkit dev staff member
so in a way, yes
this ironically is probably the price to fix my car currently
yeah but hotels cost a lot though unfortunately
and airbnb isn't anymore helpful on that
I gotta get new glasses π
I got contacts
was going to say, that is the most I have paid for glasses XD
Why?... Idk if Im stupid or what π
String version = "1.1";
String[] versionSplit = version.split(".");
PersoKits.console.sendMessage("0: " + versionSplit[0]);
PersoKits.console.sendMessage("1: " + versionSplit[1]);
not that I need glasses but my SO does
They'd be much cheaper but my dad decided that a 70% discount due to insurance were just them trying to scam him into buying them early
is there any reason to use runtimeOnly classpath in gradle while developing spigot plugins
i cant see any use of that
So instead of paying like 100$ for frames and having free lenses I gotta pay mad cash money
use split("\\.")
Yay regex
And I do need glasses for driving
70% discount? that isn't too bad
that would mean the glasses would cost you like $100
half price on frames and free lenses
So yeah like 100 bucks
Which is much less than the like 350 I'll have to pay
Frames are always so damn expensive
because he'd be buying it after like 2 years instead of once every 5
I mean insurance itself is a very elaborate large scale scam, but I mean the choice of having and not having it though is a very big difference however regardless
it was their own insurance
that works, thanks. But I don rly understand why..
Regex
30 bucks and you get free lens replacements for 2 years
- 50% on frames
n some other things
. is a special character in regex
Oh, I see... Im stupid thanks
What ide are u using marek, I think ij scream if you don't escape dot
If I give money to one of you, will he be able to answer my questions?
alright
Eclips... I know is horible
That explains it π
π¦ xD
i wanna understand hikari work
- i set config to hikaridatasource and i connect with hikaridatasource ?
I never used hikari so I'll just let jesus take the wheel
or someone else
any of y'all used hikari?
yeah
Yes
ill let coll explain
Go for it then
It manages a pool of connections for you, you grab a connection from the data source with HikariDataSource#getConnection and then just close it when you are done (try with resources)
HikariConfig is what you pass to the constructor of HikariDataSource to specify config options
Chat components
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
I personally use boneCP
in protocollib, how would i get stuff that have the field type as VarInt?
It's just a regular int
I thought there was a getVarInt
Nope
ProtocolLib wraps the nms field class and not the contents that are then encoded
Meaning it doesn't match wiki.vg/Protocol
There's no VarInt class that's used in nms, that's purely a byte encoding thing
So if you have any int fields in the packet class, getInt to access them
hi choco
And any nms fields in the nms packet class are just their wrapped counterparts in plib
RE, i found the old error logs
saving datas to db with hasmap is good method ?
i mean player on join server i add hasmap and if player left server i set hashmap to db and remove from hashmap
or is there a better method?
how do i use event priority from a field
i want to get it from config
any idea why java public void applyKit(Player player, Kit kit) { PlayerInventory inventory = player.getInventory(); inventory.clear(); inventory.setHelmet(kit.getHelmet()); inventory.setChestplate(kit.getChestplate()); inventory.setLeggings(kit.getLeggings()); inventory.setBoots(kit.getBoots()); inventory.setContents(kit.getInventory()); player.updateInventory(); } isn't working? This is the Kit data
@Data
public static class Kit {
private String name;
private ItemStack helmet;
private ItemStack chestplate;
private ItemStack leggings;
private ItemStack boots;
private ItemStack[] inventory;
public Kit(FileConfiguration config, String path) {
this.name = config.getString(path + ".name");
this.helmet = getItem(config, path + ".armor-content.helmet");
this.chestplate = getItem(config, path + ".armor-content.chestplate");
this.leggings = getItem(config, path + ".armor-content.leggings");
this.boots = getItem(config, path + ".armor-content.boots");
this.inventory = new ItemStack[9];
for (int i = 0; i < 9; i++) {
this.inventory[i] = getItem(config, path + ".inventory-content." + i);
}
}
private ItemStack getItem(FileConfiguration config, String path) {
if (config.contains(path)) {
Material material = Material.valueOf(config.getString(path + ".material"));
int amount = config.getInt(path + ".amount");
return new ItemStack(material, amount);
} else {
return null;
}
}
}```
EventPriority e = EventPriority.valueOf(getConfig().getString("PlayerQuitEvent"));
Because I have this ^^^
You need to use the method I provided
Debug that the items are not null, also you shouldn't need updateInventory
Also also use Material.matchMaterial over valueOf
I tried it without the updateInventory and it still didn't work, the only things updating are the hotbar itself, only the armor isn't updating and it's all not null. but I'll go ahead and change it matchMaterial
I sent it
idk imma take a break from it though, my heads hurting
but i stole it
from EpicEbic
That video is quite old
π
No idea who made it
ig you try checking the domain register
setContents is probably removing the armor
Completely replaces the inventory's contents. Removes all existing contents and replaces it with the ItemStacks given in the array. from the doc
cap
you guys suggested me hashmap method for store datas to db is this good ?
is there a problem if a player constantly rejoin the server?
its for libs that dont need to be on ur compile classpath
how would i go about changing nametag colors like in faction gamemodes? Ive been thinking about teams but i dont think it'll work the way i want. Is it possible to just get all the player info thats being rendered to the player then just change the colors client side with NMS?
Team prefix is the best option
Yeah setContents removes armor
alright thanks π
yea but on spigot everythings is loaded via custom plugin class loader
so there's no need to use runtimeOnly
since it wouldnt launch the plugin from application class loader (for example, CLI)
Try to disable ssl with your sql connection
I need mental help
Me2 tbf
Show entire code
It's not
the other code is to pickzp the block
Also what event is it
PlayerInteractEvent
?interactevent
The PlayerInteractEvent may be called once per hand. If you only want code to be executed once, you can check the result of https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerInteractEvent.html#getHand(), then decide functionality.
For example, only executing code if the main hand was used:
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
if (event.getHand() != EquipmentSlot.HAND) { // * if the hand used is NOT the main hand:
return; // do not progress past this point |
}
// provide functionality
}
Smh
Armorstand blocking player interaction?
Not blocking interaction
it executes
it has to be rightclick block
^
while shifting
are you srs
im
going
to
go
cry
I want to move my self out of the window, at a very high velocity
Its fixed
Me every 15 min
bedlessDeus.setVelocity(bedlessYeus.getLocation().getDirection().multiply(15)) // please work
NPE is probably caused by how you're setting bedlessDeus
"Cannot get Velocity of entity 'bedlessYeus' in line 1 of Yeet.java"
Lmao
Turning into my server console
Line 1? Where are you defining bedlessDeus, send the line for that.
public class Yeet extends bedlessEntity {
bedlessDeus.setVelocity(bedlessYeus.getLocation().getDirection().multiply(15)) // please work
}

- Naming conventions should be BedlessEntity
- If you're accessing the class variable
bedlessDeusthat's defined inBedlessEntity, you should be usingthis.in front of it - You're using both
bedlessDeusandbedlessYeus, which I imagine is a typo on the 2nd one. - Missing semicolon
depends
if ur spigot plugin chooses an impl to some api
then runtimeOnly would be reasonable
- yes
- bedlessDeus is a static refrence to a player
- bedlessYeus is an undefined Entity in bedlessEntity
- yes
Fix the 3rd one to say bedlessDeus and it might work
Or atleast not error provided you're defining that variable properly
Player bedlessYeus = null;
no
yes

π£
Imagine actually creating a something that would work like that lmal
I remember there was a guy who was like: let's make a real world api
yea
lemme just hack the mainframe
go into europe
get my entity UUID
and get my interface
extend it
HumanEntity is a thing, right?
is there a good guide for learning mysql?
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
if you want mongo
(which is better)
You will find lot of guides, there's not "a good guide" as many will be easier for you, and others will think other guides are easier than then one you read
No π
It depends on how you are going to use the database and for what
End of conversation
Ill throw rocks at you
Just make a library that wraps it all so you can make sql databases with an abstract class that ends up being like this long Plus getters :L
Is it on github
Not yet, we are currently in beta. Something like this, we wanna make sure its as idiot proof as it can be as , unlike most plugins, bugs in this one can seriously screw up a plugin
As its making database tables etc
Last thing we wanna see is 1000 lines in the console of SQL exceptions
lmao
Can i have the db stuff
.
How does it work? Can you make an example?
Pes cry
Of course. That image is a single table.
It is controlled using an SQL table manager:
Each "table" added to the manager is a cache of the table that updates every X ammount of time (config defined) that allows for easy calling of data from the table.
If a row is added, updated, removed etc, every X ammount of time the SQL is also auto updated.
If, onEnable, the table is initialised, and a check of the database shows the table does not exist, it will create it as per the fields of the Class.
In fact
Decent, I usually just have a main table class and do a lot of manual logic
Problem is
I can share one thing, and please forgive me it is NOT a completed javadocs, it was a test with an unfinished bodge job: https://curiositycore-development.github.io/TheCuriosityCore/
package index
There are certain parameters that certain drivers have
Apologies for any errors, missing stuff etc
What happens if a table already exists, but it has new fields or some have been removed?
Is there an "updateTable" method?
It automatically procs as per a setting within the library's config
I know you usually don't modify a table, but let's imagine
Interesting
Now this is exactly why we havent released it publicly yet, for this was something we hadn't actually considered. If you wanted to elaborate either here or in dms id be super grateful
In mysql you have BLOB, MEDIUMBLOB etc
In postgres it's all just a BYTEA with no limit
There are also some query changes
From ON DUPLICATE KEY UPDATE to ON CONFLICT etc
Why don't you "translate" the column type on creation? By having a SQLDriver enum, or somthing to identify the sql engine
Just look at the uhh
queries here
I am not actually familliar with Postgres.
The library is strictly for MySQL atm, with room for expanding to other types in the future
Wait, wasn't mariadb syntax the same as MySQL syntax?
diff driver
Oh
Tbh this is why i want to release it publicly sooner rather than later as it would allow the benefit of folk more familliar with other drivers to potentially contribute
Finally an utility I would use that is not made by alex?
Yeah tbh im happy with the whole Library.
The team really smashed it out (mainly myself and a guy called chronicler delta).
Got our commands down to this:
public class ClaimDepositExecutable extends SettlementExecutable {
/**
* Constructor initialises the settlement manager, along with initialising all the fields of the {@link
* CommandExecutable} from TheCuriosityCore. This makes the
* creation of nested commands much easier.
*
* @param settlementManager The settlement manager for this plugin, initialed as a singleton onEnable.
*/
public ClaimDepositExecutable(SettlementManager settlementManager) {
super(settlementManager);
}
@Override
public void perform(CommandSender commandSender, String[] args) {
if(!(commandSender instanceof Player)){
Bukkit.getLogger().info("You cannot execute this command as the console");
}
Player playerSender = (Player) commandSender;
UUID settlementId = this.settlementManager.getSettlementID().get(0);
Bukkit.getServer().getPluginManager().
callEvent(new SettlementWealthDepositEvent(playerSender,settlementId,Integer.parseInt(args[1])));
}
@Override
protected String initName() {
return "deposit";
}
@Override
protected String initDescription() {
return "Deposits cash from the players currently selected settlement";
}
@Override
protected String initSyntax() {
return null;
}
@Override
protected List<String> determineTabCompletes(String[] strings) {
return Collections.emptyList();
}```
I love how almost nobody uses the return statement of bukkit command API π
simply inferior
Oh I like your approach.
Our library focused more on making it so these arnt command persay, but executors that can call on other instances of the executor abstract to allow really easy tab completion and nesting
someone using hikaricp ?
Yes
can u teachme somethings ?
Aye thats cool
Itd be cool to see what bits n bobs we could take from each others approachces once our library is public
Collaberation is best dev work
change my mind :L
Where there's a FilteredParameterType interface where you could define a list of inputs
and it automatically tab completes
Can you just ask question please
dont ask to ask
aight
Oh we have that as an optional. Its what the determine tab completes are. We keep it empty unless its the executable at the end of a nested command
If not the sub-executeables are the tab completes
only way to setProperties "HikariConfig"?
and where can i see other properties like maxpoolsize
the filtered param type is also used for automatic filtering and casting
You can have a list param which is a filtered param type of a list
And that list can be of anything
And given you pass a T -> String function, you can get the param as an object from that list
Oh noice, we do something simmilar but the oposite way around with our config package
where we have a cache of values that absoloutly need to be fast as heck (around 80% faster?) from the config where you dont need to use a million different methods to get different types of data from the config.
Just put in the class as one of the params and boom, u either get the value or an exception if youve been dumb and picked the wrong class
What
yes can i set hikari properties with any method ?
likemaxpoolsize
or like poolclosetime
Wdym any method
You have javadocs
all videos for spirng boot
javadocs don't tell me how to start
How to start what
Here's what I mean with params
Where should I start using hikaricp?
i mean which method getting my db information like username port host
docs can tell me this ?
Can you please use some translator
Hikari is just used for obtaining connection, everything else you do normally
Preparin statements etc
Can't I change certain settings while connecting?
i mean cp settings
like maxpoolsize
"most open pool"
Ahhh this is actually quite smart. Might end up picking your brain with this as its something i imagine could only make our packages even more versitile
Its amazing we've used class converting generics everywhere, but yet never thought about it
What settings would you suggest I change?
Oh? Parsing the data to the correct format?
Really depends on u, I usually change none
message <player> [no-logs] (content)
And 2 examples of how it works:
/message ImIllusion Hey there!
/message ImIllusion no-logs Hey there!
Am i being dense? Whats the problem
So the parser is broken down into 4 elements:
- Literals
- Parameters
- Tags
- List parameters
Literals are just 1:1 text
Parameters have a type, and if they're optional and don't match the type you skip ahead to the next element
Tags are like optional literals
And list parameters are like parameters except that if you do have a match, you match until:
- The next element (Everything has priority over list parameters)
- The list's parameter type no longer matches the input
And I just did this with a big ass for loop
And honestly I want to rewrite it into an actual parser with tokens
Source: The Sweater (NFB, Roch Carrier) https://www.youtube.com/watch?v=ZZyDsF-Gp3o
yes this is that one part from skooks but unedited, that's where i saw it first too
Tab completion was a whole other brainfuck
where I get what element we're at with a rewritten version of the parser
And I match all the next possible elements
I should really just rewrite it but I already spent way too much time
I had no prior experience of writing a parser
I should really just write it properly lmao
You are gonna hate me, but you know how im already thinking of implementing this into my executables:
Object[] paramTypeArray = {param1.class, param2.class} etc
Like erm... done?
Or at least the foundation makes it easy to be done
Class[]
Eh
Wait what did I just write
Everyone writes bad code
this is very much a proof-of-concept adapted as production code
I have some code I'm proud of
Also
But only some people get to write bad code that makes it to production
Like the profiles system for my skyblock code :)
fuick you for shitting on enterprise shit and then doing fucking //comments with full ass shakespeare verses
and not making em javadocs
fuck off
I don't shit on enterprise code
Truly a marvel
Hire this man
The description tho
Why would you want to access the builder
You wonβt be able to see it at all. It just exists
Thatβs not a default then
@echo basalt the main spine of my command structure :L https://paste.md-5.net/gosixohiba.java
I am ready for judgement
Hello, I want to use packets to change a players nametag, is there any guide, material i can use to learn packet spoofing?
BlockBreakEvent?
or does this not work?
if i add hikari am i need add mysql connector to maven ?
Hikari needs to be shaded but CraftBukkit already provides the MySQL driver
so i got this warn bcs craftbukkit already provides ?
wdym for shading i don't know .D
I think you misspelled packetWrapper. It should be PacketWrapper
Hi, how can I freeze player movement on the horizontal axis (x and z) without affecting the vertical (y) axis?
For context, I want the player to not move horizontally when he has the levitation effect.
I made this event but for some reasons whenever the player walk, the Y position is modified/frozen.
@EventHandler
public void OnPlayerMovement(PlayerMoveEvent event) {
if(event.getPlayer().hasPotionEffect(PotionEffectType.LEVITATION)) {
Location from = event.getFrom();
Location to = event.getTo();
if(to != null) {
to.setX(from.getX());
to.setZ(from.getZ());
}
}
}
```Any ideas?
this code should work if you aren't modifying the Y at all. My only guess is there is a possability Levitation doesn't send you straight up
Wdym by "levitation doesn't send you straight up" ?
Even if it's not taken in account in PlayerMoveEvent, in theory it should be fine π€
can you send a video of what happens with this could I mean it looks like it should work technically
Sure, lemme record
Usage: !verify <forums username>
Guys, how do i use packets, i dont understand :(?
https://mappings.cephx.dev/ you can use mappings
you have 2 types of packets, Clinetbound, and Serverbound
each Player on the server has a connection you can use to send packets
https://mappings.cephx.dev/1.20.1/net/minecraft/server/level/ServerPlayer.html see the connection field
https://mappings.cephx.dev/1.20.1/net/minecraft/server/network/ServerGamePacketListenerImpl.html ServerGamePacketListenerImpl which is returned by ServerPlayer#connection has the method send which you can use to send any of the Clientbound packets
Found out also that the levitation is handled after the event call in Spigot/Paper.
// If a Plugin has changed the To destination then we teleport the Player
// there to avoid any 'Moved wrongly' or 'Moved too quickly' errors.
// We only do this if the Event was not cancelled.
if (!oldTo.equals(event.getTo()) && !event.isCancelled()) {
this.player.getBukkitEntity().teleport(event.getTo(), PlayerTeleportEvent.TeleportCause.PLUGIN);
- return;
}
// Check to see if the Players Location has some how changed during the call of the event.
// This can happen due to a plugin teleporting the player instead of using .setTo()
if (!from.equals(this.getCraftPlayer().getLocation()) && this.justTeleported) {
this.justTeleported = false;
return;
}
}
}
// CraftBukkit end
this.player.absMoveTo(d0, d1, d2, f, f1);
+this.clientIsFloating = d11 >= -0.03125D && !flag1 && this.player.gameMode.getGameModeForPlayer() != GameType.SPECTATOR && !this.server.isFlightAllowed() && !this.player.getAbilities().mayfly && !this.player.hasEffect(MobEffects.LEVITATION) && !this.player.isFallFlying() && !this.player.isAutoSpinAttack() && this.noBlocksAround(this.player);
this.player.serverLevel().getChunkSource().move(this.player);
this.player.doCheckFallDamage(this.player.getX() - d3, this.player.getY() - d4, this.player.getZ() - d5, packet.isOnGround());
this.player.setOnGroundWithKnownMovement(packet.isOnGround(), new Vec3(this.player.getX() - d3, this.player.getY() - d4, this.player.getZ() - d5));
if (flag) {
this.player.resetFallDistance();
}
this.player.checkMovementStatistics(this.player.getX() - d3, this.player.getY() - d4, this.player.getZ() - d5);
this.lastGoodX = this.player.getX();
this.lastGoodY = this.player.getY();
this.lastGoodZ = this.player.getZ();
I guess I'll have to predict the levitation velocity addition in my code π₯²
if you have any fix suggestions for a fix or just in general I'd reccomend opening a jira issue
?jora
?jora
?jira
bruh way too used to mythinkpad after tinkering with it for 5 hours
How long would it take to be fixed?
depends if anyone picks up the issue and how simple the fix was
If it's like more than 2-3 months then I will work on another solution
I wouldn't wait fo ra solution
yeah
but submit a jira
doing it rn
because its an issue nonetheless
yep
Whats the issue?
.
.
It could be a spigot issue, but I feel like it should just work regardless of when levitation is handled
Also, idk if this has importance or nah but i'm using 1.19.3-R0.1-SNAPSHOT
I don't think any changes were made to that event
But from what I saw, there isn't differences for the levitation handling
So the issue is when you cancel the event they continue to go up?
I don't cancel the event, I simply modify the X and Z position of the destination, yet it affects the levitation velocity
As alternative solution, I will simply add the levitation velocity in my event (even tho it's not great/optimal)
So when the player moves you are changing where they are moving to?
If that is the case that makes sense in why velocity is affected
This isnt really a bug
Rather the server recalculating their trajectory and time it should get there
By setting for example their position further then the server says well for that to be possible they need to be going this fast or this slow lol
Its not like teleporting
This would be the correct action. You need to factor in their new velocity due to the sudden change in position
It makes sense that when you change the X/Z destination, that the X/Z velocity is affected (due to shorter/longer distance).
But how is it affecting vertically?
Well idk if while having levitation you can hover across the ground moving freely. If not the only free movement is on the y
Well in vanilla MC, you can move horizontally while having the levitation effect
Which I am trying to avoid by simply making the player levitate upwards only
You can try setting their walk speed to 0
Then i would cancel the move event if x and z changed by 0.5
I am not quite sure to understand your sentence
Move event?
Just cancel it if x and z changed by 0.5
Not sure what is difficult to understand here
By canceling it, you cancel the Y velocity
Does setting fly speed work?
Sure, just reset the y velocity
Not sure why that would be so hard
That would break the levitation effect
If I cancel it
Not sure but I can try, I think fly speed only affects when you fly, rather than hovering
It shouldnt if velocity is reset back to being upwards
Yes, that's what I said here, no?
Like they are not going to fall out of the sky unless you dont set the velocity of course. All you should do is check the move event and see if x and z changed by a certain amount. If it has, cancel the event reset their velocity
I'll try to calculate the levitation velocity while revoking the horizontal ones
You dont need to recalculate anything if you just cancel the event
Is there a way to know what chunks a player sees?
Or what players can see a chunk
Might be something about the chunk ticket system
Why would I cancel the event? It would lock player Yaw and Pitch
Believe you can do this by seeing the amount of chunks the client requests?
Probably
You never specified this as a requirement
π
Anyways their view only resets when the event is cancelled and the event should be cancelled when x and z changes
So it wouldnt be all the time
Same way I never specified that I don't want the player to die or other things.
I just don't see why would you delete a variable, just to recode the same one, when you can just modifiy a variable via get/set
What you should do then, is set their velocity to 0 when you change their position
Then set the velocity back to upwards
I have no ideas if you are trolling or if you are genuily serious
But that sounds like a really bad idea, sorry
Ok then i wont help further.
heβs being serious lol
I have no idea what this issue is, but frost doesnβt joke
I will simply add levitation velocity (0.9blocks/s) to my event while preventing the x/z variables to change
pretty sure heβs incapable of such
Spigots code on the other hand there isnt a flaw with it though
Just you have a unique requirement that doesnt fit the api
Indeed
I don't really think it's a flaw, just my case is very unique and wasn't taken in account for the Event
Well resetting the velocity should do the trick for you
Because then it removes any guessing
Its basically like normalizing
But math/code wise, it's far simplier (logically) to revoke X and Z changes in the movement, while adding the predicted Y movement needed for the levitation.
Instead of rewritting the whole Location after canceling an event
Well you said it was causing velocity to be added everytime to the y
You could just nullify that velocity by resetting it.
Nope, the velocity is frozen a bit
But I'll try to reset the velocity
rather than canceling the event
I was continuing with you not cancelling the event
If you dont cancel the event just nullify the velocity by resetting back to known values
Yeah
And then add velocity if its needed right after
Mhm, hopefully this won't alter the levitation
It shouldnt, but this just removes a lot of guessing to predict unexpected velocities lol
Tried and, it works halfway. The player moves simply slower horizontally (altho the levitation works fine now)
It's like if the velocity (event) is reset in specific frames, but in between them the player can move a little bit
Well better then nothing. And see wasnt such a crazy idea after all 
xD
I wonder if its because of the client
Well I will revert my code like before, and will do some testing to find a good way to remove the freeze of levitation by adding some Y velocity
It could be
If its due to the client you would need to reset velocity a couple of times to get the client to register that lol
Client uses prediction with movement and over rules the server in regards to where it wants the player to move
So even though the server recognizes you want the player to stop the client could send another position packet and thus player moving again
Always fun to battle the client
Ah yes, forgot that in Minecraft it's the way around than most video games xDD but yes makes sense
Would I need to make a loop or idk to make it work?
Idk you could try that or see if resetting velcity a couple times spaced by a tick or two works
mhm
If could maybe give negative velocity depending on the destination velocity? altho it might not be great
Really wished mojang would let the server dictate movements and not the client
Well the hacks are actually easy to curtail
Most people dont because they want hardcore pvp
Basically how you handle them especially something like reach is you would set a lower value for the reach. This way if they use a hack they can only ever achieve normal values
Which makes detection super easy after that 
But yeah it is the reason those things can be done more easily
I see I see
Anyways time for me to get back to work. These tires arent going to roll themselves
?workdistro
thanks 7smile7
:,) My spelling has always been a bit
slow
my language skills in general have always been a bit slow
Maybe its average and everyone elses is fast or advanced
If return is a glorified goto statement, does it go to the ending method brace or the line before it?
this work distribution thread is great but misses some parts
well, Workload can be replaced with Runnable and it doesnt contain any multithreading
It exits out of the method. So ending method brace.
that's not even the point of the thread
some tasks need to be done on the main thread
that thread covers such tasks
I think you dont understand
its easy enough to do multithreaded workloads
I know it can be about changing blocks or modifying world which cant be done asynchronously. But it can work just like FAWE deals with it
I'd be opening to see a better workdistro thread if you want to make one tbh I think that's something everyone could benefit from
I'm not far enough into this shit to know much better
well, you should read fawe docs
ik that much just saying if you know a better way it'd be beneficial to see a better more indepth post by you, that workdistro command is semi-popular
that thread tends to be reccomended for workdistro problems too
its good to understand logic of work distribution
Thats the point. The thread is specifically about asynchronity and not multithreading.
Those are often confused
A lot of tutorials online for NBT usage is saying to use NBTTagCompound, however I can't pull that method up. All other methods seem to work.
Has this been replaced with something else, if so, what's the renamed version?
I've tried taking a look at wiki.vg as well. (P.S using 1.20)
why are you using NBT in 1.20?
Dont use NBTTags in versions >1.14
?pdc
there are a few valid reasons, but its far and few between at this point
so agree for the most part
I need to get the information of the mob that is being hit (e.g. skin type, collar, etc.)
I guess if you want to modify vanilla tags
and store this information, but I'm stuck on the getting information part
i do it to modify vanilla lore and name tags with components on Items :P cuz no component api yet
Which of those arent accessible through the spigot api?
(Neither)
Through PDC? Or are you recommending I go through each mob that stores unique information
Because there's sheep, foxes, villagers, and many more lol
I see
Plus if I want to be an experienced minecraft developer, learning about NMS is nice and just widens the scope a bit. Shutting people down each time the words NMS comes up is kinda sucky imo.
It's nice to use an API when it's there and makes it easier, but in this case I feel NBT is needed.
I just can't find any information on where to get the NBTTagCompound
I dont see. Which tag is not accquirable though spigot?
They are named differently in the newer versions i believe
mojang mappings
net.minecraft.nbt.CompoundTag
It'd be easier for me to make a list of mobs that have custom tags (such as cat, fox, etc.)
Then run my method and get the Variant information, then store that information.
@worldly ingot Apparently it does not actually include color codes in the charater limit
For versions older than 1.20.1 I mean
The change was made a couple days after the 1.16 release
well I also dont see any asynchronity there
ty, seems to be working
but its still good to understand meaning of workload distributions
imho you should make a thread covering multithreaded workdist for operations like FAWE block placement etc which must be sync
I personally would like to see and in detph coverage of that kinda workdist vs an overview of the logic
you know what fawe does, do you?
Distributing a workload over multiple ticks is splitting a synchronous computation into an asynchronous one.
Pretty much the same i do in this thread
well, yes but no
Nope no clue but you seem to have a good grasp which is why I made the reccomendation I can't write it I don't know wtf is going on
if they use workload distribution it doesnt mean they have same code
try {
asyncCatcher = Class.forName("org.spigotmc.AsyncCatcher").getDeclaredField("enabled");
asyncCatcher.setAccessible(true);
asyncCatcher.setBoolean(asyncCatcher, true);
} catch (Throwable ignored) {
}
thats part of fawe's code
Cursed
Blazingly fast world manipulation for artists, builders and everyone else: https://www.spigotmc.org/resources/13932/ - IntellectualSites/FastAsyncWorldEdit
they modify spigot so AsyncCatcher doesnt catch it
Ok but "it" is not traditionall block modifications
well ofcourse it isnt
They still synchronize with the main thread, just manually
they use NMS for faster block placement, workload distribution to not run everything in 1 tick
depends
Fast async world exception
But yeah fawe does a lot of very weird stuff in the background
I know like they overengineer it
but it is still efficient, but could be even better
well if you have time you can update your thread or github repo to make it even more optimized because it surely can be
t h e y d o w h a t n o w ?
XD
at least they're replacing blocks fast
well yes, but at what cost
replacing blocks asynchronously may cause server crashes
*from another thread.
And as stated before: They dont actually do that. The unsafe sections
are not used for placing blocks...
7smile can i get ur opinion
Sure
which is better https://paste.md-5.net/xewewocure.md or https://paste.md-5.net/hosazorexe.md
ofcourse they are not
in sense of readability to end users that have no idea bout developing
how did you know kekw

Hm, both are quite readable.
I think the split of each section having
- Quick use
- Further explaination
Makes it useful for experienced and new users
ones written by me, the other is chatgpt making it formal
@lost matrix are you planning to update the spigot thread or github repo?
Uhm, for which thread? I got a few...
the workload distribution
I would have to re-visit that because it was written a while ago.
But i didnt see anything missing the last time i checked
which would be better, making 2 parts of the page each having all cmds with quick use or further explanation or just a "Do this then run cmd" and a "More explained: " with its explanation on where it is currently
What would be your suggestion i should add
well Workload is useless and can be replace with Runnable
and it should work on many threads and queue it to main thread
Workload was the first iteration of the class. Its expanded later on

Elaborate on that. This sounds like a metric ton of overhead for no reason.
wdym for no reason
the entire queue works on main thread
+it runs even when tick is overloaded
it should check it before polling it
It doesnt. Further down i added limiting procedures that simply skip ticks when they are overloaded.
I've just checked the thread again and it's mostly what Aikar said
This comment was on the first version of the thread
was it?
Let me double check
how do most people actually learn to write wikis
whats this like, seems misformatted but you get the idea
i added limiting procedures that simply skip ticks when they are overloaded.
where
Yes ive written with him about that.
Conclusion: Using a concurrent queue would decrease performance for removeIf.
Synchonization is the responsiblity of the dispatcher and not the queue handler
Elaborate
on github or spigot
Quick question. I know the best practices but I'm curious why they're best practices.
So obviously, use SQL connection pooling because it's slow to open a new connection for each transaction.
But why not just have a single connection open for the whole duration of the program?
?!
well you have repo on github and thread on spigot
Because you should close connections after you are done using them.
Sometimes there might be an error while doing transactions which will
drop the connection. There is also the possibility of multiple threads
wanting to connect to your DB. And all of them waiting for a single connection
is very questionable.
But why should you close connections after you're done with them?
also using NMS you can place block way faster
The other parts make sense though.
What are you talking about? There is no runtime check i can do to gain the exact server tick start.
NMS is discouraged due to its instability, but nobody's stopping you from using it.
I should wear glasses
reminds me i wanted to PR a ServerTickEvent w two possible "stages", START, and END, like
public class ServerTickEvent extends Event {
private final Stage stage;
public ServerTickEvent(Stage stage) {
this.stage = stage;
}
public Stage getStage() {
return stage;
}
public enum Stage {
START, END
}
}```
Oh Fabric has something like that.
imagine that
imajin that
as long as the servers event manager isnt dogshit it shouldnt be an issue
Well, you're probably already calling a shit ton of events every second anyway
And on Paper this is negligible
clients call millions of event/s just fine 
have you ever used PlayerMoveEvent buddy?
No but I have seen what player move packets are like :)
haha packet spam go BRRRRRRRRRR
So I can only imagine what that looks like on the server side
Same reason why you dont have open, dangling file pointers: Resource management.
There are only so many open connections you can have. So best practice is:
Use a pool
Close your connections
Dont worry about creating them and just ask the pool to handle it
1.9+ tried? to optimize this iirc by sending fewer position packets if a player hasnt moved
but i think it still spams hard p sure
mojang goo rewrite to not send move packets for mouse move ment
2 more events per tick are neglible
yeah :P
We are speaking about micros here
Well when it comes to having a single file open for long periods of time, you'd probably find a lot of devs using mem-mapped files.
I can imagine that being useful for log files?
I swear to god. When i hear this i instantly remember @wet breach ...
I'm not arguing, mind you. I'm just trying to understand why it is that it's so vital to close a connection immediately after you're done with a single transaction.
I can understand the multithreading aspect though
Also mem mapped files dont keep file pointers open in the traditional sense. It lets the os
map files into virtual memory. Big difference.
That's true.
Most of the time I keep resources active for however long I need them and then when everything's all done I shut 'em down lol
But good question. Its been a long time since manually handling connections myself so i just took it as a given to close them.
application crashes -> resources get hogged
@lost matrix you may implement system to your queue that reduces queue ticks per second depending on tick responds (how fast is the code ran)
or just use multithreading somewhere
Not entirely true, the kernel will close most resources, i.e. sockets and file pointers, and I thiiink that should apply to SQL connections since hopefully the server would be able to detect a closed socket...?
because you can run Workload tasks on main thread but manage queue in other thread
That would introduce overhead.
Makes the application actually slower. Very nice.
actually it might make it slower
I think the better solution is implementing fork/join lol
but this may work
For a task like setting a large area of blocks, fork/join sounds perfect since you cut down the large task into smaller tasks.
But I'm not sure how compatible Bukkit is with just regular ol' Java concurrency lol
Yeah that might work. But that sounds very specifc to me.
Its just a matter if introducing a tick counter and checking with a modulo
which is defined by the current tps. Limiting the millis per tick should be enought
I read through that post on workloads but I'm still not capable of understanding it tbh
Almost nothing is thread safe in spigot
Of course
yes but in large tasks you might feel the difference
The thread kind of is about a fork/join where you fork on ticks but stay on the same thread.
Not sure how this analogy holds up.
I saw the example repo too but the workload solution was seemingly slower than the regular one?
I mean you can still send message, title, actionbar to player asynchronously π
There were example gifs side-to-side and it took a much longer time for the workload to complete
I'm going to assume the benefit is that it doesn't block the main thread
Yes but the instant one tanked the tps to 17.0 and the distributed one kept it at 20.0
