#help-development
1 messages · Page 2288 of 1
yep
you cant fake linked spigot names
me?
You sure?
No was telling them
was odd the naming convention but other than that gud
weird
yeah imma be deadass with u
idk why its saying invalid plugin.yml
oh
api-version
set that field
thats only difference i see rly is ur missing that field
set it to 1.18?
yeah, minecrell again
minecrell
I'll delete it and try
has the main name and api-version
gnome de?
gnome op tbh
Dual boot is great but sometimes its fucked up with raid setups
wtf i like linux
can you spot the mistake?
i couldnt find a more appropriate gif
had to go with the most sparatic one
Been using arch linux specifically manjaro, i get the freedom windows doesn't allow
what are you using rn?
she uses linux
much better
Whats the error
invalid yml
wait
new error
org.bukkit.plugin.InvalidPluginException: java.lang.NoClassDefFoundError: your/package/charts/CustomChart
bstats
seriously
Did u relocated it properly
make sure bstats is set to compile scope
can I dump my pom?
?paste
interesting
The scope is redundant as long as it is relocated properly
Shouldnt need relocation
It will be compile by default
when no scopes set maven will default on provided iirc but he has a scope set
Maven shade plugin auto shades all compile scopes
But for 1
thats fine scope is compile anyways
your/package/charts/CustomChart
your/package/charts?
my charts?
never used bstats so maybe i just dont know how it works
but i would assume a class called CustomChart is trying to get used and isnt there
weird idk why bstats wouldnt just take the Class directly
like registerChart(ThatChart.class)
Eventually my bstats is shaded in and i dont have any scope set in the dependency
Works fine for me
Yeah i thought i was wrong about it but hope that clarifies it
i tend to always set scope with maven whenever i use it
Plus i havent used maven in soooo long
been using gradle for like 4 months now
I'd try gradle soon with my new projects if time permits
Yeah i saw the structure once, its too clean
and not to mention import jars is suuuper easy
in maven u gotta install-file which is annoying asf
thats all u do to import jars in gradle
ofc considering you want the entire dir shaded which i do
Yeah maven sucks on that

