#help-development
1 messages · Page 1823 of 1
It will if you have a config.yml in your plugin's archive, which according to that stacktrace, you do not have
oh i forgot stacktrace, Thanks :D
It was the first thing you sent 
Just make a config.yml in your resources directory so it's exported with your plugin
yeah, this is what im asking, how to do it
Why?
You throw the instance at the registerEvents method ?
oooooooooooooooooooooooooooooo... yeah i literally forgot it lol
Is there any way to expand the inventory of a dispenser or store more items inside of it?
There isn’t any magical method for it
But you could do stuff with databases or some other form of storage
Yeah... I was hoping to store everything in the state
I thought you can't store items in that
I could also serialize the inventory into a string ig
net.minecraft.world.level.chunk.Chunk.a(BlockPosition, IBlockData, false) doesnt seem to actually change the block I'm targetting, even if i reload the chunk/relog. Anyone knows why?
how to delay a for loop
i have some packets in a list
and i want to send it to a player
but every like 5 tick
use runTaskTimer and iterator
Or queue
oh ok
i dont know how, can you explain ?
@quaint mantle like this ?
else cancel();
Looks good to me
ok thanks
Any reason for a delay of 1?
just use delay 0
or delay 5, period 0
there are other Holograms
i want to optimize the packets
so the client wont decline them
Yes but the delay is the initial delay before the first run
Is there a reason for using 1 over 0
there are other holograms doing the same thing
its for a fake packet hologram keep alive thing
Hey can anyone help me real quick. I have some problems with updating my maven project rn The POM for org.spigotmc:spigot:jar:1.17.1-R0.1-SNAPSHOT is missing, no dependency information available
Im trying to make a keepalive task for a hologram so it wont despawn
but it spawns duplicate holograms
https://cdn.discordapp.com/attachments/917075401136816198/920570408221175808/unknown.png
CODE: https://paste.md-5.net/porigejupu.java
and it gets bolder
it is not nms related, im doing something wrong in the code & method call
that i cannot figure out
Hear me out, but if its spawning multiple armor stands wouldnt that mean it didnt despawn in the first place?
I had a stacker plugin i was working on that had armor stands as holograms and they never despawned for me even after i afked or spent a few hours in my IDE, or even after server restarts
packets
& nms
never needed it, invisible armor stand set no physics and boom
- referance to entity UUID
wdym
as in
is there a patch for lib4j?
You spawn ArmorStand.class
Set invisible, no physics, set custom name, set it to visible or invisible (Your preferance)
And store a referance to the spawned ArmorStands UUID so you can easily find it without needing to store a pesky Location
EntityArmorStand
You mean Log4J?
Never needed that class
ye soz
I simply spawned ArmorStand.class into world and then it returns an Entity you can modify
placeholder support
Parse the name with PlaceholderAPI
Then yes use packets
for every player
im using packets and this keepalive problem is happening
But for a basic Hologram you generally shouldnt need packets unless its things like this
i messed something
in this
method call or ...
that spawns duplicate holograms
You should store a referance to that ArmorStands UUID
and then get it by UUID
and see if it still exists before spawning another
World#getEntityById()
Entity#getUniqueId()
dude it is nms
You should still be able to get the ArmorStands UUID
Wether its after you spawn it or getting the entity by location and then storing that entities UUID
also does anyone have the resource for the mapped nms jar
how to get it in my maven project
i cant find it but could be googlign the wrong thing
I believe its not that easy if the entity is client sided
True but im not sure how theyre sending that custom name to the player
But i assume there could be a method to check if an entity exists clientside with packets?
either way the problem is with some type of check for seeing if that ArmorStand exists already
However if theyre rendered to the client wouldnt that mean theyre going to stay until server restart anyways?
Yeah, well you’d have to send a packet to tell the client the entity died or smtng
Well I don’t mess with packets a lot so I shouldn’t say too much
Me neither but i feel like the general idea is still there
I really feel like that armor stand shouldnt be despawning though until restart if a type of meta deta gets set onto it, when i made just basic hologams with armor stands they never ever despawned on me
I am following a tutorial that used getTitle()
but that was already deprecated then, and removed now, so it doesn't work. What should I use instead of getTitle?
Does the AsyncPlayerChatEvent
1 Fire when a Player runs a command?
2 Fire when a Player uses /say or /tell or /me to chat?
no and no
declaration: package: org.bukkit.event.player, class: PlayerCommandPreprocessEvent
hey how can i detect when i break a block under a banner and the banner drops?
paper thinks its so special sometimes getTitle() -> title() cmon really paper make them the same method name
It’s to not cause confusion and for possible removal of obsolete deprecated string methods in the future
ahhh i see fair enough
was always curious about things like that it got annoying sometimes xD
Also I believe x() is an official accessor convention as opposed to getX()
For instance even Java uses that convention regarding records
so player() would be more acceptable rather than getPlayer() essentially? (If you made your own API methods for something?)
hi im trying to extend from EntitySpider but this is showing up. Can someone please help
Show the error
Never extended an entity before, not sure if thats possible but ive seen other stuff
Yes well it’s a bit contradictory since methods should on the flip side be verbs and not nouns
Your overriding a method with a incorrect return value it seems
interesting, ive actually been using "records" lately and ive been liking the style how they make the getter as player() or location() i think ill do some refactoring to my API
it seems like x() is supposed to be a void according to that error?
I remember some people up above saying having custom entities like this was a huge pain
Whats that error say? and ide just make the method body empty, and maybe ctrl + click that method
if you ctrl + click it should take you to the class file and it may or may not have a java doc
java: x() in com.DominateMonsters.Plugin.AbstractSpider cannot override x() in net.minecraft.world.entity.EntityLiving
attempting to assign weaker access privileges; was public
oh the void issue
is this
4
Use mappings
mappings?
Use the mojmaps to avoid two methods with the same name like that
guys, what am I doing wrong?
Show the entire method
I don't have too.... the cause is at that line
also, its a big method
is my logic broken or something???
Anyone know how to cancel/allow falling through powdered snow?
I think it's because line 269 already knows the next else will be higher than 2 so you could likely just use "else" if you have nothing else you're checking for what Olivo said below
Well then all I can tell you is that args.length > 2 is always true
it should be an if-else
How can you say “I don’t have too” when we are trying to help :/
you want the whole method?
fain
there...
No, was just stating a point
May i reccomend helper classes xD
The reason we ask is because somewhere off screen you are already saying if Args is > 2 so when you get to the line you show, it will ask ways be true
^
the IDE already told where the range is known
anyway, I'm compiling it
so an empty else will be
Next time if someone asks for the entire method send the entire thing instead of arguing
There won't be one there
Empty would end up at the bottom of the method
In the else statement
ohhhh that's right
what method gets called when somebody places a minecart ?
EntitySpawnEvent possibly? wouldnt be BlockPlaceEvent since minecarts are an entity
PlayerInteractEvent would also be fired
^ that too
Won't work for dispensers though
how to check if the player spawned a minecart ?
Check item in hand. Anyway don't use it
so what should i do
Use EntitySpawnEvent
Show how you cancel it
unnecessary. seems like you just cancelled it wrong
the code
both cancel & remove
?paste
Wait this exists https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/entity/EntityPlaceEvent.html
declaration: package: org.bukkit.event.entity, class: EntityPlaceEvent
bruh thanks
oh ok ive never used mojmaps before do you have a guide that i can follow
to use it
what event gets called when a player throws a potion ?
Probably the projectile launch event
Read the release post for the version you're using
Hey, I am currently trying to experiment with GUIs. I was wondering, could I store an inventory as a primitive so i can store it using YAML, and then convert it back to an inventory to use again?
( or is this a really stupid and not-gonna-work idea? )
ItemStacks are serializable. You can loop them and save that. Then save title and recreate inventory from that
Convert inventory to ItemStack array, then loop trough the array, save each item, then store?
I can loop trough itemstack arrays normally, I'd have to see what i need to change using yaml
okay, will do
Did spigot remove the jars for pre release 1.8 from the maven?
@ivory sleet can you try to test PrepareItemCrsftEvent and set some random stuff to get a new result ( place 3x3 stones and get 1x obsidian for example) and then try to cancel it with the CraftItemEvent ... I believe it is not working because it does not know the recipe
Also items get somehow duped with not registered recipes and custom result in prepareitemcrsftevent
hey, i am stuck, is there any way of depending on this without compiling it locally? (i use gradle)
Just compile it or use jitpack
wdym use jitpack?
but it's not my repo
And?
Jitpack works for most GitHub repos
Hehe
Lol
which file is this?
new File(Bukkit.getWorldContainer().getAbsoluteFile(), "bukkit.yml")
Does anyone know if there's an easy way to create an API jar from your original jar file? Same structure, but with empty method bodies (returning null, 0, etc.)
A Uber jar which contains all the interfaces, then just copy the resource write it somewhere else
remap biome IDs on MC 1.18 Somebody told me not to know how to get the biome id in 1.18 from the packet
I don't know either, so that is why I am asking
I already told you...
That’s a neat little system
so the PlayerRespawnEvent isn’t working, and i’ve /killed myself, it should be triggering right? i’ve tried it with other events and the code works just fine, it’s just not detecting the event
Then you did not register the listener
you mean import the listener? as i’ve said, i’ve replaced the event with another one and it worked, and i have both of those events imported
it shows red if you don’t have it imported
Show me your code
public void onRespawn(PlayerRespawnEvent e) {
Player player = e.getPlayer();
for (Player p : Bukkit.getOnlinePlayers()) {
player.addScoreboardTag("1");
player.setGameMode(GameMode.SURVIVAL);
player.setAllowFlight(true);
player.hidePlayer(p);```
......
bruh
the wrong part?
the whole class
ohhh
That’s some weird code
like implements
i can send later cause i’m not at my computer rn
¿
And there are things wrong in this loop
but i’ve implemented everything correctly, like i’ve said, ive literally replaced PlayerRespawnEvent with PlayerDropItemEvent (whatever it is exactly can’t remember) and it worked
how can you see it does not work?
oh and i also don’t have the online players bukkit thing in my new code cause i don’t need that
like a sysout
Or throw an exception
what’s that
We got 3 possibilities here
Ah got em, doesn't know Java
i’m sorry, i’m new to coding so i might not understand everything
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.
Yes, in this case it is, but if you are debugging it is pretty handy
throw an exception when the player moves. petition for that
Good idea throwing an exception in PlayerMoveEvent.........
But I meant, SOMETIMES it is handy, not for everything. But it is still a possibility
or just crash the player ig
😂
........
i just need to know if there’s something i need to do to make the respawn event work?
cause other events work
guide on hoe to fuck up users / admins
Registering????
Throw an exception on PlayerMoveEvent
nvm i’ll google
You didn't prove
i’ll google this
System.out.println(„String“);
Hahahaha
thats your debugger my god
No but the first " is wrong
nah german keyboard
Achso du bist Deutsch
😄
well back to english
Yes
@EventHandler
public void chunkLoadEvent(ChunkLoadEvent chunk) {
if (chunk.getChunk() == location.getChunk()) {
}
}
``` is there any better way to listen to when a certain chunk loads?
google wont help if you dont know what to google
I guess not
😄 😄 😄
prob not
why code not work help please fast
Yeah boy, google will fix it in seconds
welp
Imagine If I could fix my packet problems with that, that would be amazing
The packetlistener doesn't work, I am currently writing one myself
And NMS is pretty hard
Oh shit have to go bye
why tho
ig so
cant u use protocollib or somethin?
prob has reasons
org.bukkit.event.player.PlayerRespawnEvent
is this what you meant by registering
well that is registering
please learn java my god
i thought this is what you meant
my b
no that is importing
okay bud
i think this is a ?jd moment
a package / class
?jd
perfection
i just got the two terms mixed up jeez like chill
actually is there a cmd to link to spigots how to make a plugin, that would suite this better
pretty sure it goes over events
kinda lazy to catch myself up2speed on this so, do u have access to ur source rn @atomic violet
no, i’m not home
rip
wait source of where i learned code or my actual code
actual code
no
when u get home take a look at ur plugins entry class (the one that extends JavaPlugin), see if u have a getServer().getPluginManager().registerEvents or w/e in onEnable()
ur code for ur plugin
yeah i think i might’ve forgotten that and added it for the new event i was testing, i can’t remember tho cause my short term memory is shit
Hi, I'm having a problem with the Spigot dependency, I have my maven dependency like this:
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.18.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
But my code is giving me some compilation errors in methods and attributes that do appear in the documentation but don't appear in the classes that Maven downloaded, for example:
i cant send images, damn
Don’t need to
Ik
do u have the maven repository added?
yes
the rest of my maven dependencies are working, and many spigot things are working
Sometimes ides get confused about maven stuff and i find it best to try to compile to see if maven actually cant find the dependency
for example, all the materials are working, except Material.CROSSBOW
should i try opening the project with another IDE then?
okey, gonna try that
It can tho lol
Compile error
Have you tried building it with maven yet
Im trying, im getting an error because Im using MythicMobs dependency, and it cant find ProtocolLib INSIDE the folder of that dependency
I need to do some errands, once i get it to build with maven I'll let you know if it solved the problem
thank you !
hello, I would like to make plugins in 1.18.1, but when I put the spigot that I have downloaded in my project, it does not work, extends JavaPlugin is unknown and the rest too
Read the update post
which ?
thx
How do I save the config.yml in the outside of Main class?
I thought calling a method from Sentry, but goddamn static blocked my way.
i have read, but i don't quite understand how i do it, i don't use maven and i don't know how to access the jar in question ... do you have a solution?
you call saveDefaultConfig() from the onEnable() method in the plugin that has it
it should be stored in the resources folder of said plugin
You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar
It does say the path
Thanks
Why are you looking in the jar
fwiw the getPlugin() method wants a string name of the plugin, so if you named your plugin Sentry it's getPlugin("Sentry")
Look in your buildtools folder
You should read the javadocs for that method
I probably should
I don't have BuildTools
Then where did you get the jar
on internet
?bt
Stop using illegal rehosting sites
this one?
that's the one I was talking about anyway
Forgot about that one
But it's really janky anyway, use proper DI
Or a static getter if you must
well, that's if you can (in his case he can), in my case I use it for Vault
for my own plugins I just use static stuff 😟
Wut
wym wut?
This doesn’t sound good to my ears

🥴
lateinit var plugin: HomesPlugin```
I call this one
which I assign in the onEnable() method
You use kotlin?
Koin is cool
not sure what it compiles to (bytecode)
True that
Tho something like
companion object const X = 10 would be cool
So without the {}
Indeed
I tried looking into Guice before, but I absolutely hate it
I love Spring's DI though
Spring is definitely not ideal for a Spigot plugin though
yeah, my problem with Guice probably mostly revolves around me not knowing it at all
and every time I touch it, I have issues
I'm in the Spring DI mindset whenever I try
Yeah well it’s somewhat too complicated arguably so in that angle, spring di is probably better
yeah, when I last tried it (followed some tutorial for Spring Plugin with Guice), it just felt like I was doing just as much work as before
so the gain was probably better code, not more efficient way of writing it
Yeah
I cannot recover the files from the BuildTools: the error is that I must have java 17 but when I do javac --version, I have 1.17 ... someone can help me
And well to be fair, normal explicit dependency injection isn’t always that bad
Like in worst case, extract a function and have a builder 
not entirely sure I follow, have very little experience with DI outside of Spring
Well
Just passing objects to constructors and functions
Without using a framework to help you bind everything together
so just reflect the stuff yourself and call their constructors/methods?
is ur java path pointing to a j17 jre/jdk?
run java -version instead
1.8 😢
F
ahh
how i can change it ?
Just normally passing an instance of C to a new instance of A (;
Google how to change JAVA_HOME
edit environment variables or temporarily run from the full path
think I'd need an example where this logic is applied to fully grasp the concept lol
Every object you pass as an actual argument to a function is a dependency of that function
ex:
path/to/java_17_jdk/bin/java -jar buildtools.jar
Function/constructor
@next robin you can have multiple versions of Java in the environment variables (the one furthest up on the list will be the active one), you also have to restart all cmd/powershell/command line tools for it to take effect (easier to just reboot or relog the PC)
ahh yeah
Ok, thanks everyone
np, good luck 🙂
Did you restart git bash after changing java
i restart my computer
theres a good chance its because the JAVA_HOME path is still pointing to java 1.8
maybe setting the java paths to java 1.17
on another tangent
int x1 = x, x2 = x+16;
int z1 = z, z2 = z+16;
for(;x1<x2;x1++){
for(;z1<z2;z1++){
for(int y = 127;y<255;y++)
setBlockInNativeChunk(world, x1,y,z1,Material.NETHERRACK);
}
}```
For some reason this does not iterate over the increasing x coords and i dont know why
result's a wall instead of a block
anyone knows why?
the loops are the same
That code looks fine. look elsewhere for your issue
i doubt it's the method call
nms_1_set(chunk.getWorld(),chunk.getX()<<4,chunk.getZ()<<4)```
That should get me the 0/0 coords of the chunk, right?
isn;t that bit shifting the wrong way to get a world coord?
ok
Yep I was thinking world coord to chunk
so doing -15 on the x coord is just causing it to fail completely
its not that part
okay i tested the setblock method. It works on other x values too
so wth is up with the loop causing it to not work
They ask in a spigot support discord
good point, why on earth i'm asking here 🤔
int x1 = x+16;
int z1 = z+16;
int i = 0;
for(;x<x1;x++){
for(;z<z1;z++){
i++;
}
}
i = 16
WHAT?
wtf is that
Is it possible to show a custom recipe in the recipe book? 🤔
discoverRecipe does nothing
afaik yes in newer versions
So not in 1.17? :/
You can
when i do for(Player all_Players : Bukkit.getOnlinePlayers()){ all_Players.damage(final_damageamount); } it goes through the online players like thousands of times. how can i do it that in only goes through once?
Is it in the damage event
it gets better
int x1 = x+16;
int z1 = z+16;
int i = 0;
int j = 0;
for(;x<x1;x++){
i++;
for(;z<z1;z++){
j++;
}
} }}
i = 16, j = 16
someone explain this
r/blackmagicfuckery
ur supposed to initialize z in the inner loop
yes in the entitydamageevent event
That is why, .damage will call the event again
Set a boolean to true before your loop and back to false after, then return at the start of your event handler if the boolean is set
Neither of them worked
i dont really understand the retun part
iirc there's a way in spigot to create custom music disks then use a resource pack to add sound files - Could anyone direct me to a forum post / method with infio?
(or do you need to use a mod)
well
Yes, you can.
I could use some opinions, I'm having a lot of fun with Java JNI from Rust, and I am considering writing a Bukkit abstraction layer so that one can essentially write plugins in Rust for Bukkit without looking at JNI's ugly head. Would this be a good plan, an entirely crap one? Do you think people would be interested in such a library? Thanks
You'd just need to add some tag to the music ItemStack and play a custom sound when they right click with the disk instead of playing the normal song.
Do you have to override a music disk and store metadata in a persistent data container then on play events play the custom sound?
yeah ok
You also would have to reimplement some jukebox stuff
Hey is there a way to detect if arrow hits a block that it doesnt collide with? For example grass
Hey, when creating spigot commands via implementing the CommandExecutor class, I have a slight issue.
In a number of my command classes there are variables that every method in my class uses, playernames, etc.
How would I store these so their accessible across all methods without doing something like this:
`onCommand(CommandSender sender, Command command, String alias, String[] args){
Player player = (Player) sender;
a(player);
}
a(Player player){
b(player);
}
b(player){}`
If I were to do something like create a public Player field and assign it, to the sender when onCommand is executed, would that feild not be changed when its run by another player?
Just do it like this
Ye whats the issue with passing variables to other methods?
I have a lot of variables, surely theres a less messy way? I also like to split my methods up into many smaller functions because its cleaner but I don't really want to do that if I have to pass the variables to each method.
You could use a Record class?
Though you should probably rethink your design once you go past ~7 parameters I'd say
your saying I make the class that implements CommandExecutor a Record?
maybe if I write a custom CommandExeutor class that could work
no
Thats your design problem
okay, well i'll prob jsut do it that way. it would probably be possible to create a custom object with all the variables you need.
make a public Map<Player, CustomObject> and add the player to the Map when onCommand is run. Then all variables will be editable and accessible, but also wont be messed with by other player running the command?
how can I check if a player is moving, but not forwards?
this not beatiful and easily can lead to memory leaks
depends on what type of command im implementing. If i remove the player from the map when I know the command is done, how will that lead to a memory leak
if its something longer I cant do that
but im making a shop gui
I can check when the player closes the gui and remove them from the map
also its more beautiful if you have like 10 variables
that's just annoying to keep control of it. Command execution context wasnt meant to be persistent
Im not saying thats what I'm going to do, I jsut said it was possible
what about just using that custom object to store everything and parsing that through each method?
yeah thats definetly better
cool I may do that. I can just make that custom object a private nested class.
Are you using maven
same
no maven
use maven
Maven is cool
ikr
but i dont want to use it
no you want
Gradle?
no
What do you use
i want to umport it like on other versions
not possible smh
because now spigot is bootstrap jar
See spigotmc news
Anyways you should use a proper build tool like any sane developer
what does means this?
If I do a plugin in 1.8 will it be compatible with versions up to 1.17
no problem with Java version used ?
no i believe
I'm paid to make the plugin compatible lol
oh
mc 1.8 only works with java up to 8
yes so it's ok
Java is backwards compatible so
where i can find this jar?
Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar
In the buildtools folder
Use. Proper. Build. Tool.
Everythings possible
In programming not everything
But most
Why wouldnt it be possible
import net.minecraft.nbt.NBTTagCompound;
cant import this
use. Proper. Build. Tool
I hope java ide's for mc plugin/mod development on mobile devices would be possible, as I can't access my pc always
API does not have NMS
how to import net.minecraft
NMS requires Java 16/17 in new versions, but some versions of spigot will not launch with java 16/17 afaik
run buildtools and add spigot artifact
how to add spigot artifact?
you put in depenencies in pom.xml
no
i dont use maven
i just want to import a jar
You can targetCompatibility to 8 and source to 17
So you will develop against java 17 but plugin to going to be built to support java 8
Without maven you wouldn't even be possible to compile (probably)
use. Maven
You'll find that using maven will drastically decrease the size of the final plugin
No it won't?
I went from 60k kb to 40kb
Yes
Ah
i dont use maven
dont tell me again to use maven
i know how to use maven
Maven is the official way
nah but fr tho maven is some hype train stuff
i have 200 plugins i not have the time to convert them to maven
You're on your own
umm what
Maven is dying build system from 2008
You can very easily set up some kind of template for a project
I have a script I run that prompts me for the name and version of the plugin and creates the project with the main class, build script, and plugin.yml
ok
Since when is maven dying
Idk it’s just that gradle is becoming way more popular from what I can tell
And it’s for some quite powerful reasons also
i cant verify the source but this is from wikipedia projects on maven central repo overtime
That's not maven usage
well its clearly not dying is it
Even gradle projects pull from maven central
so its being used
Gradle uses maven repositories as well
A project being on maven central doesn't mean it uses maven as its build system
wha
It kinda does
It's 1 line to add the plugin for shading
smh
That's 1 too many!!!!11111
iirc using java-application plugin will shade in runtimeOnly and implementation
ye but like maven is being used
Maven repositories are definitely not going anywhere
feather.setDisplayName(Color.YELLOW + "Change Flight Speed");```
this isnt changing the color
Maven as a build system might be falling out of favor
Ok you are really missing the point here
ChatColor no?
ChatColor
its just showing the color id in game
Yeah
I didn't see it was Color instead of ChatColor
ye
Lmao
ok
Set the item meta also
Umm dont you have to add maven-shade-plugin for shading on maven too
Shhh
Hehe
💀
And that is definetly more than one line 🤠

What even makes maven necessary for anything
I mean
ive never had an issue without but im just a nub
What do you use if you can’t use maven / gradle?
intellij
one last thing if (player.getScoreboardTags().contains("1")) how do i make the code execute if the scoreboard tag is not "1"? i know it has to do with ! but idk where to put it
or maybe its somethign different idk
Have you heard about using libraries
im stupid
Oh well but if you use ant, eclipse people can’t work on the project or maybe eclipse does in fact support ant
Oh yea ive never even heard of ant so idek
I cant live without
- Jdbi
- Adventure
- MiniMessage
- Hikari
- Caffeine
- DazzleConf or Configurate
- Cloud command framework
- RedLib
common libs are boring!
@olive lance build systems mean you can press one button and build your project exactly the way you need
Cloud command framework is cool but a bit too verbose sometimes imo, like the asynchronous command coordinator
Why would someone want to build a plugin a diff way tho
What
.
If you're working on a project with someone else a build script makes it much easier
Anyways add guava and arguably moshi, sometimes Configurate also :3
If your code is open source anyone can clone and build it locally
guava is built-in in spigot so!!
What if its not spigot 
I use it very oftenly ngl
I might know a command framework that isn't verbose
Yeah mine is open source so if I used maven then people could contribute easier?
Yup
Or gradle, yes
Oo redempt what are you thinking of?
I wonder what it could possibly be
im honestly clueless as to what to put here
If my only dependency is spigot api then is it still easier or no?
! inverts a boolean
Just put a ! in front of the boolean expression
!player.getScoreboardTags().contains("1")
idk about moshi because of general compatibility
bruh the one place i didnt check, alright thanks, i just didnt know where to put it
Yeah well gson isn’t as bad it’s probably preference
ItemMeta compass = (ItemMeta) item.getItemMeta();
compass.setDisplayName(ChatColor.RED + "Teleportation Menu");
item.setItemMeta(compass);
player.getInventory().addItem(item);
ItemStack item2 = new ItemStack(Material.FEATHER);
ItemMeta feather = (ItemMeta) item.getItemMeta();
feather.setDisplayName(ChatColor.YELLOW + "Change Flight Speed");
item2.setItemMeta(feather);
player.getInventory().addItem(item2);```
its giving the first compass with the custom name, but its only giving the feather with the default name, not my custom name
and they are exactly the same (except the variables to distinguish them)
What's with the pointless cast to ItemMeta
idk, its how someone told me to do it a while ago
i figured i didnt need it but they told me i did :/
anyways how do i get the feather with the name, cause it wont do it even tho it works for the compass
Hmm, you are calling item.getItemMeta instead of item2.getItemMeta
This is why you should use a builder, or make them constants defined externally
Or at least scope them differently, like make functions that return these rather than defining them in the middle of some other function
quick question
if i subtract from itermstack
for example by 1
will the itemstack get removed automatically if the amount < 0
or i need to manually check and remove it
Yes at least in newer versions
neat
And it's so nice that it does
dont make a second itemstack object, just reassign the previous
does anyone know any resource that helps locate NMS methods?
for example,
ServerGamePacketListenerIMPL
im watching a tutorial for 1.17 but im using 1.18
and 1.18 doesnt have this method/it was renamed
?
That won't help you find the method name...
You should use Mojang mappings to avoid this issue in the future
This may help https://minidigger.github.io/MiniMappingViewer/#/
oh, ok
wait, how do i apply those mappings?
Check the 1.17 release post
sorry, im very very new to nms, im watching a tutorial on making npcs with nms to practice ¯_(ツ)_/¯
is there a way to apply those mappings in intellij so i can use the mojang mappings in code?
Yes
Ok, i read that it says i have to add <classifier>remapped-mojang</classifier> and reload maven pom, but i got this error
Could not find artifact org.spigotmc:spigot:jar:remapped-mojang:1.18.1-R0.1-SNAPSHOT in spigotmc-repo (https://hub.spigotmc.org/nexus/content/repositories/snapshots/)
Is there a way to have multiple config files using the configuration API?
How about saving defaults?
ello how do i resolve this error? ```[ERROR] Failed to execute goal on project crazycrates-v1_18_R1: Could not resolve dependencies for project me.badbones69:crazycrates-v1_18_R1:jar:1.10.1: Could not find artifact org.spigotmc:spigot:jar:1.18-R0.1-SNAPSHOT -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <args> -rf :crazycrates-v1_18_R1
oof i think you need to run buildtools???
can @young knoll confirm?
Could not find artifact org.spigotmc:spigot:jar:1.18-R0.1-SNAPSHOT i think that means they dont have CraftBukkit
spigot
usually its spigot-api
but spigot means the code uses CraftBukkit & nms
im pretty new to NMS so i cant really confirm this is correct
this is correct my lord
spigot-api uses the api that comes from the maven repo i guess?.
spigot is taken from your local .m2 repo, what means you need to have ran bt before
Pretty sure both come from buildtools but may be wrong. If you want to use NMS definitely recommend --remapped flag
api is not from buildtools
Hi what's up i try to create a custom mobs in 1.18 on intellij with minecraft plugin, so i copy/paste to my pom.xml on the forum but i have to same problem like him : https://www.spigotmc.org/threads/nms-entity-creation-problem.537427/ and idk how he fixed it...
It's online
kk
If you're using maven, https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/ has some info for maven config
Had the same issue yesterday but proper config is the fix
Heh?
I think it's all okay ? https://paste.md-5.net/icaligepot.xml
i download intellij today so i'm not good at it for now
Rename the 1.18 references to 1.18.1 and run buildtools with the --remapped flag, and --rev 1.18.1 as well :)
i need to take the lastest version ?
It's recommended because of the log4j patch coming in with 1.18.1
ok ^^
Anyone know a good way to get the item entities a player drops on death?
I see the PlayerDeathEvent has a method for accessing the ItemStack, but not the Item entities
The event is triggered upon the death but before dropping the items, there would not be any item entities at this time
That would make sense. I tested PlayerDropItemEvent, it does not trigger for items dropped on death either
Is there no clean way to access the dropped entities?
Does spigot have a 'onJukeboxPlay' event or do I need to use NMS?
Interact event I guess
You could clear the dropped items in the event and create your own drop system that tracks the new entities I suppose
Yeah to get the event - however to prevent another sound being played
Oh well I guess you can cancel the interact event never mind
Seems too janky. My end goal here is to make any item with an enchantment take much longer to despawn by just changing the age of the item to a negative value, but now I realize that I might be able to listen to an entity spawn event and listen for items spawning
That might work as well :)
Even better
the chunk data sent to the player is taken after the chunk has ran through generation and onChunkLoad, right?
wonderful
When the 1.18.1 will coming out ?
it is already out
^
:)
i mean spigot
It's already out
java -jar BuildTools.jar --rev 1.18.1 --remapped here's my buildtools command
wait what does --remapped do
Remaps NMS so it's actually usable
do you mean simpler to use or same to use over different versions?
Somewhat both
I mean instead of a() it's registerGoals()
Deobfuscating
ah not much use for me then... i need consistency not readability
the only reason i found to use nms is the abysmally slow setBlock bukkit function
I'll take a look at it later thanks
bukkit-1.13.1-R0.1-SNAPSHOT.jar, spigot-1.8.8-R0.1-SNAPSHOT.jar define 679 overlapping classes:
[WARNING] - org.bukkit.Achievement
[WARNING] - org.bukkit.Art
[WARNING] - org.bukkit.BanEntry
[WARNING] - org.bukkit.BanList
[WARNING] - org.bukkit.BanList$Type
[WARNING] - org.bukkit.BlockChangeDelegate
[WARNING] - org.bukkit.Bukkit
[WARNING] - org.bukkit.ChatColor
[WARNING] - org.bukkit.Chunk
[WARNING] - org.bukkit.ChunkSnapshot
[WARNING] - 669 more...
``` How can I fix something like that
Hey ! Do you guys know of there is some kind of database that would allow direct communication from one server to another (redis allows you to create a channel but I'm looking to be able to chose which server I send info to)
Take a look at RabbitMQ
I think thats what your looking for
Some kind of Messaging Queue
cant u just use normal sockets?
well redis got a more vulgar mq tho it works still
Yeah Redis Pub/Sub
normal sockets is basically just creating your own ducttaped mq
Mark the depends as scope provided
<dependency>
<artifactID>Spitog-api</artifactID>
<scope>Provided</scope>
...
```like that
as mentioned countless times, spigots method of manipulating blocks is safe unlike the nms method you use which might not update adjacent blocks and update physics etc
You can also elect to not update physics with spigot
^
Can I chose specific servers to send a message to ?
The annoying thing about pub/sub is that you create topics and the info gets sent to every server that follows that topic.
I want to be able to send stuff to specific servers
considering im making one cube of netherrack i dont really need that
lower case p
moterius, why didn't you just use workers
less work this way
arent you the same guy that asked about updating a ton of blocks at once
the method is not going to be any slower than NMS unless you are using NMS to put the world in a bad state, like by not updating lighting
SolverSelf
Yes, you can have different channels and work that way, just look at their documentation
you can just use different channels? ^
the bukkit method, especially in World literally just calls nms
Theres literally no other way...
physics=false then
its settled here
setType(type, false)
What about dependencies I don't have access too that are in multiple Libs I use tho```[WARNING] hamcrest-core-1.1.jar, junit-4.10.jar define 22 overlapping class and resource:
[WARNING] - LICENSE.txt
[WARNING] - org.hamcrest.BaseDescription
[WARNING] - org.hamcrest.BaseMatcher
[WARNING] - org.hamcrest.CoreMatchers
[WARNING] - org.hamcrest.Description
[WARNING] - org.hamcrest.Factory
[WARNING] - org.hamcrest.Matcher
[WARNING] - org.hamcrest.SelfDescribing
[WARNING] - org.hamcrest.StringDescription
[WARNING] - org.hamcrest.core.AllOf
[WARNING] - 12 more...
That's what I'm trying to avoid, I want to be able to see all the servers and send stuff to specific servers.
In order to do this with pub/sub wouldn't I have to create separate channels for earch server ?
those should already be scope test, since theyre test depends
isnt that just that both jars contain said classes?
and also its lowercase P, the example someone gave above was wrong
yes
I know
but that's not an issue solverself?
I know, but I want to get rid of the warnings, thats why I ask
I guess not, it just didn't seem like a very clean solution 😅
well what would be a more clean solution to you then? out of curiosity 
I don't even have those as a dependency, They come bundled with some Library
if it is, then its the library that's broken. You can work around it with an <exclude> but you need to be sure that the library doesnt actually need those for whatever reason
also what is this on line 132' <!-- <dependency>
how is that not blowing things up
If I knew I wouldn't be asking lol but it just sounded weird to make a channel for each server.
Especially if I have a lot of servers but if that's the best way than it's fine with me
hmm yeah
you mean 143? thats just a comment
have you peeked at LuckPerms (altho they use jedis which is a bit meh)
but the comment is never closed?
oh
Oo md_5
syntax highlighter was weird
I'll take a look, though I would have imagined that all servers would sub to the same channel but could be wrong
but anyway you need to find what dependency is incorrectly including junit/hamcrest and exclude it
assuming the dependency doesnt actually need them
Yeah Idk if you use jedis but personally I use redisson which is on a whole-nother level
so might wanna look at that also 😛
Yeah I use redisson as well
🙏
It's seams to be json-simple which is used by spigot-api
good thing json-simple was removed from the API in later versions 😉
but it isnt the API
because <scope>provided would fix that
so it must be pulled in from a different depend that you havent set to scope provided
JScoreboards, TitleAPI, Mysql, or RabbitMQ
mvn org.apache.maven.plugins:maven-dependency-plugin:3.2.0:tree
or I'm sure your IDE has something
maven graph plugin is also fun
mvn org.fusesource.mvnplugins:maven-graph-plugin:RELEASE:project
I love it
Yeah just used the IntelliJ tree tool, sadly I can't set those Dependencies to provided since they won't be in the classpath otherwise
You have an interesting definition of fun
ye so you need to add an <excludes><exclude> under whatever is providing them
one of the 4 above I mentioned
What is the syntax for those excludes
Saw them online but never could get them working
thx
I will definitely remember that one
there should be a channel that relays irc messages to discord and back
yeah that'd be nice
not sure why i put that in this channel whoops
public void onPacketReceiving(PacketEvent event) {
if (event.getPacketType() == PacketType.Play.Client.TAB_COMPLETE && (!event.getPlayer().hasPermission("nucleus.*") && event.getPacket().getStrings().read(0).startsWith("/") && (event.getPacket().getStrings().read(0).split(" ")).length == 1) && blockedCommands.contains(event.getPacket().getStrings().read(0).toLowerCase().substring(1))) {
event.setCancelled(true);
}
}
});```
doesn't work
trying to block tab complete
for /about
lol
why?
event.getPacketType() == PacketType.Play.Client.TAB_COMPLETE && (!event.getPlayer().hasPermission("nucleus.*") && event.getPacket().getStrings().read(0).startsWith("/") && (event.getPacket().getStrings().read(0).split(" ")).length == 1) && blockedCommands.contains(event.getPacket().getStrings().read(0).toLowerCase().substring(1))
wtf lol
what
still doesn' twork
Why stop /about let people have info 🙄
can relocating the classes in a dependency fix the overlapping classes thing
Yes
ye but your issue is just dodgy dependency
That’s actually one of the motives for avoiding LinkageErrors
so exclusion is the way to go
I highly doubt your dependency needs junit at runtime
Yeah
junit is for testing really
junit is a unit testing library, if your plugin needs that at runtime, you're doing something wrong
You just don't understand the higher level of programming my plugin is on
not their plugin, one of the depends
I know that Junit is for testing
It’s even weird one of their depends has it as a transitive dependency for the non test classpath
Yeah it's json-simple which has it defined as a transitive dependency and it's used by spigot in that ancient version that is 1.8. I'll have to work with excludes
yes but that spigot is not being included by spigot