#help-development
1 messages · Page 551 of 1
My whole test plugin is filled with comments testing out all the component stuff
So yeah
well time to sleep, hopefully that Pr get accepted I want my components >:D
MY STUFF IS STABLE >:I
reminds me I need to do the smithing table thing tomorrow
someone check out smithing table i'm pretty sure its broken (according to paper)
I’m currently just using the enum constant for items as lore
specifically the Recipe's
And it works, but it’s not ideal
anyone?
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/entity/LivingEntity.html#getKiller()
Does this method only return non-null inside PlayerDeathEvent?
huh trying to use it in the respawn event and it want to remain null odd
sad, wonder why it gets cleared
guess i can just add a small listener for death too, just a tad annoying :p
yeah seems like it does get cleared just retried it sadge
I'd just add both the victim and killers uuids to a map in the death event, and then check if its in the map in the respawn event
ehh i need a slightly different use case, im just gonna store a list of uuids of dead people, map useless for my purpose :p
Fair enough
its rly gonna make me do this
imma cry my beautiful code just got all shattered apart
how to create a plugin
do you know java
and then they never replied...
i wonder if like
file based gui creation
would be cool and feasible
adds another layer of customizability to bigger plugins to let static guis just be file based
doubt it would be hard
just a list with letters then have an items section where you define items
name: Cool &6GUI name
format:
- "#########"
- "####a####"
- "#########"
items:
- id: "#"
type: black_stained_glass
- id: "a"
type: blue_stainted_glass
do chunks have any kind of unique idetifier
quantum minecraft
Hey , may i ask If anyone have the ability and the experience of being a Minecraft Staff + experience of plugin and configuring and expertise (Please DM me) there well be offerings + based on your knowledge.
?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/
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/World.html#getChunkAt(int,int)
F3 in your client, you can see chunk coordinates as well.
declaration: package: org.bukkit, interface: World
is it safe to remove from PDC when iterating over it's keys?
Is not PDC like a Map?
Like a serializable map?
Not quite but ig, if you edit the keys you get back it doesn't reflect any changes so ig it's a clone?
It just has a key to serializer & val
I attempted doing my own PDC so 1.9 - 1.16 structures could also store stuff. As far I remember, a Map was the most ideal way to store stuff, that's why I am asking.
I don't know if it still is tbh
I mean most likely it is
Eh fuck it i'll just test it
Props to shynixn for structureblocklib 👍🏻
Could also use their region code in combination with their x and y coords in that region
They probably went to learn java jk
if I keep a reference to that itemstack, and then change it, will it also change if it gets dropped and picked up again or nah?
like item X is stored as an instance temporarely, if X is dropped, can I still change it from that same ref?
and if X is picked up again, can I still change it?
No
It should not
hi
i have problem with java vm
a jni error has occurred
oh well then I know what I must do
and a java exception has occurred
By the way, what you mean is that if you store a specific ItemStack's reference, whenever dropping it and picking it up again, if the game will still preserve the reference or if it will like clone it or something
yep
if it gets cloned that's sadge
I got kind of confused with your question
Yeah
By the way, don't ItemStack#clone
yeah
Just ItemStack::new and pass the old ItemStack in the constructor
Didn't know about it and was wondering what was going on lol
Well so now I know how to handle my issue
What are you trying to do?
Custom item stuff
What's your project's goal?
It's an api for custom items
How so?
ike do you not work for socksfor1 anymore
I do there's just nothing to do there lmao
lul
Example
class FireballItem extends Item {
@Override
public void onRightClick(ClickContext context) {
var clicker = context.clicker();
var world = clicker.getWorld();
// Get the variable "power" from the ItemStack, if it is not present, use the default of 1F.
var power = context.variables().getFloat("power", 1F);
world.spawn(clicker.getEyeLocation(), Fireball.class, fireball -> {
fireball.setYield(power);
fireball.setDirection(clicker.getEyeLocation().getDirection());
});
context.consumeItem();
}
@Override
protected Material getMaterial() {
return Material.FIRE_CHARGE;
}
@Override
protected void setupItemStack(SetupContext context) {
context.variables().setFloat("power", ThreadLocalRandom.current().nextFloat(0.5F, 3F));
}
@Override
protected boolean isStateless() {
return true;
}
}
```Something like this
And then
var fireball = new FireballItem();
var stack = fireball.createItemStack(new ItemData.Builder()
.displayData(
new DisplayItemData.Builder()
.displayName("§6Epic Fireball")
.lore(List.of("§7Right click to shoot a §6fireball§7!", "§r", "§7Power: ${power}")) // Use ${name} notation to get a variable from the item
.build()
).build()
);
```*There are more things in an item data
wouldnt it in that context be better to have a .builder() method that returns a new instance
No
Why do people override Interface methods?
bc thats how interfaces or abstract classes work
It's not the standard spigot item class
u right
extends
lol
But still
If it's an abstract class
And you declare the method as abstract
You have to override if you are not going to use default implementation of a method
People (I did it before so I know it from first hand) use to Override the method even though there's no need
you mean @Override
Yes
how do i remap an library and make the users see it as remapped?
If you provide javadocs to the implementation or the abstract method, if you override it, you are basically forcing yourself to write the javadocs again
i tried shading but it's not working
ij has the option to copy them
and who puts javadocs on interface or abstract impl
Do you mean relocating?
Because I expose interfaces in the API
i think so
Not the non abstract classes
For relocating you specify a pattern to match, if pattern is matched it will move that package or class to the pattern you specifies
Don't you think?
I believe i might have a pom that shows this
and any dependant will see it as relocated?
It should yes
can I technically use PersistentDataType.STRING to deserialize any type?
technically
I mean as long as I get a string version of the value I'm chilling
Java String Max Size with java tutorial, features, history, variables, object, programs, operators, oops concept, array, string, map, math, methods, examples etc.
not what I meant
Was asking if the string type could also just parse other ones, which it should be able to right?
Why not make a serializer for PDC for bson Document?
For this interpolation here
byte array 
Before I ask a question about this I just want to make sure that I never learned how to code and this code is generated by an ai. What is wrong with this code?
then this is not the right place to be
this chat is for mainly for (plugin) developers
also bukkit is dead
bukkit isnt on any repos. use spigot api
also you will likely not get very far without any programming experience, ai isnt that good yet 😛
can I store open inventories in a weak hashmap?
As key or value ?
I don't know how are inventories managed in spigot
You should try by yourself (and I'm interested for the results if you don't mind)
they aren't lul emote but i dont boost anymore
yh but chunk coardinates dont help me identify the chunk x)
yes they do
bit shifting be like
¯_(ツ)_/¯
arent chunk coardinates just coardinates inside each chunk
no
each block has an xyz coord
each chunk has an xz
the first 16x16 is 1, 0, 2nd is 2, 0 etc
nah they are modified coordinates
indicates the direction and how far away it is
alright i'll do some testing, gimme a bit
i think that it would not work since CraftInventory wraps the actual inventory, but we'll see
what are you trying
i'm making a gui library and I need to store active inventories to listen for slot clicks and get rid of them when the gui is closed, else i would be leaking memory
another gui library
so i have a map that stores inventories as keys and an object that holds gui info (the gui object, the current page) as the value
store the instance then listen to the global inv close event then remove it
that's what i'm doing right now but i was wondering what would happen if i were to use a weakhashmap
it seems to work fine with a weakhashmap
How did you test ?
sending the hashmap with a console command while having the gui open
tho for some reason even when i close the inventory the map still holds a reference to the object
i guess it's because the gc needs to run
yeah exactly, now the map is empty
tho i wonder if it would gc open inventories
need to test hold on
i'll leave it open for a few mins
nope, the gc only removed the old reference
makes sense, since there would still be a reference to an open inventory
Hello, how can I use the CitizensAPI? I need to make the NPC turn towards the player, where can I find such a method?
quick question. When I start up the server, my /spawn command isn't working, because he can't read the location. But if I do /reload after that, it is working again
How can I fix that
can you show the code?
you are accssing yoru config/data before the worlds are loaded
No worlds = broken location objects
that could be it yeah, I am loading the config when the server starts up
don;t touch your config until onEnable
when then
in onEnable
?
do you not have an on enable
dont do it before
I do
thats what elgarl means
so do it in that method
I do
all objects in your config are deserialized the first time it is accessed.
If you assign a field for your config it will be accessed at class instantiation and not in your onEnable.
I just do:
getConfig();
saveDefaultConfig();
in my onEnable
You can have a field, but you can;t assign it until onEnable
wrong way around
saveDefault shoudl be the very first entry
?paste now post your javaplugin class
the onenable part?
whole class
the whole class
one**
So wats the issue?
if its the command not execute, you haver to put it in the plugin.yml
show us the error
if I do /reload after the server starts up, it is fixxed
does the TablistManager class access the config
GodCipher — heute um 11:53 Uhr
show us the error
Jo, warte. Muss server starten
move saveDefaultConfig() to the 2nd thing onEnable does, below instance = this
Where are you reading your locations?
Caused by: java.lang.IllegalArgumentException: location
when I do /spawn or onJoin
?paste the error
whats JoinQuitEvent.java ln 54
dont answer that, just sent the whole class and mark line 54
paste the whoel event class
public void teleportToSpawn(Player player) {
FileConfiguration cfg = SKGaming.getInstance().getConfig();
Location loc = cfg.getLocation("spawn.main");
** player.teleport(loc);**
player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP,1, 1);
}
JoinQuitEvent class
your spawn location is probably not set
What you are describing does not fit the code you are showing.
What should I do
the config is set
on startup it doesn't work
after /rl it does
if spawn.main exists in your saved config.yml there is no way your current code can break on first load
show us your config
spawn:
creative:
==: org.bukkit.Location
world: creative
x: -38.244765003921
y: -60.0
z: 30.247893054514456
pitch: -1.2999984
yaw: 61.049038
main:
==: org.bukkit.Location
world: main
x: 5.0
y: 38.0
z: 7.0
pitch: 3.1497862
yaw: -129.89755
oh one sec
hmm, I have noticed my config failing sometimes for first start up too, but idk what I did to fix it
have you set a silly load order in your plugin.yml?
idk what you mean tbh?
if you set LOADBEFORE in plugin yml, it will break on startup
nothing like that in there
you don;t have load: STARTUP ?
no
then your error description makes no sense
you want to see?
is your world actually called main?
is main set as your first world in your server settings?
add a depend: [multiverse] in your plugin.yml
level-name=world
so no
your main world doesn;t exist
okay
add a depend or softdepend
I don;t believe so
Could not load 'plugins/SKGaming-1.0-SNAPSHOT.jar' in folder 'plugins'
org.bukkit.plugin.UnknownDependencyException: Unknown dependency multiverse. Please download and install multiverse to run this plugin.
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:269) ~[spigot-api-1.19.4-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_19_R3.CraftServer.loadPlugins(CraftServer.java:430) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3762-Spigot-7d7b241-2270366]
at net.minecraft.server.dedicated.DedicatedServer.e(DedicatedServer.java:219) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3762-Spigot-7d7b241-2270366]
at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:975) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3762-Spigot-7d7b241-2270366]
at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:304) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:3762-Spigot-7d7b241-2270366]
at java.lang.Thread.run(Thread.java:1589) ~[?:?]
it's pushed to a map using lowervcase for lookups
is it Multiverse or Multiverse-core?
-core
I forget it's depend
oh no Snake changed in 1.20
no SafeConstructor anymore it seems
depend: [Multiverse-Core]
worked
I guess, I'll try again
it is case-sensitive I guess. Bc I wrote that before, but in lowercase
Yes, it is working
Thank you very much
?jira
what's that?
for me
looking to see if there are any reports about SnakeYAML empty SafeConstrutor
seems it no longer exists in Spigot 1.20 but it used to be use to prevent code injection
SnakeYaml got bumped a major version so I guess that isn't needed anymore
Why not use the config api?
GM never has
but you can change that 
Well moving major version could also mean work
Also this allows you to keep compat with old versions without any extra work
It's always safe now
🙂
Day 2 of using lombok.
That's it... I can never go back....
once had to convert a project using public variables everywhere to use lombok
Day 2 of learning Dart
Great language 
day 5 of learning odin 
Public variables....
Public....
....
Variables....
i remember it took 10 minutes for intellij to process a few thousand files
gradle then decided to reject the annotation processing
stupid gradle
well i dont like maven much better cuz it uses xml
i dont like that old stuff
You shut your damng mouth! 🤣
Guys
Maven my beloved
Yes?
sometimes to improve stuff you have to think about it differently
im not that bad
Probably means you forgot to import something
would be more useful to say what symbol
Lemme grab my crystal ball chief
java
is 1.20 only an RC for MC at the moment?
cannot find symbol java :/
yes
1.20 is full released
send screen
odd, it doesn;t show up in MultiMC
Unlike popular rumor...
We don't have trojans on ur pc bro.
Shows us rhe damn codew
can i ?paste my code so that u guys see the error?
Shows up in Prism. Try restarting
?paste
formatting tools exist
And the error?
public final class RandownPoints extends JavaPlugin {
public class SpawnListener extends JavaPlugin implements CommandExecutor {```?
you think x1, y1 and z1 come out of thin air?
did you copy paste this
Yeah there are so many things wrong with this code
//add your spawn points here
i wanted to make a simple plugin where the plugin chose for the first joined player gets randomly 4 spawnpoints
Chat gpt does that when it doesn't know specifics
L coder using chatgpt
L
where he'll spawn (4different spawnpoints)
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/
?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.
i think its more an skill issue
I know this isn't the first time we've told you to learn Java
Ye indeed
i remember them from before
You can't write an essay without knowing how to write
Chat gpt will not make good code. Its a good debugger or novel concept bouncing board at best
guys can u help at least?
good debugger? ugh ugh
i used to make chatgpt do what i couldnt be arsed all the time
I told you what caused your issue
now it doesnt understand what i mean
skill issue + L + go learn
.
pay me and i will make you the plugin
ooooooh true
this reminds me that someone was making plugins in webstorm
CuriosityCore would wack it together too
Why
That is horrible
i have no clue
brudda open the wallet and make it empty by giving it to me skill issue if you cant
i told them use to atleast use ij instead but they disappeared
use neovim
Ewwwww
straight to hell
Ah back to the abyss where they came from. Makes sense that we see the abyssal ones from time to time
Pirce of paper and a word scanning app on ur phone or nothing you losers
i used to do that
anyone who uses a text based IDE has a god complex
I had to do that on my programming exam
This is why I still want a dev general.
I wanna put on daft coding challenges with prizes n shit
they never stop talking about how good their ide is
Java on Paper 
There is a guy who made a program that turns their writing into code for their 3d printer
what happened if you messed up
be careful with the word paper here matey
They just write on the whiteboard and that is it
Thankfully it was an easy short method and not an entire program
we can just use this or general for that
I heard if you say it 3 times , a purpur fork appears
If you say it more you might see the infamous toilet paper
Nope @ivory sleet legit muted me once for that (which i agreed with btw love ya homie)
hm why would you be muted for that?
You can make a thread in this channel just fyi
sounds good until people start begging for us to make plugins
Because this channel is officially for dev help and casual chit chat floods the channel
or ask questions in it
Make thread
That is why you make a thread
I don't believe in async
we have just normal convos here a lot, sometimes people ask stuff we either miss it and come back later or all of us end up helping
Main thread or nothing
Fellow brit uwu?
yeah
28°C tomorrow
Ayo my people
13deg celcius rn for me and im freezing my ass off
It's not that cold bruz
you clearly never had 40
we had 40 for a week like last year
im wearing 2 jumpers rn
As a Canadian
it normally doesnt go higher than 30
Spigot Code Challenge Idea
Y’all are cowards unless you wear shorts in 0°
25 degrees is perfect temp i reckon
Canadian or a geordie.
Nah
what happens with me is im wearing long trousers most of summer, then by the end im in shorts and then all winter im in shorts
20°
Also see guys? Threads don't work. Check mate
and by the start of summer im in long trousers again
-28 is better
22.5°
idk
also check that it works on 1.19.4
(can i just suggestion you put the error on a paste before someone screams)
I hate looking at text from screenshots especially when the screenshot makes all the text super small
you are calling getBlockData where hasBlockData is false
hmm though docs say that should be OK
are you sure it was ok?
the code doesnt look like it has changed
uhh why does https://hub.spigotmc.org/nexus/service/local/repositories/snapshots/content/org/spigotmc/spigot-api/maven-metadata.xml show latest as 1.19.4
lmao
Because latest means latest stable
[21:11:33] [Server thread/ERROR]: Error occurred while enabling TestPlugin v1.0-SNAPSHOT (Is it up to date?)
java.lang.NullPointerException: Cannot invoke "net.minecraft.nbt.NBTTagCompound.e()" because "nbttagcompound1" is null
at net.minecraft.world.item.ItemBlock.getBlockState(ItemBlock.java:177) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:dev-Spigot-7d7b241-2270366]
at org.bukkit.craftbukkit.v1_19_R3.inventory.CraftMetaItem.getBlockData(CraftMetaItem.java:930) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:dev-Spigot-7d7b241-2270366]
at net.md_5.TestPlugin.onEnable(TestPlugin.java:66) ~[?:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:266) ~[spigot-api-1.19.4-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:342) ~[spigot-api-1.19.4-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:480) ~[spigot-api-1.19.4-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_19_R3.CraftServer.enablePlugin(CraftServer.java:541) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:dev-Spigot-7d7b241-2270366]
at org.bukkit.craftbukkit.v1_19_R3.CraftServer.enablePlugins(CraftServer.java:455) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:dev-Spigot-7d7b241-2270366]
at net.minecraft.server.dedicated.DedicatedServer.e(DedicatedServer.java:220) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:dev-Spigot-7d7b241-2270366]
at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:975) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:dev-Spigot-7d7b241-2270366]
at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:304) ~[spigot-1.19.4-R0.1-SNAPSHOT.jar:dev-Spigot-7d7b241-2270366]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
computer says no
Does Sigot site take a while to update from external site download to Direct Download once you upload a jar and push an update?
Lol I made the same mistake
Its been like 2 years since I updated the spigot site 😛
Setting an Item with an itemstack with count 0 worked for me in 1.19.4
Turns out that was a paper thing too
My fault for testing on paper
oh oki
We got the code competiton ideas down to a point its voteable
Maybe because you were using paper?
is there a method to get itemstacks from a container but only those which arent null?
was figuring out why "latest" went to 1.19.4, i've fixed it now
yes i have to host my own javadocs as its integrated into my bot and will get ratelimited on spigots side when downloading the docs for the first time
without filtering using streams ofc
Filter using for loop 
linter is already screaming about complexity
why does it go to 1.19.4 lol
i grabbed it off here lol
but i guess its not stable
I honestly dont know why that has latest as 1.19.4
Is 1.20 latest now?
Ah
dw md_5 i've added a fix
have something to hate https://paste.md-5.net/ibomawidag.java
do i rewrite it or just leave as is
Json really shouldnt be used for storage
i dont use json for storage what
Ok then why are questioning about using json for storage
im not lol
Did you not read what you typed?
i said, when i use json i prefer to use mongo
Mongo is a real db
as someone was talking about rewriting their code for json
:P
That is not what you said
let me add punctation:
idk why, if i use json as storage.I have to use mongodb. I dont like json files.
If they use json as storage. Which it shouldnt be. It should generally just be used to transport information but not for storing
Not sure what you think the definition of storage is. But if you are not using json to store data, then maybe wise to use a different word then storage
Mongo uses a json like format they simply meant they prefer json format in mongo vs actual json files
Don't look into it too much lol
im not sure if you know what mongodb is
Oh this makes sense
You both are misunderstanding eachother it's pretty funny
@young knoll feast your eyes
Why in the the damn did you not just make the boolean nullable
*the god
hm
why me
GOD DAMNIT GOD
D:
i didnt disappear, if u were referring to me
what was the easy way to make item unstackable? random pdc value?
Yes
and for best randomness i guess random string?
Convert a UUID into 2 longs and shove it in there
were you developing with webstorm
what about current system time?
Wait no i misread...
My brother in christ you should of made the UUID / long a generic and had a guard check that would of converted the long to UUID lmao
yeah well
that can never repeat
my brain didnt think of that
System time works
No worries lad but imo when 60% or more of a method is repeated, it usually means there is savings to be had
As long as you don’t make 2 items in the same millisecond
true
hmmm
If you drop me q message I'll have a proper look when I'm home ^_^
nop idea
so i wasnt talking abou tyou
ok cool
manipulating ItemStack asynchronously is chillin' right? just adding em to players inventory needs to be on main thread?
Should be fine
some things that are safe are fine, ie ChunkSnapshot
Just didnt want to write this chunk of code out using async and get let down 
Just take care for some sanity check tk ensure the actual method that calls it into async doesn't grab the same players stack twice
Async is a beautiful, horrible and unforgiving bitch
Does anyone know how to change a /setspawn?
Change how
The /spawn command to move it
Is that your plugin
But how to change esq I put /setworldspawn and it doesn't change place
should be ok
itemstack is a data object
inventories I wouldn't do async
there's a lot that you can do async tho
I'd hate myself if you couldn't send messages async
yeah im planning -> grab inventory contents -> edit everything async -> back to main to add edited items
And excuse me
not good
that better be one expensive edit
player could drop items or offload in some way while you are making changes
Can you elaborate?
oh hmm true
Adventure library is love, adventure is life
I'm not talking about adventure
If you need server help you’re in the wrong Channel this is for plug-in development help
I know but they use async
It's literally just the process of sending a packet
I use async everywhere
All my plugins are love
I need help with a plugin of this server
all my plugins are life
Man after my own heart.
Make those CPUs do graft 🙏
ok
Haha
Re doing dies brewery plugin rn
Because async is desperately needed.
Tbh... a flame thrower is desperately needed lol
Whe I say redoing, I mean making from scratch
I'm aware
Cause his plugin makes me cry
lol nah add add add but never change
*imagine using lists in search functions that grow over time
✨ tech debt ✨
why you doing searching first of all
Any plugin for spigot 1.8 which allows the mobs to not burn in daytime?
prolly worldguard
Oh no its when he is loading refipies he grabs em from config and some of the 'caches" he makes are lists thst need to be searched through via loop
Too old! (Click the link to get the exact time)
Mythic mobs is love. Mythic mobs is life
For spigot 1.8
I don't think I can see that they are 1.13+ on the spigot page
doesnt matter. wrong channel, wrong spigot version
Btw I know one server with 1500 recipies.
Pray for them 🙏
1.5k loop is not much
It is when it's constantly being called for each drink on the servwr
Player roll up to wars with shulkers full of em
it's called O(n) cause its what server owners say when it bites huge chomps into their tps... "Oh.... no..."
O(n)o
Also he makes a new water bottle every time he wants a blank Potion meta 🤣
My brother in christ .clone exists
you do know that clone does effectively the same
doesnt matter if you create one or two throwaways with one call
It does when every scrap of performance counts.
All he wants is the meta.
potionMeta.clone is better than new itemstsck and then .getitemmeta
if every scrap of performance counts you shouldn use java
once again, it doesnt matter. it doesnt even nearly pull at the performance. clone also does effectively the same as getItemMeta since getItemMeta internally creates a new itemmeta instance itself whyever
dont overengineer your software to get the very best performance possible
premature optimization is the root of all evil
.clone is cloning an itemeta instance is better than grabbing a new item every time and getting a meta
do you now really want to argue over that 1ns of performance
Actually it's post mortem optimization
because you made one object more
Now appreciate in the field tests show that 1ms adds up when there are 4000 instances of it going brt in one go
oh yeah, it shows that if you create 100k instances of something, that it slows down your program. damn it
Look man its a plugin that's poorly optimized and is an ongoing issue with several servers.
I'm plugging a gap and I'm gonna do every bit I can to ensure a quality product innit
look man, idc whats your intention. your comments before were just bs
That's cap
alright
When the issue is in the constant creation of a new item on scale, halfing the processes is a smart move, even if it , on a singular scale, isn't the biggest deal in the world.
you don't know if the code underneath clone is heavier than the code to create something
Only one way to find out
still bs. you do know that the JVM is optimized for that
rather, as said before but ignored from you, make a constant of the meta
and use that if you dont need to change it
thats your best practice
but hey use your clone
I'm optimised for taking a piss in a Bush when camping. I'd still prefer a portalloo
now your stance is changing
something tells me you're trying to sound smarter than you are
he's a young lad. He used "cap", so not much more than a teenager
so am I
27 🤣
I blame the server communities I'm around when developing
I turned 18 a couple months ago
I heard cap for teh first time yesterday
It's spread so bad even the adult groups in those communities are saying it
I've not heard anyone in the real word say it
Kids and their new lingo, get off my lawn!
🧢
elgar's the definition of a really ancient rock
But yeah to sumnerize :
The dude was making an item stack of a Potion
Then taking thst item stsck and grabbing its meta.
I just wanted to grab the meta, save as a field and clone.
Now if I've missed a trick with constants I'm happy to hear it.
Only ever used constants to help in math or grab config data.
So respectfully and happily would apologise and have poo on my face from being dumb, is there a trick with constants I've missed that would allow the creation of a new Potion meta instance via that constant?
detritus
getItemMeta returns a new insteance every time you call that method
Overall negligible given the amount of random crap the server does anyways
if you were to save it as a constant and constantly clone that item meta, it'd be weird
But once again its the scale.
You say overall negligible but I've seen sweats cooking 400 + of these bad bois at a time in 1 group, and there's around 20-30 brewing groups.
Then consider those checks keep getting made ever few ticks as the dev was a bit brain dead, negligible becomes significant
I figure go in, fix any little thing and come out with a better product regardless.
then you are at the wrong spot
you should rather work at the distribution then what actually happens
How so?
you will figure it out. who knows how the current state is
?
even then not quite
but yeah you should fix the source of the issue
And what if the source is death by 1000 cuts?
do the larger cuts first
Then burn it with fire
sounds like a you problem to me
yeh p much
never really had an instance where I thought cloning itemstacks was the performance killer
it was always stuff like thread pool exhaustion
and reading blocks
Well I'm just going through one step at a time. I'd love a second opinion from yall if u fancy. Could wack the repo in and see if u find any huge problems
give us code pieces and we code review
but i wont scour a whole big ass repo
and if its complex to understand because its shit i wont review anymore
That's sort of the point with this.
I'm in the exact same boat as it isn't my code. It's a public repo for a well used plugin and I'm going back through step by step improving it as i build a new one. (Looking at the downfalls from that one, and using better practices and approaches).
I noticed something silly, as I'm coding and comparing, and commented on it.... briefly...
I said "haha he makes a new item, to grab its meta next line, when he could just clone the meta itself" .
As another example... of a poor practice... with the first one being half his shit is O(n).
I genuinely don't know how this turned into the back and forth it did.
I'm sorry.
Aye you are most likely right.
Fell into the strong foundations trap
It's just driving me mad trying to figure out whats causing the problem
Either way sorry u 2
Do respect and appreciate ur opinions 🙏
illusion
Invisible, probably the coolest Minecraft map experience I've had in a long time. Hopefully there will be a full length version.
Minecraft Map Playlist: https://www.youtube.com/playlist?list=PLSUHnOQiYNg0IJ98O-DmQTkj2MclJsZ8_
Map: https://www.minecraftmaps.com/horror-maps/invisible-demo
Also music:
"Quinn's Song: The Dance Begins" Kevin MacLeod...
some good class names
those are crazy shaders
I'm no shader dev
become one
I've done a few shaders in my time, they are far from easy
opengl shaders are even worse
I've only done opengl
I use React with NextAuth. I get a weird error with async authorize(credentials)(see link) that I haven't seen in any tutorial yet. I have also googled etc but have not found anything and am hoping for help.
ItemStack[] items = new ItemStack[6];
items[items.length - 1] = CAGE_POS_ITEM;
items[items.length - 1] = GOAL_1_ITEM;
items[items.length - 1] = GOAL_2_ITEM;
items[items.length - 1] = BOT_FIRST_BRIDGE_ITEM;
items[items.length - 1] = NEVERMIND_ITEM;
items[items.length - 1] = CONFIRM_ITEM;
im using player.getInventory().setContents on the above array, but it's only registering the 'CONFIRM_ITEM' item and other items arent added in inv
Well yeah
You're setting the same array index
Set item 6 to cage pos item
set item 6 to goal 1 item ... etc
Yeah you set the size when you created the array
dunno how minecraft shaders are done
idk either but its insane what you can do with it 😱
hello, are there any ways to use bukkit with mcp mappings and obfuscate on build?
ok thanks
cause i just build 10 hours ago
i know about mojang mappings already, but i am using a version that does not support mojang mappings at all
You are not using spigot then
there was a bug with api-version: 1.20
spigot didnt use mojmaps before 1.17
oh true
[INFO] Total time: 22.459 s
[INFO] Finished at: 2023-06-08T14:11:21Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project spigot: Could not resolve dependencies for project org.spigotmc:spigot:jar:1.20-R0.1-SNAPSHOT: Could not find artifact org.spigotmc:minecraft-server:jar:1.20-R0.1-SNAPSHOT in minecraft-libraries (https://libraries.minecraft.net/) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :spigot
Error compiling Spigot. Please check the wiki for FAQs.
If this does not resolve your issue then please pastebin the entire BuildTools.log.txt file when seeking support.
java.lang.RuntimeException: Error running command, return status !=0: [sh, /home/container/apache-maven-3.6.0/bin/mvn, -Dbt.name=3777, clean, install]
at org.spigotmc.builder.Builder.runProcess0(Builder.java:1062)
at org.spigotmc.builder.Builder.runProcess(Builder.java:993)
at org.spigotmc.builder.Builder.runMaven0(Builder.java:962)
at org.spigotmc.builder.Builder.runMavenServer(Builder.java:931)
at org.spigotmc.builder.Builder.main(Builder.java:742)
at org.spigotmc.builder.Bootstrap.main(Bootstrap.java:27)
i cant download
pretty sure it never used mcp though
iv use the rebuild tool and build the api again
did i miss anything for migrate from 1.19.4 to 1.20?
i'v chaged this
<dependency> <groupId>org.spigotmc</groupId> <artifactId>spigot-api</artifactId> <version>1.20-R0.1-SNAPSHOT</version> <scope>provided</scope> </dependency>
backwards compat should remain so unless you used nms your good to go
so if i use the plugin compiled in version 1.19.4, that still works?🤨
?paste
yeah
nms is the only thing that would need updating for spigot stuff
Hello, Is it possible to remove hit cooldown in spigot plugin?
I mean is it possible to remove a cooldown for players to getting damaged?
like if you stick next to the catus, you die in 0.1 sec
ok thanks for ur help OuOb
just figured out x % y is the same as x & (y - 1) 💀
??? is this an IDE error??
reload maven or gradle
the first one yea?
yea
I believe so, yes. Though you're limited to one damage frame/tick because that's just how fast the server operates
If you set that to 1, it should damage the player each tick
Otherwise, EntityDamageEvent, https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/entity/LivingEntity.html#setNoDamageTicks(int) to 0
still the same
check the package is correct at the top of the class
i can import the other classes from the same package just fine
this particular one is broken for some reason
just build the project, jetbrains products all begun the have the same bugs
thank you! 😄
i just remade the class lol and it works now
when came 1.20 ?
yesterday
i know but for spoigot 😄
Yeah
yeah, it came out yesterday
Yesterday
can gportal play spiggot with 1.20 ?
Sounds like a question for #help-server
paper and spigot are both on the mc server options
can you send me a link bruv
have you a link for spoigot 😄 ? the download
?bt
As always the only offical way to get Spigot is with BuildTools
I mean someone made this, https://github.com/lucyydotp/spigotclip
Never used it nor do I know if it even still works, but it exists lol
Hi, it looks like the maven repository (https://maven.sk89q.com/) is down, anyone has the same issue?
iirc that repo has been down for a while
Hopefully Coll works on the gui for build tools I'm looking forward to it
Hey, I am a bit confused about this Open Sign Editor packet which is client bound
https://wiki.vg/index.php?title=Protocol&oldid=18242#Open_Sign_Editor (it is for 1.19.4)
But now in 1.20, if you have tried, the sign editor doesn't get opened automatically, which means Open Sign Editor doesn't get sent automatically from server. But in wiki.vg, it says it still gets sent. (Or could be that they are wrong/forgot to change it?)
https://wiki.vg/Protocol#Open_Sign_Editor
And also the ones who know, does this change mean client will ignore open sign editor packets sent from the server and just sends update sign only now?
most stuff thats on it should be on https://maven.enginehub.org/repo/
oh alright, thanks
How can I change the Transformation for an ItemDisplay?
like changing scale, rotation
is using import static and then your main class a valid way to get an instance of your main class
?
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
^^
i know but would it be valid
yes but i dont recommend it
using dependency injections makes dependencies more visible and it also results in cleaner code
ok cool
So, im getting an error when running mvn clean install, as seen in the screenshot below, im not sure what im doing wrong, any help is appreciated
What Java version?
Yeah that won't work
im running this from the command line, is there an arg i can add to the command?
to change the version of mvn
It's a setting in your pom
do i change the marked one to 10 then?
can they not be 10?
You're probably not using any of the Java 10 features
if you compile to 10 every user needs to use Java 10 or above
For there projects?
Depends on how your lib is loaded
projects and server
Server yes
im installing the lib to my .m2
project maybe
and running it on the serbve
@cobalt thorn dich kenn ich
are there any spigot plugins out yet for 1.20 ?
Spigot has no breakages in api natively so all plugins not using nms directly work
Most plugins don't even need changes no?
Hi, im making a "weekly shop" inside a plugin and by testing it in a week and the trader didn't spawn
Code: https://sourceb.in/xdXRDk0ifa
No error
i don't know german and i used google translate but i didn't know you knew me?, nice btw
Oh
Sorry I know a German guy that is a dev that is named exactly like you and has a similar pfp
oh lol
write a bunch of souts everywhere
wait i can ask you something what are "souts"?
type sout in intellij and see what comes up
oh system print ok
you sure?
i saw now that
and for the code "if it work the spawn and despawn" works just fine so in theory everything should work
i don't know if it is the scheduler not working
Does any of this need to change for 1.20?
compileOnly "org.spigotmc:spigot-api:1.19.4-R0.1-SNAPSHOT"
}```
Yes change 1.19.4 to 1.20
probably xD
it is
That's not the offical repo
literally going to teh front page will tell you its out https://www.spigotmc.org/
We don't host the API on Maven Central
Choco, are updates to resource jars often this slow? I'm hoping not but I can understand if it's a backlog due to the release of 1.20
Did one on GM a few hour ago but the Site still links to external
Uh, not sure. I've not released any updates nor heard anyone complain about them being slow
odd
did it 5 hours ago today. Pretty sure I did nothign wrong, other than change from external site to an uploaded jar
update shows, but no jar, still external link
Its not, look at teh download button
the download button takes me to github for the 1.20+ release
oh
I uploaded a jar and set to download from Spigot not external
anyone know why it just overwrites, instead of adding the updated amount it just sets it to whats passed into the agrumnet
int currentAmount = uuid.getInt(crate, 0);
int updatedAmount = currentAmount + keyAmount;
uuid.set(crate, updatedAmount);
try {
keyData.save(virtualKeyData);
} catch (IOException e) {
e.printStackTrace();
}
what is uuid? what is crate?
what is , 0?
locations:
89172e41-e9fe-41c0-8ce9-e83a58eca756:
event-crate: 44
this is an example
I'm assuming uuid is a map and 0 is a default
no i think the getInt method is wrong
but a map doesn't have getInt
yeah no clue
uuid is the players uuid as a configurationsection
what?
locations:
89172e41-e9fe-41c0-8ce9-e83a58eca756:
event-crate: 44
see the uuid
thats uuid in that code
uuid is a config section im guessing
yeah
use better names. descriptive
yeah my fault
if it's a player uuid in a config then uuid shoudl be playerSection
that doesnt matter rn
it does if we can;t understand your code
Umm hello i want to know why nms not work in ubuntu
i have the players uuid in a variable, how do i access the integer 44 from this config
locations:
89172e41-e9fe-41c0-8ce9-e83a58eca756:
event-crate: 44
i thought it was uuid.getInt
config.getInt("locations.89172e41-e9fe-41c0-8ce9-e83a58eca756.event-crate")
ok
thx
ConfigurationSection#getInt("locations.89172e41-e9fe-41c0-8ce9-e83a58eca756.event-crate")
or if you have the uuid section, uuidSection.getInt("event-crate")
Please pick better names. It's really important for YOU in a years time when you look back at teh code.
I will thanks for the suggestion elgar
k
I usually name the variable with their datatype but in camelCase
If datatype is a primitive, I name it in lowercase first letter of the primitive
better names for a uuid?
it wasn;t a uuid
Just be sure that if method is exposed at any time, document it well with /** comment (javadoc comment)
doesnt work, ill rename everything nicely and ask again
xyzIdSection
it was a ConfigurationSection
wdym by exposed
private String name;
also if its obvious what a method does, there is no point int writing docs for it
That's encapsulated
Ok let me ask the question again
But whenever you do
public String getName(){
return name;
}```
You are exposing it since it was encapsulated before
what docs are you gonna write for this function
It not only applies to private keyword
How can I put Java 18?
/**
* Just the name getter //this line can be skipped and just have the return one
* @return the name
*/
public String getName(){
return name;
}```
I know
I have this method here
public void addVirtualKeys(@NotNull Player player, @NotNull String crate, @NotNull int keyAmount) {
if (data == null) {
data = keyData.createSection("data");
}
String playerUUID = player.getUniqueId().toString();
data.createSection(playerUUID);
ConfigurationSection playerUUIDWhereCrateKeysAreStored = data.getConfigurationSection(playerUUID);
int currentAmount = playerUUIDWhereCrateKeysAreStored.getInt(crate);
int updatedAmount = currentAmount + keyAmount;
playerUUIDWhereCrateKeysAreStored.set(crate, updatedAmount);
try {
keyData.save(virtualKeyData);
} catch (IOException e) {
e.printStackTrace();
}
}
This code should take "45" from this config for example:
locations:
89172e41-e9fe-41c0-8ce9-e83a58eca756: # playerUUIDWhereCrateKeysAreStored
event-crate: 45
And then add the argument "keyAmount" to it and then save the file.
But all it does now is set that "45" to whatever is passed in the "crate" argument.
Any ideas?
There
yeah that seems a bit pointless in that case, im pretty sure most of us just call the variable and the getter exactly what it is, so its self explanatory
But sometimes whenever you are exposing, you are writing an algorithm
So in the Javadoc is where you document such algorithm
docs become important when you have a specific use for your method
or when the method is really complex, but then you would just do the comments in the code block usually
configsection section = createSection()
You can also document in the getter (also in the setter) what the String name attribute is used for. So in the setter document how it affects the object.
What
data.createSection returns the config section
you dont actually have to create the section
oh
yes in some cases that may be usefull
you can just set the sub key
imo its useless to suggest to always write docs, as mostly, its not needed and leads to reading even more
so whats the error then
I use React with NextAuth. I get a weird error with async authorize(credentials)(see link) that I haven't seen in any tutorial yet. I have also googled etc but have not found anything and am hoping for help.
Link: https://paste.md-
Pls i want to know why nms not work in ubuntu
thats not a working link
what do you pass in as the amount
like 5 for example
Documenting the attribute in getter & setter can really help and save time
yes but you dont need it for everything
thats all im saying
im not saying it cant be usefull
Remember you wrote the code
check if the key isSet or use getInt(path, def)