#help-development
1 messages ยท Page 549 of 1
Clan channels are hard to make sometimes
You needed 15 warcraft 3 accounts to make one
Because of me my clan had 3 clan channels. I possessed at the time 1k starcraft keys, and like 300 warcraft 3 keys
The hard part about making a clan channel as well once you have everyone. Is that once you hit create clan everyone within 5 minutes has to accept the clan invite. If one person doesnt receive it or doesnt hit accept you have to do it over again
Also if you try to do it by yourself you needed proxies because only a single ip was allowed 3 connections to battle net
Btw, when one of my bots was opped, it accidentally banned the clan leader for swearing
And then when they got unbanned they were trying to whitelist themselves and they accidentally activated my bot protection for the channel so it started banning everyone in the channel lmao
I lost my ops for like a week for that
Anyways, have some work to do. Be back in like an hour
I keep getting null pointer exception on line 57, i have tried a number of ways to fix it but I'm not sure what's going wrong its printing this to console so i assume the item is being pulled from the map fine? [17:38:41] [Server thread/INFO]: Selected tool: {54569797-2646-4112-92ea-f566ec302ad4=ItemStack{ELYTRA x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name={"extra":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"color":"gold","text":"Elytra"}],"text":""}, lore=[{"extra":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"color":"gray","text":"Click to select an elytra!"}],"text":""}]}}}
How are you getting NPE on line 57 and still getting stuff printed ?
Show us the exception as well
why is gradle failling to download dependencies that is from https://libraries.minecraft.net
it doesn't give any errors it jsut says "FAILED"
"this.selectedTool" is null
Looks like you're not setting the Map<UUID, ItemStack> selectedTool
sorry im still really confused as to why this isnt working. this is the class i have the this.selected tool in. any ideas on how i could fix it?
https://paste.md-5.net/ujomejujom.java
I think you are passing null in the constructor for the selectedTool
Try putting the System.out.println("Selected tool map: " + selectedTool);
after line 23 and see what it prints
[18:38:07] [Server thread/INFO]: Selected tool map: null
why not access selectedTool through DI instead of passing the entire map
https://gyazo.com/8bd0a0c7af287c6b6ddbc2671e5a179a
I have this script to when holding an iron ingot while left clicking an oak door, it will turn it into an iron door. But the iron door keeps breaking. The script was working a while ago but it suddenly just idk stopped working so can anyone tell me why?
^also event.setCancelled(true) does work when not holding iron, but when it turns it into an iron door, it immediately breaks and turns into an item
use a delayed runnable
Will learn that ty! Was stuck for a long time
yeah sometimes events are just funky with that sorta stuff. delay it by a tick and it should be sweet
^ applicable to a few other events aswell
I don't think that is the case
The problem is that he's setting just a single block of the door
ah you might be right
I think you need to disable physics on the first half of the block and then set the other one normally
yep
how do you fix unable to find valid certification path to requested target
ive been stuck on this error
for soo long
Can anyone explain this to me:
https://youtu.be/kEcwYaXNWI8
This is my code:
https://paste.ofcode.org/DQANrPXp7uQyhBGfRrGi7y
Check for hand as well
Might be running twice - once for main and once for offhand
oh my, use a decent paste site. that is unreadable
declaration: package: org.bukkit.event.player, class: PlayerInteractEvent
What is that website that let me super easily view the obfuscated names for Mojangs obfuscated names?
Need to make a private field public in the Block NMS class but during runtime, the field names changed obviously
Screamingsandals
are you complaining that the torches duplicate?
I am complaining that you can literally dupe entire inventories full of any item that can be put inside Shulker Boxes ๐
When you close an inventory you are copying the players inventory into the shulker.
this rly needs to be a command here, thank you :))
I will have a look, thanks
Yes, but my code works fine - As long as you don't have a shield in your off hand
The PlayerInteractEvent may be called once per hand. If you only want code to be executed once, you can check the result of https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerInteractEvent.html#getHand(), then decide functionality.
For example, only executing code if the main hand was used:
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
if (event.getHand() != EquipmentSlot.HAND) { // * if the hand used is NOT the main hand:
return; // do not progress past this point |
}
// provide functionality
}
There is command for everything, isn't there.
I think he is scanning for the shulker with specific tag in PDC, then setting the contents of the currently open shulker inventory into the item.
yep, but he also copies the closing inventory to teh schulker, so even though he emptied it he put the items back
So hard to read double spaced code though
My mind just can;t process it
if he removed the items from the inventory then he copies the empty inventory into the item
so that is fine
not if the inventory thats closing is the players
?paste
there is check for shulker inventory on top
The InventoryCloseEvent doesn't even fire in that case
As I said, too hard to read double spaced for some reason. Once it hits a blank line my brain just switches off and thinks it's a new bit of code forgetting the previous.
Yeah, kinda same.
Really hard to read that.
SOOO, on a scale of 1-10 how stupid am I approaching this:
My reflection method: https://paste.md-5.net/coxuruloga.cs
Screaming Sandals says that the obfuscated name is aP (screenshot), Block implements BlockBehaviour and I'm wanting to access the properties field that BlockBehaviour (yeah I tried properties as well) holds
Is this cause im using a paper server jar orrr?
you get the player's direction, reverse it
normalize if needed and multiply by 2
I recommend reading this
me writing a 2d game and having no clue how vector multiplications work ๐
getDirection, multiply -1
a direction vector is a unit vector, so a length of 1
multiply by -2 if you wan to go back 2
still the same process
get Location, get Direction, multiply. add vector to location
anything more than this is spoon feeding
I suppose you could take all declared fields and print them ?
Also if you modify the hardness on server there will be visual desync for the client when mining the block
But sure let me point you in the right direction
Location playerLocation = player.getLocation();
Vector direction = playerLocation.getDirection(); // if you're looking north, which is +Z, it'll be (0, 0, 1)
Location ahead = playerLocation.add(direction);
actually not a bad idea ill do that
Wouldnt the hardness of the blocks get resent to the clients? I could always just send refined progress packets to the player shouldnt be too hard
That information is not synchronized with clients (yet)
what in particular
hmm so could i just synchronize block hardness with the client with a packet? i havent really ever messed with block hardness before so idk much about it (doing this in 1.19.4 as well)
You can't, it is not modifyable so there is no reason to even have a way to do this
play with it
huh interesting...
ah so its basically just redoing the entire block breaking progress then, block hardness wouldnt even matter really tbf
.multiply
What you can do is give mining fatigue and then send the break progress manually
^ works quite well
Only problem is it makes breaking blocks server side, which means ping becomes a bigger problem
I saw that as a common solution but I really wanted avoid the effect state of things
I'm basically wanting to recreate the hypixels mining system/speed in turns of the normal efficiency levels buuut
Yeah you do have a point there coll, would have a great deal on performance TBF
Just be sure to not accidentally make it possible to mine bedrock
Is that with just mining fatigue??
or nms + packets
Well that's on Minestom, but it can be recreated with mostly Spigot API
I believe I did it entirely with the api
Minus sending a packet to give mining fatigue client side
Youโve got the BlockDamageEvent and BlockDamageAbortEvent
Does it really matter if the effect is client side or not?
(Also PlayerAnimationEvent if needed)
No but I didnโt want to replace any server side mining fatigue
Ah I was looking for these events was unsure if they got added
operator overloading ๐
For vectors thatโs reasonable
But people use it on classes where it makes no sense and it just kills readability
true
ah so you did this instead of sending a bunch of progress packets i see
or you used it entirely to control the break speed?
Progress can be sent with API
true but it's kinda weird
Looking at the block damage event right not but only see insta break options unless its private and needs reflection
yeah nothing for block breaking progress or setting it in there
declaration: package: org.bukkit.entity, interface: Player
yeah but you can't control the entity id belonging to the packet
That packet is just
entityid, stage
You can now
Yeah there's a method that accepts the id
Thereโs an overload with an int
holy crap perfect, gonna give this a whirl now thanks
took me an hour to write this, time to test this shits gonna be broken as hell i bet
chunksnapshots cords is binary ?
binary?
a chunk is 0 to 15
bro are u not sleeping ?
i wanna show my code to u but
they will laugh at me
#help-server if you're not asking for code help
hello, i'm trying to set custom effects to the enchanted golden apple only, but it keeps applying it for the regular golden apple and the enchanted one.
public void playerFoodConsume(PlayerItemConsumeEvent e) {
Player p = e.getPlayer();
ItemStack ega = new ItemStack(Material.GOLDEN_APPLE,1 , (short) 1);
if ((e.getItem().getType().equals(ega) && !e.getItem().getItemMeta().hasLore()) || (!e.getItem().getItemMeta().hasDisplayName())) {
p.getInventory().removeItem(ega);
if (p.getFoodLevel() <= 18)
p.setFoodLevel(p.getFoodLevel() + 4);
e.setCancelled(true);
for (String po : this.effects) {
String[] inf = po.split(":");
if (inf.length == 3 &&
PotionEffectType.getByName(inf[0].toUpperCase()) != null) {
PotionEffectType pot = PotionEffectType.getByName(inf[0].toUpperCase());
try {
this.dur = Math.min(Integer.parseInt(inf[1]), 2147483647);
} catch (NumberFormatException e1) {
this.dur = Integer.MAX_VALUE;
}
try {
this.amp = Math.min(Integer.parseInt(inf[2]), 255);
} catch (NumberFormatException e1) {
this.amp = 255;
}
if (!p.hasPotionEffect(pot)) {
PotionEffect potionEffect = new PotionEffect(pot, this.dur, this.amp);
p.addPotionEffect(potionEffect);
continue;
}
p.removePotionEffect(pot);
PotionEffect effect = new PotionEffect(pot, this.dur, this.amp);
p.addPotionEffect(effect);
}
}
}
}
any ideas?
this is kinda nested and unreadable
he wants all golden apples
enchanted ones
Only the enchanted ones.
default enchanted golden apples
It keeps applying it to both regular and enchanted.
still you shouldn't match by names and lore
you can just check if it's enchanted
are there any errors tho?
nope
ItemStack ega = new ItemStack(Material.GOLDEN_APPLE,1 , (short) 1);
if ((e.getItem().getType().equals(ega) && !e.getItem().getItemMeta().hasLore()) || (!e.getItem().getItemMeta().hasDisplayName())) {```
what the hell is in your effects
Since when is enchanted golden apple not its own material 
that you check for numberformat exception
all you are matching is any golden apple with no lore or no display name
its in 1.12
Too old! (Click the link to get the exact time)
java 8
hello i m trying to set custom effects
how to import api?
lol why is it searching on papermc
How i can get stationary water/lava in 1.19?
he asked about vault though
Pls, i dont wanna use legacy_stationary_water/lava ๐
yeah you can use the blockData and do #setFlowing(false)
I believe false is the default
i wanna check if lava/water is flowing or not
Nvm found.
need some assistance here https://discord.com/channels/690411863766466590/1115628726269513809
How can you do an overlay like this? (top of the screen)
title with custom symbols or invisible bossbar
maybe retextured bossbar?
with custom symbols you mean that some unicode symbol is (in a resource pack) changed to have that look and be that far up, and then you display it as a title to the player, it then displays that overlay up there?
alright, will look into that, thank you
boss bar with a funky unicode title
to save you some time: the symbols are unicode chars
!verify
Usage: !verify <forums username>
!verify CiroSanchezB
This account is already verified!
oh dear
sus
how to properly load the config of the minecraft file on startup?
oh sry
was brain afk
the config.yml
onEnable
getConfig().options().copyDefaults(true);
saveConfig();
Oh idk that stuff sorry
saveDefaultConfig() and i hope you know copyDefaults() does nothing if you dont have defaults
The Configuration API is a set of tools to help developers quickly parse and emit configuration files that are human readable and editable. Despite the name, the API can easily be used to store plugin data in addition to plugin configuration. Presently only YAML configurations can be used. The API however was designed to be extensible and allow ...
he's using the correct one
Is it just me who detests the bukkit built in config idk why but I find it Hella confusing
I like it
i like the get/set stuff but the loading is weird
should I safe it all the time like DefaultConfig
actually just calling getConfig() loads the config too, only doesnt save
I also like the built in serialization
Swhat I mean
I just wish more Bukkit objects were serialized
geol would say DataOutputStream :)
You're welcome to contribute 
No real point for me. I'd make too many formatting errors to have a pull accepted
configurate supremacy
It is kinda annoying to ensure no formatting errors it's annoying as hell to setup your ide around those configs
That's why we have Checkstyle
I mean for most things, its a matter of just implementing serializable lol
I think there is only a few things in bukkit that can't
it could be one line and I'd make a formatting error ๐
Just spam my autoformat key all the time
ah xD
true I guess ๐ someone make a .editorconfig for spigot
Use LibreWolf it'll work
i thought that was smth like libreoffice ๐
@echo basalt can u teach me this switch problem ?
bruh its literally 9/10 the same code
No it's awesome
LIBREWOLF is ๐ status
but it doesnt have an auto updater
currently using firefox
man i told you yesterday
you just had to spot the differences between your code and mine
use a Consumer<BukkitTask> instead of a Runnable
Hi how to fix this :- when I use this comment [/znpcs action add 1 CMD Shop Food ] . It tells [Hey!, The inserted number/id does not look like a number]
your ide going crazy isnt exacly smth useful to say
.
Ok
alr 1.12.2 doesnt have that method, get rekt
go upgrade your stuff
imagine supporting 1.12
recursive loop 
who even told em you need to put an L after longs in scheduling methods 
learnjava moment
What's a java
i learned lambda and i wanna say this to u for comprehension
we call methods without override from interface ?
what? the lambda is the method impl
yeah a lambda is an impl of the method
basically an interface is a sort of template of a class
Runnable r = new Runnable() {
@Override
public void run() {
System.out.println("Thicc");
}
}```
is the same as
```java
Runnable r = () -> System.out.println("Thicc");```
something just saying "any class that implements this will have these methods"
parameters correspond to eachother
Let's say that interface only has one method that needs to be implemented by the inheriting class
you put all the params of that method in the lambda's ()'s
and return whatever that method would return
if i use lambda methods i don't need this ?
nailed me
But let's say you have an interface called ChatFormatter which is just a String format(String original)
and you have a class that has a method like public void setFormatter(ChatFormatter formatter)
you can call setFormatter((original) -> original.substring(1)) for example
as that's a valid implementation of the format method
kinda sucks that java doesnt have type aliases
Full tutorial for Lamba expressions in Java.
Complete Java course: https://codingwithjohn.thinkific.com/courses/java-for-beginners
Lambdas in Java can be very confusing and hard to understand for a beginner Java learner, but they don't have to be. Lambda expressions allow you to create a method implementation as an object, and you can learn ho...
here's a 15min video
c++ would be using ChatFormatter = std::function<string(string)>
i have other question elgar did sleep ?
same in java basically but i dislike people writing a new func interface where they can use parameterized existing ones
I do kind of wish it did. Even if it were as simple as import foo.bar.Bazz as Foo
uh oh the c++ commander joined
static imports 
waiting for the day that CraftEntity is cleaned up
i tried to avoid them but i came to the point that those nested types are just annoying
u guys explain me how can i convert blocks from chunk.snapshot to normal chunk blocks
this
Oh. The problem is that there isn't really a great way to resolve that
At least none I can think of
i would be one of those people that changes the order and then sees the comment
maybe a little generic typing
Can it not be done with a map like CraftBlockStates?
or use reflection to make a sort of tree
Reflection is a no
manually make the tree
I was gonna say to use reflection to like scan all mob classes and make an inheritance tree type deal
and then the method would just look over the tree until it finds the best node
Something like mapping NMS entity class -> BiFunction
or you can do that, sure
Map<Class<T extends Entity>, Function<Entity, CraftEntity>>
One way or another, you're going to end up having a lot of lines somewhere
It will inevitably be ugly
But not that ugly
something like that
The only way to make it clean is to patch every single NMS Entity class to have a createCraftBukkitEntity() method, but that would involve patching every single NMS Entity lol
it's only like 50 classes
Doesn't matter. Too many patches
better than doing this clunky mess
You're welcome to update it
"can't bother typing" brother that's why we have auto fill
md5 will be at your door
private static final Map<Class, BiFunction> map = blahblah
static {
map.put(EntityCreeper.class, CraftCreeper::new);
... etc ..
}```
I signed it like 8 years ago and he has yet to show up at my door 
Can't
yes you can
he has to go through the ocean
Does this work in theory? It would still be a lot of lines to populate the map but it's less ugly then the massive if else chain
for to unload chunk i need wait some time ?
oh elgar isnt sleep
You'd have to make sure that everything maps up correctly. There are some fallthrough cases. e.g. multiparts
But if you map each individual internal class, might work
and youd need the exact class
i mean i try this code
The exact classes are already all imported so
meh
The only special case might be the dragon
Because
else if (entity instanceof EntityComplexPart) {
EntityComplexPart part = (EntityComplexPart) entity;
if (part.parentMob instanceof EntityEnderDragon) { return new CraftEnderDragonPart(server, (EntityComplexPart) entity); }
else { return new CraftComplexPart(server, (EntityComplexPart) entity); }
}
cancel();
this.cancel();
}
}
}.runTaskTimer(Main.getInstance(), 0L, 1L);```
thats my code
ah
than what is it ?
BukkitTask particleTask = new BukkitRunnable() {
double progress = 0.0;
@Override
public void run() {
if (!player.isOnline()) this.cancel();
if (true) {
//stuff
} else {
this.cancel();
}
}
}.runTaskTimer(Main.getInstance(), 0L, 1L);```
mine is a BukkitTask
or am i wrong ?
ah
anyopne know if its possible to check if a location is in a player's plot using PS api?
the ages you set depends on how long the chunk has been unloaded
other then this, the only other way to resolve it would be to use reflection
There is overload that takes a consumer
Use that overload, and call task.cancel()
๐ญ
holy cow
i understand but u was talking about async this isnt async ? bcs i loop snapshot and u was said use runnable
for the growth system u say do growth system bcs when player load the chunk before specified time the method will be reset and crops will take longer to grow ?
yes, you've not implemented anything async that I told you. You got as far as taking a chunk snapshot, then went your own way
but how can i convenrt snapshot blocks to normal blocks ?
i need get block locs from snapshot and set type in world ?
don't get distracted with work distro, lambdas or queue system. implement an async runnable, passing the snapshot
ham
Hello, I forgot my spigot account password. And it asks for email to reset password and I forgot the email because it's pretty old account. Is it possible for you to send me your e-mail name?
?support
i believe i found my new editor, ides are overrated
Oh dear
vim like keybinds ๐ฅฐ
I always assumed that was a negative thing
it makes me not require a mouse anymore
why is buffer like [1024]?
you put the size in front of the type
i have seen same stuff with a spigot custom config tutorial
buffer[1024]
i know it is array size but beside that i got no clue
best file finder
1024 is approximately 1mb buffer size, which in terms of text is quite adequate for a cache
still learnig java?
could anyone help me improve this ?
#1100941063058894868 message
Honestly I just need to take time to learn Vim properly. I really enjoy at least the basics of Nano, but learning some basic Vim, or at least Neovim would be useful
this editor is called helix btw
Yeah I've seen Helix before
nah then brain just fails
ofc i'm not highly advanced in java
hmm ill love this
ah yes i have two processes on that file and they're deadlocking eo
.odin
does anyone know if its possible to check if a location is in a plot
define "in a plot"
.
that would work though no?
if it's work its not stupid ๐คฃ ๐ญ
that's... not the right approach
let me edit my coms*
comrades
packet interception is obviously going to be faster and the most โtrueโ to the real event because nothing couldโve modified it yet
I mean
but yeah you would never do that unless youโre trying to keep the server blind
"Faster" is out there
it really isn't
It really is
Itโs faster for your code to execute.
You save that reflective call to your event handler!
that already uses method handles or full ASM
Maybe on paper
and is effectively as fast as a normal invocation
Because itโs not dependent on every other event before yours in the handlerlist to run, furthermore the reflective call
I mean, even normal reflection is implemented with MethodHandles these days
Sure, faster
Earlier != Faster
No one said the server gets a speed boost
that is literally what faster means
Hey even a method handle takes some CPU cycles :p
y'all are arguing over the dumbest shit
faster is not earlier
if I want my send message to run 20ms instead of 30ms after the packet is received
that's faster
and earlier
let's not be dumb, please
that-
don't argue just to argue
It also depends on events though
it literally is
Some events don't coorespond to a packet being receieved
And some packets don't have cooresponding events
for the general case, events are better
of course, and I completely agree
the "faster" part is so miniscule it doesn't affect anything
Yeah in the case of 1-1 events are infinetly more stable at the cost of a few CPU cycles
and only works if your logic does not require main thread either
and using proper API > magic that other plugins need to start injecting into the Netty pipeline
I mean you can always get to the main thread from another one using the scheduler
but yeah, that's probably slower than just listening to the event at that point
ye
Hey guys I was trying to play around with NMS and when I switch up my xml file to have spigot to allow me to use it underlines yellow and says this
EXPOSURE OF SENSITIVE INFORMATION TO AN UNAUTHORIZED ACTOR IN COMMONS
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.19.4-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
Anything to worry about or could I just ignore this?
You can ignore it
ItemMeta keyCrate = new key.getItemMeta();
Cannot resolve symbol 'getItemMeta'
?
?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.
Nooooo but I wanna code minecraftttt
i didnt see i put new
are you saving data to the lore of an item?
oh good luck
i need extends bukkitrunnable to class ?
Why
for to make methods to async i need use runTaskAsynchronously ?
redstone requires dustoptions
iirc
if i recall correctly
i dont believe thats redstone
im not sure actually
redstone needs the dustoptions instance, in recent versions its passed to the last param no idea abt 1.12.2
should be a T data param
Maybe spawn some type of particle?
Pretty sure it has a default for that
?
It absoultly is
They just spawn the break particles
And play a sound
Last time I checked MCMMO used particles
in recent versions they throw an error when u dont
or well thats what happened to me
Iirc its Particle.BLOCK_DUST
switch (scrollParameter){
case EXPLOSIVE:
scrollMeta.setDisplayName("Explosive Scroll");
spearLore.add("Scroll Type: Explosive");
case LEVIATING:
scrollMeta.setDisplayName("Levitation Scroll");
spearLore.add("Scroll Type: Levitating");
default:
Bukkit.broadcastMessage("what");
}
in this code when i try to do levitating it works fine but explosive applies both the levitation lore and explosive lore, as well as sets the name to levitation scroll
omg u right
You always need break at the end of a case
Unless you want to fall through intentionally
break; or i like to do return true;
thank you guys
I thought the new switch case didnt need them?
do u answer ur dm messages ?
Well that isn't the new switch case
oh mb didnt see his i kinda just popped in
But yes the new stuff means you can avoid them
I do not answer random unsolicited DMs
i was about to say damn i been writing stuff wrong for a long time 
are player inventories not an inventory? what im tryna do works in like a chest (and the players inventory while in a chest) but not just like a normal inventory opened by E
there is no open event when the player opens their own
elgarll
it listens for a inventoryclickevent
then your code is flawed
if i put my chunk load method to async runnable w
i would have prevent the lag, right?
oh dear
you cant load chunks async :p
you cant do a lot of stuff async with minecraft
he's not
oh with ChunkSnapshot?
?paste
yes
Yeah CS is generally safe for async and ^
everything is fine up until you change the block data
finally u spoon me lol
u trying to help me on this day thanks bro
is an 'InventoryAction.SWAP_WITH_CURSOR" different in a player inventory?
Afaik CS is fully threadsafe
yeah you just cant actually edit the blocks, for some reason paste.md5's coloring is weird it made me miss that runnable he added lol
But of course it only has read methods, no write methods
๐
is there a way for me to get picture perms in here
!verify
Usage: !verify <forums username>
Sometimes I wonder what goes on in https://discord.com/channels/690411863766466590/695837543962247190
can extract the sourcecode of a plugin? dm me
we shall never know
It is possible yes, but chances are that is the wrong approach
dont help him read his username 
bro pirates plugins smh
Incremental recompilation is recommended especially if the plugin is larger
Most IDEs don't provide such functionalities out of the box but recaf does support that.
But please remember that JPantom is reliable and fails.
idk intellij's decompilation always worked whenever i wanted to see how a plugin is doing something
But... i HIGHLY doubt he wants the source code for that purpose
Meh, probably a skidder
He defo wants to recompile the plugin, at which point you'd likely not want to decompile the plugin in it's entirety
any time I've needed source jd-gui has done it fine for me
๐
I shall convert you heathens with the glorious might of recaf 4X made by Col-E and xxDark.
Once it releases that is
public void inventoryEvent (InventoryClickEvent event){
Bukkit.broadcastMessage("inventory click event");
if (event.getAction() == InventoryAction.SWAP_WITH_CURSOR){
Bukkit.broadcastMessage("1");
if (event.getClickedInventory().getItem(event.getSlot()).getType() == Material.TRIDENT) {
Bukkit.broadcastMessage("2");
if (event.getCursor().getItemMeta().getLore().contains("Scroll Type: Levitating")){
Bukkit.broadcastMessage("3");
event.getCursor().setAmount(0);
event.getClickedInventory().setItem(event.getSlot(), new Spear().getSpear(Spears.LEVIATING));
}
Bukkit.broadcastMessage("4");
event.setCancelled(true);
}
}
}
ok dont mind the amount of nested if statements i was testing it
but why doesnt this work in a players inv?
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
in players inv it only gets to the first broadcast, does nothing else
however, this does work in a normal chest
no errors or anything
try getRawSlot()
where?
everywhere you use getSlot()
alright
but just to elaborate it does work in the players inventory if a chest is opened
Unsure if this is the correct chat as I'm unsure if its a coding issue or a plugin/api issue, however when using Holographic Displays API my hologram only will show after I rejoin my server (using my plugin)
https://hastebin.com/share/olonuhataz.typescript
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
Why did you use multiplication?
a chunk x and z are groups of 16 blocks in each axis
well it didnt work unfortunately. is it possible that that action is called something else in a solely player inventory?
so multiply chunkX to get the Location X
I wonder if it's better to batch that rather than calling a bunch of runTasks
whats the best way i can check if args[1] for example, isnt set
Meh, doubt it matters much
args.length <= 1
If length is 1 or less tha args[1] doesn't exist
Hey, sorry if it's a stupid question but how can I remove some particles from the world? Like spigot allows you to spawn them but I can't despawn them ๐
you can't
oh, fun
particles are fixed duration and client side only
server litterally just sends a packet to fire a particle
So there's no way to get the particle at the location and delete it?
no, it doesn;t exist on the server
Hm, I just wanna spawn it for 5 seconds then remove it so that's not possible? It must be possible to make them invisible or something
no
How do popular servers spawn particles for guns and such then? ๐ค
as I already said, particles are client side only. server only has control over spawning them
They just spawn them
I wish there was a way to specify how long they're around for ๐
So the one I need only accepts color and size. Fun ๐ฅฒ
Hey guys, i'm making a plugin which uses https://github.com/JEFF-Media-GbR/CustomBlockData, but when i try to use it, i get the following error:
java.lang.NoClassDefFoundError: com/jeff_media/customblockdata/
I can find it in pom.xml and i am autocompleting the classnames, so i think its weird that it doesn't work
You need to shade it
I don't understand maven sorry, I only use gradle. I'll have to wait for someone else to help
Okay, thank you anyway
I did that
I'm so confused how there's so many servers deleting particles after a certain amount of time and I can't work out how to do it lol
there's literally no way to remove particles
particles have a set time
you just spawn them once and they'll fade away
Can I set the time they're alive for then?
wouldnt that be args[0]. i think args.length < 1 is args[0]
An array index always starts at 0
So if your array length is 1, you fetch at index 0
yeah thats what i said
Attempting to fetch at index 1 will provide an exception
So yes what coll said is correct
and it is the exact same as what yo usaid
I mean, at the moment my plugin has been ruined due to the particle thing, I want to spawn particles in a certain shape then them go
bet
So, I'm trying to spawn some particles in a set shape then remove it after 5 seconds or so. I've currently got the particles spawning but I can't remove it. I need to use black and red.
I've been doing it like this
for (int d = 0; d <= 90; d += 1) {
Location particleLoc = new Location(center.getWorld(), center.getX(), center.getY(), center.getZ());
particleLoc.setX(center.getX() + Math.cos(d) * circleSize);
particleLoc.setZ(center.getZ() + Math.sin(d) * circleSize);
Objects.requireNonNull(center.getWorld())
.spawnParticle(Particle.REDSTONE, particleLoc, 1, new Particle.DustOptions(Color.BLACK, 5));
}
https://paste.ofcode.org/ncSeExRiRmucUFHg2ErwJX
I don't see where i went wrong
spawn another one after a few ticks
But the first one isn't even being removed
After relocating make sure to import your relocated files
it should be as long as you aren't running that code every tick
https://gradle.org/ ๐
You may have just found the bug lol

it doesn't find it when i use
import me.emiel.lockdup.customblockdata.CustomBlockData;
im open src but file is ready error help me
man speaking google translate
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
?ask
||how to get bitches||
leave this server
Hello, i'm building minecraft plugin with maven. And i have small problem.
I am use maven shade plugin to create jar and after this in this jar there are these files:
org.intellij.lang.annotations
org.jetbrains.annotations
I was doing mvn clean, restarting intellij, deleting .idea directory but this not work.
It doesn't throw any error, but I'd like a clean jar file with no redundant files.
Anyone know what I can do to keep them from being in this jar?
You need to disable intellij's annotation processor for this iirc
i got more problems with maven than my shitty code ๐
minecraft spigot make particle go away how to
impossible, still
not worked
Because ItemsAdder error
knowing
same bro
Is there a method to see if a bounding box intersects a sphere?
mans trying to do a crazy physics engine
sphere intersections should be super easy as you just check the distance between all points of the box and the center of the sphere
if any of those is smaller than the radius, you are intersecting
Yes, but that doesn't check for the case if the sphere is intersecting with a plane of the bounding box, but does not contain any of the vertices.
I did that math once for cuboids and it was annoying
I have custom firework explosions I am working on and want a way to check if the bounding box of the player is in range before I raytrace.
but like you said it gets weird for some combinations like this
the only solution is to probably raytrace with a limited distance honestly
just take a point an measure the distance
pretty sure I actually did the math for a plane and it was just raytracing with extra steps
unless it needs to be mega precise it wont matter
not 100% true I did it while I was in this server
@tardy delta just believe in yourself and keep coding you will finish that AI girlfriend eventually
if you're a bad dev you still have chances

ayo ai girlfriend
So I have code for a countdown plugin. What is wrong with it. Also, how would I use it. I need it as a jar. https://pastebin.com/U1btt6m8 Make sure to ping me.
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Uhmm, I mean looks fine to me? I don't really see why it wouldn't work unless im overlooking something
Not sure what you mean by what's wrong with it. "I need it as a jar" - did you write this yourself? Compiling a jar is something you learn when you first learn java
You typically use something like maven or gradle to compile java into jars
in maven typically you can just mvn clean package, gradle sometimes its different but normally the compile task works fine enough for most things
This is even considering you have these setup in the first place
What do you recommend?
If you are just learning java - maven since its probably gonna be easier for you to read, others are probably gonna disagree. But, in reality, it's a personal preference unless you're gonna get into NMS you may wanna stick with Maven since I've always found it easier with a special source plugin
I recommend taking a few courses in Java before trying your hand in spigot plugins
?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.
Thank you
It might require a valid recipe
wdym
Do you have a recipe registered that takes Diamond pants and a gold ingot
em noo?
Then perhaps the game doesnโt like that
how do I make it then
Register a recipe
how this isn
this isn't the same as craft table recipes
So?
You can register any type of registry with Bukkit.addRecipe
*aside from merchant recipe
Smithing
ok
Wild question:
Is there a way to convert Pojo classes to Yaml back and forth 
you can for json
idk if theres any libs out there for yaml
:> you should make a way
dont see why not though
yee true but im trying to make things easy for end users as json might not be the best for some people ๐
not really
but could prolly take inspiration from gson
some reflection and ur done
What yaml lib does spigot use?
Snakeyaml
oh hmm seems like jackson can do it but jackson is a large lib iirc
RedLib has stuff for converting from objects to yaml
How would spawning entities with player skins work is that packet based and can be done with NMS or is there an entity I can spawn without NMS to do so. For example on hypixel they use entities with player skins or MMO servers that use player entities with skins instead of texture packs
not so much an entity, more spoofing the server with a fake player. all done through packets
how do people make plugins like the real seasons one that changes colors without a pack
since 1.16.3 you can customise the biome palette
can i get the docs for the logic
yes but it'll be a miniscule window
anbd you can have measures in place to make sure it doesnt happen
query whether the player's data has been loaded when accessing it
If itโs during onEnable afaik no
I donโt think players can join before all onEnables are done
they said during runtime so id assume after onEnable
I see
Trying to copy Huuuge Casino slot machines but asking ChatGPT, don't know if I trust it for programming help. Is there a JQuery discord server like this one that I can ask?
Trying to use NMS I put the 1.19.4-R0.1-SNAPSHOT into my dependency but whenever I import something its from the 1.19.3-R0.1-SNAPSHOT any reason why this would happen?
What I have
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.19.4-R0.1-SNAPSHOT</version>
<classifier>remapped-mojang</classifier>
<scope>provided</scope>
</dependency>```
What happens when I import something
```import org.bukkit.craftbukkit.v1_19_R3.CraftWorld;```
R3 is the correct version for 1.19.4
ok thanks
Im trying to play around with spawning player entities through packets and its not letting me get the serverLevel through the world. I found a recource where this worked for a player but its difficult to find anything recent with what I want to do.
This is the error im getting
Caused by: java.lang.NoSuchMethodError: 'net.minecraft.server.level.ServerLevel org.bukkit.craftbukkit.v1_19_R3.CraftWorld.getHandle()
This is the code below
CraftWorld world = (CraftWorld) location.getWorld();
MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();
ServerLevel level = world.getHandle().getLevel();
Did you forget to remap
Yes but did you remap when building your plugin
How do you do that?
?nms
Yeah I do have that
By other links do you just mean the build tools link or am I blind?
I was thinking about writing a lib for typesafe resource pack stuff, so I was thinking about writring a gradle plugin to generate classes for each custom item that has methods like getItem ect what do you guys think about that or would there be a nicer UI way to do it
?nms this link
Yeah thats the one I just went through I did all of that
There is another link in the post
how do I make it so an announcement has a link embedded into a work? For instance clicking "Discord" in the announcement will take to you to discord.gg
The only link I see in that post is the BuildTools in red am I blind?
Im kinda lost here ngl I have had everything that blog post done but it wont work
Yeah its about buildtools. The first link which is the link that the bot gives describes what needs to be in your pom
Second link tells you how to get the appropriate jars for remapping
yeah I did the buildtools with --remapped and all the other steps everything has been done
Ah ok, and still having issues?
Still getting the same error tho
What is the error?
Caused by: java.lang.NoSuchMethodError: 'net.minecraft.server.level.ServerLevel org.bukkit.craftbukkit.v1_19_R3.CraftWorld.getHandle()'
This is everything
Using intellij?
Yes
Have you tried clearing caches?
I may have what do you do to do that
Um what? Lol
Oh i understand now
So i dont particularly use intellij but somewhere in the menus there is an option to clear caches
ij calls it invalidating caches iirc
First lets do one step at a time lol
ok i cleared the cache going to give it a try after its finished setting back yup
and yes im using maven
Next step is what coll is asking if clearing or invalidating caches doesnt fix problem. Just tell us how exactly you initiate building
Ok yeah still getting the same thing
To build I have the file being built right into my plugin folder with
<outputFile>D:\Minecraft Coding\3vasivesmp Test Server\plugins\EvasiveSMPCore.jar</outputFile>
and then I use the package button in the Lifecycle
Are you right clicking? On project to do this? Or using the menu build option?
Ideally if i recall you should only need to hit the big green play button
The green button also does work
I assume this is putting the default output in that folder and not the reobfuscated one
Yeah
Btw if i recall you need to surround the path with quotes if it contains spaces
It also stops it from keeping a previous file and renaming it original it just remakes the file
Anyways, it could be an issue with your pom. Which if you can use the paste site
?paste
Did you make sure remapped mojang is in local repo?
Also
Fix your java version for the compiler
You using a too outdated version and this is actually most likely your problem right there
Fix this issue
Maven is putting the regular output into your plugins folder, you need it to be putting the reobfuscated one in there
Or 18
If you use the incorrect java version you will get the error you are experiencing too since the buildtool jars and mojang stuff for the version of mc you are targeting use a more updated java version
I think its just the java version lol
Anyways, also listen to coll as i have work to do 
What java version would you reccomend and im trying the output rn
I have ranks on my server, I have luckperms, essentialsx, and vault, but my rank isn't showing on the scoreboard and it's still set to the default setting. How can I fix this?
Ah right
Am i doing this right?
<java.version>1.17</java.version>
Module EvasiveSMPCore SDK 17 is not compatible with the source version 17.
Upgrade Module SDK in project settings to 17 or higher. Open project settings.
I swapped to 17 in the project settings but im getting that
Oh i got it just didnt need the 1.17 just 17
ok well changing this broke one of my dependencies
Caused by: java.lang.ClassNotFoundException: com.jeff_media.armorequipevent.ArmorEquipEvent
new BukkitRunnable() {
int currentIndex = 0;
int iterations = 0;
final int maxIterations = Math.min(4, nearbyMobs.size());
@Override
public void run() {
if (iterations >= maxIterations) {
cancel();
return;
}
LivingEntity mob = nearbyMobs.get(currentIndex);
mob.damage(event.getDamage() + iterations);
mob.getWorld().strikeLightningEffect(mob.getLocation());
currentIndex++;
iterations++;
}
}.runTaskTimer(JavaPlugin.getPlugin(Sirius.class), 5L, 5L);
Hey guys is this code performance wise inefficient?
It does work fine without errors but just wanted to know if there is better way that I don't know to achieve this
Ok wait When I use outputDirectory in maven it doesnt use my dependencies but when I use outputFile it works ?
Ok im all good had to make a maven profile to build it correctly the guide helped a lot thanks
https://paste.md-5.net/acidabeyav.bash
getting this error while trying to use NMS to create npcs
https://paste.md-5.net/dunilofazo.xml
this is my pom.xml
https://paste.md-5.net/yiqajeguse.cpp
this is my code where it keeps fucking up (i think)
idk what i'm doing wrong pls help
how can I rotate a worldedit clipboard before pasting it?
NMS Error
Have a question about fake player packets. If I make a "npc" How exactly would I check if a player is hitting it if its only player side? Would I have to check client packets (if thats possible) or is there a better way to do it. Im trying to replicate servers that have player like npcs that can attack like hypixel or MMO servers to take advantage of skins instead of having to make custom textures
You have to listen for incoming attack packets afaik
will spigot ever add an api for npcs/fake players
Does someone has experience with using the MULTI_BLOCK_CHANGE packet (protocollib) with not fulling up the WrappedBlockData completly and the 0/0/0 origin chunk block is always empty / not set
Why do you need protocollib
I'm just using protocollib to sent the packets but I already tried a minimal setup with just nms and the origin will be empty.
Example how I'm testing it. When im removing the if case and set all blocks, it also fills the origin chunk block otherwise its not set or just ignored
int index = 0;
for (int relativeX = 0; relativeX < 16; relativeX++) {
for (int relativeY = 0; relativeY < 16; relativeY++) {
for (int relativeZ = 0; relativeZ < 16; relativeZ++) {
Material material = Material.BLACK_STAINED_GLASS;
// with this line, the origin block at 0, 0, 0 will be missing.
// this is just a example logic to show
if(relativeX > 5 || relativeZ > 5) continue;
positions[index] = (short) (relativeX << 8 | relativeZ << 4 | relativeY);
blockDatas[index] = WrappedBlockData.createData(material);
index++;
}
}
}
Why are you not using the API
Glad you fixed it
Player#sendBlockChange(s)
How do I get the item's slot index?``` if( !hopperLib.isVaild(event.getSource().getLocation().getBlock()) ) { return; }
event.setCancelled(true);
Inventory sourInv = event.getInitiator(); Inventory destInv = event.getDestination();
ItemStack item = event.getItem().clone(); item.setAmount(8);
if( hopperLib.isVaild(event.getDestination().getLocation().getBlock()) ) {
}```
umm anyone has an idea?
ur right, I just need one of them
and also is it better to separate into distinct plugins if I have multiple features like item, gui, npc, level plugin in one plugin.jar or it doesn't matter in terms of performance
BlackList, WhiteList and VoidList would be useful for hoppers
A private message has been sent to your SpigotMC.org account for verification!
wich is the best method for control if a player have an item?
.
has spigot already got 1.20 support?
Have you heard an announcement?
untill 1.20 releases fully spigot cant release an update
so , just re-create the item in the event ( because i wanna use it here ) and it's done(?)
where?
our-custom-key
so , can i use what it want ?
there are some rules but yeah
ok thx :))
when minecraft 1.20 comes out will spigot have a update?
obviously
should be iirc
why this: Bukkit.getScheduler().cancelTask(0); dont stop this task: Bukkit.getScheduler().runTaskTimer(PlaygroundHC_Survival.instance(), () -> { p.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent(ChatColor.YELLOW + "> Jesteล w trybie sprawdzania <")); }, 0, 30);
?
because that isnt the right task id im gonna guess
this.cancel();
BukkitTask task = Bukkit.getScheduler().runTaskTimer(PlaygroundHC_Survival.instance(), () -> {
p.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent(ChatColor.YELLOW + "> Jesteล w trybie sprawdzania <"));
}, 0, 30);
Bukkit.getScheduler().cancelTask(task);```
im pretty sure thats not how their id'd
read the code i sent
you get it from the BukkitTask, https://hub.spigotmc.org/javadocs/spigot/org/bukkit/scheduler/BukkitTask.html
declaration: package: org.bukkit.scheduler, interface: BukkitTask
this code not works becouse I have task in deferent verible
and stop has deferent verible
why are you stopping the task elsewhere
becouse one command starts it and deferent stops
keep an instance of the class then
then add a getter
or use a manager class type deal
you have 1 instance of the class and have a start and stop
sorry, in deferent if
one min
Player p = (Player) sender;
if (args[0].contains("on")){
p.sendMessage(ChatColor.GREEN + "Uruchomiono tryb sprawdzania!");
p.getInventory().clear();
p.setGameMode(GameMode.CREATIVE);
BukkitTask task = Bukkit.getScheduler().runTaskTimer(PlaygroundHC_Survival.instance(), () -> {
p.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent(ChatColor.YELLOW + "> Jesteล w trybie sprawdzania <"));
}, 0, 30);
p.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent(ChatColor.YELLOW + ">> Jesteล w trybie sprawdzania <<"));
PotionEffect effect = new PotionEffect(PotionEffectType.INVISIBILITY,Integer.MAX_VALUE,0,false,false);
effect.apply(p);
}
if (args[0].contains("off")){
Bukkit.getScheduler().cancelTask(task);
p.setGameMode(GameMode.SURVIVAL);
p.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent(""));
p.removePotionEffect(PotionEffectType.INVISIBILITY);
}```
Guys, I have a project and there are like a lot of classes that are all of the same category and I need to make a list of them, should I make like an enum or a class that returns a list or is there a way to do that stuff automatically?
Explain more because it could actually make sense to use reflection depending on what you need
@quaint mantle https://paste.md-5.net/olaxazuyoj.java
most code ive wrote in the past like 3 weeks
Basically, I have a project with guns. There is a class that has all basic stuff and then there are other classes that extend that class and I need to get all of them that extend it
https://github.com/RaydanOMGr/GunStop/ here is the project, if I made no typo
isnt there Class#getSubtypes or smth?
That exists?
Whats that
that looks fine, just low quality
i still have no idea what youre doing
is it just a low poly game
on screenshot yeah
in reality it is pice of sht
you sure it not just your monitor
maybe but on some games it doesnt have blury textures
thats why I am confused
oh this is not general ._.
sorry
I texted in general before and messed up
I could definitely see reflection paying off here
Id add them to a registry with reflection than retrieve them from the registry
I need to learn java because my understanding of what reflections are is basically 0
This would be a pretty good application of it especially as you scale it would reduce your workload a shit ton
hmm Math.ceil and Math.floor should always return a double that can be represented as an int without precision loss right?
im kinda wondering why they dont return a long
So you can continue the builder pattern
especially gets annoying in langs without implicit casts
hey im trying to make a GUI that enchants a selected item with selected enchantments, but im getting a null pointer exception when trying to pass the selected enchantments to the confirmation page. I have no idea how to fix this, been trying for hours but nothing seems to work. any help would be much appreciated!
here is two of the classes: https://pastebin.com/8WD4hvrn, https://pastebin.com/jhc5S3u4 and here is the error: https://pastebin.com/upLp550t
Caused by: java.lang.NullPointerException: Cannot invoke "java.util.Map.getOrDefault(Object, Object)" because "this.selectedEnchantments" is null
ConfirmationMenu.java:51
you either didn;t set it or you passed in null
how would i go about fixing it, everything seems right to me but im obviously wrong this is line 51 Map<Enchantment, Integer> enchantments = selectedEnchantments.getOrDefault(player, new HashMap<>());
figure out why selectedEnchantments is null
where do you initialize the ConfirmationMenu class?
kinda looking awful without implicit casts
in this class https://pastebin.com/Mf38Admy
look at line 60
you create a new instance passing in selectedEnchantments
Now find where in that class you set the Field selectedEnchantments
oh and also, you shouldnt be storing in a Player instance
i changed it to private Map<Player, Map<Enchantment, Integer>> selectedEnchantments = new HashMap<>(); i'm not getting the error anymore, but the enchantments aren't being applied to the tool when its placed in my inv
how should i store it?
you are never putting any enchantments in the Map
enchantments.put(Enchantment.MENDING, 1);``` i have this line in my enchantment class, isnt this storing it in the map ?
ok thankyou for that, i will change it
it stores it in that map, but not in the selectedEnchantments map
You never pass any of that data to your confirmation menu
Polite PSA to devs out there making lottery plugins on a set timer.
Random uses the current server time for determing the number ... predictably so ๐คฃ๐ญ
Use Secure Random instead ๐
securerandom
HAHA BEST YOU TO IT BUDDY
Or, don;t encourage gambling
Eh , just a good QoL piece of semi obscure java knowledge either way
Depends. The random class does use the seed (or current time) when the instance was created
You really underestimate the level of nerd these servers witb that sorta plugin are.
if they are going to put that much effort into guessing your random, they deserve the free rewards
Therefore people would have to know when the server started and at which millisecond the plugins onEnable was called
Either way think about the human subconscious factor of a set interval repeating task using a random number gen based on time values.
Eventually someone is gonna subconsciously rain man it
not going to happen, not unless they have direct access to the server hardware
at which point some free rewards are the least of your problems lol
just run mvn with the development profile
