#help-development
1 messages Ā· Page 1004 of 1
CraftItemStack is the implementation of ItemStack
NBTTagCompound is the nms class for NBT
And no it's not 1.20.6
Most likely something old like 1.8
1.20.6 still isn't the default stable version
i think i'm gonnai wait the stable 1.20.6 version and after do the display name thing
how to fix this
what bro š
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!
i dont know how to fix it
?nocode
Itās hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.
There
ah
I mean, share your code
oh this is plugin code
I mean, you are in #help-development
This is a channel for plugin developers having trouble 
oh sorry bro...
1.20
plain 1.20?
yes
Fun fact, that doesnt include 1.20.6, 1.20.5 or any of those
maybe why my server its 1.20.4
1.20.4 isnt 1.20 thats why
I want to create daily and weekly player kills tops and idk how do this, I mean reset at every day and week
Save starting time stamp in system nano
Time usually
Why nano
Use Unix time
(LevelTools)
Thats doesnt tell me much
no
Save the timestamp in the unix time
Well you need to save time
Do you know how to code?
maybe yes i check
Where are you going to check if you can code?
I don't know
Do you know Java, the programming language, that is commonly used, when developing with the spigot/bukkit api?
no
Then you can hope that theres a newer version, this channel, is for users, that are having a problem, with there code, and want to fix it!
?
what
their* š¤
how can I change item's durability in 1.19.3?
not a good way. YOu just have to track it yourself pretty much in the PDC
https://www.spigotmc.org/resources/admibotintegration.116586/
Can anyone please test my plugin and tell me if it has any issues to you?
i created a vault economy provider, bc i want to be able to add details to transactions. im checking the stack trace to get info about it, like what plugin did it, what command, etc. but, since im the author, i want to be able to extend it for my own plugins that also use the server economy, so i dont have to check the stack trace for my own plugins. so i need a way to communicate between two of my own plugins, but, without interfering with its economy provider ability, meaning, without modifying the withdraw or deposit methods with a details parameter or something
im not a java developer so i have no idea whats the proper way of doing that, i guess getting the plugin by name and then calling methods on it is not the best way, right?
whta is pdc?
?pdc
Insert own logger into provider 
umm thats what im doing, but i need the plugin that initiates the transaction to specify the details of it, not the provider itself
i mean, i wont modify quickshop, plotsquared, and all of those plugins, just to add details to when they use the economy provider, i will do some weird stuff with the stack trace and thats it. but, for my own plugins that use the economy, i would like to be able to optionally call some method in the provider to give more details or something
and im guessing there is a better way than this, but im not a java developer so i have no idea tbh
if (Bukkit.getPluginManager().getPlugin("MyProvider") != null) {
Bukkit.getPluginManager().getPlugin("MyProvider").setupDetails("i will do something something")
provider.withdraw(x)
}
idek if that would work tho
Thereās no way. Plug-ins should have their hook for custom economy
In vault you canāt really track which plugin doing the transaction
well thats what im trying to solve, i already have a way of doing it by checking the call stack trace for all existing plugins, but i wanna do it the proper way with my own plugins
does the Bukkit.getEntity(uuid) load the chunk the entity is in?
how can i check when the player does a command and the command failed or they didnt have perms
and not just for commands in my own plugin but when commands for other plugins also dont work
imo itd be better if the plugin self hosted the bot for its own instance ( so u just input the bot token in config ) , but thats just my opinion
having a centralized one could lead to some potential security issues, but š¤·
The whole purpose of the plugin is to make it easier for the user to integrate their Minecraft server to discord by just having an unique key like I did another project with just self hosting
Okay ty
how do i detect block right clicks?
is it the action event?
or maybe player interact event
player interact event
thanks
is there a way to make a nametag grayish dark, like when a player sneaks?
is this the correct way of doing it?
public void playerClick(PlayerInteractEvent e) {
if (e.getMaterial() == Material.NETHER_STAR) {
}
did you register it?
what does that mean
oh yes i did
okay
how would i use this to check if the command sender was able to successfully send the command or not?
Should I dependency inject my plugin instance or make it a singleton? I ask because I have a singleton storage class that stores references to objects needed throughout the program, and its messy to dependency inject into a singleton
I ask because I've been using it as a singleton and tons of people on the forums say to inject it
Neither is necessarily āmore correctā but you will find some people that are die hards against having it as a singleton
Ah okay. I just find it makes the code more messy, especially if you're dealing with another singleton already
I could inject my storage class, but I'd like to prevent the ability to make a new instance of the storage class
I will use di considering thereās more than one call the to the main, otherwise I just get it statically
The reason for people arguing against your main being a singleton is because iirc bukkit offers a static method of getting your main instance
Bukkit#getPlugin(plugin.class) ith if my brain is braining right now
Right, but I remember having issues with that in the past. I can't exactly remember why as it was well over 4 years ago but I haven't ran into it since because I have been using singleton method since
It kinda depends on your impl as well, I personally only put startup functions in the main
I haven't touched spigot as well since about 2021 so I'm still a little rusty on it
If I had to guess those issues came from premature initialization of some class before the main was actually loaded
That makes sense. I'll see about using getPlugin, however getInstance looks a lot cleaner than the big Bukkit#getPluginManager(plugin.class) way
Yeah iirc that also might involve some stacktrace jank
Not sure Iāve not looked at the impl
How would you recommend getting instances of a Bots storage class?
In my plugin I instantiate bots from the config yml, and then store it in a class to manage them. I use it as a singleton. I could dependency inject, but it allows people to make new instances of the bots class
The only reason I use Bukkit.getPlugin is to define a constant of the main for whatever class I need it in otherwise di imo is just simpler
I would like to use DI, and I could use it if I also DI the bots class, but I'm not sure if I want to use the bots storage class as a singleton or not
Iād need more context to give an opinion on that tbf
Is bots a rather globally used class?
Well, it's used in main, an event handler, and a command handler to close and open the pools, as well as reload them. This kinda points me towards utilizing dependency injection, however I'd like to avoid making new instances of the Bots class for obvious reasons
I know I could still use bots as a singleton but in implementation it is gross because I'd need to lazy initialize it and pass in the plugin class into the getInstance
It is possible to only ever have a single instance of said class with di, however the structure has to be solid and initialization has to be precise
This leads me to say just play with di a bit, that just sounds like a mess waiting to happen considering you change the structure in any way
Yeah I agree. I guess its not the end of the world if its possible to make a new Bots() class anyways.
Coming from my Java bible āno impl should be considered āgoodā until itās been rewritten a couple timesā
Thatās just to say in the experimentation, youāll start to find / see different and possibly better approaches
I like that "proverb"
You want the actual quote?
Lol sure
di and singleton aren't mutually exclusive patterns
but people too often mix and confuse singleton with statically accessible
Eh I canāt find it, but that was the gist of it
That was the point of the argument earlier, thereās already a provided method of getting your main class so a lot like to argue against the use of a singleton main
that's not what I'm saying
I'm saying singleton and di can be used together perfectly fine
without any kind of static getter
Sure, but in relation to your main being a singleton
your plugin is already a singleton, and that's nothing to do with the getter spigot offers you
I get the difference to an extent. I usually use it to cache certain data such as, in my case, bots loaded in from a config, and that will only be used once
Which from my interpretation was the use of a singleton
Extends javaPlugin induces the fact itās a singleton correct?
dont forget the @EventHandler annotation
I think it just induces the fact that its abstract no?
I mean the fact that there is a single instance makes it a singleton
and that instance is created by the server
Idek I ish I had a spigot api book š¦
the server injects stuff like the respective Server instance
Ah yeas sorry Iām being cooked
Iāve had 3 flights today man Iām tired
Yes you are correct, like I said Iām just being cooked⦠without actually being cooked
Ha no worries I feel ya. I fly for work across the country and it wears you down
Well when itās a triple connecting flight to get to your destination⦠that shit sucks lol
wth
huh?
Travel jobs man, my father used to make about 250k miles a year and thatās not even like bad
It's usually just for meetings. It sucks lol bc it could be an email, but its also cool because you get to leave where you live for a bit to a lot nicer place
Usually for team building
Yeah you definitely get the benefit of traveling⦠but there is quite a cost to doing so as often as most people in that position do
Eeeeeeeeek really?
Yeah lol, credit card helps for that though
At least they reimburse ya but still for mandatory meetings as most of them are, company should be taking those expenses
It was odd, for my fathers work they had him pay for local trips, but paid for international ones
Free credit building as well
(Hopefully)
Yes lol
Would they reimburse him??
.
You can't. The best you can do is check if the command is valid and they have permissions to use it.
ahh lol i was gonna say
how do i check if its valid?
there lib for detect hold right click?
You check it exists. Thats bout it
how do do that
If (sender != null)
I have a feeling we are in an xy situation here
?
Why do you want to know if a command ran?
I want to log every command ran
but i dont wanna keep track of commands that dont exist
Well you canāt keep track of something that doesnāt exist so
0-0
If it does exist then log the usage otherwise thereās no issue
im confused?
if i do a command like /afauijfbaoijbf obiosly noty a command
it still gets logged
@EventHandler
public void onPlayerCommand(@Nonnull PlayerCommandPreprocessEvent event) {
String playerName = event.getPlayer().getName();
String command = event.getMessage();
String timestamp = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
sendEmbeddedMessage(playerName, command, timestamp);
}```
im logging the commands in a discord server
using a discord bot thats included in the plugin
lol isnt a command
getMessage, split the command then if (Bukkit.getPluginCommand(command) != null) logMessage
Elgarl just faster than I
ok why does the /msg not work?
msg is a base command, not a plugin
ah right
how do i tack it for base commands aswell
wait
can i get what plaugin the command is from
cuz thats would be pretty cool
it should be in the returnd command
?
the returned PluginCommand https://hub.spigotmc.org/javadocs/spigot/org/bukkit/command/PluginCommand.html
has a getPlugin() method
ok but hoe do i also check if the command is from minecraft instead of jus plugin commands
omg
my spelling
0-0
Not ideal but you could use https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Bukkit.html#getCommandAliases() and see if the command is a bukkit command
not as simple to process though
hmm
How do people typically develop recipes that allow the items to be swapped out for others(in 1.8), for example, if a recipe has a diamond, coal, and iron, allow the coal to be swapped out for a second iron
I understand it's not possible through a recipe, but how would you get around this using a crafting table
Can't you just make two recipes
The problem is, I don't have to have hundreds of recipes for larger combos
What if you make a wrapper for the recipes
well, I guess it still runs into the same issue
Actually make a class that internally has shapedrecipe, then maybe pass in an array of recipe shapes?
That was what I tried first
I just don't think using the vanilla recipe manager would be worth the effort
But I'm clueless on where to go to next
for example, you could do
recipes = new MultipleRecipe([['I','C','I'], ['I','I','I']], item));
recipes.addRecipes();
or something along those lines
But this would still be adding a lot of recipes, in theory
Yeah, however you wouldn't have to write out the create recipe logic more than once
Well yeah
There's a collections library that does something like this
I tried checking for click events, checking for items in the crafting matrix, and setting the the output, but it causes an invisible output and didn't set the output until the player interacted with the inventory once more
Have you tried using updateInventory
Ah yeah. You honestly could do it this way too it will be a little messier though:
recipes = new MultipleRecipe(['I/C','I/D/G','I/C'], item));
recipes.addRecipes();
You'd have to map each character to a material though
And I doubt they're creating hundreds of recipes
If I don't find an efficient alternative, I'll have to
It would be easier for mkaing recipe where maybe you could use a wood plank instead of a log
Currently, I'm doing 5 items
recipes = new MultipleRecipe(['I','P/L','I'], item));
recipes.addRecipes();
so like Iron, Plank/Log, Iron
So it's messy
Is MultipleRecipes a class?
Ah yeah. I'm not too sure then, this is the only way I could think of.
No, I meant make it yourself
you'd just iterate through the array
Thought I overlooked something
Ah no haha
Got excited
Lmaoo, didn't mean to get your hopes up
I hate working on 1.8
wait does this work on >1.8?
Where does hypixel have a ton of recipes with swappable items
I'd have to check to be certain, I just remember one rn
I'm referring to UHC in specific
My way with the slashes is probably the better way at it, however you could run into issues where you want it to be coal iron coal, diamond diamond coal or diamond diamond diamond but not coal diamond diamond
lol wtf
Huh?
nvm thats the interface
Oh
I think ExactChoice is just for using itemstacks in your inventory
It's an interesting idea, maybe tomorrow I might see if I can rip something up and make a library or something
However, might I ask why you are using 1.8?
sorry had to do a two parter bc none of the gifs have the full interaction
hahaha
lmfao
I might see if I can rip something up and make it cross version platform. It seems like a good problem to solve
I wonder if there's downsides of implementing a few thousand recipes
MC has more than 1000 recipes if I recall
Yeah online all they say is to use multiple recipes
So need some help here. First time plugin developing, I figured out how to set up the package structure, but not the code. I'm set up in plugin.yml to call main: com.gmail.nikitis.maximumbuildheight.maximumbuildheight
However, I have no code in the trailing maximumbuildheight class, but it's in my BlockPlaceListener class, but if I call that in plugin.yml main: It complains that I don't have "extends JavaPlugin" in the class line for BlockPlaceListener. How do I fix this? Code below:
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockPlaceEvent;
public final class maximumbuildheight extends JavaPlugin {
}
public class BlockPlaceListener implements Listener {
@EventHandler
public void onBlockPlace(BlockPlaceEvent event) {
double maxY = 256.0; // Set your desired Y-coordinate threshold here
if (event.getBlock().getLocation().getY() > maxY) {
event.setCancelled(true);
// Optionally, you can send a message to the player:
event.getPlayer().sendMessage("You cannot place blocks above Y " + maxY);
}
}
}```
Make a new class for the listener
Or make a method for the listener in the main class, and run it from onEnable
I'd rather keep it as clean as possible, how would I do the latter?
Keeping it clean would be keeping everything in one file?
I want the plugin to load and always be on.
Make a method inside of your main class for the event handler
Then simply run that method on plugin start
Which would be inside of the onEable method, which you don't currently have
So like? ```package com.gmail.nikitis.maximumbuildheight;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockPlaceEvent;
public final class maximumbuildheight extends JavaPlugin {
public class BlockPlaceListener implements Listener {
@EventHandler
public void onBlockPlace(BlockPlaceEvent event) {
double maxY = 256.0; // Set your desired Y-coordinate threshold here
if (event.getBlock().getLocation().getY() > maxY) {
event.setCancelled(true);
// Optionally, you can send a message to the player:
event.getPlayer().sendMessage("You cannot place blocks above Y " + maxY);
}
}
}
}```
since spigot 1.20.6 is compiled on java 16, is there a way of keeping a plugin backwards compatible to java 8 or should I just make to different versions; one for 1.20.6> and one for 1.20.6<
Could you format it for me?
I really have no clue
i've never seen a working example
I'd recommended reading documentation, or watching a video tutorial on plugin creation
The only way you will ever get compatibility is by compiling against the earliest version you want to support
I'd recommended getting the Minecraft Development extension, if you're using IntilliJ
It just makes starting your plugin easier
just using eclipse and maven
Linux
I get the compiling part of it, and the .jar structure
I don't understand how the code is called. or the classes are called
public final class PluginName extends JavaPlugin {
@Override
public void onEnable() {
}
@Override
public void onDisable() {
}
the server sends you to a game instance which runs on limited resources
onReload when
oop
It's called by the onEnable method and then you calling registerListeners
So paste my blockplaceevent code in the onEnable section?
No your code is fine you just need to register it as a listener in onEnable
So like?
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockPlaceEvent;
public final class maximumbuildheight extends JavaPlugin {
@Override
public void onEnable() {
public class BlockPlaceListener implements Listener {
@EventHandler
public void onBlockPlace(BlockPlaceEvent event) {
double maxY = 256.0; // Set your desired Y-coordinate threshold here
if (event.getBlock().getLocation().getY() > maxY) {
event.setCancelled(true);
// Optionally, you can send a message to the player:
event.getPlayer().sendMessage("You cannot place blocks above Y " + maxY);
}
}
}
}
@Override
public void onDisable() {
}
}```
For Beginners:
Codecademy - Learn Java: Interactive Java programming course from basics to more advanced concepts. Perfect for absolute beginners.
https://www.codecademy.com/learn/learn-java
JetBrains Academy - Java Developer Track: Learn by doing with projects and challenges. It covers Java fundamentals to advanced topics.
https://www.jetbrains.com/academy/
Udemy - Java Programming Masterclass for Software Developers: Updated courses that cover Java 8 to Java 17 features. Suitable for those who prefer structured learning.
https://www.udemy.com/course/java-the-complete-java-developer-course/
For Intermediate to Advanced Learners:
Oracle Java Tutorials: The official guides by Oracle for Java programmingāgreat for understanding the depth of Java.
https://docs.oracle.com/javase/tutorial/
Baeldung - Learn Java and Spring: Focus on Spring Framework and modern Java technologies. Best for intermediate learners aiming to expand their knowledge.
https://www.baeldung.com/
Practice and Hands-on Learning:
Exercism - Java Track: Solve exercises and get feedback from mentors. Great for practicing coding skills.
https://exercism.io/tracks/java
LeetCode: Practice your coding skills and prepare for technical interviews with Java.
https://leetcode.com/
Free Resources and Documentation:
Java Programming and Documentation: A comprehensive collection of Java programming guides, tutorials, and API documentation.
https://docs.oracle.com/en/java/
Community and Support:
Stack Overflow: A vast community of developers. Great for getting help with specific problems or understanding concepts.
https://stackoverflow.com/questions/tagged/java
r/learnjava on Reddit: Join the community of Java learners and get advice, share resources, and discuss projects.
https://www.reddit.com/r/learnjava/
Remember: Learning to program takes practice and patience. Don't hesitate to experiment with code and participate in community discussions. Happy coding! š
I really just want the max-build-height value for server.properties to be honored again with spigot.
it's possible but yeah no one writes like that
i have a map that I can't allow building over height 256.
and when minecraft allowed 320 Y height, it seems to have broken max-build-height variable.
Can this be fixed in spigot?
I was attempting to learn to make a simple plugin to just cancel the block place event if Y is over 256, but apparently it's too complex for me
I feel the code is solid, but I don't know how to arrange it in classes and methods
You don't have to register your main class for listners, right?
Hell if I know
I don't remember but
public final class Temp extends JavaPlugin implements Listener {
@Override
public void onEnable() {
getServer().getPluginManager().registerEvents(this, this);
}
@EventHandler
public void onBlockPlace(BlockPlaceEvent event) {
double maxY = 256.0; // Set your desired Y-coordinate threshold here
if (event.getBlock().getLocation().getY() > maxY) {
event.setCancelled(true);
// Optionally, you can send a message to the player:
event.getPlayer().sendMessage("You cannot place blocks above Y " + maxY);
}
}
@Override
public void onDisable() {
}
}
if that can work i'll take it
I don't personally put event handlers in my main
might want to add
@Override
public void onEnable() {
getServer().getPluginManager().registerEvents(this, this);
}```
Do i wanna change class Temp to class BlockPlaceListener?
Yeah
My bad
Or whatever your main class name is
Which appeared to be
maximumbuildheight
your plugin name rly is BlockPlaceListener, dam-
Innovation
maximumbuildheight
oh snap it works!

!!!!
Sweet! And thanks for the example. I can learn and play around with that
next i'll work on adding perms for bypass.
but I think I can learn that from the tutorials
Perms are really easy
Just add an if statement to the top of the event handler
if(event.getPlayer().hasPermission("maximumbuildheight.bypass")) return;
But seriously, if you don't already know some java, I'd spend a few days learning
Yeah, I learned it like back in Java 6 days, Forever ago. I haven't used it in probably 18 years
A lot has changed
is this correct for Player#spawnParticle()?
e.getPlayer().spawnParticle(Particle.EXPLOSION, eventLocation.getX(), eventLocation.getY(), eventLocation.getZ(), 2)
Like my code worked first time. I just didn't know how to structure it
never dealt with groupid's archetypes, etc
The IDE is new to me
and I didn't know what minecraft required for jars
like package structuring
event.getPlayer().spawnParticle(Particle.BLOCK_CRACK, event.getPlayer.getLocation(), 1);
yea im a webdev but recently started learning java & spigot, im used to vscode
I used to code web pages back in the netscape days using only notepad
Stopped about when dreamweaver came out
oh ty, i couldn't find a location arg in the docs prob just an oversight. when i was spawning it manually with x,y,z it wasn't showing but ill give that a shot
Well, you can specify x y z, it's just simpler if you just get the players location
Actually, idk why that didn't work
Well I won't tie up the dev channel with chitchat, Thanks again! I'll likely be back as I practice adding commands, and perms.
Yeah, you kind of get used to minor oversights that cause you to troubleshoot for an hour š
you and i both ha, everyones been super helpful and patient for me though
happened to me when i was making some custom enchants yesterday
i had a spelling error that wasn't showing in intellij for some reason and i spent 3 hours trying to find out what was going on
Q: I see several resources for playing specific sounds, but they are all out of date. How would you play a enum sound like cave18 in 1.20?
playing sounds has not changed
The packet for playing specific sounds is out of date. is there a list of them somewhere
PacketPlayOutNamedSoundEffect no longer seems to work in 1.20
use teh API not packets
No point in packets for sound. Thats literally all the API does
Player#playSound and World#playSound
you have to, to play specific sounds cave18
I very much doubt thats the case https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Sound.html
Where do you see cave18 there
you will not find the MC naming there
the sound comes from the resource pack. the api only has AMBIENT_CAVE which plays cave 1-19 at random. if you use packets you can play a specific cave
You can play any resource pack sound using its defined name
literally the name of the ogg files in your resource pack
I tried "ambient.cave.cave18" does not work, the resource pack is the default minecraft not custom, doesnt seem to be located in the resourcepacks folder
you shoudl not need the path
What would i need
If you dont mind showing such example would be awesome. im not sure where that sound comes from besides random from AMBIENT_CAVE
cave18
ambient_cave plays cave# at random choice from 1-19. I want to play cave18
IDE slow to open this morning
No worries. Iāve been researching for a while and everything is about 1.8 for playing sounds, which is a bit outdated
seems I've not built remapped for 1.20.6 yet
Iām using 1.20.2
But it may be similar in 1.20.6 idk
yeah you really don't need nms
yeah no, that is just a requirement of my test plugin so I can use anything š
I don;t see any way to access individual ambient sounds though
Registry only gives the predefined enum values
You can give play sound a string
Which should work the same way as the play sound command
iirc
I saw on spigot on forums someone posted how to play it with packets, thatās all I know. But it was 1.9
Could you try to play cave18?
Would probably be faster for you to try it
Iāve tested ācave.ambient.cave18ā not working
one sec
I donāt know if itās the right directory, but it seems right
Unless I forgot to add the category or something. Maybe one of you are smarter with this and find a way
I will in a few, but I seem to have broken my tesst plugin š
Ah np. Take your time. If itās a bit then ping reply me lol
why not
I can not use player as a variable
am I just not awake
it says player is undefined in the player. bit
ugh yea, maybe the static analyzer is a bit goofy, did u try to just call a method on the player, like typing it all out
yep it's not accepting it
is it preferred to use the string version of player's uuids in my db, or is it okay for them to be stored like this
Binary.createFromBase64('C0+TsPGfbl9ttGqWfULLiQ==', 3)
hmm and you got the right java version?
You could use āsenderā
Itās the same thing
yep, one I used fo ra logn time 16 with 1.19.4
sender is of type CommandSender tho
You could convert sender to player
This is strange as it works as a variable to pass/use IN a method call
Player player = (Player) commandSender;
This works fine
Why do you need a item display for sound?
ok now it magically fixed itself
No, this is an old test plugin I was just modifying to test sounds
panic avoided, the magical pixies of IDEs fixed itself
id say your compiler is goofy
yeah I restarted it and cleared caches but it just magically started working
mhm
um, perhaps not
super wierd its not fixed, but it does not see it as a variable
the funny part is it seems to work when passing it into a function xD
yeah, I can use it AS a variable in a method call, but can;t use it as a local variable
but how, it should be the inverse
if I change to if (sender instanceof Player player) { it works in scope
right
but early exit its not seen as a local variable UNLESS being passeed as an arg
methodCall(player.xxx works fine, but player.xxx does not.
wierdest issue I've ever seen
did you set your language level in eclipse?
um good point I believe I changed it to 21 recently when testing
nope, this is set to 16
ah well a problem for future me
17 is good
This IDE is out of dsate so I guess it could be a bug
does this mean you finally gonna try out intellij?
lol no, I have other installs of Eclipse š
š
most enjoyable eclipse experience
I did "try" Ij once. Did not like it
really?
i believe there is even an eclipse theme for intellij
in case u wna make it look like eclipse
I like to have multiple projects open in one view
ah, right, intellij cant do that
eclipse is great, feels more lightweight
um this is worrying. I just opened my MC 1.19.4 and it has a wierd server I've never accessed
So I did a bit of research on the sound effect
Looks like you can't play a specific variation without a resourcepack
?bootstrap
Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.
Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163
i hear that for 1.8 but for 1.9 no
with packets
I don't think that's the case
also the audio id you have is wrong
At least for 1.20.4 which I was testing on
whats the id?
maybe protocollib could - last resort
oh I broke playSound š
Anyone know whatever work around hypixel uses on their scoreboards to prevent the score #s from displaying?
mine vs their comparison below
it can (on macos)
player.playSound(player, args[0], 1, 1); passing "AMBIENT_SOUND"
I guess you have to pass an invalid/valid MC sound name
Caused by: net.minecraft.ResourceKeyInvalidException: Non [a-z0-9/._-] character in path of location: minecraft:AMBIENT_CAVE
minecraft:ambient.cave
same as the /playsound command
which I mentioned earlier
yep I'm just not reading
looks like ima have to use protocollib. https://pokechu22.github.io/Burger/1.20.4.html#sounds:ambient.cave
they have cave18
No
?
That only shows one key
which is ambient.cave
You cannot target the specific cave sound
Its not here? https://www.wiki.vg/Protocol#Entity_Sound_Effect
no
not possible
i had to test cuz i keep seeing more forums with the answer
works fine but not in 1.20
because it is a resource pack
can try and see what protocollib reads
you can not go outside the protocol
the only variation in the protocol for playing sounds is using an id of zero. then you can pass a name
for resource pack sounds
number format
Should be in the API too iirc
only 1.20.3 and up
It might be some client hiding the numbers.
ah ty, im in 1.20.4 which makes sense
Is it possible to add the resource pack sounds without the user having to download a pack on join?
if its gonna popup, id rather go without. kind of annoying to have those downloads.
oh my playing a sound from a set is possible btu it's VERY difficult. It requires working out what random seed is needed to play each
so you would still use teh ambient.cave but you specify the seed
silly stuff. its weird they wouldnt allow simply adding cave.ambient.#
if its universal could find the seed online maybe?
unless you mean a seed that has that location where you are running the code
no, it's literally a weighted seed
sounds are loaded on the client from sounds.json
only works in newest versions
the client pulls a random using the seed you pass
if you pass the same seed everytime you should get teh same sound of the set
clients are running vanilla pack which should have the sound
you have to work out what seed will play the specific sound you want
how to input that variable in the playSound seems trouble to fit tho aye
just cave 18 lol
yea shouldn't be an issue, ill just add support for older clients with the numbers there
mhm
you have to use packets, this is not supported in the API
that was my original question. how to play sounds in 1.20 through packets because everything online is for 1.8 lol
its ok tho can probably mix some other sounds to make similar
ClientboundSoundPacket
Hey, so i have a command manager class that uses an arraylist to register commands: ```cs
public CommandManager(NexusCore plugin) {
this.plugin = plugin;
//add subcommand
subCommands.add(new CreateCommand());
subCommands.add(new DeleteCommand());
subCommands.add(new SpawnCommand());
subCommands.add(new NexoCommand());
```cs
else if (args.length > 0) {
for (int i = 0; i < getSubCommands().size(); i++) {
if (args[0].equalsIgnoreCase(getSubCommands().get(i).getName())) {
getSubCommands().get(i).perform(player, args, plugin);
}
}```
https://paste.md-5.net/pijafawocu.bash
but for some reason SpawnCommand and NexoCommand
when i use them, it says that they are out of bounds
You are using an argument that doesn't exist
No, if i do that it just doesn't do anything
because of the if
send these classes
if I use an argument that do exist is when i get that error (only with spawn and nexo )
okay
new ClientboundSoundPacket(?, SoundSource.AMBIENT, volume, pitch, seed, x, y, z);No idea what the ? arg is though
size() - 1 I think
'cause for 7 elements you will have size of 7 but indices of 0-6
just says Holder<SoundEvent>
I'm starting the loop in 0 because of that
and that would be the problem if only the last added wasn't working
oh ye, ignore what I said
np xd
nothing xd
ooh wait
could be args[1]?
don't think so
yesterday was working actually
in 1.19.4 probablyjava SoundEvent event = SoundEvent.createVariableRangeEvent(ResourceLocation.tryParse("minecraft:ambient.cave")); packet = new ClientboundSoundPacket(event , SoundSource.AMBIENT, volume, pitch, seed, x, y, z);
try adding
if(args.length < 2) {
return;
}
``` below the permission check
yeah you're getting the argument without checking if it exists
which is what I said from the very beginning ^^
ill create something like maxArgs to check before doing anything to prevent missing args
yea, but thought it was the first argument
my bad sorry
How would I go about handling the items in regards to calling a BlockDropItemEvent?
I currently spawn the item entities and then pass a list of those entities into the event but I don't think this it is respecting the modifying of the list
why are you calling the event?
shouldn't need packets for sounds :\
Its to play a specific ambient from a set
not a randome one
Need to be able to define teh random Long
to play cave18
I'm about to test some code
Since permissions can be registered from code as an alternative to registering them from plugin.yml - can the same be done with commands or is it mandatory to define the commands in plugin.yml?
btw my account can't be verified and #verification gives me errors when i open the channel, what can i do?
Verified š¤
it is fighting back tho, LOL
I see the rank coming and getting removed and the name changing too
no idea what happened
at least ur verified lol
bruh
yes lol
you gotta make sure you upload images in the available time frame
why does this stuff happen to me
even if i unbind the account (idk if can do that even) i still can' load the verify channel
oh i can do it everywhere wait lemme test it out
rejoin this server bro
lets give it a shot
declaration: package: org.bukkit, interface: World
test
yay
fixed
š¤š¤
@wraith delta API method with seed
oh
No need for packets
yeah
still 0 idea why that happened tho lmao
is that new?
Prob not
nice! will have to give it a try tomorrow. thanks for the find
Doesn;t seem to be on Player in 1.19.4
š¤·āāļø could be
I have an interactive harvest plugin (player right clicks crop and then the crop breaks and automatically plants seeds)
So I am handling the dropping of the items
@wraith delta what does cave18 sound like?
copied the video at the time of 18 - its for dungeon door. ima remove the embed
I modeled a dungeon using bdengine, and used code to grab the entities and animate it as a open/close lifting door
ok, for older versions this seems to play it```java
long seed = 17;
float volume = 1;
float pitch = 0.5f;
Location location = player.getLocation();
double x = location.getX();
double y = location.getY();
double z = location.getZ();
SoundEvent event = SoundEvent.createVariableRangeEvent(ResourceLocation.tryParse("minecraft:ambient.cave"));
ClientboundSoundPacket packet = new ClientboundSoundPacket(Holder.direct(event) , SoundSource.AMBIENT, x, y, z, volume, pitch, seed);
ServerGamePacketListenerImpl connection = ((ServerPlayer) NMSUtils.getServerPlayer(player)).connection;
connection.send(packet);```
newer API has teh seed value so you don;t need nms for that
Did you brute force the seed
yes
found a github with the seed https://raw.githubusercontent.com/Owen1212055/mc-sound-seeds/main/sound_seeds.json
CTRL+F cave18 - {"id":"minecraft:ambient/cave/cave18","seed":-4481247781671450987}
17 works for me
Does this work for 1.20?
Where did SoundEvent come from, im not seeing that in jdk17, 1.20.2
ive never used NMS. i avoided it for any risk of version complications
then you need to use protocolLib if you can;t do nms
but wait, the api method the other guy sent, we have the seed..
on newer spigot, yes
ah maybe not 1.20.2
Heres the door open/close WIP using warden sound since i couldnt get the cave yet lol. using display entities so no r packs
dam
Or PacketEvents is also a good option, I find it a fair bit easier to understand too personally
Small suggestions that could maybe help
You can make all the display entities ride a single display entity and move just that one -> that will make all of them move at once and the weird jump, just like the one at the end, will not happen
Since idk what 1.20.x we have teleportation interpolation too, you could probably use 1 or 2 ticks to make it a bit smoother, your video seems a bit jittery
?nms
that was for me to get teh currnet specialsourcce version
its a work in progress, but just to inform idk if the suggestion still applies, the door is spawned at multiple locations using a console command run from code. The code then has to retrieve those locations to read your key to unlock it and animate them even after the server restarts.
Just to note, 17 as a seed also works on 1.20.6 as well as 1.19.4
I just tested it using my code and API
In current APIjava player.playSound(player, "minecraft:ambient.cave", SoundCategory.AMBIENT,1f, 1f, 17L);
wdym by ticks? I grab the entities and put them into a list, then foreach the list in a runnable. im not able to check for the main one since its created by command
You can set how long the interpolation should last
You can either just teleport the root entity, that would hold all the entities, to the "open" position and set the interpolation to the amount of ticks you want the door opening animation
or move it bit by bit and have low amount of ticks for smooth movement, you can use different curves in this case, not only linear one
Also, doing anything by calling a command from code is just terrible, there has to be a better way to do that
bd.setInterpolationDuration(60);
bd.setInterpolationDelay(1);
bd.setTransformation(transformation);
```Yea i use this
the only time the command is run is when I choose the locations that the doors will exist
Aaah ok, then it's probably just my eyes playing tricks
oh I see, then I misunderstood what you meant
i modeled the door in bdengine and used the exported command in the code, inputting the location variables that saves it to config etc
trying to read those entites after being spawned isnt the easiest lol
anyone here know what they're doing when it comes to logarithmic functions š
?
I'm working on a leveling system right now and I'm trying to understand them but I am not exactly your math professor
?ask but idk if this is best place for math
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!
thanks for this ill have to try it on 1.20.6 sometime, but in 1.20.2 it wants me to remove the last arg (seed)
yep its a new addition to the API
older version you will have to use ProtocolLib or NMS
ya I figured š
anyways, I'm trying to create logarithmic function that dictates player level/xp. leveling up fast at the beginning, and plateauing at the end. I'd like xp values for the max level to be around 80,000,000
Ln is a function. Basically, it allows you to transform a product into a sum
It's derivative is 1/x
Which means that when you have hight value of x it increase slower
That's why it's quite convenient for leveling functions
interesting, ill probably try to play with desmos until i understand it.. my issue is finding xp/level conversions from said function
Well you probably have something like level=ln(XP)
Ln being the logarithm
Note that level=ln(experience) means that experience=exp(level)
Exp being the exponential function
But if you want specific value of experience for each level you might need something a bit more complex
Nothing very hard but it involves to do some maths
maths i shall attempt to do then, i could just hardcode values but what's the fun in that
you can look at different growth rates using a graphing calculator
really useful stuff
In 2024, what are my options for displaying texts and graphics to the players?
8 years ago there was titles and chat and inventory menus .. and .. I think that was about it.
Well, I did mention that. There's nothing, no new techniques?
Yeah, like holograms?
display entities and some raycasting
And his movements
Do you know anything particularly impressive you could link me as an example?
You can display whatever you want
Right. But those would be stationary.
Unless you mean like the map UI when looking at a map.
Right. So basically there's nothing new and ground breaking in UI since the last time I've been meddling with MC 8 years ago.
Inventories changed a bunch
What's up with those?
What would that look like?
Pair that with hiding the player's inventory and you end up with some nice menus
Would you still be constrained to display the things in grids?
Yep
I also saw something like this.
That's just the same principle but you change the title a bunch
So that's like ... resource pack + data pack + code or something?
I might look into that.
I've also managed to make individual slot background colors
Thank you.
Can you draw like that
Make a buffered image to this type of inventory converter
Could've guessed that
?stash
Make 4 colors per slot fr fr
I used it for this
it's possible but annoying as shit
Open source when
what are your thoughts on something like this? Level = Math.max( Math.floor( constA * Math.log( XP + constC ) + constB ), 1 )
tbh the guy that paid for this did exit scam me so I'm morally obligated to release this
Can I know how did you made this?
What part
Ah
That one
That's 7smile7's thing but I've worked on a really similar system
Basically maps on invisible itemframes
Everything packet-based
How do you do the overlay thing?
Do a little raycasting, modify the image
That does the job, with the three constants you can adjust it it's quite nice
I only need the colorful squares in inventory thing
Thanks 
It's a single pixel scaled up to 15*15 and some negative spacing stuff to make it all space evenly
For height I'm pretty sure I used multiple fonts that just had different ascents
Isn't that what a plugin used to display player heads on chat?
no clue
I wrote this myself
cant take all credit i had my buddy from uni help but im quite proud of the constants i proposed and he created for me š
What should i be using? I mean, what is more efficient
storing the name of the world or the world it self
.
I'm loading the world
uuid
the uuid of the world is the best
wtf is this spigot
I just started getting back into spigot since around 2020
I did not know you could do that that is very cool
@young knoll When was this merged? https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/commits/8e162d0083aa05bd3b4ec8972093fe7e9e9b53b0
I got 100 stars on VeinMiner on GitHub
34 forks
You made VeinMiner? You're a blessing to us all
What about quilt!
what about lynxloader
is quilt different from fabric? I thought it was a fork with just some extra methods
Idk if you need different metadata files for each tho
Hate it when forks break away from their upstream 
didn't quilt want to do the same tho?
woah
not a problem
they will die shortly after š š
Ooooh shots fired

If i didnt know what you were talking about, that would sound like you're a psychopath
Who knows, maybe I am 
probably
I saw that there is a methode on player where u can show the DemoScreen, and can edit it with resource pack. My question is if u can edit the buttons on what they do?
Sadly no
Not eaven on invclick event?
Nope, itās not an inventory
Sad š¦
which fuction changes the name above someones head? i forgor
the name above someones head?
there is no such thing directly you can either use a scoreboard or armorstand
(display entities better)
congratulations
next up is 200
well technically next up would be 101 š¤
not if github implements doubles for stars in a future update
wtf are doubles
i'd love to be able to give 0.99 stars
i only count in hundreds
double?
oh
me when I'm learning java for the first time
honestly
if i use scoreboard will i still be able to have a scoreboard on the sidebar?
like these ones?
im bad at doing it properly but ill try thanks
Spigorge++
yes you can have multiple scoreboards and display them all diffently
Hi
Doesn't it overwrite the current one if they are on the same display?
yes
you can only have one scoreboard (or objective i dont remember) per display at any one time
for example my plugin has multiple scoreboards that all use the sidebar, but only one of them can be visible at a time
hello i need help with the redprotect plugin
Is there a option to run a method after all plugins got enabled?
Why?
I want to make a core plugin where i can register services and managers for some stuff like database, particle, whatever
Now im trying to learn Hibernate for work. When i have a core plugin that means i have to add the "AnnotatedClasses" to Hibernate and create then a session factory
Like:
Core enabled -> other plugins can register annotated classes to hibernate -> builds sessionfactory (After every plugin got enabled)
you can set your plugin priority to be lower so more plugins load before yours
there may be an event or something, idk
ServerLoadEvent should work
Is there an event that gets called when harvesting honeycomb from a beehive?
I assumed BlockDropItemEvent might cover it but it appears not
?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.
Well, it's just not triggering when I harvest the honeycomb
?paste code for the event
It's not even running the code, I have a breakpoint on the first line of both BlockDropItemEvent and PlayerHarvestBlockEvent, when harvesting honeycomb from a beehive neither are triggered, when harvesting a sweet berry bush both are triggered
did you register the event listener
i suspect the beehive just doesnt use any of those events. might just have to just InteractEvent and make your own checks
though it is odd that it does not call PlayerHarvestBlockEvent. i would think that it would
on the other hand. they can also be harvested by dispensers so that event woulnt rlly cover everything
What gets called when using a bottle on a cauldron, could it be the same event as that? (Thinking along the lines of water in cauldrons)
well there is a CauldronLevelChangeEvent
Ahh probably not that then haha
if I knew how bee hives worked I'd test it
Is there some sort of plugin that just logs to console events being triggered
yep harvest event never fired for Beehive
What is the go-to method for checking whether the player has their hat layer visible or not on the player's skin?
why is the inventory name of the event inventory in InventoryOpenEvent always Crafting?
oh wait im dumb
dont compare inventory names to check if you have the right menu reference
i'm not doing that
well i kinda am but if it conflicts with another inventory, it wouldnt really do anything
im basically closing the player's current gui when they open another gui so it resets their mouse position to the middle but i don't want it to do that for some guis
like the ah gui
so you checking the inventory based on the name
i genuinely don't get how people can make GUis without libs such as incendo/interfaces
(or, well, the kotlin version)
Did you say kotlin
bro actually stfu
Anyone know anything about using ProtocolLib?
I can't get any packets detected.
Oh, wait.
Wrong file.
And registering:
private void registerHatDetector() {
System.out.println("CriticalFixes: Loading HatDetector.");
var hatDetector = new HatDetector(this, protocolManager);
protocolManager.addPacketListener(hatDetector);
}
we still using pastebin in 2024?
Yes. I have lifetime pro account.
you what
They were selling those at one point so I jumped at the chance.
https://pastes.dev my beloved
But if anyone can tell me what I might be doing wrong with ProtocolLib, I would appreciate it.
Constructor runs. Whitelists run.
But that's it.
paste.rs/web my beloved
ngl its a piece of shit
ah they updated it and its even worse now
legit n1 thing people confront you with
why does nothing of that sentence make sense
whaa
I think he meant legit anything people confront you with?
Idk Iām just enjoying this view
number 1
Con check general, bet youād like to wake up to this everyday (so would I)
cuz I made my own framework for menus š
Ew
pineapple has best gui
no but its nice cuz like, well I do use fabric so i got mixins but yea