#help-development
1 messages · Page 637 of 1
a typo
okay
goksi is cooking something slowly
че
:)
ye
hey, how is the sorting system in minecraft auction plugins? According to the material, it’s hardly because there are donated items, but they are somehow sorted separately
does anyone know how i would achieve something like this:
file = new ConfigFile("playerdata/world1", player.getUniqueID().toString())
Where it would create the folder path inside the default plugin folder and create a file inside named the player's id?
does Command#register actually register the command to the command map I see no indication it does
its so weird
Reflection call syncCommands method
Server class
no. commands are registered in SimplePluginManager -> enablePlugin(Plugin). this gets a list of all commands of that plugins and then calls SimpleCommandMap.registerAll(...) on it, which just calls SimpleCommandMap.register(...)
i have no clue what Command#register is used for
I think there was a brief discussion on exposing the register method
Since so many people use it anyway
I use it lol
fuck using the plugin.yml
I wanted to give an answer to my own question here
the problem was in the line where i set nametag visibility of ScoreboardTeam, it happened to send the update to every player
the way i found out is by printing the stack trace in the packet listener
anyway, peace
Ah yes that one
What's a nice way to loop over a map and remove stuff without getting ConcurrentModificationExceptions
Iterator
alr
or just simply removeIf
True
fuck I forgot about that
oh map doesn't have removeIf though
oh does the entry set modify the map itself
yes
ahhh makes sense
// Iterator
Iterator<Map.Entry<Object,Object>> iterator = map.entrySet().iterator();
while(iterator.hasNext()) {
Map.Entry<Object,Object> entry = iterator.next();
iterator.remove();
}
// removeIf
map.entrySet().removeIf(entry -> entry.getKey().equals(entry.getValue()));
// Second collection
Collection<Object> keysToRemove = new ArrayList<>();
for(Map.Entry<Object,Object> entry : map.entrySet()) {
keysToRemove.add(entry.getKey());
}
map.keySet().removeAll(keysToRemove);
these are the first 3 methods that came to my mind, there's probably at least 5 more ways lol
pretty sure keySet() and values() reflect changes too
so you can also use those with removeIf/iterator
Is there a way to register a command during the runtime? Maybe by like modifying the tab completion event and the command handle event or whatever to make a custom command handling thing?
just add it to the command map
yeah I'm working on that rn
its really easy
That shit exists?
this is what I do
public static void register(@NotNull final Plugin plugin, @NotNull final Command command) {
final CommandLabel label = command.commandLabel();
final PluginCommand pluginCommand = ReflectionUtils.newInstance(PluginCommand.class, new Object[]{label.name(), plugin});
if (pluginCommand == null) {
throw new RuntimeException("Creation of PluginCommand failed");
}
pluginCommand.setName(label.name());
pluginCommand.setAliases(label.aliases());
pluginCommand.setPermission(label.permission());
pluginCommand.setUsage("/" + label.name());
pluginCommand.setExecutor((s, c, l, a) -> command.execute(s, a));
pluginCommand.setTabCompleter((s, c, l, a) -> command.complete(s, a));
if (commandMap == null) {
init();
}
if (!commandMap.register(plugin.getName(), pluginCommand)) {
throw new IllegalStateException("Command with the name " + pluginCommand.getName() + " already exists");
}
}```
Wow
cast PluginManager to SimplePluginManager, get commandMap with reflection, done
Just make it a lib or something
Hello, how can I make a ServerPlayer (fake) join the server (I want to get the join message) in 1.20.1 with nms ?
Maybe call the PlayerJoinEvent? Idk never made fake players
with nms
commandMap = ReflectionUtils.getField(Bukkit.getPluginManager(), "commandMap", CommandMap.class); one liner with reflection utils 
Well, I never knew you can without nms
I've never seen it done as it's a completely different set of packets
I lie
I sit
I jump

Magma somethign was playing with it a few months back
Well, maybe this ? But idk how to use it : https://mappings.cephx.dev/1.20.1/net/minecraft/network/protocol/game/ClientboundLoginPacket.html
version: 1.20.1, hash: 7bbb3e4f67
PlaceRecipePacket
well 
I will never get packets tbf
wrong link
How should I check if two plugins are the same can you compare plugin with .equals?
hi guys can i do bungeecord api ?
i mean i will api in bungeecord server and other servers will get data from this api
(updated)
Can't you like use the name or something?
i thought you could have 2 plugins with the same name
@torn shuttle Tell us of your wizardry in logging a fake player in.
the name is kinda like an id afaik
Like, your plugin is identified by the name in your plugin.yml, usually
Bedrock plugins have an UUID system
lord this looks horrible
knownCommands.entrySet().removeIf((Map.Entry<String, org.bukkit.command.Command> entry) -> {
final String label = entry.getKey();
if (!(entry.getValue() instanceof PluginCommand pluginCommand)) {
return false;
}
return plugin.getName().equals(pluginCommand.getPlugin().getName());
});
no
bedrock is just bad though so who cares
So, is the name like an identificator?
thanks to his chat history, I found something that can also help me for another project 😄 https://github.com/MagmaGuy/FreeMinecraftModels
if you have two plugins with the same name, this happens
[19:53:20] [Server thread/ERROR]: Ambiguous plugin name `Daytime' for files `plugins\Daytime-1.0.0.jar' and `plugins\Daytime-1.0.0 - Kopie.jar' in `plugins'
and then it only uses one of those
Well, can't say it isn't, but I like both versions of the game, even for modding. Like, have you seen the inner-core? Broo that's soo cool.
Can you not just fire a fake login event and then send the resulting message to everyone
Isn’t that basically all login is
how ? 😅
can i make api plugin ?...
- but this api plugin will be in bungeecord.
- and it will transfer data to the plugin inside a non bungeecord server
declaration: package: org.bukkit.event.player, class: PlayerJoinEvent
something interesting
When you do reflection on a field that is a collection is the field updated as things are appended to the collection
if it works, nothing to do with nms
I would assume yes I just feel like so scared it doesn't
@young knoll I can really make an instance of a Event ?
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
ofc not, the field stays the same
the field is just like a "pointer" to your collection
you can change the collection all you want, doesn't have anything to do with the field object
Granted the event will only handle the join message
You still have to send the NPC to all the clients
sure but it's not really allowed
idk what to put in String joinMessage
The join message
I want the default joinMessage or the join message set by a plugin
I believe the default is just “X joined the game” in yellow
Yes plugins can then modify it when you call the event
I can just put the default one and the plugin modify it laters normally
Event instantiation trigger the EventHandler ?
so that's what I need to do
so every time I run my method I'll have to update the reflected field value
that fucking sucks
no
why would you
idk I thought you said it didn't update
I said the field object doesn't change
which is what you want
you want it to still point to the collection you got earlier
main.getServer().getPluginManager().callEvent(new PlayerJoinEvent(craftPlayer.getPlayer(), "Herobrine joined the game"));```
just because you're using reflection to get a field's value doesn't magically produce a clone of that value
yeah but you're not really supposed to do this
I'll explain better ig
private static List<String> reflectedList;
static {
reflectedList = magicReflectedField.get(null);
}
so this would be synced up?
I really don't know what you mean with "synced up"
alr thanks
It's no different than calling a getter
the pointers point to the same memory location
but if the reflected list is reassigned then it desyncs
myList = OtherClass.myList;
myList = OtherClass.class.getDeclaredField("myList").get(null);
// the same
I understood nothing 😢
since the field is not final, if a new value gets assigned the reflected value needs to be manually updated too
well if its in NMS its not a huge deal tbh, because you're updating every version anyways
Hello, inventory.getsize return the max slot or rows?
slot
considering the field is final I'm working with doubt I'll need to worry about that then
thanks
Getting a fields value through reflection is exactly like as if you‘d get it directly
^
in that case the value obtained from reflection and the field value are the same (i.e. ==)
yeah idk why, I was just really worried that they wouldn't point towards the same memory location for some reason
mutability and concurrency are headaches. I love rust
no but its safe so that it cant be modified concurrently by design
What happens if you add an element in a collectiom in rust?
Valence
Are they all copyonwrite?
That would make no sense lol
I'd assume it depends how you define it, that'd be slow
hey, how do I block creeper block damage without changing the overall explosion radius?
is there an event for this?
rust is memory safe first and fast second, so I doubt they'd copy on write every single append
I mean I don't know rust, but I doubt every list is copyonwrite
?jd-s
declaration: package: org.bukkit.event.entity, class: EntityExplodeEvent
remove from the blockList
oh thanks. because I had the problem, I changed explosion radius to 0 but then I noticed player damage is also blocked which I dont want
real question are you even using paper API if this isn't at the top of your class?
That’s why I’m simply not using paper api
same
Well, it isn't working...java main.getServer().getPluginManager().callEvent(new PlayerJoinEvent(craftPlayer.getPlayer(), ChatColor.YELLOW + "Herobrine joined the game"));@tender shard
it does nothing
You need to take the result of the event and send it to all players
Well, the result message
what are you trying to do
oh okay thanks
fake join message
You can technically just skip the event and send the message
someone know mysql ?
i got this error on exporting
But then other plugins won’t be able to change it
soooo ?java Bukkit.broadcastMessage(new PlayerJoinEvent(craftPlayer.getPlayer(), ChatColor.YELLOW + "Herobrine joined the game").getJoinMessage());
You still need to call the event
okay
PlayerJoinEvent event = null;
Bukkit.getPluginManager().callEvent(event);
String message = event.getJoinMessage();
if (message != null) {
Bukkit.broadcastMessage(message);
}
and get the result inside ?
(except don't use null obviously)
^
okay thanks
ofc it does something, it calls all EventHandler methods that listen to PlayerJoinEvent
I thought it was sending the message, but no
Nah event calls are never responsible for actually performing the event
That comes after
perfect thanks 😄
How to code a PacketReader in a version higher than 1.19.4?
Does anyone have a ready class they would like to share
Hi , how to connect to mysql in easy way and short code ?
DriverManager#getConnection(String)
inject a handler in the connection pipeline
I know but how do I get this pipepline from a player since the 1.19.4 changed something
and connect a event ?
i mean a connection event for mysql
why is everything givingan error for some reason, i littaraly build it a minut ago without even opening this file. so the code is correct
bruh this makes my brain hurt
it littaraly build succesfull with all these errors
Most likely just an IDE cache issue or something
thats the .idea folder right
Guys, how do I get this pipeline from a player since the 1.19.4 changed something
pipeline?
Hello, in the inventory object, if i open the same inventory for two players, thes two inventory are considered like equals?
its like 2 players look inside the same chest, if one picks an item, its also gone for the other
to inject an packetreader yk
packet listener?
not really, i use the "modearn aproche for gui(exemple)" so its create 2 separate inventories i aimgine?
I use Eclipse ¯_(ツ)_/¯
?, i have no idea what the "modern aproche" is, but an inventory is an invetentory. they are shared objects just like in vanilla
so that "modern aproche" then probably makes a new instance for eveyone or something
i just use the default inventory object, and if i make any changes, it will change for everyone
https://www.spigotmc.org/threads/a-modern-approach-to-inventory-guis.594005/
we have a manager (hashmap) inventory, menuclass
so , on action, the manager get the eventinventory and got menuclass in hashmap.
My question, if 2 players open the same inventory, in the hashmap, there will be a difference between the 2 inventory keys?
What can I use instead of ChatColor, because it is deprecated? is there an easy method?
paper user spotted
Can we get a ?paperapi command
?fork
SpigotMC maintains the Spigot server. If you are using a fork of Spigot (such as Paper, Airplane, Purpur, or other derivative works), you should seek support in the appropriate Discord servers.
?whereami
inventory key?!?
If anything it's a dead giveaway now
key of hashmap is inventory (instance)
(btw that thread is way to long so i am not reading that, also Cntr+f searching for "inventory key" gives nothing lol)
but its really simple
if you have a method simular to openInventory(...) and it creates a new instance of a inventroy every time, then yes, its a seperate inventory, and people wont see any changes appart from themselves
if instead you constantly open the same instance (created once, and then constantly reffered) then and people will see every change you make to it
because you are using hashmap i dont think its even posible to make the first senerio
so key X will always reffer to inventory X, and verse visa
(its because you made the inventory instance once, and saved it at the key. thatway the key has only 1, and always that same 1 instance)
If both open the same instance then there is no difference. They both retrieve the same handler from the map.
How do I decide whether I should use a registry or enum
idk I only use registries when I have like a item registry and a bunch of classes that extend item or smth and then use enum when its like Permission.XYZ
registry if you have a LOT of entries or you need to be able to add/remove entries on the fly
👍
oh so don't worry about that
PaperAPI? More like ComponentAPI
The exception says literally what the problem is
lol
You/your plugin is trying to create a team on a scoreboard, but that team already exists
So tell me how to fix it
Remove the team (if exists) from the scoreboard then create it
Or modify the existing one
Is there anyway to not show the users inventory at the bottom?
n o
resource pack i think
Thought so
Has anyone here implemented a grafana dashboard to moniter stuff in a spigot plugin before?
if so did u use prometheus or influxdb?
Not even with resource packs, the inventory will still be there
You will need to create a mod or a modified client version (which will be most difficult to do than a mod)
Hello, two questions :
how can I hide ServerPlayer (nms 1.20.1) nametag with spigot or nms ?
Is player PDC persistent after player disconnect ?
Always remember, non server side controlled modifications requires client side modifications
- Use teams
- Yes. The P in PDC stands for Persistent
that was to be sure, thanks 😄
for nametag I found this https://www.spigotmc.org/threads/hide-player-nametags-all-time.356450/
I made a plugin that hides player nametags when they're not visible
Like behind a wall for example
It's not that hard to do
perfect
good idea 👍
Is it worth switching over to library loading instead of shading dependencies?
TIL you can see that
I get all the google ones
because if you search skyblock core spigot my result's just below ssb2
hi guys i have a question
i will do stats plugin but this plugin depends api
if i upload this api to bungeecord
my stats plugin will work ?
💀
what in the world
Yes, you make instance of class using new keyword
There are two ways to create instances:
Using the new Keyword
Using Static Factory Method
But tf is this
You can't make new instance of your main class
You have to pass it, either using Di or static getter
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
How do you make a static getter?
Main class = current class I'm in?
Then just pass this
Okay
First argument in runTaskLater should be instance of your main class
Like, iirc this isn't a thing in static
There is JavaPlugin.getPlugin(Class)
Ohh that's what copilot suggested me
So you can get instance of your class with getPlugin(YourClass.class)
That's interesting
Anyone know how to fix this error and can provide some simple solution?
you create a team two times
(it is already created)
How can i avoid that? Can you provide me some code that solve it?
Thanks, appreciated
And where should i put that? Because the error occur only in BungeeCord
just check if the team already exist
using Bukkit.getScoreboardManager().getMainScoreboard().getTeam("YOUR_TEAM_NAME");
Can you show me how? I am fightning with this using SwiftBoard api tried several method and i start doubt my skill
I don't know the SwiftBoard api and I don't know how to use BungeeCord 
the only thing I can say to help is #help-development message
Thats what i am asking for
perfect
Come on, man. Use at least a little bit of critical thinking ;p
The error says in plain English why it's being thrown. So you need to find some way to check if a team already exists on a scoreboard before you register it
Look at the Javadocs or use your IDE to see if there's any method whatsoever that might possibly give you some indication of whether or not a team exists
In this case PauLem is correct, getTeam()'s nullability will tell you if a team exists. But in the future, at least pretend to have put in a little bit of effort
first result for "check team exist bungeecord" on google @green plaza https://www.spigotmc.org/threads/bungeecord-and-scoreboard-packets-illegalargumentex-team-already-exists-error.186994/
same answer
Or, yeah, some simple Google-fu
what event is triggered when i use a lava bucket?
it will turn it into a bucket??
that's not a real thing is it xd?
Javadocs have a search bar, just fyi in the future
What is the difference between Enttity and EntityType is an EntityType more specific to an entity type?
EntityType is just a list of all possible Entities
they don't really have anything in common
?jd-s
Represents a base entity in the world from Entity
javadocs are illegal don’t use them
or like YourPlugin.getInstance()
public static class getClass
Entity = in world
EntityType = a simple type of entity. Might provide stateless data about a type of entity (e.g. whether or not it's alive, or supported by experimental features, etc.)
for (int i =height; height<=10;height++){
for(int x=-width/2;x<=height;x++){
for (int z=-width/2;z<=height;z++){
Location loc = topPos.add(x, - height, z) ;
//spawn the particle from loc
}
}
}
been writin for 10 mind
*10 mins
Writing at phone is pain
Updated
topPos id the top corner of pyramid
they are probably client side. which blocks are you talking about?
How would i create a random number for a minecraft seed?
Well i think the only limitations for the seed is character limit and alphanumeric
So you could just use a generator from online to make you a seed from those limits
generator from online?
Yeah there is plenty of web generators to generate random strings with whatever limits you impose
And then you can plug that into the server.properties file for seed. Then delete or move old world and let it make a new one
Server only uses new seed when creating new worlds
yeah im trying to create new worlds on the fly
just random seed mineecraft survival worlds
cant i just do Math.random() i just dont know what are the restrictions to Minecraft seeds
ig ill just try Math.Random idk
oh that gives a double
I want random float from 0.01 to 100
so what will be the bound?
I am doing new Random().nextFloat(101.0F); rn. but look like its choosing from 10-100
I will tell you the limits
If you use any alphabet characters or the character limit exceeds 20 characters. The limit is a 32bit int. Negative and positive is allowed. If instead you use only numbers and dont exceed 20 characters the limit is a 64bit long negative or positive
Cant use doubles or floats. Has to be an int or long
nvm they want to take in a string as the world seed idk how that works but ig i can generate 20 random letters for it
"seedString - The seed in the form of a string. If the seed is a Long, it will be interpreted as such."
It works by getting the hashcode of the string which gives an int
This doesnt mean you cant use purely numbers. It is treated as a string because alphabet characters are permitted not just numbers
If the string is nothing but numbers it will treat it as such
i mean then i can creeatea random string of 20 letters that will bascailyl create a random number
It should yes
You can use any long value for the seed
nah they need a seedstring
Notice that it says if it’s a long it will be interpreted as such
so create a random long in the form of a string?
You whould just use the random method that resolves a range
ThreadLocalRandom random = ThreadLocalRandom.current();
float number = random.nextFloat(0.01F, 100.0F);
anyone know any good inventory api's for 1.18.2+?
Looks like it
cuz i found a few that imo are pretty good but some how are broken so im still on the hunt
veri nice
Not sure if its still maintained but ive used Triumph a while ago.
But writing your own lib with GUI capabilities is also something you
might want to pursue at some point.
alright thank you!
long leftLimit = -2147483648;
long rightLimit = 2147483647L;
long seed = leftLimit + (long) (Math.random() * (rightLimit - leftLimit));
@young knoll i think i did it right
Just use ThreadLocalRandom
ThreadLocalRandom random = ThreadLocalRandom.current();
long number = random.nextLong();
^
ty
This doesnt really create a range.
There is methods to create a range to input in for picking a random value
Was just thinking about that. I would honestly just multiply the random by 2 and multiply with the long max value.
Then overflows will take care of the negatives.
still not getting 0.9 or less
tried 1300 times
it always start from 1
public static void main(String[] args) {
int belowOne = 0;
for (int i = 0; i < 1_000_000; i++) {
float random = randFloat();
if (random < 0.9F) {
belowOne++;
}
}
System.out.printf("Generated %d numbers below 0.9%n", belowOne);
}
private static float randFloat() {
ThreadLocalRandom random = ThreadLocalRandom.current();
return random.nextFloat(0.01F, 100.0F);
}
Out
Generated 9040 numbers below 0.9
Process finished with exit code 0
9000 is about 0.9% of 1_000_000 so this sums up
Oh good the laws of math are still working
So went and had a look and the random method has been updated. Dont know when and it automatically generates randoms in both directions from min negative to max positive if you dont specify a range. Which is what they want so they only need this code you provided lol
Time to keep that info tucked away for later now
I only remember it generating values from 0 to max positive
is there any ways to make npc(fake serverplayer) class instanceof Player?
Thats a weird question. NPC is an interface which extends Creature iirc.
What are you trying to do?
my fake player extends ServerPlayer , but it doesn't instanceof Player
It is
Its an instance of net.minecraft.world.entity.player but not org.bukkit.Player
Gotta wrap it with CraftPlayer if you want a bukkit player
If you want to check for instanceof for the bukkit player then you need to get the bukkit player from your nms player.
So
if(nmsPlayer.getBukkitEntity() instanceof org.bukkit.Player) {
}
huh, in which scenario would an NMS player (I assume we are talking about ServerPlayer) would not have a method getBukkitEntity() that does NOT return a bukkit Player?
ok tbh "nmsPlayer" could be anything
There is none
Unless the overwrite the getBukkitEntity method
Or yeah, nmsPlayer could be some nmsEntity
yes and no
It wont look like a circle. Even with interpolation you are limited by the clients framerate
1st: are you fine with a 20FPS spinning cube being considered a circle?
maybe you could show us a video
of what you want it do be, and what it currently is
What are you trying to do?
7smile I recently bought a bratwurst and it stank like hell
and I had to think of you
That was me
Why you already up?
me, or the other person?
You ofc
i hit the sweet spot of 1.25mg lorezepam and 4 beers
hard to explain, just trust me, it's the sweet spot
tbh that looks great, what's the issue with that?
Hm i think a flying ice block that rotates slowly + a few of those particles in the end will look nice
Doesnt need to be a circle
yes
but don't trust me. you gotta decide for yourself if you like that current animation
yes
teleport it
You could also interpolate the movement
?xy
Asking about your attempted solution rather than your actual problem
gestanksbratwurst pls do me one favor, tell me your favorite song and I'll vanish from this chat for at least 20 minutes
Oh my music will def not suit you. But i can send you one from the playlist that will motivate me to do some housework in a minute.
Ill dm you some
sounds good
it have to be casted to net.minecraft.world.entity.player
don't know why
Hmm. Quaternion fkery coming in.
You cant shouldnt cast if you dont check for instanceof before
hi, when I query the database, do I always have to do it in async?
You should never do any IO on the main thread. For example: If you query a database inside a
listener and the database is not reachable then your server just crashes. And IO is very slow.
So in most cases it produces a ton of lag, very quickly.
Paint me a picture. What do you want to get from the DB and when?
Ill give you the best approach to this.
when a player logs in, I retrieve his info from the db and store it in the cache, then when he leaves or when the server shuts down, I put the data back in the db
Use the AsyncPlayerPreLoginEvent to load the data.
You can do IO in this event and the player will see a loading... screen while you load his data.
It prevents the player from joining while you load his data.
When the player quits then you should save the data async.
When the server stops then you should save all data sync.
Also do regular saves from time to time to prevent data loss during crashes
these are very small data, is it really necessary for when it connects?
..yes
and just async at login?
Depending on where your DB is the connection allone could take upwards of 10ms.
Now imagine 10 players connecting quickly. Then it doesnt matter how small the data is, you will produce lag.
And if the DB is busy or not reachable then your server crashes as well. So its necessary.
and you say I can show a loading screen to keep them waiting?
And at logout.
But at login you should load the data before the player actually joins and
not in the PlayerJoinEvent
asyncPreQuitEvent exist?
This would delay a login from each player by 2s without affecting your game.
@EventHandler
public void preLogin(AsyncPlayerPreLoginEvent event) {
Thread.sleep(2000);
}
It will show the default login screen of the client.
Now replace that sleeping with any IO.
Nope. On quitting you need to properly handly the async requests.
what do you call io? so everyone would slow down by 2 sec? it's annoying
But make sure that your "cache" is thread safe or else you will get ConcurrentModificationExceptions
just simple async with schulder?
I have a hashmap, so instead I make a concurrenthashmap?
IO is short for Input/Output.
Some examples for IO are:
- Writing/Reading to/from a File
- Database access
- Requests to Websites
Should be fine
so in the event I just put my queries in the db? (I don't need to put any sleep?)
You can keep the sleeping in if you want to annoy your players
Let them wait in a limbo for minutes on end /s
They will timeout
and in case of any problem with the db, I can refuse them the connection and display a message to them?
Correct. Look into the AsyncPlayerPreLoginEvent for this. You can kick them while logging in and
send them a message if something messes up in your DB.
passing my hashmap to concurrenthashmap can create probleme/errors?
Yo. In the near past I saw a quite a lot of servers (1.20 etc.) which show an image of the players head in there scoreboard as an image. How does this works?
Is this also accomplished by texture packs or is there another way?
Screenshot?
Hmm. Do they appear somewhere else as well? Like in the chat or tab list?
I´m not 100% sure since its been a while when I was on the server. But if I remember correct its only in the scoreboard
The only thing i could think of are resourcepacks. But that does scale horribly.
They do have a custom server texturepack. But they cant probably replace everysone player head with a custom graphic and then automaticly reinstall the texture pack, I guess
Yeah thats what I thought too
@tame bay each pixel is its own char
negative space/back space magic is just enjoyable af
Would still require resource pack right for the custom font?
yea
I thought about that but then you would need a ton of chars for that.
Imagine a 256 bit color depth then you would need 256 x 8 images
its 8bit iirc
Well with 1.20 i think the easier way is display entities giving the appearance of a scoreboard
Thats what i mean. 8 bit is 256 colors
This way you can use whatever images you want
from the looks of it, they have 64 different colours ?
But wont this cause quite a bit of client side lag?
One image being 8x8 custom rendered chars...
10 head being 640 chars. And the network traffic as well if
you update this too often.
eh ¯_(ツ)_/¯
More of a reason to believe its a display entity and not an actual scoreboard
Assuming there is one lol
I mean
server resource packs are still downloaded
there is a resource pack on that server
I know they get downloaded but that is if the server specifies one
that server does.
Oh ok well i cant tell from the image lol
just gotta know all servers in minecraft smh
Without a resourcepack this wont be really possible. They also removed the numbers from the scoreboard
and i think this requires a resourcepack as well
Its possible with a display entity
And the missing numbers makes me think that as well
Just make the display entity move with the player at an offset and it gives the appearance of a scoreboard
Even with interpolation this could look whacky
Also writing on display entities is hard
Why is it hard? No different then your typical hologram stuff
Just a new entity with a bit more features
The alignment and rotation is waay harder
Well it may have more freedom in those regards that old holograms didnt have. But it shouldnt be an issue. But because it can rotate and align in more ways is nice because it does make for a better scoreboard replacement
But without more info or images though its hard to say one way or thr other but i believe its a display entity. Only makes sense because you dont need to bother with the resource pack for every player that joins
Ive tried writing UIs with the new display entities and i think its poopy
And it doesnt help that its resolution/FOV dependent
Well that is how holograms always worked
The scoreboard numbers are usually removed with core shaders these days
?whereami
Well
The server discards the info about the events when applying the component to the item
add to yaw
nevermind
your issue is this
getLocation always sends a new location
@quaint mantle
reuse location
Location location = livingEntity.getLocation();
//do your stuff on location
//teleport using location
getLocation return location copy, don't actually mutate players location
That is what he wanted to say
So yeah, this is what you want to do
Should work ig
Hi, I was a 1.8 Minecraft Spigot plugin developer, and I want to learn to code 1.20 plugins, which places do you advise for me to learn ?
there isn't much to learn except perhaps PDC
What is PDC ?
?pdc
ty
There is also the new fancy Material API but you'll stumble on it soon enough to the point that is makes little sense to raise notice to it
90% of it is transferable knowledge tbh. If not forums are your best friend
Thanks, I'll check it out rn, I'm reassured for my knowledge
Yeah thankfully it isn't as bad as 1.8 vs 1.20 in modding space
In 1.8 I couldn't do anything (e.g. custom villager, I had to use NMS, it was horrible), but now it sooooo easier
@wet breach @lost matrix @eternal night thanks for your ideas. Im gonna try to hit up someone from there dev team. If I find something I let you know
really comes down to modding (usually) being closer to bare metal (in this case, net.minecraft.* classes) tbh
bukkit is a pretty huge abstraction layer
thank god
yeah
if someone had a mod engine that used an approach similar to craftbukkit itd defo be much less aids than dealing with stupid little things like mappings changed
some people did attempt that but not on the scale that bukkit did :v
what do I use instead of the deprecated org.bukkit.ChatColor?
(paper, if that makes any difference)
is org.bukkit.ChatColor deprecated in spigot?
hmm
you can still use it
thanks
i know, ty
to be fair, bukkit was in the works before it was bukkit. Bukkit is a fork of hMod
I got an invalidconfigurationexception: https://paste.md-5.net/cicitijozo.pl
yes
?whereami
one of these days I will make one of my implementations where basically I strip out the majority of Mojang code and implement the bukkit api
im just talking about the abstraction of Minecraft to create a version-independent workspace
where stuff like Mappings dont play much of a part
they DO matter internally, but not for the actual development of plugins
is that a paper related error then?
well that is because mappings are done already really
but yeah
my implementation will basically not be dependent on updates
in a personal experience, client mappings played a key role in why a mod stopped working despite no significant changes to internals happening :P
on Forge
in other words, the moment an update comes out I could in theory already be updated since it wouldn't rely on the mojang code
its not going to be a clean room implementation either
meanwhile u can download a bukkit plugin thats 10+ years old n itll probably still work mostly as intended :p
probably not unless its something that is simple and doesn't touch the player objects
player object stuff got moved around a little in the API
or the methods in the object
true, it was an arguable example but mostly true for something like an MOTD plugin or announcer
then you have that api version enforcement in the plugin.yml lol
which that is easy to add for your example
hey anyone good with server optimazations
the api-version tag is for like forward compat tho isnt it? like a "this plugin uses api of at LEAST this version"
It is.
its so the server knows whether or not to use legacy api for it
which I am not a particular fan of
if a plugin has to use legacy api, already its unoptimal and cause your plugin to use more resources just because of it
or make the server work harder
since it has to translate
whyyy
skill issue, just dont use Lombok 
I am using NMS, I want to create a custom glowstone dust, but make it so that the dust is not stackable. So I want to set the maxStacksize to 1. I'm new to NMS and have been looking through the code, but Item seems to be deprecated and I don't know what to do.
you could just generate a random id to stick onto the item data
this would prevent it from stacking
Yeah but the item will be used in for example crates, so then it will always be the same copy of the item
Which will make it stack
I don't follow
Main plugin file: https://paste.gg/p/anonymous/71eae2a956264879952be933cbd39f42
Reload command: https://paste.gg/p/anonymous/fd5dd49e5dfd4fe690a0807363787986
My reloadConfigValues function doesn't seem to be working, in another file (my reload command) I'm using this function, the config variable doesn't seem to get updated even though I changed it a lot
Hi, i need to take randomly the x and z between two coordinate one min and max, i tried with random but it didn't go that well
second assigning getConfig() to a variable makes little sense as it doesn't do anything different
I think you were wanting it to save?
if so, you need to call getConfig().save()
nope, i'm trying to load the config again incase of a change
alright
why would just straight up reassigning not work?
Alright, so just tested it out:
public void reloadConfigValues() {
config = null;
config = getConfig();
}
It's doing the same, not changing at all
So imagine if I create an Item with unique id 123, like by doing a command. I will have the unique glowstone dust. If i do the command again this time I will get glowstone 456 for example, these don't stack. Then when you want to use for exampmle a crate plugin or shop plugin (external), you input the item 123 into the rewards section. If someone wins that item it will also have unique id 123 which causes it to stack anyway.
oh right, its the main config
you can use nbt and add a custom id to it
so in that way the wont stack but if the have the same nbt they works just fine
so you have any idea?
but i want to prevent them ever having the same id, they can never stack
reloadConfig()
forgot there is a method for reloading main config 🙂
then create your own crate plugin
or if you already made it
create a list that you keep track with the ids inside
alright imma try it out
most plugins don't copy the data of the item rather just track the item type
and for the not stacking part
it is what you asked, you said you didn't want them to stack
so now you do want them to stack?
it finally works!
No i never want them to stack, no matter the situation
thank you so much
you are welcome 
something to ask, really stupid and probably fast i need to take a X and Z and generate a number between the min and max of a region
Kind of like debug stick, it looks like a stick but it will never stack because the maxstacksize is 1 (because debug stick is a custom material, which you can't create i think). So I want to create an itemstack with a custom max stack size but idk if that's possible either
ok, then test with whatever plugins you have for crate or shop and see if it actually cares about the data of the item or if it only cares about the type
if it only cares about the type then the custom data doesn't matter
and then all you have to do with your plugin that handles these custom items, is check if they have these things in their inventory
and if they do, apply random id
this takes care of the receiving part of the item from the shop
or crate or whatever
?gui
Someone know why (1.8.8) even.setExpToDrop in BlockBreakEvent doesn't work or it's just for me pls ?
What’s that article about how to make inventory uis the right way
I doubt you’re gonna get much 1.8 help here
?command
?commands
Is there a list somewhere of all of the bot commands
?ui
?inventory
?chests
Damn
This is tragic
but i think it would work like the same in my situation
?
YES
appreciate it
Who needs cafebabe when all of the discord members already know what I’m talking about
Is there a way to change an ItemStack in a player's hand without showing the little swap item animation?
Trying to change enchantments for context
no
nah
Ah well, thanks
cause checked exceptions suck
wait does that not propegate to the lambda
How often is that forum post being shared per day
Probably like 3 to 5
he'll be $10 richer than you 🙂
Ah smile. That a legend o7
10 richer than frost
o.O
Paying for nitro is bleh
bro what is hikariconnection pool ?
is like hibernate and jpa ?
It's a connection pool
Hello help me I need deluxe combat addons
World guard
Hi, what is the differences between AsyncPlayerChatEvent and PlayerChatEvent ? except one is async
None
Except chances are you do not need PlayerChatEvent
Because uh, if you do that you add lag
Hello guys,
could you tell me, how i can spawn snowparticles in the whole world?
don't
so for modifications on the chat, I do an AsyncChat or just the chat event and I put the "loudres" things in async after canceling event
Spawn them in a distance around each player.
But let the player only see their own particles.
Is that the full exception?
EntityDamageEvent triggers each tick?
can someone actually explain what this error is: https://paste.md-5.net/cicitijozo.pl
im nut a pro, but i think it could mean a package loss
so for modifications on the chat, I do an AsyncChat or just the chat event and I put the "loudres" things in async after canceling event
Are you doing anything with packets or protocollib?
...?
when they do not have armor (the second check does not return;) its fine
Is there a way to access ServerboundInteractPacket Action?
Player#setHealth() might trigger EntityDamageEvent recursively
Cant think of anything that could cause this. The exceptions looks pretty useless on its own.
I tried getting the declared field, but could't get the class type
show code
same result without that
Check your config. Might be empty.
no it just has some text in it i was using to test if it worked
Show this "text" pls
just the word "test"
Thats not valid yml
OH that causes the error?
Yes
thanks
So you take damage once and it starts spamming your console with the damage event?
it was because of canceling the event
using event.setDamage() fixes that
Btw you should give your InventoryHolder classes an onClick(InventoryClickEvent) method. Let it implement some interface HandledInventoryHolder.
Then you can do
InventoryHolder fromOpenInv = topInventory.getHolder();
if(fromOpenInv instanceof HandledInventoryHolder handled) {
handled.onClick(event);
}
This way you wont have to touch your listener ever again.
Simply implement your interface and it works. Prevents you from
doing endless if-else clauses.
if I do it in async with a cancel event, there is no risk that the chat will be sent before the cancel?
You shouldn't use holder in general
is it worth storing data from a config file into something like a hashmap so you don't need to access the config every time or is it just more efficient to access the config?
Try delaying by 2 or 3 ticks and see if that changes anything.
using FileConfiguration its already in a Map
FileConfiguration is pretty much a Map<String, Object> internally
ok thanks
But you should def load everything into concrete classes when the server starts.
Dont randomly access configs within your code on runtime.
is there anyway to get the saturation amount of a food?
from the itemstack/material
because canceling FoodLevelChangeEvent makes foods doesn't feed the player
❓
well i don't want players hunger get changed by health regain
i'm making it -1 each minute
Alright, i think you found the GameRule for that already, right?
yes
getServer().getWorlds().forEach(world -> world.setGameRule(GameRule.NATURAL_REGENERATION, false));
And whats the problem with your FoodLevelChangeEvent?
You want it to be cancelled, but not if the player eats something?
I'm codding this plugin for my Roleplay server
if player gets damaged by guns or whatever they have to fill their health in medic, not by foods
and hunger doesn't affect by anything, for example health regain, because health regain event is already canceled
if i don't cancel FoodLevelChangeEvent somehow server does not understand the health regain event and rapidly takes hunger for health regain
and if i cancel the food level change, the Food items do not fill the hunger
so i want to fill the players hunger when they eat a food (using PlayerItemConsumeEvent)
thats why i need this
One solution
@EventHandler
public void onFoodChange(FoodLevelChangeEvent event) {
// Cancel every food lvl change which is not caused by food
if(event.getItem() == null) {
event.setCancelled(true);
}
}
Another solution
@EventHandler
public void onFoodChange(FoodLevelChangeEvent event) {
int before = event.getEntity().getFoodLevel();
int after = event.getFoodLevel();
int delta = after - before;
// Only cancel event if the player loses food, but not when he gains some
if(delta < 0) {
event.setCancelled(true);
}
}
Or you can define custom food levels if you want to
@EventHandler
public void onConsume(PlayerItemConsumeEvent event) {
Player player = event.getPlayer();
ItemStack consumed = event.getItem();
if(!this.isCustomFood(consumed)) {
return;
}
int customFoodLevel = this.getCustomFoodLevel(consumed);
player.setFoodLevel(player.getFoodLevel() + customFoodLevel);
}
https://paste.md-5.net/gipebenixe.cs so I'm a tad confused why... I can't add MineDown as a dependency. Gradle is complaining about missing repo, but I literally added the correct repo and double checked too
do you have minedown as a dep in other modules
no
thanks a lot, ig solution one takes the item from player's hands right?
so if he held a food in his hand everything changes
the second one is better, i'll use that, thanks again
for to use hikaricp am i need spring boot ?
or hikaricp has maven for self
no, hikari has its own dep
To me it looks like you need reflections. Which can be tricky if you are using mappings because the
mapped class on runtime might as well be something completely different.
btw for to use jpa or hibernate i need spring boot ?
doubt it
I searched them, they all talk about spring boot
yeah you dont need spring for hiberante
for jpa ?
You will find it as well when looking for tomcat, jetty, undertow etc
But you wont need spring boot for anything, ever
jpa is for vanilla java ?
probably not
alright
Hibernate implements the jpa standard
but jpa is spring feature ?
No
or vanilla java ?
Neither
Its a java enterprise standard like jcache
It simply defines a standardised approach to persistence
Yeah, i don't want to use it but i think i'll have to
I was hoping for some workaround 😂
ah i was think jpa is maven depencency
aight, lets get to coding
🥲
In old spigot mappings it was accessible, wasn't it?
The chat message will only be sent after the events are fired
Well, there is a workaround. You can always read the bytebuf
I think about to pull my hair out 😂
now i will add hikari for connectionpool and i will add hibernate
wouldn't be a problem right?
Hibernate already includes hikari.
I wouldnt use hibernate for spigot plugins.
It requires quite a bit of experience to get right.
spigot have a feature like hibernate ?
You should not check custom items by their name or lore.
Rather use the persistent data container of itemstacks and tag your items.
?pdc
Just write your data into files. Its the first step if you
want persitence. Databases can always be tackled later.
Sounds like a custom item to me...
Anyways.
EntityDamageByEntityEvent -> get attacker -> get item of attacker -> get ItemMeta of item -> check name, check lore
That is. So weird.
Wait are you on 1.8?
Because then i wouldnt be surprised.
Buggy ass, crumbling, ancient spigot version from last decade.
It changed a ton
each public static method is access able from other plugins via Class.method?
bro sry for my ping and i wonder this
im developing api plugin for my other plugins
this plugin will store some datas player_rank, player_money
but this plugin will be only for bungeecord
so could servers under bungeecord depend this api?
Every method is accessible from anywhere.
You just need them on the classpath.
thanks
If i understand you correctly, then yes.
You can write your api platform independent
I am trying to check if the attackers held item is a stick with knockback 2 named §c§lSTICK but i dont know how to check the enchanted
if(((Player) attacker).getItemInHand().getItemMeta().equals("§c§lSTICk")
ItemMeta will never equal String
?learnjava!
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming. https://media.discordapp.net/attachments/694661573125472256/998143126373941248/6n0v4g.gif
once again
api plugin will be in the bungeecord
but plugins depend to api, will be on servers under bungeecord
And how do you think this "connection" will be realised?
Take it slow. Split this into multiple lines.
Create one variable for each step.
hey, simple question
with the @EventHandler
if you have 2 of these with the same name, will they override eachother, or will they just live happy ever afhter
(inside the same or in different classes, with same or different events)
They can have the same name as long as they dont have the same event type (obvsly)
also when they are not in the same class
Thats fine. The Method objects are different.
In memory you will have the full path of your Method as identifier
com.beeme.kitpvp.listeners.CombatListener#onDamage(EntityDamageByEntityEvent)
So if you have another class or another parameter type, then the methods wont clash
oh wait, that is totally right, didnt think about it
aha, that makes it a lot more comfortable to work with lol, dont have to check the names anymore
If (memory.boolean > 0) this is under the block break event, it should fire if the boolean is greater than zero right?
lol
huh
You can just do if (boolean) or if (!boolean)
can java booleans be compared to numerical values?
yes
Sorry it's a double not boolean
for some reason i thought they couldn't lol
ok this makes much much more sense
Not directly
I'm learning... And very slow
title & subtitle
there are also fadeIn, stay and fadeOut values, but you don't have to change them
leave it blank
""
if(Boolean.TRUE.equals(memory.bool) == true != !false) {
}
Let me show what I actually have may help
this is reminding me of the terrible-plugin
thought they were using a booleanfactory 😦
ok there is one
This currently doesn't fire, I feel like I'm missing calling the event itself but I'm not sure
https://paste.md-5.net/gipebenixe.cs so I'm a tad confused why... I can't add MineDown as a dependency. Gradle is complaining about missing repo, but I literally added the correct repo and double checked too
Oh imgur link isn't even opening through discord anymore
The file just doesnt exist
You need to be verified for embeds
I think I understand I need to put <= not just < trying it now
Yeah working now. I just guessed made sense in my head
is it a bad practice to use <version>LATEST</version> for a dependency? specifically it's a private api that i think i'll be updating frequently, but i will thus know exactly when and what is updated
In general, yes
I mean if its private you would know when you make breaking change
But I wouldn't use latest anyway
Hi, to get the prefix for a player. The best method is using vault placeholder?
In code you can use the vault api
okay update turns out this is the cause of the issue removing this line from the publication fixes the error, but also doesn't push anything to the final jar
project.shadow.component(publication)
what is the event for a block being broken due to another block
like a torch or redstone
physicsevent?
can you show an example
?jd-s
Blocks cant really break other blocks. Maybe water and pistons. But those are covered by other events.
yeah I can't find an even regardless
BlockPhysicsEvent
@lost matrix can i have a code
Sure
tnx
if(Boolean.TRUE.equals(memory.bool) == true != !false) {
}
Here is "a code"
You didnt even continue your question
my friend needs it
the code
what is the event for a block being broken due to another block
the code for it
There is none. Blocks cant break other blocks.
final String username="root";
final String password="root";
final String url = "jdbc:mysql://127.0.0.1:3306/?user=root";
try {
Connection connection = DriverManager.getConnection(url, username, password);
PreparedStatement stmt1 = connection.prepareStatement("USE ladno");
PreparedStatement stmt2 = connection.prepareStatement("SELECT * FROM points WHERE nickname LIKE '?'");
stmt1.execute();
stmt2.setString(1, player.getName());
ResultSet results = stmt2.executeQuery();
if (!results.next()) {
Bukkit.getServer().getConsoleSender().sendMessage("Failed");
} else {
Bukkit.getServer().getConsoleSender().sendMessage("Success");
}
} catch (SQLException e) {
Bukkit.getServer().getConsoleSender().sendMessage(e.getMessage());
}```
This interrupts the work on the line "```stmt2.setString(1, player.getName());```"
and I see in the console ```Parameter index out of range (1 > number of parameters, which is 0)```.
What did I do wrong?
i don't think you should do '?' when escaping parameters in preparedstatements, just do ?
^
i had a similar problem
Oh, really. Thanks. I didn't think it was that easy
np
For the Water: BlockFromToEvent
For redstone on top of other Block: That should be covered by the BlockPhysicsEvent
can you give an example code
both of my hands are in cast
i cant search or try myself
i need the code for a friend who is not fluent in enlish
Hello, how can I make a player send a message ?
player.chat
okay thanks
how exactly are you typing
so you can just send the events to your friend and he can figure it out?
because i'm busy working on my own project and i don't know why i spend time distracting
Because thats not help, its spoon feeding
@EventHandler
public void onWaterFlow(BlockFromToEvent event) {
if(event.getToBlock().getType() == Material.REDSTONE_WIRE) {
System.out.println("> Redstone was broken by flowing block.");
}
}
agree
i need spoonfeed now
?spoon
Spoonfeed a newbie for a day and they'll come back with more questions. Teach them to find their own answers and you'll both be better off: you won't get stuck answering the easy questions and they'll be much more productive than before.
also i need for block under breaking
looks like it's not your friend after all
MY HANDS ARE IN CAST
left hand
Try BlockPhysicsEvent. Tell me if it works.
speaking as a professional liar ^^ (dark past)
it calls a lot
limit the conditions
dont know what to check
to what you're seeking
Might be worth helping them get better at English
ok this is bye
material
You won't get very far with programming if you can't understand English well enough for documentation
or how to find help
do you know the spoonfeed answer
olivo, can i ask you for some creative ideas? i'm trying to come up with the gui items for muting a player for: foul language, spam, and advertising
no idea what to use
sign is a good one, foul language is i don't think so
good one
Snowball
as in spamming it in pvp
snowball is a good one
i think water bucket works best for me, snowball is good too
COme on Mojang, when do we get multi texture packs
ooo
Someone really needs to make a auto merger
7smile7 did
Oh?
sorry alex not smile
Nah that's a program tho
yep
we need support for multiple keyed packs
@tender shard Make your resource into a plugin
And make it automatic at runtime
it could even read a resource pack info from the plugin yml
plugins would have to be compatible
perhaps a registry system for plugins
register their RP
plugins can register resource packs?
