#help-development
1 messages · Page 1543 of 1
okay
literally read what you posted a screenshot of
So heres the fun thing, I come back after retiring from my plugin development times and notice that the method to get the player’s command has changed. I used to do if(label.equalsIgnoreCase(“”)) but now that doesnt work, anyone know how I should do it?
"foreach performance is approximately 6 times slower than foreach"
the excerpt is clearly lacking context
isnt it inlined?
by JIT probably yeah
oo
they do compile into slightly different bytecode but the difference is negligible unless it's a hyper hot loop
it says for?
yeah
for/foreach
i think it means foreach as in for (A a:as) {}
If anyone has time for me just ping me
the iterating is different
both basically do the same however
the performance stays the same
the performance is different
There is still the lambda overhead
the lambda overhead and the extra stack frame yeah
why did paste bin thought it was js XD
but all of that is negligible
quite a lot of opinion for so little knowledge
that's this guy in a nutshell
Two extra frames
constantly screeching about shit without actually knowing anything
who cares we need every bit of performance :)
You have the #forEach and #accept
"CamelCase for classnames are bad"
i didnt say that
basically just parroting everything everyone else here says
that is pascal case my dude
it's getting pretty tiring tbh
camelCase is this, PascalCase is this
i thought "CamelCase" isnt camel case cuz i only knew that came case is "camelCase"
someone asks a code review and at some point someone points out the wrong casing
5 minutes later you're still all capsing about DO YOU REALLY USE CAMELCASE FOR PACKAGES or some shit
its the same
alr but yeah i dont like it
if i google for "Pascal Case" i get many articles about Camel Case
they are largely synonymous
^
okay, then what is the one we are actually using
yeah but i didnt knew that upper camelcase was a thing lol
both is correct
ah, so pascal case is explicit
thats why i said it isnt camelcase
we actually corrected you and you still stated that like a parrot
camelcase just refers to there being humps in the casing
because everyone else was saying that too
i didnt even know of PascalCase
So I stand true
whether the first characer is uppercase or not, it's still camelcase
you said it was camelcase not upper camelcase lol
50/50
hence the more verbose definitions of upper and lower camelcase
ambiguity is the last thing one needs
As such I hereby declare that pascal case is not a form of camel case
there, spigot solving real problems
where is the difference 🤡
you should of told me the actual thing
lol
do you even develop anything ever
every time someone asks a question you link to some unrelated javadoc page or an irrelevant spigot thread
and then say idk idk 5 times
unless of course there is wrong casing somewhere in which case let the all capsing about camelcase resume
i just dont know about cases lol
it looks categorically silly for you to be bashing people about casing when that's the only issue you can tell from their code or question
kk ik that
but packages should be named in lowercase
and anyway who even cares at this point
lmao
yes, but you don't need to scream about it as if not knowing that makes someone subhuman
it's a clear inferiority complex where you try to shove others down with overly agressive remarks about irrelevant shit to make yourself feel better than they are
it disgusts me
stop doing it
and yes, i'm going pretty hard on you here
you think im screaming just cuz i used all caps lol
but i've been looking at you doing that shit for weeks and you haven't improved at all
im just asking them who even uses camel case for package names lol
NNY has spoken
Yeah you tell him NNY! You aggressively push him down and subjugate him 👀
yeah i need to sate my fucking inferiority complex
wasnt screaming lol
yeah you was obv. typing
whats going on
seems serious here
maybe the caps was a little excessive.... but like i was just trying to tell him who uses camelcase for package names lol
Sir, how do i list all the worlds in the server (all worlds created using multiverse.)? Please point me to the docs if it's considered spoon feeding.
Thank You
Bukkit.getWorlds() lists all registered worlds. BUT only after plugins are loaded
i think the docs are on the wiki https://github.com/Multiverse/Multiverse-Core/wiki/Developer-API-Starter
I don't think you can track all the worlds created/loaded by mv specifically
You can all loaded worlds
you can track all loaded worlds, but for unloaded worlds managed by MV you need to hook into their api
will check it. thanks
idkidk tho pretty sure that's just their api version of Server#getWorlds 🤷
nah it says "Returns a list of all the worlds Multiverse knows about."
that should return unloaded worlds as well then if their documentation is in line with their normal terms used
myeah idk somewhat ambiguous imo
i looked at the code lmao it just returns this.worlds.values()
real men would just get their plugin directory and read their worlds.yml
Wats better spigot-api-1.12.2.jar or spigot-1.12.2.jar ?
Inevitably yes idkidk
If you only need to depend on the api, then the api jar else the other one
For intellij
Yes
The normal spigot-1.12.2.jar?
But the latter has the api and nms and all the other things shaded in
@quaint mantle just use the spigot-api
Spigot-api-1.12.2.jar?
yes
Its for modules for intellij
?
Dependencies
ok i dont know lol just use the spigot api... which is how you make a spigot plugin
im pretty new with intellij so dont ask me for intellij stuff
is the plugin.yml in the resources folder?
are you using maven also?
I use java
hh
Kotlin
isnt 1.12 like outdated lmao
no 1.9 :) since its higher than every version
9>10 🤔
i would say since we are in java its version 8, version 9, version 10, version 12.2 rn
so 10>9
put it in a black hole
That’s not how versioning works
you will see that 1.10>1.9
how do i pull an OfflinePlayer from uuid of a player that i know is cached
isnt there a Bukkit.getOfflinePlayer?
nothing wrong with that
Bukkit#getOfflinePlayer(uuid), Bukkit#getOfflinePlayer(name) or iterate through Bukkit#getOfflinePlayers
Uh I don’t believe such a method exists in spigot API, only paper but in worst case you could maybe do some craft bukkit shit
what paper method?
getOfflinePlayerIfCached
returns an offlineplayer but name is null even though it exists in usercache.json
i have a uuid not name
did you try .getDisplayName on the OfflinePlayer you got?
so just do the same just withz the uuid
uuid.toString into that method?
thejakwe yeah the name is null if the player hasn’t joined the server
"Names are no longer unique past a single game session. For persistent storage it is recommended that you use getUniqueId() instead." <-- it says in the getName on docs lol
but its in usercache.jsonm
which gives you back the offlineplayer with the given uuid
if they are in the usercache, the name shouldn't be null, unless the entry expired
have you checked whether the usercache entry is expired
it shouldnt
it would have to expire at some point?
Essentially Server#getOfflinePlayer(uuid) may just wrap the uuid with an OfflinePlayer object leaving name to be null
i cant send images here but this
public OfflinePlayer getOfflinePlayer(UUID id) {
Validate.notNull(id, "UUID cannot be null");
OfflinePlayer result = this.getPlayer(id);
if (result == null) {
result = this.offlinePlayers.get(id);
if (result == null) {
result = new CraftOfflinePlayer(this, new GameProfile(id, null));
this.offlinePlayers.put(id, result);
}
} else {
this.offlinePlayers.remove(id);
}
return result;
}
``` (from CraftServer)
?paste
it creates with null name
as I just mentioned
cant you just get the name urself?
why tho? the username is available in the cache
because it never requests the cache
it takes his data from playerdata
idk exactly how the usercache.json works
you'll have to complete the game profile
uuid + cache is enough
accessing the cache directly requires nms
is there a method to pull from cache
there's a get usercache method somewhere in nms or cbo
f
Bukkit.broadcastMessage(ChatColor.RED+"The worldborder will begin to shrink in 3 minutes.");
//wait 3 min
Bukkit.broadcastMessage(ChatColor.RED+"The worldborder is shrinking!");
world.getWorldBorder().setSize(800, 300);
Bukkit.broadcastMessage(ChatColor.GREEN+"The worldborder will resume shrinking in 3 minutes.");
//wait 3 min
Bukkit.broadcastMessage(ChatColor.RED+"The worldborder is shrinking!");
world.getWorldBorder().setSize(500, 300);
Bukkit.broadcastMessage(ChatColor.GREEN+"The worldborder will resume shrinking in 4 minutes.");
//wait 4 min
Bukkit.broadcastMessage(ChatColor.RED+"The worldborder is shrinking!");
world.getWorldBorder().setSize(200, 180);
Bukkit.broadcastMessage(ChatColor.GREEN+"The worldborder will resume shrinking in 2 minutes.");
//wait 2 min
Bukkit.broadcastMessage(ChatColor.RED+"The worldborder is shrinking!");
world.getWorldBorder().setSize(100, 60);
Bukkit.broadcastMessage(ChatColor.GREEN+"The worldborder will resume shrinking in 1 minute.");
//wait 1 min
Bukkit.broadcastMessage(ChatColor.RED+"The worldborder is shrinking!");
world.getWorldBorder().setSize(50, 60);
Bukkit.broadcastMessage(ChatColor.DARK_RED+"The worldborder will resume shrinking in 30 seconds!");
//wait 30 seconds
world.getWorldBorder().setSize(0.5, 60);
How can I have this stop constantly after running each line of code?
that said, that should still have a nonnull name
as it does query the offlineplayers list
?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.
Thread.sleep
couldnt that guy use the bukkit scheduler lol
Yeah k then the server crashes
no bad
oh
yep but like would I have to put one in another or what
like its just weird cuz i need so many delayed tasks
thank you for the advice
could ya explain plz
yeah see the time needs to fluctuate
Thread.sleep is not something you should use on the main thread
and WorldBorder::setSise is not something you should use off the main thread
so you have something of a conundrum if you don't use the scheduler
i was doing normal java and also didnt think that was running on main :okayge:
anyway
so theres no way to pull it from cache?
long seconds = ...;
Bukkit.getScheduler().runTaskLater(JavaPlugin.getProvidingPlugin(this.getClass()), () -> {
//TODO
}, 20L * seconds);
this is what you would do if you wanna schedule something later
there's a get usercache method somewhere in nms or cbo
Huh, I wasn’t aware of the getProvidingPlugin method
?spoonfeed
fuck
?spoon
Spoonfeed a newbie for a day and they'll come back with more questions. Teach them to find their own answers and you'll both be better off: you won't get stuck answering the easy questions and they'll be much more productive than before.
ah
its a pseudo code tho
Lmao
im bored
getprovidingplugin calls getClassLoader on the given class and tests if it's an instance of pluginclassloader
any idea where to look
if it is, it'll return the pluginclassloader's associated plugin
CraftServer
Very cool
you would have to search for it nms isnt a api it doesnt have documentation
How does the dependency injection stuff work - I normally just pass the plugin instance thru the constructor
we need nms documentation :) someone painfully go through the files and make one
Uh wym?
I mean that's dependency injection
Well NMS isn’t really api lol
ik
I thought it was a bit different to that but very nice
but we need a doc with every single version
Ok well I’m not doing that
you can go ahead and start then idkidk
with not for*
You can wish and pray
That is a metric butttonne of work
I’m not doing it
nah if you had source code you probs could get a thing to generate javadocs
consider we do have mappings also
It’s not like you would be recognized or anything if you did create docs…
I mean - I’m not sure how you stand legally after making a jd
lets make nms a api :)
yes.
When you say “make nms an api” you should just pr nms features into Bukkit
And by extension spigot
at this point you should probably just create your own server implementation
That won’t even work easily
NMS changes so much every version
Nah it won’t
bukkit is a nms api
You need concrete implementation
i really wished there was a way to do packets in spigot apI
What the hitler man said
without nms in your project
there isn't and there won't be
Sure, but it’s not like it’s going to allow you to do anything fancy
this is at least the third time we've gone over this
what if someone pr something like that?
closed
packets and their specific implementation is an implementation detail
Same, idk what the heck is with you and your wishing lmao
it is not and it cannot be a part of the api
yeah but they want people to not use nms why not make it impossible to use nms if they have everything you can do in nms in spigot no one would use nms
“But”
just saying it would be cool to do packet stuff with spigot lol
packets, once again, change freely and without constraint between versions
you can't have that in the bukkit api
Literally protocollib exists
that the game runs on packets is an implementation detail, and not part of the api
i guess
the api may provide functions that leverage packets, like sendBlockChange, but no direct access to packets will ever be provided in the api
well if everything you could achieve with packets exist in spigot api then there would be no significant need for packets
you shouldnt be running just spigot Okayge
splögget bad
While annoying sometimes, the whole never use NMS isn't really meant literally. It's just trying to get people to check the API first, because a ton of people use NMS to do stuff that can be done though the API.
use tuinity or at least paper
If we even added a proper API, you realize how complex that would be too… right
Go to wiki.vg
Go look at the packet structure
:YEP:
but hiding entitys isnt a thing In spigot api and that needs packets which sucks lol having to use nms just to hide a entity
Yeah hell no nobody is gonna do that
Have you seen the packet structure for a chunk - the fuck I’m not touching that shit
no i havent
Exactly
i just skimmed through it
not to mention that that shit changes like every version
especially now that mojang is doing world format changes
Do you even know the patch list idkkid
this is why we have apis YEP
It’s humongous
kk i get it
pr it
Dude
If the Spigot API doesn't have it, then that's when you use another API or go into NMS.
It sucks, yeah. Ask me about what it's like dealing with Mojang's world generator. :|
doing that is trivial with protocollib, but you can pr it to the api if you want
it's something that could maybe get accepted if it doesn't have a high maintenance overhead
that nobody has done it yet is simply because it's so easy to do via protocollib that it's not worth the effort to modify the server for it
It’s a bit more complicated to re show them
i dont think i would pr something cuz i really dont know how to make things for spigot or use patch files lol but i think the Entity class should have like a hide(Player player) and show(Player player) tho because some non experienced users gonna find it hard using packets and stuff
Btw that should 100% be in the player class and be a hide entity
Bukkit.shutdown() is a pretty good concrete impl for it
can't see the entity if the server goes offline
lol
What
hiding players for entitys when?
i wonder how far it boids could be taken with clientside entities spoofed via the protocol
No
for flat areas it should be somewhat fine, i think
perhaps a meta entity that takes the shape of a bounding box that encloses the boid group
and caches terrain and block collisions within its bounds
which could then be used for the boids' movement, processed asynchronously
shit like projectiles would be a pain
perhaps just braindead dummy entities that do exist on the server side but would not do entity or block collisions, and be updated from the async processing from the boid group
still uses memory, but that should be fine
how are the entity update packets done internally, I wonder
are they buffered onto the main thread before sending
tons of entities would also overload the chunk distance tracker shit that keeps track of entity destroy/create packets
perhaps that could be managed externally
i remember someone doing an optimization on top of paper to the distance tracker, because they had like 100 thousand non-ticking armorstands
is Minecraft servers still running on 1 thread?
they didn't tick, but the constant checks on whether they should be shown to players or not were killing the server
it was a relatively simple patch that changed the time complexity from linear to logarithmic, I think, but I can't remember for the life of me what it was
Yes
ish
how complicated is it to remove an entity from the view distance manager, I wonder
i should fire up some alts later and ask in paper
i doubt anyone here knows
everybody here are just plugin developers that occasionally dabble in small parts of nms
with the exception of md69 who only materializes here when I shit on bukkit to threaten me with a ban if I don't sugarcoat shit
we too dumb
lol
and choco who has stopped existing entirely in recent weeks
at least they took my suggestion to heart and sprinkled some mod perms to more users
He was here earlier
I would if I was him
i tbh dont know what half of NNY said XD
Mean swing on you 😎
the swing of a king
Which bit?
the middle
Reply to it
0x4
0x4 is the 4 bit
0xff is 255 right or is that wrong?
0x4 "should" be bit 3
yes but it's the bit with the 4 value
like, the second digit in decimal is the tens digit
i suppose 4 bit is a little ambiguous
0x4 or 0b100
at any rate, for the full factorio experience on my tech server, I want hordes of hundreds or maybe thousands of mobs
so is it 0x0 - 0ff? for 0-255?
which is kind of infeasible without something like boids
flocks of a few thousand phantoms would be interesting as well
if my client wouldnt crash that is
the weak should fear the strong
depends on what you mean with weak and strong
manliness, of course
is 0x9AB = 2475?
i don't know, use an online hexadecimal converter
i did
it said that
idk if its correct
windows calculator in hex mode
nah google
You really want google to know you can't count in hex?
all i know is 0xFF is 255 XD
frankly it was some time since I counted in different bases 🥴
anyone know what a Googol is in hex?
I guess
I think that with that many entities the client is the problem
well, that's not my problem
I mean - how can you test it without a client. Actually I take that back. You seem like you assume your code works
you just can't comprehend it because you're not a real man
Mr skull head
it isnt a skull he said lol
for (int i = 10; i > 0; i--) {
if (parkourLeaderboard != null) {
if (parkourLeaderboard.size() >= 10 - i) {
new Hologram("" + ChatColor.DARK_GRAY + (10 - i + 1) + ". " + ChatColor.GRAY + parkourLeaderboard.get(10 - i).replace("null", "N/A") + "s",
new Location(world, x, y + (increment * i), z));
continue;
}
}
new Hologram("" + ChatColor.DARK_GRAY + (10 - i + 1) + ". " + ChatColor.GRAY + " N/A - 0.0s",
new Location(world, x, y + (increment * i), z));
}```
That code is causing this error:
`java.lang.IndexOutOfBoundsException: Index 1 out of bounds for length 1`
The line that is causing it is:
```java
new Hologram("" + ChatColor.DARK_GRAY + (10 - i + 1) + ". " + ChatColor.GRAY + parkourLeaderboard.get(10 - i).replace("null", "N/A") + "s",
new Location(world, x, y + (increment * i), z));```
please help
really
cuz the array is only size 1 and not size 10
Your array has one entry. What do arrays index on?
well it starts on 0
please read the fucking stacktrace
So do you understand the error now?
Um, ok. So what are you asking?
idk how to fix it
get element 0 not 1
so -1?
cuz i have already tried that but then it says "Index -1 out of bounds for length 1"
for (int i = 10; i > 0; i--) { is going to loop 11 times
oh
It loops ten times
11, its inclusive
That's a >, not >=
well you havent made the array have 10 items
#!/usr/bin/java --source 11
public class PrintTable {
public static void main(String[] args) {
for(int i = 10; i > 0; --i) {
System.out.println(i);
}
}
}
10
9
8
7
6
5
4
3
2
1
10 times
11 times, it includes zero
it only ends when its LESS than zero
wouldnt that be i >= 0
It ends when it's less than or equal to zero, run the code yourself, test it
🤷
yep, >=0 would be 10 times
no not less or equals, its only less than
it ends when it is = 0
So I have this plugin I'm making and I have it so that when the game ends its supposed to delete the world file I already have it so it can delete the world file but how do I make it so when theres only one player left it does that?
it never reaches 0 as the x > 0 condition fails when 0 is reached, and the loop terminates
so yes, 10 times
10 through 1
x >= 0 would run 11 times, 10 through 0
no, he is counting down not up
yes
which means that changing > to >= increases it by 1 iteration
as 0 will be counted
The issue is on this line
if (parkourLeaderboard.size() >= 10 - i)
ah I see
That should be > there, not >=
I guess I'm tired and blind
However the answer is, just loop the contents of yoru array not a counter
@torn oyster swapping that should do the trick
alrighty
rip
There's probably a more elegant solution, but this works fine
it works ty
np
it turns out what I was looking for under the name of navigable is what java actually calls list iterators
not that knowing that fucking helps any because there are still no collections that do what I want
Something seems to be not right... 🤔
The code is actually same, with other config names, but it makes me appear with three errors...
Where did I messed up?
What does it tell you
Multiple markers at this line
- No exception of type Object can be thrown; an exception type must be a subclass of
Throwable
- InvaildConfigurationExcepton cannot be resolved to a type
and
The method printStackTrace() is undefined for the type Object
Oh
Found one
xd
Might as well write the function 1 time and just add a name parameter so you can generalise it more
InvaildConfigurationException*
never repeat yourself needlessly
-.-
Fun fact: this is an error
Multiple markers at this line
- InvaildConfigurationException cannot be resolved to a type
- No exception of type Object can be thrown; an exception type must be a subclass of
Throwable
and your code is needlessly repetitive
BRUHMOMENT.exe
F
Cannot understand you. Are you trying to make beginners hate programing or WTF?!
more code to maintain means it's more difficult to maintain, which leads to issues like these
having to type large blocks of code by hand just to repeat a function is a serious fault point and will inevitably result in you making a typo like this
even if you copy paste and only modify certain values within the code blocks, the same can happen
Exp.: copy-pastes makes you learn nothing
not really what i was going for but whatever
yeah so when i read a stack overflow i write it myself
Writeing a code yourself makes you learn it.
that doesn't mean you should write the same code repeatedly over and over
He could bring it nicer, but trying to make your code more generic makes it easier to read/understand and saves time when debugging/re-using code. So I'd say just take the pointers and not worry too much about intonation😅
The point is that your two functions could be one function
But how to do that? D:
look at the differences in your code blocks
they are currently hard-coded; you are changing them in the source code of the method itself
(and don't force me Java wikis or Bukkit stuff. That actually won't help me)
change them to variables
Just pass down a String variable in the method parameters which represents the name of the file.
🤔
instead of "Configurations/Bedwars.yml", use "Configurations/" + configName + ".yml"
String configName, and just use that instead of the file name. Also I don't get why your using saveDefaults() multiple times, it's the same function and will do the same thing in this case so call it once outside of that function. Is more efficient 😉
and change the method name from generateBedwarsConfig() to generateConfig(String configName)
can call it once with generateConfig("Bedwars") and a second time with generateConfig("Main")
private void generateConfig(String path) {
saveDefaultConfig();
File f = new File(getDataFolder, path);
if (!f.exists()) { this.saveResource(path,false); }
YamlConfiguration playerData = new YamlConfiguration();
try { playerData.load(f); } catch (IOException | InvalidConfigurationException e) { e.printStackTrace(); }
}
private void generateMainConfig() { generateConfig("Configurations/Main.yml"); }
private void generateBedWarsConfig() { generateConfig("Configurations/BedWars.yml"); }
also something you can do, but not strictly necessary
Lemme see it
Oh something you might like, you can do new File(getDataFolder, path); instead of doing + File.seperator+ the file class file handle that for you by going this
Also, you don’t own the exception; I’d throw it up the stack. However, I assume that might be a bit advanced for now.
i wrote it in discord so indents might be fucked
This actually has two errors said by my editor.
Return types are missing.
that's for generateMainConfig() and generateBedWarsConfig()
F
oh
add void since you don't return anything
Add «void»
shit i forgot that
sorry i forgot to add them
just remember to not just copy code tho
sometimes you gotta do things yourself but i added them now
Is fine, keeps the mind sharp of those looking at it
Agreed
I added the code, and there are no errors.
Too sad I need to actually export the jar, upload to the VPS, and restart the server. 😹
(jk)
just do a local server
(but that's not a jk to test it)
f
i do wish if maven was as fast as gradle but i really dont care about the speed lol
is there a way for me to list every online player name onto a scoreboard with skript? I know I might get criticized for using skript, but I simply don't have enough time to learn java atm
?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.
"Jar creation failed!" - ALLRIGHT! You won again! 🙄
f
@granite stirrup if hes using skript he doesnt need java docs
i told him to learn java
lol
Creation failed, but there was already one JAr.
ik that
Nice job, editor.
did i say u couldnt read?
cry
Fun fact: I learned Skript myselft... Somehow... Sadly I don't think I can do this with Java. Java is a way more bigger language than Skript, and with Skript, you can just do something like...
command /killmepls:
trigger:
kill executor
stop
you could just do kill player lol
Works with both
skript is also not a programming language
lol
Yeah. 😹
I also like how I needed to delete all of my scripts 'cause of the addons.
They f*cked up the main plugin
I'm trying to make it so when there is only one player left in the game it deletes the world I think I got how to delete the world but how will I make it so it happens after only one player is left alive?
so if i understand you correctly u want to check if only one person is alive in the game?
exactly
I mean that would only execute if no players are alive
Isn't poiting an idea?
(when players join, the a variable gets one point. Each deaths removes one point. At 1, it deletes the world - if it is a minigame)
Loop over what?
players?
and check if they are alive
also check there world
so I want it to check for players alive not online because the dead players will be in spectator if that helps
Hmm. Would the plugin not scale better with a cache system and checking size instead of looping over every server player?
collectionType#size might scale linear as well though. Can’t remember rn.
what is collectionType?
Whatever data structure he would use. Just wrote collectionType as they all inherent from Collection
oh that highly depend on implementation
its O(n) for a concurrent hashmap keyset for instance while other data structures like arraylist caches the size making it O(1)
most things do cache it, even linkedlists
Oh yeah make sense, since they save by index
stuff like the concurrent collections may be an exception
but i'd expect most of them to maintain a tally of it as well
regardless, if we are talking about the Bukkit.getPlayers() collection, that will realistically never be large enough for any of these to be valid considerations
Conclure swedish 😮 I’m from norway
the only case where you might run into performance issues with time complexity because of it would be if you were trying to sort it with bogosort
😮
Yes
lmao
damn
don't talk shit about sweden
even though it sucks
lol
sviden
I mean
its boring
What makes it sucky?
it has nothing fun
comparing to?
usa
Not that type of attitude here my dude
water = stinky brown brown
D:
in sviden
racist
the most racist
is there any easy way to clone a region like with worldedit, but in code?
depend on the worldedit api
lmao
in every person there's a small racist inside
not really
i for one do love formula racing
imagine being racist
i guess going fast isn't in your blood
actual trash human
nnya you should verify
never
If I was going to change a player name for a "nickname" should I be using Player#setDisplayName
yes
Document document = new Document("uuid", uuid.toString());
document.append("name", name);
mSkyblock.getInstance().getMongoHandler().collection.insertOne(document);
}```
this code works but I can't find a way for the life of me to get a check as to whether a user is already in the db.. all the ways I've tried either just duplicate the entry every time i log in or do nothing at all
anyone know a way to check if there's already a db entry under the UUID
Yeah I understand this (sorry for the very late reply), but I was just wondering if there was a way that wouldnt require for me to make one of these every time I wanted to delay something, especially when I wanted to do it constantly with a fluctuating time. I think I know what I have to do now though.
What java command would allow me to move an item from the helmet slot to the inventory?
youd need to code it
get the player's equipment, get the helmet slot, save it to a variable, set the slot to air or null, get the player's inventory and add the item in it
i got it to work by just hardcoding the values in a while loop, no api needed :)
I pray for you working with worldedit. I have been stuck trying to paste a fucking schematic for weeks
One minute it accepts it in the code but then doesn't accept it in game :/
im just pasting a spleef map to reset it so this works fine for me
You can paste a schematic using the api? Is that with fawe or nah?
this is all it is:
World world = player.getWorld();
int x = -252;
int y = 23;
int z = -7;
Block block;
Location blockLoc;
while (x != -305 && z != 47 && y != 2) {
block = world.getBlockAt(x, y, z);
blockLoc = block.getLocation();
blockLoc.add(100, 0, 0);
blockLoc.getBlock().setType(block.getType());
if (x == -304) {
x = -251;
z++;
if (z == 46) {
y--;
z = -7;
}
}
x--;
}```
why did it
ok
I mean, don't you paste it via schematic?
i built it in the world
Oh, you're harding coding it
yeah
lol
thats what i said
I miss read sorry its 2am
Hmm, I don't think BlockIgniteEvent is properly handling candles ignited from fireballs
i don't know if ignite event is supposed to handle those
isn't that for stuff literally catching fire
as in, fire blocks being formed
That's how it's handled for campfires
there's a little bit of a difference between a campfire and a candle, but I suppose I can see the logic there
pfft why do you need it anyways intelli 🙄
public void playerJoin(PlayerJoinEvent event) {
event.joinMessage(null);
new BukkitRunnable() {
@Override
public void run() {
event.getPlayer().sendPlayerListFooter(Component.text(getServer().getCurrentTick()));
}
}.runTaskTimer(this, 20, 1);
}
is this ok or will it break everything (testing)
should be fine
consider using the bukkit scheduler rather than a bukkitrunnable, though, as that is cleaner
ok cuz it says dont call api methods from async runnables
this wont like block the method?
that isn't an async runnable
that is being run synchronously
runTaskTimerAsynchronously would run it asynchronously
or whatever that method is called
for this what should i use
sync is fine
Bukkit.getScheduler().runTaskTimer(plugin, () -> {
event.getPlayer().sendPlayerListFooter(Component.text(getServer().getCurrentTick()))
}, 20, 1);
it's the same but using a Runnable with the scheduler rather than a BukkitRunnable
ah oke
since Runnable is a one-method interface, you can use the () -> lambda function instead of having to create an entire anonymous class
and no, it won't block the event
Here's a function I made to delete a world.
public void deleteMap(String mapName){
System.out.println("deleting " + mapName);
Bukkit.getWorld(mapName).getWorldFolder().delete();
}
However, when I do System.out.println(Bukkit.getWorld(mapName).getWorldFolder().getAbsolutePath()); it outputs "C:\mypath\bla\bla\bal\.\world_name
it adds a .\ before world_name and this is confusing me a lot any help would be appreciated :)
that's the least of your worries
i'd be more concerned about fucking with a world that is loaded
o
that can cause far worse things than just explosions
if it were unloaded, getWorld wouldn't return it
@wraith rapids will it auto cancel the task when the player disconnects or do i have to do that manually
no, you need to do it manually
the only case where tasks are cancelled automatically is when your plugin is disabled
alr
Unloading it should be enough it should be gced iirc at some point … if you care about the folder delete it after
If i were to do a GUI based Item Builder what would be the best way to implement that 🤔
I instantly think of using NBT to do it dynamically. Which would be a single class with the needed info and the GUI would said class to pull the supported NBT and modify/create said item.
I could also do a bunch of if/else statements or one class per item, however i feel like that'll get messy the more items I'd want to support.
edit for quote:
Lets say you wanted to create a monster spawner.
You'd be able to set all of the values via said GUI and while bukkit supports it it's limited to an extent (e.g. one entity only).
Now, lets say you wanted to create a spawn egg using the same GUI based creator.
Bukkit support falls apart, massively, depending on what you're trying to create and with each spawn egg being a different material it's an even bigger pain to do. I could do separate classes or if/else statements for each case however i don't think that's a clean implementation.
Doing it via NMS means a fuck ton of registering and shit and a lot of it already done via bukkit impl, but it would get rid of the edge cases...however I'm not really sure that's the best implementation method either :/
The goal is to put specific items in specific slots?
Nah, that's the easy part 👀
It would serve as a way to create spawn eggs, monster spawners, etc easily
I am trying to import a /nick plugin into spigot and nothing is working, can somebody vc and help me
The issue with that though is some don't play nice the bukkit way
So umm, I am trying to get the chunks around a chunk, I have this code. https://gitlab.com/openstreetcraft/minecraft/-/blob/47-add-command-to-regenerate-chunks/bukkit-server/plugin/regenerator/src/main/java/de/ixilon/bukkit/plugin/regenerator/BukkitRegeneratorCommandExecutor.java#L55 And it kinda works but it only preforms the operation on the chunk I am standing in not the chunks around me, take a view-distance of 1 for example, its meant to do the chunks in a 1 chunk radius but it doesn't.
Hmm I guess I’m lacking some info. So the gui would serve the purpose of running different code blocks per item you click on? What would you store in nbt
i want to delete the folder. but doing .getWorldFolder() adds a .\ before the world name.
how am I supposed to delete it at that point?
I am trying to import a /nick plugin into spigot and nothing is working, can somebody vc and help me
no, nobody will vc you
ask your questions in text
if you can't explain through text, use screenshots
Isn’t there a worldContainer.absolutePath
Off of server,
Lets say you wanted to create a monster spawner.
You'd be able to set all of the values via said GUI and while bukkit supports it it's limited to an extent (e.g. one entity only).
Now, lets say you wanted to create a spawn egg using the same GUI based creator.
Bukkit support falls apart, massively, depending on what you're trying to create and with each spawn egg being a different material it's an even bigger pain to do. I could do separate classes or if/else statements for each case however i don't think that's a clean implementation 🤔
Doing it via NMS means a fuck ton of registering and shit and a lot of it already done via bukkit impl, but it would get rid of the edge cases...however I'm not really sure that's the best implementation method either :/
nvm i figured it out
I am reminded of why I hate java so much
why?
Mainly because it sucks
I think that issue is resolved
So umm, I am trying to get the chunks around a chunk, I have this code. https://gitlab.com/openstreetcraft/minecraft/-/blob/47-add-command-to-regenerate-chunks/bukkit-server/plugin/regenerator/src/main/java/de/ixilon/bukkit/plugin/regenerator/BukkitRegeneratorCommandExecutor.java#L55 And it kinda works but it only preforms the operation on the chunk I am standing in not the chunks around me, take a view-distance of 1 for example, its meant to do the chunks in a 1 chunk radius but it doesn't.
Ah, yes. Comments
/**
- Get name
- @ return name
*/
String getName();
addUnsafeEnchantment
for the client, yes i think
Is there documentation on it
Wait so this isn’t what I’m looking for
I’m looking for a way for uses to be able to add sharpness to an item that isn’t supported by sharpness
Like a trident with sharpness
What’s that do
I'd like to make a very very simple chunk based land claiming plugin - where should I start? Any tutorials available that anyone knows of?
towny
Can I set the damage of a item?
How
And attack speed
Yep
How
ItemMeta#addAttributeModifier()
Thx
So I am making plugin for a game and Im working on the countdown for when people join the lobby... Any reason why this isn't erroring but isn't sending the message? It did at one point but stopped after further development.
for (Player player: Bukkit.getOnlinePlayers()) {
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText("Game Starts in 15 Seconds"));
//^Plays Title Screen at the 15 Seconds mark at ActionBar
docker plugin for vscode is very nice
@novel pendant Use a countdown task.
Make a new class that extends BukkitRunnable
public class Save extends BukkitRunnable {
@Override
public void run() {
for(Engine instance : EntryPoint.getWorldTracker().values()){
instance.saveMappedDataToFile(false);
}
}
}```
?
He wants to know how to countdown 15 seconds.
i know
He can do this with a BukkitRunnable and then do runTaskTimer
but why the example code
for(Engine instance : EntryPoint.getWorldTracker().values()){
instance.saveMappedDataToFile(false);
}
lol
🤷
Yeah it's a backup task that I use in my plugin
I have it set to run every 12 hours
cant you just do this
Bukkit.getScheduler().runTaskLater(Main.plugin, () -> {
//your code here
},time);
yep. That is valid too.
better to have an object than have a huge stack of lambda code
wait why would I make a countdown task for that though, I need it to put out a message at each milestone
Ah.
Wasn't aware of this
I thought you just wanted to count 15 seconds, then execute some task
this will also become more and more delayed based on server tick speed, i would definitely schedule the timer async and just schedule a sync task within
No I was mainly asking why this wasnt running even without any errors
for (Player player: Bukkit.getOnlinePlayers()) {
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText("Game Starts in 15 Seconds"));
does it run in the first place? try a broadcast above the for loop
just use new TextComponent()
that's not the issue
I cant send the full class
?paste
aight yeah probably a copy paste error at some point
you're only setting ifHap to true at the very start
should it be above the onEight function?
it's running for the first player that logs in and setting ifHap to false, but at that point the player count is 1
so you see nothing
you can check booleans directly, ie if (ifHap) {
i don't know what ifHap is, but you should probably be setting it within the PlayerJoinEvent as well as at the start
btw is it possible to set that some file in the local repository is not copied to github (cuz some file are too large and github is complaining)
gitignore *.jar?
^
how to make one
right click on it in github desktop and press ignore
do you have git integrated into your ide?
i am using vscode
i mean yea
but it cant just right click and ignore
it has a .gitignore.txt
?paste
I can just right click and ignore, Idk how to do it manually
I suck with Git
Yeah sorry. I don't really know
@EventHandler
public void onBlockForm(BlockFromToEvent e) {
int id = e.getBlock().getType().getId();
if (id >= 8 && id <= 11) {
Block block = e.getToBlock();
int toId = block.getType().getId();
if (toId == 0) {
if (generatesCobble(id, block)) {
if (rand.nextInt(5) == 1) {
block.setType(Material.COAL_ORE);
} else if (rand.nextInt(7) == 1) {
block.setType(Material.IRON_ORE);
} else if (rand.nextInt(12) == 1) {
block.setType(Material.LAPIS_ORE);
} else if (rand.nextInt(18) == 1) {
block.setType(Material.REDSTONE_ORE);
} else if (rand.nextInt(22) == 1) {
block.setType(Material.GOLD_ORE);
} else if (rand.nextInt(45) == 1) {
block.setType(Material.EMERALD_ORE);
} else if (rand.nextInt(50) == 1) {
block.setType(Material.DIAMOND_ORE);
}
}
}
}
}```
this isnt working
i updated it from 1.8 - 1.16
changed a few things
that is 100% the best way to do random selection lol
hold on let me get my cobble gen plugin
diamond is 2%
?paste
can i copy it
private final Set<BlockFace> waterFaces = EnumSet.of(BlockFace.NORTH, BlockFace.EAST, BlockFace.SOUTH, BlockFace.WEST);
private final Set<BlockFace> lavaFaces = EnumSet.of(BlockFace.DOWN, BlockFace.NORTH, BlockFace.EAST, BlockFace.SOUTH, BlockFace.WEST);```
private Material pickMaterial(String tier) {
if (tier == null) return null;
double runningTotal = 0;
double choice = plugin.random.nextDouble() * 100;
Set<String> keys = plugin.getConfig().getConfigurationSection("generators." + tier + ".blocks").getKeys(false);
for (String materialName : keys) {
runningTotal += plugin.getConfig().getDouble("generators." + tier + ".blocks." + materialName);
if (choice < runningTotal) {
return Material.getMaterial(materialName.toUpperCase());
}
}
return null;
}```
i was also lazy and didnt make it a relative total, so the chances have to add up to 100
easy to change though
wut are you guyz making rn
babies
-_-
idk what he's making just wanted to show off a simple cobble gen plugin
skyblock core
because MagicCobblestoneGenerator is a terrible bentobox addon
for my server
why not just use bentobox
there are some things not worth (re-)creating, in my opinion
whats that magic cobblestone generator thing
wait i cant cancel a bukkittask from within itself, i thought it was supposed to be possible?
doesn't detect permission properly, breaks when the permission are taken away (people still have access to tiers they dont have permission for)
what are you trying supa
OhhhhhhhhhHHhhhHHHh
manhunt addons
i am training a machine learning model for minecraft
interacting with C++ libs are annoying
oh didnt someone already try that
and decided minecraft is too difficult for a AI
XD
well gl
who?
dunno
watched a vid like a long time ago
not sure
ik theres bots for
PVP
Mining(hacking)
bots != ai
cuz i am doing one for outlining buildings from real life building images
yes
nice
but i know little about AI and need someone to help me fix the model
i dunno much either
cuz the IO size is not desirable
thats reinforcement learning
what i am doing is 3D convolution
theres many types of ai
my type is (similar) to those that regconize pictures
cool
OHHH
NOOO
there is a AI
there is like
SOOO BAD
at recongnizing pictures
here
an example
face depixalizer
try not to um
I know this one
vomit
i knew theres a AI to depixalize some umm..... you know.... videos...
hold on a moment
not good to say it out here
hent AI ?
idk , i know someone made it
hmmm
This the one?
this one sucks , only good for western people
wait y they not png
cuz it generated from matplotlib
are you on a phone @digital plinth ?
no

