#help-development
1 messages · Page 554 of 1
i use the left side of the screen
that shit barely works half the time
make sure ur github info is setup correctly
so you dont commit as BuildTools@spigotmc.org
xD I always configure my git correctly
oh man i can already think how many http requests are needed to initialize a discord client
its horrible
Surrond 1.20 with ""
only fifty requests per second :(
or it will think it's a float and remove the 0
Change it in the plugin.yml
api-version
For some reason i am getting the error: java.lang.NoClassDefFoundError even though the class is properly included when i build it, i cant figure out how to fix it for some reason, when i look in the jar file after building it is actually in there, the PlayerLeave is the only file that is having this issue
My code: https://pastebin.com/BR99dhg0
PlayerLeave code: https://pastebin.com/YbbUNitX
Full stack trace: https://pastebin.com/YerCkssf
File Structure: https://imgur.com/a/sq95q56
When you unzip your jar file (use winarar or similar) are the classes still in there?
What are you using to compile?
im using intellij to compile it as a artifact, and i used 7zip to look in the jar file using open archive
maven
Use the panel on the right side and double click package.
can i make it so it automatically packages into the plugins folder using that?
Yes, you just need to adjust your pom.xml a little bit to do so.
oh and it didnt fix the error
no.. the color class not chat color
Is it the same error or a different one now?
same error
is there not a way to get a bukkit color using a string?
sure
should i use the normal jar or the shaded jar?
Probably won't make a difference, but you should probably use the latest version of the shade plugin. (3.4.1)
Use the normal jar.
As of right now, are you using the jar that's located in your target folder?
yes
And it is the normal jar? Not one of the -original or -remapped-obf?
there is no -remapped-obf for me, i just use the one that has no prefix/suffix
so the name is just server-manager-1.0-SNAPSHOT.jar
its all my dependencies, is it alright if i upload it to mediafire so you can take a look yourself?
A screenshot would work just fine. Just double check that your source files are in there. Especially the one that the error is telling you about.
?img
Not verified? Upload screenshots here: https://prnt.sc/
The file names don't match somehow. They are case sensitive. (PlayerLeave vs playerleave)
ye i tried changing the names to all lowercase before i went here and that is properly changed to all lowercase
Just make sure that all of your file names and reference calls match up. Then run the clean command and then the package command and try again.
it is so far i know, nowhere in intellij it gives me a error. even in the error it gives me it tells me the exact same location and it should be able to find it, i cant even see a single upper case where there shouldnt be one.
@EventHandler
private void onEvent(PrepareAnvilEvent event) {
AnvilInventory inventory = event.getInventory();
if (inventory.getItem(1) == null || inventory.getItem(0) == null) {
return;
}
if (!plugin.getBackpackManager().isBackpack(inventory.getItem(0))) {
return;
}
ItemStack backpack = inventory.getItem(0);
int size = plugin.getBackpackManager().getBackpackSize(backpack);
int modelData = getCustomModelDataForSmallBackpack(inventory.getItem(1).getType());
if (modelData == -1) {
return;
}
ItemStack newBackpack = ItemStackEditor.of(backpack.clone())
.setCustomModelData(modelData)
.finish();
inventory.setRepairCost(1);
event.setResult(newBackpack);
}```
Why item is set but i can't grab it? No errors.
Make sure you are copying the correct file to your server. Changing the plugin.yml version is an easy way to tell if you are using the right file. Try updating that and recompiling.
still gives me the error, and you mean package right?
Yes
do you have any more ideas?
anyone knows?
yes, package will update the output jar
Not exactly. If your files show up in the compiled jar, there's no reason it should fail.
You could try removing the shade plugin and see if you get a different error at the very least, but I'm kinda at a loss here.
i still get a error but it is a different one now
its still a class not found error but its a different class this time
the full stack trace is: https://pastebin.com/ imma check if it is actually included in the jar file
now this is a error i understand is happening
https://prnt.sc/wzWM9SiD-evH
does anyone know if i stored a scheduler in a variable, and after its been called, it will delete itself meaning the variable would be null after it is called?
It won't
Any idea how I would hide the brewing lore under any brewing items? I've tried everything and it just won't work. I'm looking for something to either clear the lore before I add my own or just to remove that specific thing...
ItemFlags
Elaborate please
ItemFlag.HIDE_POTION_EFFECTS iirc
public void onEnable() {
onEnable();
}
XD
Apply it to the meta
alr,
doesn't work :/ i'll try found out what's going on but if you find anything ping me
Yeah, thanks
any reason intellij is literally hogging my cpu
It’s hungry
@quaint mantle hmhm potato fs
i5 damn
(my i7 11th gen)
tbh that's still good
it might just be that intellij is heavy resource reliant
i5 12600k is a beast
1ghz... but yeah
its one of the top CPUs 12th gen
I mean.... only 1 billion processes per second
thats just what its using
but you do you ig
Can anyone help me with this issue? I'm trying to change a players skin when they join or run a command. All other packets work but the respawn packet is giving me this issue https://pastebin.com/uQQcQC5E. Have any ideas how I can fix it? So far I've only tested it when a player joins the server.
I'm on linux
oooh hacker man
3.60 GHz not overlcocked
nice
if you overclock its 4.9 GHz
lol
don't do it i can't change itb ack
half the time there's a fucking camp of cavemen sitting in my pc making themselves a steak over the fire
free room heater ig
only works during winter
in canada where it's -52* cel
is this method ok to increase a item max durability
If i posted my plugin on spigotmc can i somehow hide it withoud deleting it?
what event?
how do i get a config that isn't config.yml
?configs
See this wiki page on how to use custom configuration files: https://www.spigotmc.org/wiki/config-files/
So you didn't read it 🤦♂️
there's no point in bothering to reply to me if all you're going to say is that.
i have done?
stop accusing me of stuff
seriously
i'm asking for help after reading the wiki. if you actually cared you would have told me what i missed
then maybe that would have been respectful
sigh I'm not here to argue
If you have any questions about that article then just ask
For example the getCustomConfig is something created in that guide
Which you seemed to have ignored
Are text display entities supposed to not be affected by velocity?
good chance
public transient volatile String a = "";
do youthink I can fit more stuff into this to make it look funnier
ok then :/
strictfp
static
Modifier 'strictfp' not allowed here
final
i recently changed my plugin over to using maven (using intellij) and suddenly its not booting on server start or showing in the plugin list
any idea what couldve gone wrong?
i can send screenshots of stuff if that would help
change it to a double and you can use strictfp
wuh
why not
static gives you errors, what
synchronized
final, and I'm unsure if you're able to use const but it is a keyword
Illegal combination of modifiers: 'volatile' and 'final' Illegal combination of modifiers: 'final' and 'volatile'
Oh I wasn't aware those two modifiers conflicted
- Nullable for good measure
I suppose it makes sense
Don’t forget all the other nullability annotations from various sources
@NotNull @Nullable public static volatile double a = 2.2;
lmfaoo
@RequireNonNull
synchronized
` @NotNull
@Nullable
@Deprecated
@Native
protected static volatile double a = 2.2;`
you can make it volatile
be able to
You can’t mix final and volatile
Modifier 'synchronized' not allowed here
something tells me if we add enough modifiers and annotations this variable will end up in some weird state that the JVM will start spewing out some absurdity
forgot the strictfp tho
Doesn’t work in new java versions
idk its obsolete anyways
wheres the link to asyncchatformatter++
thats what I meant
https://www.spigotmc.org/resources/deluxeasyncjoinleavemessage-fully-optimized-async-everything-open-source.88129/ - DeluxeAsyncJoinLeaveMessage/FinalProUltimateDeluxeAsyncChatJoinMessagePluginImpl...
wtf
a not null, notNls, and a Nullable every line
and dont even get me started on the class name
"join": "A player joined the server",
"quit": "A player left the server"
}```
doesnt even support adding the player name
2/10
Why can’t we just do import *
still need help with this - ping me if/when you can help
Spigots checkstyle wouldn’t yell at me about import order if there was only 1 import
md plz fix
?paste your pom.xml
yes
and is there any errors
FinalProUltimateDeluxeAsyncChatJoinMessagePluginImplFactoryAbstractCommonMainProviderBootstrapExecutorHandler
plugin.yml please.
fix your api version first of all
api should not be 1.20 lol
You need ’ to use 1.20
You don’t have anything from newer versions
So using 1.13 means it’ll load on any version 1.13+
I just know its the only thing that works for my 1.8 plugin
yeh p much
and I run the server on 1.19
its a spawner plugin; interacts with camels/sniffers/etc
lower numbers always work, higher numbers not so much
I wonder how many people are getting screwed by api-version: 1.20
ill try loading it now
okie
Also you were 100% getting an error before
Not that an api-version above 1.13 does anything except disable the plugin if not met
I like coding in 1.8 but my plugin is meant for 1.13 +
Mhm
spigot 1.8
` <dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.8.8-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>`
1.12.2 best version
🔫
🔫
Microsoft should've stopped after that
But sniffy bois
i was also curious if there were any plans to show that a spawner is empty when doing getSpawnedType()
right now it just shows pig
if (getSpawnedType() == null)
Problem is if we add an empty EntityType that will break old plugins
Same if we make it nullable
make it null, plugins will update if they break
I'll look at the PR again
What does it mean for the spawner if it's null
Spawner is just empty?
Welp time to do all the breaking changes then
Yeah they can be empty now
Another option that wouldn’t break things is adding a hasMob method or something
But then getSpawnedType would still be pig which is weird
theres also the UNKNOWN entity type but thats probably used for other things maybe?
It’s the fishing bobber
oh
for (Player player : Bukkit.getOnlinePlayers()) { for (Player player2 : Bukkit.getOnlinePlayers()) { player2.sendMessage(player.getAddress().toString()); } }
How can I make this better? lmfao
it also appears that left clicking with a sword in creative counts as breaking a block
should probably just put this on spigot jira
for (Player player : Bukkit.getOnlinePlayers()) Bukkit.broadcastMessage(player.getAddress().toString());
Why do you want to send the address of every player to every player
Nah you gotta keep both loops
its a joke
what does getAddress return
yeah wtf why is he doing players2 anyway??
why do 2 for loops
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
Wdym why?
Why r u sending the address to the other players
It’s funny
its illegal in many countries
Hahahaahhahahhahahahahahhahhahahahhahaahhahhahhahhhahhhahhahhaahhhhahhahahhahhahahhahhaahhahhahhahahhahhahahhahhah
called doxxing
tfw not behind 7 proxies
Only 7?
Meh what they gonna do, tell my cat I code spigot plugins?
That's a joke... I can't afford a cat
Bump ^
how do i send an actionbar to a player
player.spigot().send...
yeah what do i put for the basecomponent
after some testing i have partially figured it out, the reason it cant access the file is because something locked it, after i tried running the plugin in paper the error was a little bit different, it said the zip file was closed and after some more testing i figured out there is nothing wrong with the line of code that was causing the error, but something i have added before caused the error indirectly.
the piece of code that i am talking about is when i am trying to create the table in the database:
if (!databaseEditor.CreateTable()) {
getLogger().severe("Unable to create a table in the mysql database.");
Bukkit.getPluginManager().disablePlugin(this);
}
But because the code in the if statement didnt run i know that it is caused by a different class i have made before, databaseEditor.CreateTable. do you have any idea what might be causing the zip file to close,
The dataBaseEditor code: https://hastebin.skyra.pw/monuzumuhu.java (i have ran out of pastebin pastes)
probably a TextComponent
yeah thats what i did
first of all, that wont work
second of all, why would .remove return a list
it just wont
You can’t remove a player for a world
most lists in the API are immutable or copies, and even if they weren't it wouldn't clean up the world properly
what are you trying to do
You can teleport them to another world though
Just teleport or kick
What i said is one liner
Abuse streams
if i have a bungee plugin that links all the chats, asyncplayerchat event doesnt work anymore, is there a way to bypass that?
No
the code above is the best way
use it
any other way will be way more complex and inefficient
If you don’t know streams you don’t need streams
call the event yourself?
wdym
i have a chatevent that listens for a player's chat to configure a plugin, i assumed there would be a way to make a command or smthn to bypass bungee chat and just send a chat to the server
can you explain more please
are you running a global bungee chat plugin and that plugin is removing AsyncPlayerChatEvent?
I would speak to the author of the global bungee chat plugin then
im not 100% sure but whenever i chat, the event isnt called
I would speak to the author of the global bungee chat plugin
alright
or use commands to configure lol
I feel like that's a bit more natural
or inventory guis like all the cool kids
or just a config file
i did that but had to redo my entire plugin cuz anvilgui api sucks :p
is there a way to hide a specific attribute? not all of them?
not really
damn.
you could strip it out with protocollib if you really wanted to
but thats not great
No its fine, im not trying for more work and more problems lol. I have an upgrade slate. that adds to all current attributes, and they wont add together into 1, it just add the attribute all over again. So i thought about hiding that attribute, and just updating the lore.
so uhh turns out i am just stupid, in my databaseEditor i had a addfield function that was making sure the fields got added to the hasmap, however i did if (!Fields.containsKey(name.toUpperCase())) return; instead of if (Fields.containsKey(name.toUpperCase())) return; wich was making the hasmap empty wich caused the CreateTable function to return false, and i made it so if it returns false the plugin will be shut down and when i shut down the plugin and it closed all the files but i forgot to add a return statement when shutting down the plugin so it still tried to initialize some other things causing that error to be thrown because the plugin files where already closed
so basically to summarize i forgot 8 characters causing another error to be thrown making me miss a error i had thrown myself before the plugin shutting down, wich took 5 whole hours for me to track down'
A world's name is the name of the world's folder right
correct
Hm okay I have a custom world Spawn that is not recognized with Bukkit.getWorld("Spawn")
Yes it is the exact same as the folder name
No it is not actually hardcoded but that is the true value at that point
Yes but I tried to use one but it doesn't work for me
maybe send your code and explain what doesn't work
custom worlds have to be loaded
you have to load the world first like ElgarL said. only world gets loaded on server startup. You have to do other worlds your self.
separate class from language
What
uwu
that's how i did it:
`public PluginLang(Pluregin plugin) {
try {
this.plugin = plugin;
FileReader reader = new FileReader("Lang/" + this.plugin.getConfig().getString("language") + ".json");
Object obj = parser.parse(reader);
json = (JSONObject) obj;
} catch (Exception e) {
e.printStackTrace();
}
}
public String getPlugin(String path) {
pluginJson = (JSONObject) json.get("plugin");
return (String) pluginJson.get(path);
}`
And why are you using json for language when you have yaml parser provided in spigot
Also that looks like simple json library and I see noting wrong, what is error
Well, I prefer to separate them so as not to use the same language for everything.
when I run it it tells me that the this.json is equal to null but when I check it and I see that the json variable is not changed
yes
yeah
Alright I'll try that out
I could make a search index entry teaching all about worlds and world pooling
I'm sure a lot of people would find it handy lol
Well there's quite some info to talk about
and forks like paper also add some annoying parts
like uhh
file contents not being saved on WorldSaveEvent
because async
hello?
uhh
.
good idea to read this
No proper stack traces
no proper idea of what's the objective
Wayment....
Isnt JSONObject even a Gson thing? isnt that like jackson or somthing?
Why not just use gson provided by spigot bruh
or at the least, use POJO Classes to make your life easier
is the classifier for remapped jar still remapped-mojang?
in that way?
JSONObject etc is provided by jsonsimple which is utterly gross and shouldn't be used over gson
anyway
does anyone know if bungees ServerConnectedEvent fires on server switch too? I don't have the hardware to test it at the moment
because?
should the Spigot maven dependency be declared optional in a public api-based project?
is there a way to send an actionbar message without using nms?
seems to just be title and subtitle
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, whatever)
p sure you gotta pass a bungee component but those are easy enough
my bad
elgar's eyesight needs resting
lol
yep, I saw title and subtitle
so which library should i use for json files? because I don't know what happens and it doesn't detect the folder with the file since it creates them and they are in the .jar file of the export
or any library that you recommend
how do you do this
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
?bing
Bing your question before asking it:
https://www.bing.com/
better
bing? o_O
bing.
wasnt it once
md hates ducks
Question how do I create custom blocks with spigot 1.17.1? ._.
texture pack
i think its simple json, gson would be like JsonObject
- i made a class to handle database connections, and i wrote some methods to make manipulating the database a bit easier
- generally it works, but the query method never seems to return anything in the
ResultSet - i know that the issue is with this code because ive tried using the regular
Connection.prepareStatement()way using the same SQL code and have no issues - if it helps, the
setArgumentsmethod is also used by the update method and seems to work there, so i doubt the issue is with that, but i thought id better include it anyway since its used
private ResultSet executeInternalQuery(Connection connection, String query, Object... arguments) throws SQLException {
try (PreparedStatement statement = connection.prepareStatement(query)) {
setArguments(statement, arguments);
return statement.executeQuery();
}
}
private void setArguments(PreparedStatement statement, Object... arguments) throws SQLException {
if (arguments.length != statement.getParameterMetaData().getParameterCount()) {
throw new IllegalArgumentException("Number of arguments does not match number of placeholders");
}
for (int i = 0; i < arguments.length; i++) {
statement.setObject(i + 1, arguments[i]);
}
}```
What's likely happening here is that the statement you're creating in the try-with-resources is being closed at the end of the method scope which closes any ResultSets that were opened by it
that makes a lot of sense, thanks
It's yelling about two different things
getEquipment() can be nullable, getItemInMainHand() cannot be
oh thats good to know so i can just asset then ive always null checked whenever the ide told me
Well, better yet, I'd just opt for getInventory() instead of getEquipment()
It's @NotNull but has the same getItemInMainHand() method
mmbruh whys there two ways to do it lol
I remeber there just being Player#getItemInMainHand() lmao
Well, EntityEquipment. Things like armour stands or skeletons
They don't have inventories but they have equipment
Players just happen to have a PlayerInventory which has those hand item methods too
thats actually sad that entities cant have Inventories
Some do. Villagers for instance
oh yeah true, is it just like a normal inventory like the players but the like 7 or 9 slots it has?
forgot how much they get
or was it 3?
ah its 8
Ummmm, I'm not sure
Yeah I think it's just a generic inventory. No GUII for it or anything, no special Bukkit interface because there's no additional methods to expose
wtf this is actually good information
so that basically disable villager breeding doing that
huh
For asking someone knows an API for guis with Pattern for 1.8 - 1.19?
like
" # # # # # # "
" # . . . . . . . # "
" # # # # # # "
I was about to play GTA SA on my ps2 emulator then I noticed this error, this get player is giving me a headache
Error: https://paste.md-5.net/liqejexera.bash
Main.java: https://paste.md-5.net/aqejuxeguw.java
Hopper.java: https://paste.md-5.net/zuyasobavo.java
Any fixes?
Helper from lucko
You need to null check Player from OfflinePlayer, from there you can use isOnline
OfflinePlayer player = Bukkit.getOfflinePlayer(UUID.fromString(this.data.getString(section+".Player")));
Hopper hopper = new Hopper(player.getPlayer(),block,hopperLib.getItem());
thats the part your getting the error on
and, tbh you wouldnt even need an isOnline check since that getPlayer() only returns if the players online anyways
Let me drop the files I just downloaded in its place and will test it
I am trying to make an armorstand spin but everything I try is not working. I have this bit of code I am using but it is not working can anyone see an obvious fix?
https://paste.md-5.net/oqiniburuv.cs
?paste
No errors so far, lets see in a minute
how can I make a command name configurable, what do i add in the plugin.yml
IE like have an end user pick the command name?
Youd need to inject the class extending BukkitCommand into the CommandMap
yeah im making some config files and i want to have it so they can select the command name
it'd probably be better to just use sub-commands
the best way is to utilize aliases for commands
ok perfect, thanks for answers
Working on tracking book insert/remove on chiseled bookshelf. I'm now using PlayerInteractEvent(not sure if there's other choice), but I can only use clickedBlock.getState().getLastInteractedSlot to get last interacted slot. How can I get the current interacted slot?
If schedule 1 tick later, than it returns current interacted slot. But I'm not sure if it breaks if anyone spams the actions.
Was watching the console while driving around on GTA SA, thanks for telling me that I don't need .isOnline(). I did not think the object its self can be null
i would like to make it so that the timer is same for everyone, and not just for one player
You'll have to describe more, or give some code samples, ...
i was continuing the discussion from #general to here to not flood the chat
but i wanted to make a plugin that imitates minecraft demo mode
Wdym
yeah its already solved by now
is there like a way to reset the world or we have to do it manually
using spigot
No way to reset the world except make a new one with the same seed
hm
ok
more specifically
create a new world with same seed
tp all players to that world
Hey guys, I am trying to use JDA in my plugin (Discord API). I have read multiple guides and even tried chatGPT but I can't seem to get my head around why it isn't working.
Does anyone here know of a super simple way to make a Discord bot within a spigot plugin.. It seems the errors I am having are to do with JAVA its self. I have successfully compiled and ran my plugin without JDA, so I know the issue is somewhere there
im pretty sure discordsrv has an api
The official documentation for DiscordSRV. The most powerful, configurable, open-source Discord bridge plugin out there.
does DiscordSRV allow you to build a bot though?
my end goal is having a discord bot where people run /whitelist.
slash command or prefix command?
slash
I built a bot in DiscordPY that kind of worked, but I would love if it can be incorporated into the spigot plugin, that way I don't need to mess aroudn with hosting a python bot as well
since im going to be using the Luckperms API to add people to the "whitelist". I want to be able to link peoples DIscord account to their Minecraft profile
tbh I think the issue im having is that I am not fully proficcient at java, so it could just be something simple that im overlooking
im following these docs --> https://github.com/DV8FromTheWorld/JDA
Trying to do "slash commands"
Java wrapper for the popular chat & VOIP service: Discord https://discord.com - GitHub - DV8FromTheWorld/JDA: Java wrapper for the popular chat & VOIP service: Discord https://discord.com
Or kick all players while generating the world
but right now im just trying to get it to connect to my bot and verify the token
well i plan on keeping the players in the server
Java wrapper for the popular chat & VOIP service: Discord https://discord.com - DV8FromTheWorld/JDA
apparently this should work
@Override
public void onEnable() {
this.saveDefaultConfig();
getCommand("hello").setExecutor(this);
getLogger().info("slimebob is here");
String discordBotToken = getConfig().getString("discordBotToken");
try{
jda = JDABuilder.createDefault(discordBotToken).build();
} catch (Exception e){
e.printStackTrace();
}
}
did you make a variable on discordBotToken?
cheers 🙂 ill try adapting the sample code and see how it goes
yes
oh right
this is my config yml
# This is the config file for Slimebob. Made with <3 in Perth, WA
discordBotToken:
dbUsername:
dbPassword:
i didnt see them first
String discordBotToken = getConfig().getString("discordBotToken");
i think you should put empty "" strings
what are the errors anyway?
i have tested and the plugin is getting the tokens
did someone say jda
so in this block of code, its not liking "listenerAdapter"
private clas ReadyEventListener extends ListenerAdapter{
@Override
public void onReady(ReadyEvent event) {
getLogger().info("Discord API Connected");
}
}
can we get on a VC and ill share screen?
private class not private clas
yeah you dont need to do that to send a message on startup
Hey, I'm trying to make a bungee ticket plugin, and I need to retrieve the Player's location, and I can't do that with Bungee API. Is there any solution for this?
we all have done that dont we
by location do you mean what server is it on?
aight im gonna build and see what happens
Nope, like the player location
bungeecord is a proxy and isn't the actual minecraft server, it doesnt hold a world, unfortunately
you would probably want to use plugin messaging channels or redis and send data to bungee
hmm
ofc the bungee api doesnt have a function/variable to get player's location other than the server they're on
even tho i dont know bungee api
ur welcome!
can you help me
java.lang.NullPointerException: Cannot read the array length because "<local3>"is null
give code
and is it bungee api or spigot api
bungee
this is my first time working on a spigot plugin. Is there any way to be able to not have to build every time you want to test a change in code? could I set it up so I just have to say push a commit or something?
im thinking no
public class WartungCommand extends Command {
public WartungCommand() {
super("wartung", "mentania.admin.wartung", null);
}
@Override
public void execute(CommandSender sender, String[] args) {
if (sender.hasPermission("mentania.admin.wartung")){
sender.sendMessage(new TextComponent(MentaniaUtils.getPrefix() + " §7Wartungsmodus aktiviert!"));
} else {
sender.sendMessage(new TextComponent(MentaniaUtils.getPrefix() + " §7Dazu hast du §ckeine §7Rechte!"));
}
}
}
you mean this?
I like how in python I can just run code in the IDE
do you think we can wait for another person to answer? i unfortunately dont know how to help you other than sending your code.
yeah u can
what do you mean with code man
you dont know how happy I am to see the green dot haha
or maybe idle or dnd :)
says eclipse, but do you think i could make it work in intellij?
You can use the Paper weight test plugin as a base. It comes with hotswapping and runServer/runMojMapped server options
awesome
guys, I love this community already. you have been super helpful
can I ask about velocity and fabric here too?
or is it primarily spigot help?
too easy
you may also ask about bungeecord
waterfall, velocity and papermc tho you'd have to ask in papermc
fabric in fabric
forge in forge
?fork
SpigotMC maintains the Spigot server. If you are using a fork of Spigot (such as Paper, Airplane, Purpur, or other derivative works), you should seek support in the appropriate Discord servers.
How would I go about using NMS in a 1.19.4 (paper, if possible) plugin, with the mojang remappings?
?fork
SpigotMC maintains the Spigot server. If you are using a fork of Spigot (such as Paper, Airplane, Purpur, or other derivative works), you should seek support in the appropriate Discord servers.
i forgor
Use the Paperweight test plugin as a base
It comes with a gradle setup that handles it
only lucko made an api like this? or there are others, becuase the only with this "feature" was invUI but doesn't work on old version but only on newers
Hello I have a question that's more comfortable to create a server in 1.18.2 or 1.19.4?
Thx in advance
always go as new as you can
ok thanks
Apart from 1.20 as not many plugins have updated yet
pretty much everything will work fine on 1.20
Well not ones that use NMS, but those always have to update
what's new for the API in 1.20?
oh thanks
and no, I didn't
perhaps I didn't even notice the channel :D
what's a good library to load custom gui from users, simple for them that support 1.8 - 1.19
Can I do this or I need to use method .asString(), ...?
idk, try and see
how can I update num variable?
have you tried making it final
if num is final
yeah make it final then create a new int inside the scheduler
of the value of the final int
didn't understand what should I do? if I create a variable in the scheduler and assign 0 to it, then when it is updated in the next cycle it will be 0.
send code
You need a class not a lambda
Bukkit.getScheduler().runTaskTimer(plugin, task -> {
if(num == 0) {
dataManager.addPlayerTask(player, task);
}
if(num == 100) {
textDisplay.remove();
dataManager.removePlayerInfo(player);
dataManager.removePlayerTask(player);
}
num ++;
}, 1L, 1L);```
Make a proper class for your runnable
can you use atomic int?
I imitated Minecraft's judgment system, and got the slot based on the player's target position. Now there is a new problem, player.getEyeLocation().getDirection() may not be instant, that is, the getDirection() value may be the location pointed by the player before the interaction... Is it possible to fix?
this is my solution idk
AtomicInteger num = new AtomicInteger(0);
Bukkit.getScheduler().runTaskTimer(plugin, task -> {
int currentNum = num.get();
if (currentNum == 0) {
dataManager.addPlayerTask(player, task);
}
if (currentNum == 100) {
textDisplay.remove();
dataManager.removePlayerInfo(player);
dataManager.removePlayerTask(player);
}
num.incrementAndGet();
}, 1L, 1L);
It's better to just use a new class
Ye
like that?
Yeah but you can extend BukkitRunnable
So you don't have to track taskId and make a cancel method
bukkit does that for you
oh wait why is it abstract and missing run method
Do you plan on reusing it or smth?
no
The thing is, the actual player clicked position is in PacketPlayInUseItem, but when Bukkit fires the PlayerInteractEvent, it doesn't pass it (they are cast to int, not float)
?
@EventHandler
public void PlayerInteractEvent(PlayerInteractEvent event) {
Action act = event.getAction();
if (act == Action.RIGHT_CLICK_BLOCK || act == Action.LEFT_CLICK_BLOCK) {
event.setCancelled(true);
event.getPlayer().sendMessage("You can't do that!");
}
}
Doesn't work, no errors
any insight?
We plan to expose this soon
did you register this event in the main class?
OHHHH
that's probably it
thanks
Why are you keeping an instance of a bukkit runnable in your bukkit runnable
You might want to read up on how inheritance works in Java
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
can i check block damage stages with sapi ?
blockdamage event only works first interact
i mean i wanna get this stages
Why do you need each stage?
im making custom blocks
Which event is fired when brushing a suspicious sand?
Hi, I need to know if you can make custom blocks with spigor 1.17.1
i need add custom break sounds or digging sounds to blocks
You can just use the BlockDamage event then
update so you have the abort event and it's simple
^^
but abort event is not only work for when player stop digging ?
Yeah start playing sound when BlockDamageEvent stop playing sound when abort
Start when you see a BlockDamageEvent. Fire everytime the player swings arm in the amination event. Stop when it breaks or you see an abort event
4 events in one class
Hi, I need to know if you can make custom blocks with spigor 1.17.1?
wdym ?
I mean that if you can modify the blocks, that is, place a menu or items, etc...
you understand?
if u know api
u already get ur answer
I wanted to try it but I don't know how to use the Block interface of bukkit.block and the Block class I don't know how to use ._.
Sounds like you're not experienced enough to make custom blocks
^^
same goes for you poinetr
needs a whip emoji 🙂
Making blocks requires a lot of trickery
Since you're not actually creating any new ones you're modifying the looks and behaviour of existing blocks
when did they add collision shape in the api? 😮
ok but there is also a class for the blocks but I don't know if it can function or call me from the main class
can i call events in event ?
call events?
i mean example can i call playeranimationevent in blockdamageevent
Friends, do I need to know Java to learn full spigot?
yes
Where do you learn from?
do u have guide for this ?
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
but you shoudl not, you shoudl use the damage event as a trigger to start tracking swing arm
like this
Hello I have this error when I launch a spigot plugin although it is well imported in the project can you help me please? java.lang.NoClassDefFoundError: javax/mail/MessagingException
@EventHandler
public void PlayerInteractEvent(PlayerInteractEvent event) {
Action act = event.getAction();
if (act == Action.RIGHT_CLICK_BLOCK || act == Action.LEFT_CLICK_BLOCK) {
ItemStack i = new ItemStack(Material.BLAZE_POWDER);
ItemMeta im = i.getItemMeta();
im.addEnchant(Enchantment.VANISHING_CURSE, 1, true);
im.addItemFlags(ItemFlag.HIDE_ENCHANTS);
im.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS);
im.setDisplayName(ChatColor.RESET + "" + ChatColor.RED + "This is a test item");
ArrayList<String> lore = new ArrayList();
lore.add(ChatColor.RESET + "" + ChatColor.YELLOW + "[BTools] This is a test item");
lore.add("");
im.setLore(lore);
i.setItemMeta(im);
if (event.getPlayer().getInventory().getItemInMainHand().getType() == Material.BLAZE_POWDER) { <-------
event.setCancelled(true);
event.getPlayer().sendMessage("You can't do that!");
}
}
}
I want to change the line with the arrow (<-------) to recognise the item i as an item and compare them to check if it's identicle
Ideally you'd use something like the PDC to store NBT on the item which you can check rather than relying on the item being exactly 1:1 to what you expect
?pdt
bro really?
I suck with commands
?persistent
I give up
its called pdc choco
wdym by pdt
pdc*
?pdc
oh i've looked this up...
idk how to use it lmao how would i import it xD
is there a version for 1.12.2?
Oh