But i tend to avoid local imports if possible
i hate they deprecated systemScope ngl
Yeah i only use local imports for testing
once my libs stable ill slap it on jitpack
Fair
i honestly need to learn how to setup a repo on my vps
i wonder if jfrog has docker images with jfrog on it already
[18:58:47 ERROR]: Could not load 'plugins/NeoPerformance-1.9.9.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: java.lang.NoClassDefFoundError: com/neomechanical/charts/CustomChart```
Does that package path and class 100% exist?
show screenshot of the files if you can
yeah package path is wrong that you specified for bstats
do I need src.main.cdsfsdf
Lol bad import
that class should actually exist on your package path of com.neomechanical.neoperformance
and then inside of another package called chart
where there is a class called CustomChart
or
just disable bstats for now if you dont have a chart made
cause you likely know where the chart is if you made one
hmm
whats your bstats code?
thats throwing that
code on theyre website doesnt say anything about sharing a package name or stuff
do you need anything at ./bstats?
wait is bstats in default spigot now?
theyre example project doesnt even import bstats
its probably this java metrics = new Metrics(this, pluginId); metrics.addCustomChart(new SimplePie("Language", () -> NeoPerformance.getInstance().getLanguageManager().getLanguage())); metrics.addCustomChart(new SimplePie("halt_at_tps", () -> String.valueOf(getDataManager().getTweakData().getTpsHaltAt())));
is it?
Not sure about that
If it would then the docs for bstats should have stated it for a specific api version, etc
It does have a jitpack iirc, its in their docs
cya
hi i want to start learning Spigot Plugins does anyone here know where to start and what i should try making first??
Sorry if too noob, but I need help with updating my intellij buildTools. I have managed to update the BuildTools.jar but I don't know how to bring it into intellij as I'm trying to update my spigot dependency to 1.19. I keep getting the error that dependency not found. Please can someone help me?
._. i don't have coding experince besides basic Python Scripting
I got an idea
YouTube
And Google
ik ik, Im a genius
best website
used it so much xD
Just follow some tutorial series on youtube: https://www.youtube.com/watch?v=tnJZMaoMPhE&list=PLfu_Bpi_zcDNEKmR82hnbv9UxQ16nUBF7
Then find some plugin idea that interestes you and try code that, then get stuck and ask stupid questions on spigot and keep doing that until you have a really buggy plugin held together by bits of string. Then come back to it a few years later and be like wtf is this shit, and recode it it.
In this episode, I give you a brief overview of what you can expect in this MC Plugin coding series. #Spigot #MCPlugins #PluginTutorial
Java Tutorial: https://www.youtube.com/playlist?list=PLfu_Bpi_zcDPNy6qznvbkGZi7eP_0EL77
How to Setup a Test Server: https://www.youtube.com/watch?v=58MZ4THF73g&ab_channel=KodySimpson
Discord: https://rebrand.l...
Hello everyone !
Do you know how I could create an huge explosion?
CraftWorld#createExplosion() is capped to 10, I need something like 25
Can we pin that please admins
it is? where u find that out?
Not me, a friend tried it
well, try it yourself
doesnt mention being capped in the docs
declaration: package: org.bukkit, interface: World
not a great idea
Why ?
Is there an integrated method to get the time a player is on the server?
in the current session
cuz then u dont get the random explosion, the sounds or the particle effects or the damage or the fire
Why not ?
I was looking for spigot implementation
plus calling the createExplosion method calls events meaning it will hook into worldguard and other land protection plugins
^
Mh
recreating the method yourself means not using a spigot implementation?
Anyway, I havent heard anything about it being capped at 10
try World#createExplosion(x,y,z,100,true)
Here is an example:
player.getWorld().createExplosion(loc.getX(), loc.getY(), loc.getZ(), 100F, false, true)
Is that 100 blocks ? :x
100 doesnt equal 100 blocks
Ah
its power
^^
mans is doing over 20x normal tnt
xD
honestly tho
Oh, I see so this explosion will just do as much as 25 TNT, but all TNTs are on the same block
it may have a limit just not publicly documented
yes
but
Ah f....
I mean try set it to like 500 or smthn, see if its a bigger hole
doubt, why would they not document that, and ive also heard no mention of a limit
what are you looking for?
I would like to create a huge explosion, not an explosion with huge damages on a single block xD
Something like a 20 blocks explosion
well
create a grid of tnt blocks
True true
u could do smthn like
for(int x = 0; x < 100; x+=4){
for(int y = 0; y < 100; y+=4){
for(int z = 0; z < 100; z+=4){
world.createExplosion(x,y,z,4);
}
}
}
which will create tnt sized explosions in a 100x100x100 grid, spaced out 4 blocks each tho
lag warning tho 👀
@rotund pond
Well, this should be a bit huge but thank you xD
is this the fastest way to iterate a double nested array?
for(Object[] o1 : o0){
for(Object o2 : o1){
//do something
}
}
We're going to try somethings
well
actually
im not sure if using index access is faster
eg for (int x = 0; x <= (o0.length - 1); x++)
might be actually. I do have the sizes of the array, and it shouldnt contain null entries
I mean.... theres probabbly faster ways, but its negligable, your probabbly talking a difference of in the milliseconds. If your looking at optimisations you will usually do those on bigger complicated stuff not looping
^
eh fair point
im just curious
^
always a tradeoff between optimisation and readability
well, just do it in a 10x10 then 
o rly?
its either faster or slow but its so small a user wont notice it or dev
lemme find the article
Yeah Ik dw :p
TreeMap<Double, UUID>. If 2 players have the exact same Double as key, what will the TreeMap do?
are you sure you dont have this the wrong way around?
shouldnt UUID be the key and Double the value?
I want to make a top
But it only sorts by key
Sort things yourself
it returns the uuid registered last iirc
Not the one i rly wanted but it explains it partially
if you want to sort by value, you could turn into an array and sort the array
I have an uuid associated with a score
And I want to get the UUID's with the 5 highest score
Mainly its stuff like this that make lambdas slower here it is
and then u can do smthn like Map.values().sort()
Yes, but how can I get the UUID's associated?
Because you cannot get by value in Map
Could someone please help me with updating my dependency to 1.19... I'm not that well versed and I really need some help
Thanks
this thats useful
thanks
shit*
basically your getting the entrySet of the map, and then sorting by the value
didnt know sort was a thing
i was gonna loop through that values orgnizing myself once i made my own leaderboards 💀
It’s important to note that in those cases you aren’t sorting the map, you’re copying the data to a new structure and sorting the copied data
List<Map.Entry<UUID, Double>> sorted = map.entrySet().stream().sorted(Map.Entry.comparingByValue()).collect(Collectors.toList());
probabbly the cleanest way
yeah, u cant sort a map tho
Probably most expensive also
Depends on the map implementation
pfft
LinkedHashMap can be sorted
yeah, but thats nerd shit
^ as well as tree map
Is there a way to control player like you are the player
Yes!
Probabbly but it would looks super hacky, and not very clean
Listen to all of the controller’s movements and teleport the controlled player accordingly
As well as make the controller invisible
But it will look awful to the player being controlled
Actually
You know what
Here’s how you do it:
Disguise the controller as the controlled to every other player
"Yeah thats nerd shit"
in a java development channel 
Send the spectate packet to the controlled player to make them spectate the controller
Boom
For bonus points you can send the controlled player a disguise changing the controller’s skin to theirs in case they F5
Or, just give up and download a plugin that already does that 👀
Because i wanted to do something like in this video but with snowballs. If you throw a snowball on a player you can controll him then
yeah but i want it with snowballs XD
Well, looks like its opensourced: https://github.com/RayzsYT/ControlPlayer/tree/main
plus it even has an api
Oh, hell naw
this some messy code
Holy
Yeah the way they did it just doesn’t seem as nice as my elegant solution lol
Mr AlexTheCoder, are you still working at mineplex?
is mineplex even a thing anymore?
Yes and yes
ayo wtf
ohp sorry for ping
thought i was holding shift
just a quick question. probably stupid but oh well
should i use PostLoginEvent or ServerConnectEvent? I want to kick the player if specific conditions are met/not met
What type of conditions?
if username starts with something
PostLoginEvent might suffice
alright thanks :^)
You can use PreLoginEvent
the username supposedly is disclosed already by the time that event invokes
buuutt postloginevent should be fine too, right? or does it send the player to the backend before too? :P
Im not sure
ill test it rq
But I think backend’s AsyncPlayerPreLoginEvent will fire before
why not just use that event ^
They’re on bungee
public class VillagerCured implements Listener {
private final Main main;
public VillagerCured(Main main) {
this.main = main;
}
public int potionDuration = main.getConfig().getInt("discountDuration");
...
gives me "variable main might not have been initialized" regarding the "main.getConfig" portion?
any ideas
Yes
the code public VillagerCured(Main main){…} will run after potionDuration = …;
so at the time when the variable potionDuration gets initialized the value will of the variable main remains null
that code would be slower without JIT
Move the initialization part of the variable potionDuration to inside and after the this.main = main part
in monkey terms
OH right thanks
whats JIT
for (var x : array)
produces
for (int z = ; z < array.length; z++) { var x = array[z];
so - pretty much the same otherwise
Just in TIme
Just in time burchard
Just-in-time compiler
ahh
The actual compiler in the java ecosystem
jit trippin
Java is both interpreted and compiled interestingly enough
i normally dont tend to stress over small things like that because you just barely notice the difference
unless you forget to call .join on a CompletableFuture

Yeah lol
The JIT is incredible these days
so
public VillagerCured(Main main) {
this.main = main;
int potionDuration = main.getConfig().getInt("discountDuration");
}
int potionDuration;
public VillagerCured(Main main) {
this.main = main;
potionDuration = main.getConfig().getInt("discountDuration");
}```
You made potionDuration to whats called a locally scoped variable
sorry lol
Teacher Conclure today 🙂

Oh so it's like how I use main before using it in this.main = main?
now @fallow valley, write 100 lines of I will not use uninitialized variables.
Yeah
for(int i = 0; i < 100; ++i)
System.out.println("I will not use uninitialized variables.");
Nice, you go out and play now
Thank you sir.

I promise not to do it again!
deaths:
1:
- ["speed", 12]
- ["haste", 10]
this is in my configuration
right now it only has 2 effects
the number of effects can be modified
how do i get each effect
public Map<PotionEffectType, Integer> getEffectsFor(int deathNumero){
potionEffectMap = new HashMap<>();
this.config.getList("deaths." + deathNumero).forEach(effectList -> {
potionEffectMap.put(
PotionEffectType.getByName(
String.valueOf(
((List<Object>) effectList).get(0)
)
),
(Integer) ((List<Object>) effectList).get(1)
);
});
return potionEffectMap;
}```
this is my current method
class Example{
static final int C = 19283; //global constant
// static variable
// global variable
// global field
// static field
// mono state
static Object o = new Object();
//instance variable
//field
//instance field
//prototype variable
//prototype field
Object h2o = new Object();
void epic(
//parameter
//parameter variable
double o
){
//local variable
int epic = 459;
}
}```
@fallow valley
as you can see it doesnt work 💀
For any future references
Calling a package private variable "global" 
lemme get the error once more
Again: Dont use mixed type lists. You will only have problems with that.
i tried your way
it only confused me more
But with restricted access and visbility Ig
Is it possible to make a queue for Bedwars with a Hashmap?
Depends
More likely not
Myes but there are more relevant data structures you could opt in for
Whatever that means. You can surely hack it.
hashmap not sorted
It is sorted
+1
LinkedHashMap
Just not by any significant means
uh uh
Just use Queue
^
forgot about linkedhashmap one
I want it just to pick a random PLayer, teleport it to the teambase it belongs, and then remove this Player
The order of a hashmap is conceptually useless 99% of the times
Queue is an actual Java data structure, so you can use that
And then repeat until everyone is in a team(which is not the same)
How do you get the order then?
Wym get order?
iterator::next
I would still just use a Queue
how do I use queue?
I've never heard of it xD
LinkedList is poop.
I'd use Deque instead
Iterable ≠ ordered
Not sure whether the former exists
remove O(1) :3 iirc
He doesnt really need both ends so it wouldnt matter
not sure if its possible to get the order then
Yeah while iterating. But an ArrayDeque just performs better when used as a queue
Indeed
arraydeque backed by an array? 🙂
Iterable does insist on some type of order
since it provides an Iterator with some notion of order
Use a Stack and just pop players from it until its empty
Kinda yea
Then whether that order is useful is another debate but ye
Well now it's more about what "order" is
Yup
Whether you mean a meaningful order
Precisely
Stack test = new Stack(); <- Like that?
I mean impertinently HashMap has a pretty useless order
Stack is generic. So you have to infer type arguments still.
@EventHandler
public ShapedRecipe PotionRrr() {
ItemStack Potion = new ItemStack(Material.DIAMOND_BOOTS);
PotionMeta meta = Potion.getItemMeta();
ItemMeta meta1 = Potion.getItemMeta();
meta1.setDisplayName(ChatColor.GREEN + "Froggy Boots");
meta.addCustomEffect(new PotionEffect(PotionEffectType.JUMP, 1200, 20, true, true, true), true);
Potion.setItemMeta(meta1);
Potion.setItemMeta(meta);
ShapedRecipe recipe = new ShapedRecipe(new NamespacedKey(this, "FROGGY_BOOTS"), Potion);
recipe.shape("NNN","N N","NNN");
recipe.setIngredient('N', Material.NETHERITE_INGOT);
return recipe;
I'm trying to Make PotionMeta but the PotionMeta meta = Potion.getItemMeta(); Showing red line how can i fix ?
Thats not how you use event handler methods.
You need exactly one argument of type Event
Why Stack over Queue?
uhh method naming conventions are gone now?
wdym ?
FIFO vs LIFO :0
how can i add the PotionMeta
Stack has different behaviour
Doesnt matter. Why not.
LinkedList… runs
what do I have to add?
He wants random elements. So if he scrambles a list and puts it in a stack or queue then there is no difference between lifo and fifo
Ah
type arguments
But i cant find the place where i can add my code with tthe snowballs
I'm trying to Make PotionMeta but the PotionMeta meta = Potion.getItemMeta(); Showing red line how can i fix ? uhm how can i fix
You are overwriting meta1 with meta. Makes no sense.
variable name start with a lowercase character smh
only 1 meta ?
and method names too 😢
Yes use only one meta and add your changes there.
ok
I dont know which, I'm pretty much trash at programming xD
Stack<Player> theLot = new Stack<>();
ok, thanks
UUID is preferred but lets keep it simple
Now my prob is the PotionMeta meta = Potion.getItemMeta(); showing red line how can i fix
<ThingsInsideTheseDiamondBracketsAreTypeArguments> and they are usually as in always the names of classes
i removed the meta1
- Learning the basics of java
- Cast
Nice
?learnjava :3
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.
sorry
And I add Players with theLot.add(Player)?
Ohyeah
i just didnt get to use that

i made that meme today i had to use it, but defo look at links conclure sent
Where can I find all these commands?
You gradually fetch them here and there when they are used.
- effect: speed
multiplier: 12
``` this is a LinkedHashMap right
uhm
No
idk what that is
But i cant find the place where i can add my code with tthe snowballs
a yaml exception
No this is a list of objects as far as yaml is concerned
I will post them in #spigotcraft
its a linkedhashmap as far as my java errors are concerned
-
effect: speed
multiplier: 12
doesnt that do the same thing
looks cursed no
really does
how can I pick a random Player out of the List?
Which I believe is backed by a LinkedHashMap
therefore its a linkedhashmap?
One moment
no
ok
use Random#nextInt(int) with a bound argument of the list size - 1
but its stored as it
Stack has a get method
The Config is a LinkedHashMap
your Objects are stored IN teh configs backing LinkedHashMap
smiles gonna write an example doing kinda what i said likely
theLot.add(all)
;Player ranplayer[] = {all.getPlayer()};
int randomPlayer = rand.nextInt(ranplayer.length);
Player ranpl = ranplayer[randomPlayer];
this is how I did it before
huh i believed not
it will go from 0 - length
cuz random.nextInt(0, 5) goes from 0 to 4 right?
Yeah
noob
By convention most stuff is inclusive exclusive
you confused me
thats my goal
Lol
imagine being able to write a async websocket
ah :'(
lol
thanks
carrotus bro ignore what i said and what fourteen said instead
my brain cell count is low today its 3am
1 pm here and my brain aint working properly tho
public Deque<Player> createRandomOnlinePlayerQueue() {
List<Player> list = new ArrayList<>(Bukkit.getOnlinePlayers());
Collections.shuffle(list);
return new ArrayDeque<>(list);
}
Something like this
bit expensive but you wont call it often
Ok, Thanks
interesting
i didnt realize i had to cancel the event and not just disconnect the player lol. had me bashing my head on the table for a while. thnx bud
Collections.shuffle
does this already remove the People from the queue?
🥲
how can i do crafting recipes with custom items
How resource intensive is that method smile?
say for like a list of 200 strings at 16 bytes each
Its like O(2^(-1)n) iirc
im wondering if iterator::next on an arraylist is going to give a random element or not
No? This gives you a filled queue. You still need to poll() until the queue is empty.
is that like a real expression for it
n/2
ok, thanks
Sorry my math head is a bit dodo
maths lmao
🥲
How will I be able to reset a world with different seeds everytime I restart the server?
You mean O(2^(-n)) ?
2 ^ -1 -> 1/2^1 smh
wtf is this equation for
google big o notation
There's only a world.getWorldInfo().getSeed() but how would I set it for the server.properties to reset the world with a new seed?
Maybe, is that the right complexity?
In onLoad of yoru main JavaPlugin check Bukkit.getWorlds() == 0, then delete teh world you want to regenerate.
No idea. Would have to look up which algo is used
But it's the main world
It can't unload the main world
oh so its like a calculation oh how large input size can be before it starts slowing down
ie its a input/slowdown graph in a sense
https://www.spigotmc.org/threads/guide-beginners-guide-on-improving-your-codes-performance.396161/
In section 3 i explained a bit how big O works.
Yes, thats why you do it in onLoad before the worlds are loaded
You delete it as teh server is starting as you can;t unload it
wow thats crazy didnt know you could calculate speed for things in java before testing them
Oh god i actually find this a bit cringe now. Eclipse screenshots. I had like 10 months of experience back then.
Even so, the seed will still be the same
tfff
Not if there is no seed set
omg how much ive seen that
you doing that at 10 months??
it picks a random seed
HAHAHA

im convinced smile isnt human
i think hes some machine learning ai that learns java off spigot code
mans is cracked at programming
How do I give an Entity a potion effect, i checked for potion methods but didnt find any
I would not create one task per arrow.
Create one runnable that maintains a collection of arrows and spawns particles for them.
On shoot -> add to collection
On hit -> remove from collection
the only thing wrong here is getting the player 20 times?
no the UUID
you would make that UUID a local variable
so your not constantly calling getUniqueId
There should be something like add potion effect
however for that specific method speed wise it doesnt matter, since that is cached already i beileve
but design wise it makes a big difference
and sometimes some gets do process more heavy code
nope it isnt there
Yeah explanatory variables superior
like getOfflinePlayer
declaration: package: org.bukkit.entity, interface: LivingEntity
100% wanna cache that bullcrap class
oh no i should cache plugin.userrepo :(((
i would
I mean the cons of using many local variables is that they do take some space
UserRepo repo = plugin.getUserRepository();
Like you push the variable onto the thread stack
Oh thats for Living Entity
But who cares
not Entity
yeah but once the calling method is over its gone or cleared by GC
Readability >>>
is casting safe here
Eh those few bytes on the stack
Why you want to add a potion effect to an Entity
Yeah maube gets a little bit cramped in the stack but thats just cozy
thats how its supposed to be done
Only LivingEntity can have potion effects
unless
you use nms
Well that's how you should do it
I don't really know the context
I thought you meant Entity
Entity can be a ItemFrame, which cant have potion effects
hence why it isnt a thing
Spigot should add the same reactions that or on the forums to the discord (eg. agree, like, winner)
everyone, tanks youz
like that?
Definitely
Ohyeah
I always get an error when Putting this into My code, when I put this before the Override I get an error for Override and "onCommand" but I have to put the braclets around the whole code so I can use the list. And when I put this after the Override where I need it, it also has an error
I have
This one still hits hard
that last one wtf
i cant stop laughing at this
I think Imma create a thread to send My code, because its hard to explain
i thought he was gona say new thread in his code
and i was thinking how is that gonna help
Btw I've noticed, that on some older posts, there are also disagree reactions, why was it removed?
and use code blocks lol
yoro code
ppl got sensisitve
"Waah i got ratiod"
You’re so mixed up in multithreading put simply 
"remove dislike"
Its soooo good
Ugh
my server handles so many requests
People would use it purposefully to be douchés on the forums
no idea
Is there any rule for sending .txt files? because I cant really send My code because its too long
however idk why it keeps saying they execute on thread 15
?paste
May I ask
Are use using the worker pool to accept sockets?
No
Yes
i assume because the requests execute so fast that the thread is available immediantly?
and it just reuses it?
You might wanna use another thread pool if your socket connections are alive for a longer period of time
Yes
That partly
cause thoe requests do execute in about .001, but theres other factors so the delay is longer
Idk
but actual code fires isntantly almost
But anyway java sucks when it comes to the socket part
?paste
Cause usually
well the actual connections arent async
We want a thread per socket
here let me send my code
Or sth
?paste
https://paste.md-5.net/lewazijaca.java
The actual WebSocketServer is ran in a new Thread and all actions of the websocket get handled in futures
ignore my hashmap of conenctedClients
Was there also like a negative ratings on people profiles?
it was before you taught me atomic stuff
Ah
idr
But likely
Interesting
Btw
Burchard
Netty might be what you wanna use
Since it can handle like millions of requests
so i want to get the name of a block on BlockPlaceEvent
basically getting the itemstack of that block
how do I exactly do that?
i heard nettys hard
never
plus would i need to rewrite my entire socket logic?
Cause what i have rn is so nice with json pojo schema parsing
Fair
ignore the code, but i made a Bukkit style action handler where the code inside here will be ran async
and the second argument is any pojo class you want to accept
Itll turn the class into a json schema, validate it and then initialize it to pass to that, its pretty cool i love it xD
my old server code was horrendous
Nice (:
?paste
there is an event for when tnt explodes iirc
ooh
https://paste.md-5.net/xikaxuwiyi.cpp
This used to be the old socket logic
💀
Oh god
btw there isnt a method for that i think
Nope sadly
I wish
google it is
dang BlockExplodeEvent wont tell you if it was tnt
unless
blockList contained the primed tnt that was exploded maybe
and you can check the location against that, then cancel event
TnT when it explodes is an Entity
Blocks exploding are things like Beds in teh nether
entityexplodevent exists no?
lemme see
declaration: package: org.bukkit.event.entity, class: EntityExplodeEvent
that might work
but
actually nvm
wait if you cancelled that
wouldnt the tnt get locked at primed state
🤔
pretty sure it just disappears
but you can clear the block list if you still want it to explode
now how do I detect from BlockExplodeEvent if that block is a primed tnt i spawned from my code
just would have to handle entity damage then
use EntityExplodeEvent
PrimedTnt is an entity
so how do i detect if thats the PrimedTNT i spawned
I'm having an issue with some custom crafting with some custom items :
The custom items are implemented by adding a CustomModelData to them, and are recognized the same way
but that means they are still recognized as normal items for the server
eg : a new ingot that uses the iron ingot as a base will be usable in crafting involving iron, and we don't want that for custom items
My solution was to put every custom recipe in a list, and upon crafting, checking if the recipes in the event matches one of the custom recipes, if not, that means the recipe is vanilla and thus, should not contain any custom item
I then cycle through the items in the crafting matrix and if one of them is a custom item, I cancel the event
But the problem is that the recipe fired in the event seems to not match any of the stored custom recipes.
TL;DR Cannot get #recipe.equals(Recipe other) to work
✅ Solved : Cast recipe to ShapelessRecipe or ShapedRecipe and check if the NameSpacedKey matches
check if the entity id is equal to the tnt entity id you spawned
Oh so now this is where i store all of em ids in an array
Hi I'm tryna hide nametags in my spigot server cz im tryna do a pvp thing with my friends but i can't do anythin. I've tried the team method and don't wanna use the scoreboard methods it seems complicated
teams works though
without any plugins even
nah i don't i've tried setting visibilty to never and hideforotherteams only
both don't work
lemme test a few things brb
sn
do u want a list of the plugins im runnin?
btw im runnin 1.19
i'm gonna test with vanilla teams for now
klm
done
it works with normal vanilla ?
yup
u can set it but others can still see it no?
as long as they are in the NoNameTeam no
but I wanna hide it from other teams
then have both set to "hideForOtherTeam"
nd i'm not runnin on a vanilla server
lemme test that
klm
doesnt matter, you still have the vanilla features
I've tried all of them but no matter what the other team can see my nametag and I can see theirs
could it be my plugins then?
i mean, it could if one of them uses teams
lemme send u a ss of it
afaik you cant be in two teams at once
bump
oh nah i'm doin seperate teams
but there is this ghost team that appears, says it doesnt exist but its there and i can't remove it either
not what i meant
let's say plugin X is using teams for specific features and adds you to one of it's system teams, it would remove you from the team where nametags are hidden
Does anyone here know if it's possible to keep those 2 lines in one line instead of splitting this text here into a solo line?
wdym by "keeping them 2 lines"?
smth like this?
first line \n second line
jus realised i cant send the ss of my plugins here
that the unformatted text and the formatted text stay in the same line
yes
`like this would render` like this
its not exactly the same
but its the cloest there is
test
this
is meant to be used to write block text like code
So just a single `instead of 3?
ye
@rare flicker issih klm if i send u a ss of my plugins to ur pm
ty! ;)
but mainly have coloration
public static void main(String[] args){
}
idk every plugin so i don't think i'll be able to do much
wait nvm I think ik which plugin is causin the issue
cancelling this would not trigger the explode animation?
i kinda want that animation to show up
but without damage to players/blocks
ooo
I dont see any thing related to EXPLOSION in Sound
Oo
Has anyone ever played around with custom recipes involving custom items?
Yea, I just use the custom item itemstack as the result in Crafting event
Yes
Added Thread.sleep() and it bricks the request line
and with ShapedRecipes ?
Even though each requests handles in a future
Wait send code
never worked with shaped recipes, but you can use something with the NameSpacedKey thing to register your recipe
?paste
aw..
i have it working and everything
but now i'm trying to cancel custom items from being usable in vanilla recipes
ShapedRecipe expBottle = new ShapedRecipe(dingusItemStack);
but i cant find a way to recognize a recipe as custom or vanilla
https://paste.md-5.net/feqahoqope.java
Executor is:
Executors.newWorkStealingPool(Runtime.getRuntime().availableProcessors() * 8);
annd runAsync is just a wrap around of CompletableFuture.runAsync(Runnable).join();
public static void runAsync(Runnable runnable, Executor executor) {
CompletableFuture.runAsync(runnable, executor).join();
}
private Recipe maillechorts_rod() {
ShapedRecipe recipe = DEItem.MAILLECHORTS_ROD.getShapedRecipe();
recipe.shape("i","l","p");
recipe.setIngredient('i', new RecipeChoice.ExactChoice(DEItem.MAILLECHORTS_INGOT.getItem()));
recipe.setIngredient('l', Material.LIGHTNING_ROD);
recipe.setIngredient('p', new RecipeChoice.ExactChoice(DEItem.MAILLECHORTS_PLATE.getItem()));
return recipe;
}
just loop through the itemstacks and check if it contains your itemstack
would join() make the futures block on the server thread?
doesnt really work
without calling join() the threads never completed theyre tasks
what are you looping through
it uses new thread on connections just fine tho
what array of itemstacks, from crafting event?
wait
this is something i want to cancel
it doesnt
because the bottom right ingot is not a real copper ingot
but a custom one
so your method would work here
so just use the inventory drop/click event
cast to CraftingInventory if instanceof
loop through the items (has a method for the recipe items)
check if it contains your item
if it does, setResult to null
I can give you repo access or just the lib jar if you want to test it out directly
but what i also have recipes like this
oh
which should remain
then u need to check for each recipe i guess
or wait
u can maybe add checks for results
^^
The work stealing pool does have 96 threads but i dont think thats the issue
tried both
oh
i have plenty of ram and im on an i7
no idea then I am sorry
are you messin with the new Loop thing
wait lets not give up imma check
nah this is CompletableFutures on work stealing pool executors
oh
i can pastebin my class if you want
yea that would be nice
i heard the new virtual threads thing is secksy
it was when it was working
not i just stopped and runs on thread 115
even after restarts it chooses thread 115 
true
i have no idea what this new thing is about
we will get StructuredTaskScopes also
its about threads
Which is awesome
basically something secksy AF that is fast AF
Wait java 19 has better thread handling?
multithreading on a new level
Yes
heck yea
ill switch my project over rn
finally a good java update
is the new changes east to implement?
xd
what changed exactly?
And use on futures?
thread creation became less expensive or smth?
virtual threads, its called "Project Loom"
And we get better error handling
im gonna have to change my auto deployment up
wat whut java19 is out?
oh is it not
so not anyone can get it
well tbf java 19 wont work for me
because my deployments need a gradle docker image
and i doubt a jdk 19 is available yet
fuck am i stoopid, i can retrieve the namespacedkey from shapedrecipe
nicee finally
new ForkJoinPool(Runtime.getAvailableProcessors(),defaultForkJoinWorkerThreadFactory,(t,e)->e.printStackTrace(),true);
^ try that impl
gotta wait some item
GG
my pleasure
docs always there to save xd
building now
how does spigot show the fake diamonds/ores stuff when a user tries to xray?
i was confused because #Recipe doesnt have a getKey method
i want to do something similar
packet interception?
oh packets, scary
like, when the server send a chunk it replace the ores to stone?
weird its still blocking
maybe its smth else i never really looked into it
and chooses thread 115 always
