#help-development
1 messages · Page 870 of 1
with basic knowledge of programming you could probably remake the minecraft packet system in like 30 minutes
A limbo with a keepalive could be done quite quickly. The handshake might be the most tricky part honestly.
Yea the theroy behind it is nothing "really" new for me. I'm doing it also at work but the practicle thing behind it (java) is a bit interesting for me as im working also with Java as programmer.
true
why is this not named "CraftBukkitScheduler"
Craft is just the implementation prefix
damn, I'm depressed now
I'm programming for 7 years but the practicle part behind network (based) programming is something i'm not really in to it. On the side of Minecraft i have a better understanding because of the experience i've made in the past years.
Just realized that im already 4y into programming now o.O
Time flies 
hmm, I'm wondering rn, what would be better, an async timer task that schedules stuff to the main thread whenever needed or just a normal timer
Java edition just uses TCP connections to the server
Depends on what you are doing and how much you want to bother with thread safety.
i know like i said, the theory is nothing new for me but in reality the core/kernel logic in programming is new for me.
A bit over 6 years for me 
I'm basically making a plugin that lets you interact with bukkit through an external program
it started out as a meme, basically, so don't ask any stupid questions cuz this project is stupid in general, okay?
Just out of interest bc I'm meaning to implement a SQLite database into the plugin eventually. Would it make sense to store a json string in a database?
It sounds stupid, but I don't know how else I could store ItemStack-Arrays in a database.
Would it make sense to store a json string in a database?
It wouldn't
that is why relations exist
If it's interacting with the outside world, run it Async and only jump on the main thread when you need to.
another issue I thought of is ticks
In that case you just throw everything into a queue and poll everything from it each tick.
There are really nice thread safe queues which let you stack on top with multiple threads from one side and poll with another thread from the bottom.
i just noticed, are u asking how to store Itemstack or how to store array of items
I'd keep it all seperate. You never know when someone will spam your external interface.
like, if the external thing executes something expecting it to run in this tick, what's the chance that something will run a tick after?
Basically store a custom inventory
Like an item vault
always assume everythign runs a tick later, other than schedulign inside an already running task
I mean a single ItemStack as json in a DB sounds reasonable. But the rest should be done through relations.
yeah that is why i asked again
hmm
Storing the whole inventory is only the final goal
So I then basically use a combination of SQL-statements and GSON?
name: WoolWars5118
version: '${project.version}'
main: org.bingogames.woolwars5118.WoolWars5118
api-version: '1.8.8'
commands:
woolwars5118:
description: "WoolWars5118 main command."
usage: /woolwars5118
aliases:
- WW
The alias isnt working
In 1.8.8
Remove api-version
Not related to your issue, but you've set it to an invalid version
ok
I'm trying to use ProtocolLib to make players partly invisible (i want their armour to be seen - like with an invisibility potion) - I've sent invisibility potion packets to the players and it seems like the client knows they have the effect however the player is just not appearing invisible, does anyone know if there is a different packet for making a player actually become invisible?
Appearing invisible for themself or for others?
If you want them to be invisible for others you need to send that packet to the other players too
To others (currently I am also sending it to themselves just because I am trying to understand why it's not working haha)
Even with the effect I am still fully visible aha
the ininvisibility effect
?
anyone know any servers i can use to commision a plugin dev?
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
ty
Would it be fine for the server to handle me looping thru a large ammount of blocks and doing checks with each.
I have a big stone cube and i need to loop thru it and find a random location that isbinside the cave to spawn a block. I tought about checking if the block has air next to it in any dirrection then add it to the list. After its done looping it generates a random number from 0 to list lenght and selects that block.
Basicly i have a cube and inside of it i have caves carved out.
depends
on many things
how strong is the server
how many blocks
are the blocks already loaded
I once looped over every block in a chunk to look for caves
When the chunk first generated
I can also generate the list before and save it and then just pull a random block out of that
I have a file for my custom yml files inside "resources" of my plugin folder. When I load my configuration files, do I need to do something specific because it is in the resources folder? Or can I just do something like:
plugin.getDataFolder().getAbsolutePath() + File.separator + "YamlFiles";
thats it?
plugin.saveResource("yamlFile")
yeah I do have a save check method if it doesn't exist on onEnable
but like it doesn't matter what folder its in?
it defaults to the plugins data folder
which is resources?
or are you talking about a folder inside your resources?
those are paths, but ok
what
a saveResource call will extract it maintaining the structure
you need to read it with that same structure, once its saved
does that mean when using saveResource I need to also specify the folder inside resources? this is a bit confusing cause its my first time doing it
so your path would be...java folder = new File(plugin.getDataFolder(), "YamlFolder"); file = new File(folder, "fileName");
aha
Anyone knows how to deal with SQLite exceptions? I use SQLite and ORMLite to simplify the sql syntax.
And i get an error when i try to get the databases value. And i have no idea how i can find where the issue is.
Its eather that the player is not being generated in the data base or that for skme reason it errors in the return function.
If i fix this then i can fix all of my database issues
?nocode no error, nothing to work with
It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.
I was asking if anyone has experience in it to aee who would help. I wasnt expecting a dirrect help.
Bc it is something that has to be asked in DMs
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
No reason it has to be in DMs
Hi , if mod send a message will can minecraft servers like spigot read the message ?
for example a mod say "Hello I am Mod " and in the console of server be log the "Hello I am Mod"
or be read the message on server
what?
I think he's talking about is a mc mod (e.g.a forge mod) sends a custom packet will spigot be able to handle the packet
is this the case @quaint mantle or
Packet channels or something
first sorry for my bad english and second yes i mean forge or fabric or any mod api in minecraft
if the mod uses PMC then yes
do you mean player.sendmessage(); ?
Plugin Messaging Channel
chatbox ?
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
oh i read it so if the message was a packet for server will server read it ?
Server does nothing with it, unless it's in a specific channel
ok
I fixed the error, it was a dum mistake.
It lead me back all the way to the onEnable function
Anyways, still one thing related to this. To represent true or false in the data should i just use 0 and 1. bc from what i see, you cant use booleans
How in InventoryClickEvent check for inventory?
does somebody know if redis is as fast as having data in server memory?
whats the in memory latency then?
IO
~1ms seems pretty fast
1-3ms
doesnt that mean its on the same level?
1-3ms for 100 players?
no
if you do separate requests it takes 300ms
use it like any other database
async
i dont want to use it as a database, i want to use it to cache data from a real database and im not sure if its worth it as im currently caching the data myself already
You can use it as a caching layer
For example, when a player joins you fetch its data (redis first then your database )and store it on ram
When a player quits you store that data back on redis for ~30 minutes
So that if a player rejoins you have less latency
Basically you want to define a lifetime for your data
And match it to something else's lifecycle
so redis fetches from database, server fetches from redis
and redis keeps it for a period of time to reduce latency
server fetches from redis, if fails fetches from database and puts on redis
okay, may i ask are you using redis yourself and which database do you use?
I'm not workin on any projects that use redis as a cache layer as of right now
But last time I did it was mongo + redis
And it was a classroom system similar to discord servers
do you think i should just fetch from redis all the time instead of caching it on my own too. It would be much easier and solve a few issues i currently have. The reason for redis is that i created a proxy with a few servers and with my old data system i encountered issues because the joinevent is called before the quitevent.(when a player switches servers in the proxy) When reading and writing to redis all the time there wouldnt be this issue as the data would be saved on disconnecting from the proxy or joining
someone give me example for #TabCompleteEvent ?
i wanna disable all tabcompleters
public void tabComp(TabCompleteEvent e) {
e.setCancelled(true);
}```
and i tried to change tab-complete in spigot.yml
I mean u can have a weighted local cache
and then redis be the second layer
whats a weighted local cache?
are you disabling tabcompletion to hide commands?
in this case you can just set a permission for the commands that shouldnt be seen
cancelling all the tabcompletion is a not so nice way in my opinion
well can i use bukkit permissions or i need plugin ?
you are going to need a permission manager like luckperms to get the permission to see the command, but setting the permission doesnt need any plugin
getCommand("blabla").setPermission(string permission);
this is to hide the command for players that do not have the permission
you need to do this in the onenable method
You can also just put it in the plugin.yml
true
send namespaced
wdym
how can you track the transfer of an item from 1 slot to another in your inventory\chest?
change send-namespaced to false
In my SQLite data base when i set players value from false to true it some how still returns false when using the get function for that data.
The .db files are successfully created, my player id is visible and there are no errors.
The get function returns it as false even after changed to true. I even made it print out the value right after setting it and it showed it as true.
?nocode
It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.
Which part do you want exactly? The command that excecutes, the data class, the dataservice class?
Note i use ORMLite with SQLite
ORM man imagine not going raw on the SQL goodness
Everything relevant to your issue
?paste
Ok i did how do i send it here
hello?
Hello there
?paste
I wanted to ask a question about bukkit velocity
I said i did it, how do i send it here
We don't support velocity
Copy and paste
A link
Velocity is maintained by a fork of spigot thus we can't guarentee it works or any features or compatability
https://paste.md-5.net/ticorokoki.java
Heres also what the player.sendMessage() returns every time i excecute the command: (for debug)
Im trying to apply a knock back to player based on their velocity, but it appears to show me x and z values zero and a constant value like 0.876666 on y component
Oh that kind of velocity xD

You never know now adays some group of hooligans named some piece of software after the word velocity.
??
no help?
It's been 6 minutes be patient
whats the knockback event?
Well ehm, share some code I guess. How are you fetching the velocity ? When are you fetching it
I don't think there is one atm
Let's see
?jds
?jd-s
There is no such thing as a knock back event currently
Idk coll is making one rn look at the pr
or entity collision
and how could i cancel the knockback?
Set velocity to 0 I suppose
That cancels all momentum
@young knoll work faster we need knockback event for this mans
Last I checked it's just waiting on merge
Merge faster then coll!!!
Player p = (Player) event.getDamager();
Player e = (Player) event.getEntity();
if (taserati.contains(e)){
Vector v = e.getVelocity();
v.setX(0);
v.setY(0);
v.setZ(0);
e.setVelocity(v);
}
}```
like that?
Code lgtm getting an error or anything?
Don't be surprised. This is SpigotMC, most of the time its disrespect and not help. I come here with a 10% chance that there is some one acualy willing to help online.
They have a history
Every dev i know relates to the same issues with this dc

You are free to leave ig
oh thanks
Can someone help me. my znpcs skin is not fetching my own skin
error: cant fetch skin with name "N8han40"
Send a stack trace and your code pls
What shoudl be best way to dettect if player equip armor with rightlcick? I had this, but code gets triggret if player clicked on crafting, bed or something like that, but armor wont be equipped so my code would run and it should not.
@EventHandler
public void onInteractEvent(PlayerInteractEvent event) {
ItemStack handItem = event.getItem();
Player player = event.getPlayer();
ItemStack helmet = player.getInventory().getHelmet();
if (event.getHand().equals(EquipmentSlot.OFF_HAND)) return;
System.out.println("INTERACT " + player.getName() + " item: " + handItem);
if (event.getAction().equals(Action.RIGHT_CLICK_AIR) || event.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {
if (handItem == null) return;
if (handItem.getItemMeta() == null) return;
if (!HelmetManager.isHelmet(handItem)) return;
if (helmet != null) {
if (HelmetManager.hasMaskApplied(helmet)) {
MaskEffect healthEffect = MaskEffect.HEALTH;
if (HelmetManager.haveEffect(helmet, healthEffect)) {
double effectValue = HelmetManager.getEffectValue(helmet, healthEffect) * 2;
removeHealthModifier(player, effectValue);
}
}
}
if (HelmetManager.hasMaskApplied(handItem)) {
MaskEffect healthEffect = MaskEffect.HEALTH;
System.out.println("EFFECT? " + HelmetManager.haveEffect(handItem, healthEffect));
if (HelmetManager.haveEffect(handItem, healthEffect)) {
double effectValue = HelmetManager.getEffectValue(handItem, healthEffect) * 2;
addHealthModifier(player, effectValue);
}
}
}
}
what file you need?
There is a resource which implements an ArmorEquipEvent for spigot. Give it a try.
If you are not programming a plugin then please refer to #help-server
alr
i will send you the znpcs file
thats the one you need ig
I found this one https://www.spigotmc.org/resources/api-armorchange.113581/ or some outdated ones. Thanks thats what I need.
very based sigma
Yeah if you expect an immediate response within 6 minutes to any question whatsoever, this is the wrong place indeed
also from randomly looking at your previous messages, it seems like any of your questions got a reasonable answer lol
I asked for help 1h ago. They asked for code and ignored it.
I mean yeah rearly there are people that do help. Most of the time its just loughing at people who are new to Java
hm my experience is the opposite. most of the times people are here to answer questions all the time, even when looking at the javadocs for 3 seconds would have answered most questions
true
I'm here to teach people to follow the fucking conventions
Very true, even people that can't think straight for more than one second
¯_(ツ)_/¯
also do you mean your question about some SQL thing that has 0 to do with the topic this channel is about?
or maybe I'm mixing things up rn
He asked the SQL one three hours ago but had no code or error so I couldn't help him then
It is a Spigot java plugin that uses SQL
I pinged you to let you know that i fixed it, but it caused a new problem and i tried fixing it for 2h and then came here to ask
your question is only related to your SQL stuff
and it seems like you're just executing a query and changing some values in the result instead of doing any changes to the database
you're not changing anything in the database
I'm not here to cause argument, but, this is not the problem with spigotmc, there are different people, different solutions and the difficulty of questions vary in different ways. but Y2K's response was not a 100% correct way to deal with stuff, reading mistakes happens, especially when you are trying to answer someone else (or doing something else) but I rather do more research on more communities, code to get my answer
you're just setting setBuildMode on the query result
yeah I see no update issued
setBuildMode(mode) excecutes a function inside SettingsData class that taks the value and sets this.buildMode to mode
Isn't that used to set the data
it doesn;t pass it back to the db though
to me it looks like it only sets one field to true and that's it
I want some code review.
I got this function which distributes some tasks to a ThreadPool and I want to check when all tasks were complete.
Moreover, I call this function every tick, and I want to make sure that casts which are batched in a tick also return the appropriate future and when it completes.
But it kinda feels weird to do it like this; I would love a second opinion.
like, I don't wanna be rude but I presume you are not basing this on 10 years of SQL experience ?
It might be better to (at least for now) stick to doing SQL yourself
ORMs are magically little unicorns that look great from far away but when you have to get close they'll bite your head off while you have to workaround some dumb restriction in their design
I would certainly not suggest them if you are trying to learn/are learning SQL
you can just use COmpletableFuture.allOf which returns a Future<Void> that completes when all it's "children" have completed
So i should do daoSettingsData.update() after is what im getting?
yes
imho you should try to understand how ORMLite works in the first place before using it. I have never ever used it so no clue, but it looks pretty obvious to me that you simply changed a value in the result you got
I wonder how efficient that thing is with the update() call 
and as I said, chatgpt also thinks that you need to call update, as I guessed
I'm doing that.
That's the part that kinda feels weird
well you're supposed to return the future that allOf generates, instead of creating your own future and completing that when the allOf future is complete
any point in not just draining your queue initially ?
fair, idk why I didn't do that
this draining and adding it to both a list and the executor seems weird
Sorry I didn't really understand that, could you phrase it differently?
I did attempt to learn it, but the syntax was just too confusing after messing arround with it for 2 days and never getting anything to work. Only thing that worked was a copy paste from a github rep that i tried studying, but a lot of the syntax looked like nonsense to me
Then i found out about ORM
I like the look of ORM and it's tidy to use, but best to know the basics first.
SQL is english in caps
Ah I think I get it. You are wondering why I have an intermediary queue instead of processing it directly, right?
ORM is for when you already know how it works and want to avoid writing your own queries
like, why not just
public CompletableFuture<Void> processQ() {
final List<CF<CResult>> drainedQ = new ArrayList<>();
while(!q.isEmpty()) drainedQ.add(q.poll());
return CF.allOf(
Lists.transform(source, input -> {
executor.submit(() -> {
processCast(input)
input.fut.complete(....)
});
return input.fut;
})
)
}
no, I mean I get the queue
if you are smacking stuff into it off thread its a valid thing
I mean, it realistically does not make a difference
don't mind me xD I'll go now. My suggestion is not smart
like, you already have a CF that wants to be completed and an executor. I don't understand the point of a queue that needs all of its abitrarily pulled "requests" to finish simultaniously. Or well, that wants to await those
but I digress, probably fine. I would not suggest a LinkedList
they are notoriously terrible
especially as you are not removing from said list
Idk if the requests are done at the same time.
It's just important that I know when all of them were completed, cause if that ever goes over 50ms, I want to log it and do some stuff.
Moreover, I might want to use the function somewhere else and would like to use #join on the CF to wait until all my requests were completed
Fair
There are two events which are fired my a hopper block. What do you need=
prevent the stove from being refilled with resources from the hopper
declaration: package: org.bukkit.event.inventory, class: InventoryMoveItemEvent
thenks
Does someone know if it's possible to code fishing on lava? If so, would you mind linking a resource, i've been unable to find one
It certainly is, but i don't know how
How can i use a sort of setblock with nbt data like in the command a sort setblock ~ ~ ~ minecraft:mob_spawner 0 replace {nbt} the example is from 1.12 but the 0 is the blockstate
Numeric block states don't exist after 1.13
my god (my personal not the jesus) java is great
I really didnt understand what asked, could you reprhase it please
if there's any way to simulate normal fishing (on water) but on lava
I want to make some special fish that can only be fished from lava
oh okay, perfect. Hmn i havent really worked with fishing but now you explained better someone can read it and try to help
sorry tho
no problem
how can i check if a player has an inventory open?
?jd-s
declaration: package: org.bukkit.entity, interface: HumanEntity
you can't
getOpenInventory will always return an Inventory instance, even if you have none open
shouldnt kotlin know that it.value is a string here? I'm literally checking it the line before
ofc I could but it shouldnt be needed
I'm just wondering why kotlin thinks that a cast is neccessary
cooler kids would use the when syntax here obvs
kotlin does that with some weird compiler checks I think
the value might be null
rather than like pattern matching
that'll crash your current code too though
because you call toString if it's not a string
yeah true
so it'd just be value?.toString() wouldn't it?
anyway the question is why is it needed
¯_(ツ)_/¯
because kotlin usually supports these auto casting stuff or however its called
probably a case where the kotlin compiler just fails to pick it up because it's an expression rather than a scope?
not sure
a match can probably do what you want anyways can't it
I mean
is it map or switch in kotlin I forget
it is calling a method there
a field
it's needed because it's probably a property where the mutability cannot be confirmed
yea
given that is a Map.Entry yes
you'd have to store it in a local ig
or just when() that shit
this is why sum types are better than oop
value is a property
what
you are iterating a Map.Entry
I am iterating a kotlin.collections.Map.Entry
is that backed by a java type ?
.value is definitely just calling .getValue() on the entry
I don't see you converting it into some mystical kotlin type
it does that automatically, see the screenshot above of IJ claiming it's a kotlin Map.Entry
show what the IJ error is
it is literally an abstract val 
anyways it.value as? String ?: it.value.toString()
I'm guessing the scoped downcasting only works on locals
it.value?.toString()
that's not the same thing
got a few nice things but lots and lots of bloat
Well and this shit
it is
I agree
abstract properties 
yeah why not?
well, at least I hope you understand why it is failing
I guess you end up with an NPE if there's no value :)
yeah because the property's getter might have been overridden / open and return sth different everytime
indeed
good language design 
if value is not nullable then it's just it.value.toString()
I can never tell if sarcasm from Lynx
definitely sarcasm
kotlin has very mid language design
if you wanna see good lang design look at rust 🙏
kotlin syntax makes rust lifetimes look sane
lol
rust lifetimes are scary but you never really need to tango with them if you use the right tools
just throw a couple smart pointers in and you'll never need to bother with lifetimes
I will hug you
Yea I mean, its a thing you don'T ever wanna touch given how leaky that shit is
well it kinda is nullable as it's a platform type, getValues returns a Map<String!, Any!>
mm
what
how leaky what is
lifetimes 
how's it leaky
like, leaky as in it forces itself up the chain
ahh
same shit with like, async in js
yeah it has a tendency to get everywhere if you're not careful
Yeaaa
but you can cut off the chain with a smart pointer anywhere
kotlin has too much syntax
rust has a lot more syntax I think, but it doesn't feel like it does
i need some help
because it's all so consistent that I've almost never looked at new syntax and been genuinely clueless as to what it's doing
with what
throw your question in here ^
- code and any relevant errors
I wonder why this channel still hasn't been converted to forums
[21:21:29 ERROR]: Could not load 'plugins/swordprogressionplugin-1.4.1-BETA.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: java.lang.IllegalArgumentException: Plugin cannot be null
at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:157) ~[purpur-api-1.19-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:417) ~[purpur-api-1.19-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:325) ~[purpur-api-1.19-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_19_R1.CraftServer.loadPlugins(CraftServer.java:451) ~[purpur-1.19.jar:git-Purpur-1735]
at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:313) ~[purpur-1.19.jar:git-Purpur-1735]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1138) ~[purpur-1.19.jar:git-Purpur-1735]
at net.minecraft.server.MinecraftServer.lambda$spin$1(MinecraftServer.java:308) ~[purpur-1.19.jar:git-Purpur-1735]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: java.lang.IllegalArgumentException: Plugin cannot be null
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:145) ~[guava-31.0.1-jre.jar:?]
at org.bukkit.NamespacedKey.<init>(NamespacedKey.java:74) ~[purpur-api-1.19-R0.1-SNAPSHOT.jar:?]
...
code?
It wont fit in a msg lmao
?whereami
looks like you're passing null to a NamespacedKey you're initializing
purpur
?paste
Ope md smelled the purpur
the purpur.yml is pretty easy to smell given its size
public class SwordProgressionPlugin extends JavaPlugin implements Listener {
private NamespacedKey swordProgressionKey;
public SwordProgressionPlugin() {
// This is where you initialize your plugin
swordProgressionKey = new NamespacedKey(this, "sword_material");
}
protected static SwordProgressionPlugin instance;
public void onEnable() {
getLogger().info("SwordSMP - Plugin has been successfully enabled.");
getServer().getPluginManager().registerEvents(this, this);
}
private final NamespacedKey materialKey = new NamespacedKey(SwordProgressionPlugin.getInstance(), "sword_material");
public static SwordProgressionPlugin getInstance() {
return instance;
}
@EventHandler
public void onCraftItem(CraftItemEvent event) {
// Check if the crafted item is a sword
Material craftedMaterial = event.getCurrentItem().getType();
if (isSword(craftedMaterial)) {
// Prevent crafting any sword (or other logic)
event.setCancelled(true);
event.getWhoClicked().sendMessage("You cannot craft swords!");
}
getting no errors in intelij idea
Ik some java not spigot api tho
i kinda made my plugin with chatgpt
?codeblock
You can use the discord code block format to display code or just text in a more pleasing way:
```java
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
}
}```
Becomes:
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
}
}```
You are supposed to head to the purpur discord pretty much 😅
given you are not using spigot
they can offer better support for their API
Im using spigot api tho
Ah
Well, you never set the instance
you create a NamespacedKey using SwordProgresisonPlugin.getInstance(), which returns null
what do i change?
Looks like purpur to me
do not create NamespacedKeys with null as plugin
server softwares purpur, the plugin is spigot (Can you even make a purpur plugin)
explain it in an easier way, lmao
Im too dumb
all ik is some jsva
null ^
that i learned from a youtube tutoril
remove that?
or wat
remove the red thing ?
?
either create that key the same way you create the other key, or properly set your instance in the constructor
there should be 0 need to call your static getInstance() method if you already have an instance
you can simply use this because materialKey is an instance field
private final NamespacedKey materialKey = new NamespacedKey(this, "asd");
same for your other namespacedkey - there is little point in setting one in the constructor and initializing the other one directly
just create both using this right where you declare the field
Hey all. Trying to construct Suspicious Stew via the SuspiciousStewMeta. I can build the ItemStack just fine, and the data is on there, however when eaten it does no effect.
When I looked at the data made by Spigot compared to a vanilla stew taken from the creative menu it was a little different.
Top: Spigot created
Bottom: Vanilla
Anyone know of a fix?
I wouldn't mind writing the metadata manually if someone could show me how to do that.
Thanks
by opening a bug report on spigot for the incorrect behaviour
beyond that, the API does not offer a way to edit that manually
you'd have to look into things like NBT-API
Understood. Wanted to ask first just in case
Thanks
yikes is it the case sensitivity of "effects" lol
Did Mojang change that at some point
so spigot creates a sus sus stew
indeed
Thanks Obama Jeb
in germany we thank merkel for stuff that doesnt work
Merkel bring 3.50 Döner abi
Paper doing fixes and never letting us know smh
Making the ticket rn
val resolvers = tagResolverFactory?.getTagResolvers(concerns)?.toTypedArray() ?: emptyArray()
lines.forEach { receiver.sendMessage(mini.deserialize(it, *resolvers)) }
is ?: emptyArray() the proper solution to be able to call a varargs method with a nullable array?
yeah sure
Anyone know a way to damage an entity as a player? Entity.damage doesn't account for the item the player is holding and stuff like that
omg it works
Player.attack(target)
ty
hey, is it currently possible to do modded armor models in mc?
like not just a texture swap
for java edition
I think bedrock has it
I woudl recommend fully java and then start with apis. Because with the past of the time you will just face and face more problems
Shaders
Tag me if you get an answer that doesnt involve core shaders plox
I have a worse solution than shaders for what it's worth
but I didn't want to do it
well shit
Hypixel does it and they dont ask u for shaders
Atleast on the skyblock with the minions im totally sure they are modded armor stands
The minions have vanilla armor and a custom skull
like I could maybe coerce a client into believing they are wearing horse armor with a custom model maybe
Well if you glue some display entities to them
desync
Make them passengers
if it's not worn by players it will look like garbage
lol
I am pretty sure that would be a war crime
holy shit I can't type today
Well then your only option is shaders
This looks fairly easy to use
actually nvm
player armor isn't a discrete entity from the player right
so at best you could retexture, right
Correct
damn
mojang where is that modding api we were promised over a decade ago
or modding tools
whats your opinions on the ytber code aesthetic
He has some very good points. But his videos are mostly about the basics for clean code.
I liked those the most
the head slot still can't do jack shit with normal helmets right, the trick would be to put something else on there?
I believe so, yeah
ok I've never done it before, how hard would it be to send a packet telling a client they are wearing horse leather armor on their head every time they equip some other helmet
Well there is a library for an armor equip event
https://www.youtube.com/watch?v=PCm5Gi0vMGA
This is the most based approach for the modulo operation
I saw that
there isn't a way to send that kind of fake behavior packet via the spigot api right
I think it's possible for blocks but not for armor?
There is
really now
sendEquipmentChange
hol' up, wait a minute
But this will only work for replacing the helmet. Not the entire armor.
Now I’m no math expert but…
Hello, i'm detecting an ItemDisplay with a raycast, this is working but is there a way to reduce the detecting box from the ItemDisplay ? I know there are no hitbox on ItemDisplays and TextDisplay but with this raycast the Displays box are way too large : ``` RayTraceResult rayTraceResult = player.getWorld().rayTrace(player.getEyeLocation(),player.getEyeLocation().getDirection(),20,FluidCollisionMode.ALWAYS,true,1,null);
it is
does somebody know how i can turn of the auto uuid assigned by mongodb to every object (I'd like to set it to a uuid)
typically you can just override it with a mongo predicat iirc, i find it easier to do that one line of code
Though, why change _id? Couldnt you just add a uuid field? Typically changing the mongo _id isnt very favored and could cause issues, mainly just cause the entry to me re-indexed but thats about it
i will never use _id and this use up storage
Thanks it is working, i thought 1 was already low enough
_id is used by mongodb for indexing
the space it takes up is also extremely negligable, its a line of JSON essentially no more than a few bytes
why shouldnt mongo be able to index it with a uuid of a player?
It does, if you add it as a field 😄
you can index by fields, but mongo by default uses _id to sort things out and index entries
bruchard on the topic of mongodb, is there a tut on how i can structure my database like a professional?
ok
yeah not that bad for storage at all even with thousands
For mongo DB i just take my PlayerData class and serialize it to the DB
i find that the easiest solution when working with MongoDB
so you have 1 humongous class with all the data?
Well, i have a would different classes but essentially yeah
For example I would have mongo db for all these seperate types of objects:
PlayerData
ServerData
EventData
Etc. etc.
Is there some built in way to get how close to being broken a block is?
e.g. when youre digging a piece of obsidian, if I had that Block as a vairable, how would I get what percentage broken it is?
sadly IIRC you just have to monitor it with packets, might be wrong here havent done something like that since 1.18, dunno what new stuff they added to the API
damn, alright
You can get how much progress the player makes per tick
But I don’t think you can get the overall progress
You could manually count tho
Via BlockDamageEvent and a scheduler
Which one is better
A:
PatternUi patt = this.newPattern(
"pmpmempmp",
"mwwwwwwwm",
"pw wrwxwp",
"mwnwbwwwm",
"ampmpmpmp"
);
B:
PatternUi patt = this.newPattern(
"p m p m e m p m p",
"m w w w w w w w m",
"p w - w r w x w p",
"m w n w b w w w m",
"a m p m p m p m p"
);
I think B is more readable, imo. Probably that one if they both function the same
both do function the same
but B is more readable
yeah i thought so, i was more thinking if compactness or readability is better in this scenario
but either way
patt.addChar('m', mg);
patt.addChar('p', pg);
patt.addChar('w', wg);
patt.addChar('e', enchant);
patt.addChar('r', right);
patt.addChar('x', bg);
patt.addChar('n', info1);
patt.addChar('b', book);
patt.addChar('a', exit);
i need to figure out how to make this part better
cause this seems excessive
theres a way to make it chainable with 2 variables at a time?
i thought you can only do that with one
oh i see what you mean
now i just gotta figure out how to get intellij to hide hints for variables
its annoying it makes it offset lmao
Right click 
thank you
I've asked about this in the geyser server too, but I've gotten no response so far and I was wondering if this "LinkageError" could be a more general issue encountered with plugins - if so what could I be doing wrong that makes this happen?
why spigot is destryoying the api that used to be?? Starting from the ids of things, api methods, conventions, java versions
item ids were removed from vanilla so they got removed
that i can understand, but why java versions? there was no need to that they just make us losting time
bukkit uses 8, spigot uses 17
but why would you use bukkit for developing? its dead bukkit
i mean spigot just destroying their amazin api
sometimes I forget spigot is even a fork of bukkit lol I just forget bukkit exists
it doesnt exists anymore that why haha
@young knoll ty folr the suggestion btw
PatternUi patt = this.newPattern(
"p m p m e m p m p",
"m w w w w w w w m",
"p w - w r w x w p",
"m w n w b w w w m",
"a m p m p m p m p"
);
patt.addChar('m', mg).addChar('p', pg).addChar('w', wg).addChar('e', enchant).addChar('r', right)
.addChar('x', bg).addChar('n', info1).addChar('b', book).addChar('a', exit).applyPatt();
Spigot I think is still java 8? Idk
spigot is technicalyl a fork of craftbukkit
i thought spigot needed 17
The server is java 17 though so that’s what you gotta use
where is Java 8? Only version 1.7x and 1.8x use JAva 8
then spigot did a fucking mess
Like I said
because you need thosens of versions for running the server, with no need
i just checked, turns out spigot doesnt care about version it wants 8
Minecraft moved to java 17
its mojang that update to new versions
So you gotta use 17
oh lmao i forgot that spigot uses native mojang server code
You can still develop with 8 but why would you when the server uses 17
spigot-api is java 8
Java 17 is same java with some shity additions
thats why i complain
because most teams do weird things to their products that were okay, without need to change it!!
spigot retains compat as much as possible
everything you can do in 1.8 you can still do now with much more features
Yeah literally nothing in the API was ever changed or broken except removing item ids which were already deprecated in 1.8 lmao
ik that, but without need. Because that why exists libraries too from a view its really unncesary changes
so we shouldnt have added new events, pdc, better api and that
You are free to use a 8 year old api version
it should be up to all 30 plugins you have to shade a library for it?
It will still work on 1.20
yeah as i said many times this the reason of being 1.8 dev
From 1.13 up all is broken and creappy to use haha
its not tho
the api now is much easier to use
i dont need to remember 20 trillion id magic values
Sssh he‘s just drunk
lmao, im being serious
Me too
im talking clearly and without saying weird things. Im just complaining about spigot doing weird changes to the api and even the versions
For example?
like?
NMS momment
Nms is not api bro
lol
.
Also we having mappings now
Which make NMS way better
And paper also didnt remove them
okay, so mappings are the docs that exists on java for a long time
no
What
mappings convert a.b.c(xyz) to player.connection.send(value)
i know NMS are reflections over obfuscated code, isnt that?
guys
how do I even name this
public final class Level1To9Wrapper implements LevelWrapper {
@Override
public @NotNull ChatColor getLevelColor() {
return ChatColor.GRAY;
}
@Override
public int getRequiredExperience() {
return 15;
}
}```
verano you need to go to bed
no need for being rude, i never used NMS because i dont had the necessity atleast to what i code
You‘re also not using spigot if you think string methods were removed
NMS is just the internal server code
okay, so reflections over the obfuscated
Technically the name NMS isn’t accurate anymore but whatever
It is impossible to work with anvil inventories via only the spigot api without using nms/packets. Are there plans on having more support for it?
no
NMS deez nuts
There’s a large inventory PR in progress
right, sorry for this. But i want to understand
can i get a link?
im not trying to be rude, but you really need to sleep
have you signed the cla?
don't know what that is so no
would this add more support for custom anvil inventories and such?
and any eta on that?
It should
And no, no eta
You can do anvil GUIs with just NMS and no packet wizardry
But yeah still not ideal
is that supposed to reflect the XP amount required in vanilla to level up?
You technically could just use a pair/map.entry/whatever people like to call it
Anyone know what I'm doing wrong here? I still can't figure it out
well
maybe these levels will have some other
attributes
You could also just have a holder class
wdym
idk I thought about that
Perfect use for records if ur on modern java
yeah ill prob do that
Why not skip this and just use a math equation for this
And for the color just do checks or smth to see what color it should be
well it's a remake and idrk the actual equation
xpRequired = level * 15 idk
nah its so random lo
oh its manaul by the level
to 900
thats really strange tbh
what i do is
XP(L) = 15 x 2^(L-1) for example
so level 1 starts at 15
then for example: 15 x 2^(2-1) (level is 2)
would be 30
well I personally think this is a waste of time cause the gamemode maxes out at level 120
and the prestiges is what continues
i guess? just seems like a waste of time to create a massive config file for a task that can easially be done w/ math
and in my personal oppinion creating a massive config file for something like that is insanely overkill, but ehh to each their own
wait what
Level1To9Wrapper?
You could just have a configurable formula
Did you make 120 classes?
Using something like crunch
from what i can tell yes
wellp ive officially seen it all
even then just math with like a
baseXp & scalePerLevel (% increase from base) would be perfect
wait i just realized these are seperate classes
XDD
i was under the assumption of oh maybe he embeded the classes inside his level wrapper?
Yeah idk why they didn’t do a single record
or go braindead basic
xp = level * 15
that oto but i likey the percentage based equation, but that would also work too
xp = 1000 * 1.01 ^ level
thats true
I think McMMOs default formula is like 1000 + level * 20 or something
whenever i do equations like this i forget bedmas and go overkill with parentheses
so it looks like the stupidest thing ever
Kek
also aaaa nobodys been able to fix my verification status
im stuck as an unverified for enternity
Except computers dont operate like this
What people forget in the order of operations is that both division and multiplication are treated with same priority. That means regardless which is first that is the one that will be operated on. Same goes for addition and subtraction.
This is why parenthesis become important or screw your equation all together
That’s on them for forgetting
Lol
oh so im doing correctly accidentally anyways
mission failed successfully
day 10 of making a wiki website: I built in a sign system into the website to display exactly 3 signs. This is because I am tired and did not want to have to boot minecraft
also manaspace is a really nice pixel font
I tend to prefer computing the result in multiple steps using multiple variables if it needs more than one parenthetical expression
which is all fine and good until you're computing enough data that the overhead from the garbage collector for all of your variables becomes a problem
you really don't need to worry about that
there is really no additional overhead to the garbage collector for this in most cases
especially because in all likelihood the compiler is going to inline it if it would make a difference
all this just reminds me why I don't use java anymore though :)
I do wish java were smarter about early collection of scoped variables or at the very least give me an easy tool to handle that myself
we already have boolean and Boolean but have you heard about bBoolean where you can just tell java to bBoolean.kill()
How do I obtain all the net.md_5.bungee.api.connection.Server in the network?
not to confuse with BBoolean which is a thread safe boolean
or bBBoolean which is a thread-safe boolean you can manually deallocate from memory
or BBBoolean which is a boolean with 4 possible states, true, false, null and maybe
ok but the reason I say this doesn't matter is because I mostly use it in mathematical expressions
which generally use primitives
not subject to gc in the first place
and even if you do use objects, storing additional references to the object really doesn't do anything to gc
if java uses a reference counting gc then the only cost is decrementing the reference count when it goes out of scope, which is negligible
and if not then there is no gc cost to having more variables
gc runtime scales with allocations and stack references are about the most irrelevant thing to it
because unless the gc pause happens while your function is running, it's just some references that will be dropped almost immediately anyways
and if the gc pause happens while your function is running, oh no, it has to count one more reference
I really can't think of a situation where this would make any meaningful difference in execution time but I would be happy to see a benchmark showing otherwise
more than anything else at a scale you might be running the gc more and more often
and the gc itself is not necessarily to smoothest experience on a live server, it doesn't have to be bad necessarily but it can be
even though the tick rate of minecraft is relatively low
eh, modern GCs can easily clean up several dozens and hundreds of GBs like it's nothing
given appropriate tuning, but even for a Minecraft server the defaults are more than fine
yeah it's not a huge problem, rarely it will run at a particularly bad time and that's when you spot it
it's interesting, in some code that I wrote recently the hottest function created a new Interval(min, max) up to 6 times at most, and it was severely impacting the performance of the function, upon profiling nothing seemed out of the ordinary, and GC contention eas not a problem, but the constant "using min/max that are jumping around all over heap" was, which obviously something like that does not show up in a profiler
can't wait for Valhalla praying rn
accurately profiling plugins is just not even a thing
that single change cut the entire run-time by, like, 60%
there are so many things that just melt into the background noise
help why is waitUntilNextTick taking 70% of my tick time :^)
If you use mostly primitives. However if autoboxing occurs it doesnt stay a primitive
ok but who is writing Integer i = ... lol
I feel like you're next going to say "but it might come from a function returning Integer"
at which point I am going to say "but I'm only talking about local variables affecting gc"
I swear I can't even give a simple suggestion like "I like to split my complex expressions across multiple lines" without people bikeshedding about the most micro of microoptimizations
It depends how your equation is written and whether or not you mix types. So you can end up with things being intrinsically turned into Integer.valueOf(). But the final output still be a primitive. But now we just made objects out of nowhere which can and sometimes hurt gc and cache related things
So in regards to splitting your equation. That actually might be more optimal in some cases
@Override
public List<String> onTabComplete(CommandSender commandSender, Command command, String s, String[] strings) {
if (commandSender instanceof Player) {
if (strings.length == 1) {
List<String> completions = new ArrayList<>();
completions.add("arg1");
completions.add("arg2");
completions.add("arg3");
return completions;
}
}
return null;
}```
is this wrong ?
tabcompleters not working
Did you register it
yes
getCommand("test").setTabCompleter(new Komut());
plugin.yml:
test:
description: My custom command
usage: /test <arg1>```
Ahhh I see your mistake switch args to 0 and give it a whirl I'm pretty sure it's 1 less than you expect for the tab completes could be wrong but prey sure that's it
🤷♂️
Try setting the executor
i will change my spigot version
Tbh I’ve never used just setTabCompleter
oke
me neither
Completed might not work without executor tbh
I'd need to take a look at internals but I wouldn't be surprised
i do this personally
public abstract static class CommandBase {
protected String key;
/**
* Generates a CommandBase for a Command.
*
* @param key The key/name for the command.
*/
public CommandBase(String key) {
this.key = key;
}
public abstract boolean onCommandRan(@NotNull CommandSender sender, Command command, @NotNull String alias, @NotNull String[] args);
public abstract List<String> onTabRan(@NotNull CommandSender sender, Command command, @NotNull String alias, @NotNull String[] args);
}
and then i have a manager for it
TabExecutor ftw
Check the dev branch in the core module
Has my gui stuff
I made my own framework that I use, and it works well, im just curious how people directly create their guis
are people using managers, or are people just making a class and calling it whenever
for example heres mine
Mine maps towards more what internal NMS looks like for inventories barring a few methods that aren't exposed by API
I am the inventory pr guy after all @young knoll can vouch
I believe it lmao
I wanna improve as much as possible with creating stuff like this personally so its better for me just to straight up ask
right now how my managment of stuff works is:
The manager that manages all the sub-managers < Sub-managers (like custom enchants, items, ect) < The objects inside those sub managers (like the custom item self)
Its weird but it works pretty well
I've always wanted to make an inventory and command framework in Lua
I actually do lua mainly
I do coding jobs on roblox XD
I started on lua when I was 10-11?
Lua is a gross language but it's a joke to embed
I would code rp games n such
Its the most barebones basic language
LUA would be an alright scripting language
Im trying to do java as my main language cause I love OOP
Probably still not as accessible as skript tho
OOP is also disgusting
:(
Man is a functional pleb
No functional is literally just people who don't want to admit objects can be useful
What’s the other option
Don't affiliate fully with one?
Oh right just punch raw binary into the machine
Thats pretty much what I did with Lua
Well Lua can't actually code OOP as OOP wants you to
I wonder how much binary it would take to write a basic functional program
you should try lmao
see how long it takes
Y2k is the embedded systems nerd
I mean reminder that java.util.function is technically functional programming and using it deviates from oop
😩
Ofc java is missing quite a few things from functional programming but still going pure OOP kinda sucks also If you were to follow SOLID your code base would end up the size of New York city
Don't get me started on those DI nerds
Fr though it's much better than arguing about which of the 20 billion java script frameworks I'm going to use for my next website
Lol
Genuinely never knew that existed
Then again currently I do not have a use for that specifically
Any good tutorials online on how to use it?
Id love to find some usages for it within my servers plugin
Or is it literally just
Like coding functional
It’s an object that can represent a basic function
Oh I see
https://www.baeldung.com/java-functional-programming baeldung is usually pretty decent but it'll take time
guys i try tabcompleter on 1.18.2 and worked
tab completers not working on 1.16.5 ?
Guess not legacy problems ftw
When the out is dated
😦
why are you using legacy stuff btw
i never even heard of that til a couple mins ago cause ive always used onTabComplete
My market is at 1.16.5
So why not change the code to function in newer versions
Worlds smallest market
Hey everyone's gotta have their niche
They are using onTabComplete
Hey, im probably just stupid or something
But what does package-private mean, and why does tying to use EntityType#getTranslationKey() make intellij tell me: "Cannot access 'getTranslationKey': it is package-private in 'EntityType'"
wait then am i dumb
is onTabComplete outdated?
?jd-s
private means it can only be accessed within the class
well i will use new version
No
Should be public maybe a kotlin issue?
yeah, im familiar with private, just not package-private
If you're using paper maybe they removed it
u guys any idea for tabcomplater without command ?
wdym without a command
I am indeed building against paper
like are you creating a searchbar?
Then this isn't the place to be asking as far as spigot is concerned this method is public
well 1m i will show
Paper probably has another method for it
ok speaking of is there any active forumn staff i can dm about my verification issue lmao
declaration: package: org.bukkit.entity, enum: EntityType
Probably translationKey() or something
Email support
?support
Md can probs helps 😌 👌 💯
alr i shall send a email
oh
Isn't there an event to be used for that
In which event should I use this?
Player join probably works fine
i will try something
Most be smh missing out in all that great new api
It doesn't fire anymore
for 1.20
Deprecated.
This event is no longer fired due to client changes
it wont work however
You might actually have to delay it by a tick
I'm unsure if the player's connection is fully ready in the join event just yet
PlayerJoinedEvent when
does anyonme know why no particles are being spawned
double minX = Math.min(location1.getX(), location2.getX());
double minY = Math.min(location1.getY(), location2.getY());
double minZ = Math.min(location1.getZ(), location2.getZ());
double maxX = Math.max(location1.getX(), location2.getX());
double maxY = Math.max(location1.getY(), location2.getY());
double maxZ = Math.max(location1.getZ(), location2.getZ());
for (double x = minX; x <= maxX; x += 0.1) {
for (double y = minY; y <= maxY; y += 0.1) {
for (double z = minZ; z <= maxZ; z += 0.1) {
spawnParticle(player, x, y, z, 0, 0, 0, 0, particleCount);
}
}
}
}
private static void spawnParticle(Player player, double x, double y, double z,
float offsetX, float offsetY, float offsetZ, float speed, int count) {
PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles(Particles.E,
true, (float) x, (float) y, (float) z, offsetX, offsetY, offsetZ, speed, count);
((CraftPlayer) player).getHandle().c.a(packet);
}```
``` Player player = (Player) commandSender;
Location location = player.getLocation();
spawnParticleBox(player, location, location.clone().add(10, 10, 10), 20);```
its supose to spawn particles in a box between 2 points
What kind of old version are you on