I guess in that case, NBT API if you still want to use the NBT route (which I recommend)
Alternatively, yes, equals() or preferrably isSimilar()
Guys, how do I enter the server, let's write to everyone in the server, can anyone help me to use the event?
Bukkit.broadacast
can I somehow skip shulker peek animation?
Yeah
You kan tell the shulker to never peek by changing it's AI
or just disabling it (the AI)
well I need it to peek
im setting ai to false
and peek to some value
just that peek animations messes my concept up
hi everyone, does anyone know how to make a Sign GUI? I was looking around and there is a plugin like that and a post that suggest to use ProtocolLib. I was thinking if there's a better approach to do what I want and without having to use ProtocolLib and spawning that sign near the player.
I should probably use ProtocolLib but I just want to know if there's something better.
My plugin is for 1.19 and under
depends on version
1.19.2
17
thanks champ
Well, clarify. Bukkit compiles against 8, CraftBukkit and Spigot compile against 17, and to run the server you require at least 17 but up to 20
is there a limit to the amount of teams you can create
not that im aware of
ty
Is there a way to do this (delay) without using runnables, or is runnables the best method.
delayed = true;
wait(2000ms)
delayed = false;
Hello.
I'm getting a NullPointerException from PLAYER:
java.lang.NullPointerException: Cannot invoke "org.bukkit.entity.Player.getDisplayName()" because "player" is null
The following line of code errors:
meta.setDisplayName(app.parse("&%COLOUR%&l%RUNE%&%COLOUR% RUNE", null, colour, displayName));
With PARSE being:
private String parseAll(String string, Player player, String colour, String rune) {
// note these if statements were an attempt to debug the issue
if(player == null) player = Bukkit.getPlayerExact("RobuxTRex");
if(colour == null) colour = "c";
if(rune == null) rune = "N/a";
String modifiedString = string;
// Colour Coding
modifiedString.replaceAll("&", "\u00A7");
modifiedString.replaceAll("%PLAYER%", "" + player.getDisplayName());
modifiedString.replaceAll("%COLOUR%", "" + colour);
modifiedString.replaceAll("%RUNE%", "" + rune);
return modifiedString;
}
If you need any more information, just ask
Did you convert their name to a string or is that already done?
.toString()
I believe
what do you mean by that
and yes it's tostring()
Oh ok
i dont think you can even do that in spigot plugins
I wanted to add a delay to having an item used
add a debounce
Lemme look it up
alr
oh and to add onto this, the parseAll() object (or whatever it is) is returned by #parse()
Hey guys. If anyone could help me out with this, it would be much appreciated. I'm trying to check entitites on chunk unload but its always giving back 0 entities for the chunk.
I can't find anything on this! Would you mind giving an example?
on chunkunload?
@EventHandler(priority = EventPriority.LOWEST)
public void onChunkDespawn(ChunkUnloadEvent event) {
for(Entity e: event.getChunk().getEntities()) {
Bukkit.getLogger().info("Entity Detected: " + e.getType());
}
return;
„In Minecraft, when a chunk is unloaded, all entities within that chunk are also unloaded. As a result, when the ChunkUnloadEvent is triggered, the getEntities() method of the chunk will return an empty list“
I get that, but any ideas on getting the entities right before that event goes through?
For context, I'm currently experiencing a bug where a player will teleport (via a plugin that does not throw a spigot teleport event) and thus unloads the chunk behind them and makes the get / remove entitites not work on that entity then
declaration: package: org.bukkit.event.world, class: EntitiesUnloadEvent
Per the documentation, priorities are called Lowest first, and highest last
changing priority will yield nothing
a plugin calling teleport will always trigger an event
priority is only important to resolve priority conflicts between other plugin registered listeners
Tell that to essentials lol. /tp ~ ~ ~ does not trigger and event, but /back does
a plugin of yours?
This is very helpful though. Thank you so much
pretty sure it should
it will
But ya, I'll give that event a try Lynx. Was not aware it existed. Thx
The teleport event is not raised by a plugin, it's fired by Spigot
Is there a way to do this (delay) without using runnables, or is runnables the best method.
delayed = true;
wait(2000ms)
delayed = false;
/tp ~ ~ ~ is vanilla though is it not?
copypasting your question multiple times won't yield you any help
do you have alzheimers
Is there a way to do this (delay) without using runnables, or is runnables the best method.
delayed = true;
wait(2000ms)
delayed = false;
jk jk
ty
I'll try runnables
?scheduling
with essentials, its overriden by the essentials version. To do vanilla its /minecraft:tp ~ ~ ~
ty
thats some great pasta
oh I see
no spigot command for that?
I have a couple indexed posts helpin ppl
oh wait its a brick wall
yp but teleporting is still a vanilla minecraft function. Therefor should trigger the event
he's talking about the ingame command
yes
but like how tf did essentials implement teleportation
thats the real question then
you mean override?
if they used player.teleport it should fire the event
its actually Entity#teleport(Location) 
🪠
isnt player location saved in a file
yeah on log out 
i would store it every time the player moves
you're an anarchist
no point
there is so many things in minecraft that dont have a point
its amazing on server crash
you have bigger issues if yoru server crashes
1gb of memory
Still you want teh player data to be in sync with the server data, so you only save it when you save the server data
no point in saving the player location every move, but not block breaks
server crashes and you log back in inside a wall
muhahahaa
You would also be hammerign the crap out of yoru HD
kill an SSD in a year instead of 10
i do tha t irl
Turns out it was just some guard statements being weird that was makin me think the teleport event wasn't firing
told you
why would they do that x)
and even weirder why would they only do it on that one command
Lynx's solution was still what I was lookin for, so props to them
the guy with the mullet
For anyone who's interested, here's what I've been working on. Currently just for 1 server as its tested for bugs, but will eventually be public
lmao
Much appreciated. Didn't expect google to dox me like that
Yeah this channel specifically doesn't allow file upload it looks like
This plugin looks great
Or maybe I just need to verify or smthin
?verified
fuck
?image
i don't know the command
?media
haha L
?verify
Fuck this
dammit
I feel really dumb, but I just don't understand how to use runnables
I don;t know how to do it at all, could anyone give an example
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Have you seen this?
Yeah
Then what do you not understand?
I'll dm you
Idk It's just difficult for me to understand lol
It's the thing I didn't understand when i started 1-2 years ago, then i quit after a month of coding and now i'm coming back
delay
Okay simple
?img
Not verified? Upload screenshots here: https://prnt.sc/
new BukkitRunnable() {
@Override
public void run() {
Bukkit.broadcastMessage("Mooooo!");
}
}.runTaskLater(plugin, 20L * 30L /*<-- the delay */);```
the new runnable lines just maeks a new object
what's the 20l * 30l stand for?
so 20 * 30 = 600 ticks?
so 20 * 30 is 600 ticks
yeah
e.g. 30 seconds.
20 ticks are ideally one second, depending on performance tho
ok
Basicly the 20* is for converting ticks to seconds
its safe to assume 20 ticsk is one second, otherwise there are bigger issues 🤣
its ?img
?img
Not verified? Upload screenshots here: https://prnt.sc/
what's the plugin in last line do?
No attachments tho eh?
?img
Not verified? Upload screenshots here: https://prnt.sc/
brb
basically the plugin is what is scheduling the runnable
I am always scared opening prntsc links
y lol
Because there is like a 50% chance its a jumpscare link
This isn't really the place to ask but not sure where else to ask since I can't find an answer on google. Is there a plugin with jobs that rewards the player with items? Basically I have a material currency and I need players to get paid with the item not with money
There are like 5 big domains that fake lightshot that are jumpscare links
Anyone know if its possible to remove a specific particle effect in 1.19 via a plugin?
explain remove
Like the particle Damage_Indicator happens every time you hit an enemy and I believe it scales with the dmg causing more of that effect to happen which is just distracting and I want to make a plugin that removes that effect
I've tried doing some research and the only existing plugin is broken, and the rest say to use ProtocolLib which I'm not entirely sure how to use in such a way to disable it
Do you know why i'm getting an error on it? I'm sorry if this is a basic/dumb questions
Well are you providing the Instance of your main plugin
wdym
plugin this, this?
send code
@EventHandler
public void PlayerInteractEvent(PlayerInteractEvent event) throws InterruptedException {
Action act = event.getAction();
if (act == Action.RIGHT_CLICK_BLOCK || act == Action.LEFT_CLICK_BLOCK) {
ItemStack i = new ItemStack(Material.BLAZE_POWDER);
ItemMeta im = i.getItemMeta();
im.addEnchant(Enchantment.VANISHING_CURSE, 1, true);
im.addItemFlags(ItemFlag.HIDE_ENCHANTS);
im.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS);
im.setDisplayName(ChatColor.RESET + "" + ChatColor.RED + "This is a test item");
ArrayList<String> lore = new ArrayList();
lore.add(ChatColor.RESET + "" + ChatColor.YELLOW + "[BTools] This is a test item");
lore.add("");
im.setLore(lore);
i.setItemMeta(im);
if (event.getPlayer().getInventory().getItemInMainHand().isSimilar(i)) {
boolean delayed = false;
int delay = 2000;
if ((act == Action.RIGHT_CLICK_BLOCK && event.getPlayer().hasPermission("BTools.All") && !delayed)) {
event.getPlayer().sendMessage(ChatColor.GREEN + "Right Clicked a block");
event.setCancelled(true);
new BukkitRunnable() {
@Override
public void run() {
Bukkit.broadcastMessage("Mooooo!");
}
}.runTaskLater(plugin, 20L /*<-- the delay */);
} else if (act == Action.LEFT_CLICK_BLOCK && event.getPlayer().hasPermission("BTools.All") && !delayed) {
event.getPlayer().sendMessage(ChatColor.GREEN + "Left Clicked a block");
event.setCancelled(true);
}
}
}
}
well you don't define plugin..
yeah, but how would I do it? That's the part i'm confused about
You can't just blindly copy code.
xd
That's where you give the instance of your main plugin
either through dependcy injection or making a getter
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
throws InterruptedException nah man
people also dont know Arrays.asList is a thing for lore
experience
fair
Also I wouldn't recommend creating items in an event handler
You gotta learn proper oop
oop?
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.
basically
Sure but it also looks unmaintanable
add a second item and you suddenly have to copypaste everything
what;s there to maintain if it works
When you come back to it or want to update it you'll get bitten in the rear
<insert itembuilder here>
true
why are you creating this item over and over again instead of just saving it in a field
You will be your own worst enemy
wdym
just make it static 😄
in every PlayerInteractEvent, you recreate the same item
why?
why don't you just create that item once, then reuse it later
true
?bt
time to update everything to 1.20... tomorrow
eat the frog
alex back to live

"