#help-development
1 messages ยท Page 1601 of 1
player.getActivePotionEffects().clear(); does not remove any potion effects?
No. You need to remove them by calling removePotionEffect(PotionEffectType)
Oh I can just for-loop them and then call that method, ok
for(PotionEffect potionEffect : new ArrayList<>(onlinePlayer.getActivePotionEffects()))
onlinePlayer.removePotionEffect(potionEffect.getType());
More like this:
public void clearAllPotionEffects(final Player player) {
for (final PotionEffect effect : player.getActivePotionEffects()) {
player.removePotionEffect(effect.getType());
}
}
the new ArrayList<>( is obsolete
Yes, but it will remove the potion effects from the list, so I get CurrentModificationException
Probably not.
Ok
anyone know anything about gradle?
It wont remove from the list
Is it a clone then?
If it is not
This would have worked right
Yes sir
java.util.LinkedHashSet cannot be cast to class java.util.List
and what I'm trying to do is do getKeys on a config to use as a List<String> for a command tab complete
can i convert them?
And some other stuff
Yeah sure
return new ArrayList<>(conf.getKeys(...)); probably or smtng
@ivory sleet have you used the api for gradle plugins. My issue is that they have deprecated some classes that im using but have not said how to fix it
new ArrayList<>(conf) should do
Youโre creating a custom gradle plugin?
Does anyone know the config things that should be changed to get nether spawning good because there are barely spawning any mobs in the nether on my spigot server
yes
no because conf would be a ConfigurationSection which doesnโt extend Collection
I believe you need to go #help-server
Then what is the linkedhashset
Itโs getKeys()
Ohh lol
FileConfiguration#getKeys underlying implementation detail yeah
Or maybe just Configuration idk
Hmm I can redirect you to someone who knows a bit about gradle plugins if youโd allow me to
Then yea, getKeys then

sure
Google?
im trying to recreate hypixel skyblock
i am currently working on abilities / mana (gets lowered when u use an ability)
but idk how i would make a mana regen system?
any help?
Map<Player,Long> (long as mana)
how do i change the level of a fluid (eg. water)
Regenerating something should be done by iterating over the user in either a fixed timestep or in an arbitrary time step but fixed time window.
So either just let a task run that increments the value for each player based on the tick or iterate over them then check the time delta since the last regeneration
to get a real time regeneration value.
the thing is if id regen it over time it will always become higher than the limit atleast once
actually i could check that
and set it to the limit if its over it
Hello there!
I've got an issue with my code regarding sign updates in minecraft.
I have explained my issue in the following thread more explicitly and have given some code samples withing my explanation of the issue i've got:
https://www.spigotmc.org/threads/sign-is-not-updating.518192/#post-4226993
How can I kick players if they join without this error? (PlayerJoinEvent)
[14:10:11 WARN]: java.lang.Throwable: [ERROR] Illegal PlayerChunkMap::addEntity for world world: EntityPlayer['tvhee'/359, uuid='2376f1f9-2b5e-352e-b71c-c5000e29a885', l='ServerLevel[world]', x=-95.87, y=66.00, z=187.25, cpos=[-6, 11], tl=2823160, v=false, rR=UNLOADED_WITH_PLAYER](tvhee at -95.86867269427883,66.0,187.25093546288687)
[14:10:11 WARN]: at net.minecraft.server.level.PlayerChunkMap.addEntity(PlayerChunkMap.java:1982)
[14:10:11 WARN]: at net.minecraft.server.players.PlayerList.postChunkLoadJoin(PlayerList.java:393)
[14:10:11 WARN]: at net.minecraft.server.players.PlayerList.lambda$placeNewPlayer$1(PlayerList.java:301)
[14:10:11 WARN]: at net.minecraft.server.network.PlayerConnection.tick(PlayerConnection.java:307)
[14:10:11 WARN]: at net.minecraft.network.NetworkManager.a(NetworkManager.java:399)
[14:10:11 WARN]: at net.minecraft.server.network.ServerConnection.c(ServerConnection.java:196)
[14:10:11 WARN]: at net.minecraft.server.MinecraftServer.b(MinecraftServer.java:1578)
[14:10:11 WARN]: at net.minecraft.server.dedicated.DedicatedServer.b(DedicatedServer.java:479)
[14:10:11 WARN]: at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:1406)
[14:10:11 WARN]: at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1188)
[14:10:11 WARN]: at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:316)
[14:10:11 WARN]: at java.base/java.lang.Thread.run(Thread.java:831)
Get the player from the player join event and kick them.
wait
show some code, then i'll look if i can help you.
Because currently, all i've got are your errors and i can't really do anything with it except guessing
You don;t kick them, you cancel the event
Ah, but I want to kick them with a message
playerJoinEvent.getPlayer().kickPlayer("Some reason");
sorry I was looking at wroing event
PlayerLoginEvent has a method like #setKickMessage, can't I use that?
yes
And smth like #setResult, do I also need to set that?
so please
Hello, I have a very weird error:
at java.base/java.lang.Thread.run(Thread.java:831) [?:?]
java.lang.NullPointerException: Cannot invoke "org.bukkit.command.PluginCommand.setExecutor(org.bukkit.command.CommandExecutor)" because the return value of "qf.Main.getCommand(String)" is null
at qf.Main.onEnable(Main.java:15) ~[?:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:321) ~[testserver.jar:git-Spigot-db6de12-18fbb24]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:340) [testserver.jar:git-Spigot-db6de12-18fbb24]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:405) [testserver.jar:git-Spigot-db6de12-18fbb24]
at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugin(CraftServer.java:357) [testserver.jar:git-Spigot-db6de12-18fbb24]
at org.bukkit.craftbukkit.v1_8_R3.CraftServer.enablePlugins(CraftServer.java:317) [testserver.jar:git-Spigot-db6de12-18fbb24]
at org.bukkit.craftbukkit.v1_8_R3.CraftServer.reload(CraftServer.java:741) [testserver.jar:git-Spigot-db6de12-18fbb24]
at org.bukkit.Bukkit.reload(Bukkit.java:535) [testserver.jar:git-Spigot-db6de12-18fbb24]
at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:25) [testserver.jar:git-Spigot-db6de12-18fbb24]
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:141) [testserver.jar:git-Spigot-db6de12-18fbb24]
at org.bukkit.craftbukkit.v1_8_R3.CraftServer.dispatchCommand(CraftServer.java:641) [testserver.jar:git-Spigot-db6de12-18fbb24]
at org.bukkit.craftbukkit.v1_8_R3.CraftServer.dispatchServerCommand(CraftServer.java:627) [testserver.jar:git-Spigot-db6de12-18fbb24]
at net.minecraft.server.v1_8_R3.DedicatedServer.aO(DedicatedServer.java:412) [testserver.jar:git-Spigot-db6de12-18fbb24]
at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:375) [testserver.jar:git-Spigot-db6de12-18fbb24]
at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:654) [testserver.jar:git-Spigot-db6de12-18fbb24]
at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:557) [testserver.jar:git-Spigot-db6de12-18fbb24]
```obviously caused by this little piece of code:
```java
package qf;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import de.spinanddrain.jumpnrun.JumpAndRun;
public class Main extends JavaPlugin {
@Override
public void onEnable() {
getCommand("jnr").setExecutor(this);
}
@Override
public boolean onCommand(CommandSender arg0, Command arg1, String arg2, String[] arg3) {
if(arg0 instanceof Player)
JumpAndRun.getInstance().startJumpAndRun((Player) arg0);
return false;
}
}
```Plugin.yml is that:
```yml
name: QuickFixForJNR
version: 1.0
main: qf.Main
command:
jnr:
Am I stupid?
@eternal oxide PlayerLeaveEvent won't get called if I kick in PlayerLoginEvent?
no
ah because I wrote command and not commands in plugin.yml ๐
makes sense that getCommand returns null then
Hey, im trying to make a plugin that makes a new world everytime the server reopens, mostly for one-off minigames i guess, but everytime i do /stop, the next time i open the server the map isnt recreated, but if i close out of the server by the X button, it works perfectly. how could i make /stop work?
plugins loads on post world, if it matters
if this file not exists maybe every server close create this file on your own
a guess Raid data is not important when it comes to Minigames
Hello ! I try to put the player in an armorstand when it is in gamemode 3 can you help me ? ๐
You have any code or any better explanation of how you actually imagine to achieve it / whats supposed to happen?
Player#setSpectatorTarget(Entity);
ho thank you!!
i'm french my english is so bad x)
Spigot is kind of weird in this regard. Unloading will take several ticks and there is no callback for that. So at the time you are trying to delete the world file, the world might not have completely unloaded.
This is just a quick example but it should work.
public static void unloadAndDelete(final World world) {
final String worldName = world.getName();
final File worldFile = world.getWorldFolder();
Bukkit.unloadWorld(world, false);
CompletableFuture.runAsync(() -> {
while (Bukkit.getWorld(worldName) != null) {
try {
Thread.sleep(100);
} catch (final InterruptedException e) {
e.printStackTrace();
}
}
worldFile.delete();
});
}
If you want to delete the world when the server shuts down then you probably need to do the busy waiting sync.
@lost matrixi have a another question ๐ it's possible to move armorstand with velocity with a passenger ?
Sure.
okay thanks ๐
java.sql.SQLException: java.lang.ClassFormatError: Truncated class file
For some reason, i'm trying to connect to MySQL remotely and getting this error, but i don't get this error when i connect in the same server
Its me again recreating hypixel skyblock.
How would i create like groups where mobs spawn
so they dont spawn entirely over the map
only on specific locations?
is that hard?
Just wondering, will you have a World for each player?
nah just creating the basic things first
like on the hub island
im done with the ability system i can just add items rn
@honest iron
sounds cool
Also how would i do this:
I wanna add a specific amount to my max mana when i equip an armor piece or hold an item but it also need to be removed from my max mana when i unequip the armor/item
through runnable
idk how tho xD
?scheduling
I just dont know how i would detect if i (un)equip an item to add the stat
Dont use a runnable for that pls. @quaint mantle
You need to listen for events like InventoryClickEvent, PlayerPickupItemEvent, PlayerCangeMainHandEvent and so on.
I want to change the color of the block set based on the x coordinate, however all the blocks being placed are white terracotta, how can I change the color?
https://cdn.discordapp.com/attachments/694661573125472256/869580255965347850/unknown.png
Did you make sure the other methods containing different colors actually get called? Debug msg it pls
I'm pretty sure it gets called because the blocks are set to air by default and the blocks placed apart from x == 0 are also white
I think its with playerchangemainhand event
All of them
huh
It's difficult to listen for armor updates lol
Every event that could possibly change the content of a players inventory needs to be checked.
ahh
Thats why if you are really going to be doing a lot of them its a good idea to make a custom patch for the server to introduce an event for it imo
prob gonna do items first then xD
Im probaly doing a noob move but I hope someone can help me
But I get the error JavaPlugin cannot be resolved to a type I have added spigot 1.17 jar to my module path in build path.
`package me.timtendo12.dcattractie;
import org.bukkit.plugin.java.JavaPlugin;
public class Main extends JavaPlugin {
}
`
and im using JDK-16.0.1
i cant figure it out imma do smthing else xD
then you haven't done it properly
Well its added. I can even see it in my referenced library
send a screenshot of your libraries
how do you put when opening an anvil gui an item in it?
i have no idea what eclipse's "modulepath" refers to, try adding it to classpath instead
Nope doesnt do it either
I use Eclipse and have no idea what a module path is
When creating the project I chose this:
instead of JavaSE-15 since im creating a 1.17 plugin
that's not your problem
Hmm okay
you need to add spigot as an external jar library, but i have no idea how to do that in eclipse
m a v e n
is there a reason you didn't create a Maven project? Spigot is all setup for Maven
I just followed a spigot plugin tutorial and this is how many of them set it up in eclipse.
I have maven installed on my jetbrain IDE.
maven is in Eclipse too
however, to add an external Jar, Project -> properties -> Java Build Path -> Libraries -> add external Jars
what jar specifically did you add?
1.17.1 fresh from BuildTools
and you added it via the method I just showed?
Yes
then theres no reason for it to not see it
use maven and you wont have this problem
so how do i put an item in my anvil i tried
Anvil.setItem(0, customAmount);
but that didnt work
can you show an SS of your expanded project structure (left pane) with libraries?
what is the best way to automatically update plugins that are not my own? is there any spigot public api to get info on version history or something? or ill have to do web scraping stuff
There spiget but it's not the greatest; Id recommend just not doing auto updating on plugins you don't control
theres no api for downloading updates and webscraping is against the forum rules
@vivid templeAnvils require NMS, use something like AnvilGUI or another library, its a bit complicated.
oh okay thanks
then what, if the plugin author doesnt implement some auto update thing, i have to update everything manually?
Run a Project -> clean, but other than that it shoudl be working. I see no reason for it to now
yes
nice
auto updating is kinda stupid anyways, you can break stuff doing that
I'll try that
Id recommend not auto updating as an author could upload anything and it'd auto be in your server and some authors release beta vers on spigot which shouldent be on prod servers
hmm, didnt work either. I guess i'll just make a fresh new project
heyyyyyy @eternal oxide you said you updated the pathfinder... can i have it please.
?paste
low low price of $299.95
๐ณ
๐
is requires spigot; a must have in my module-info.java? it seems to have fixed my problem
but it does give me the warning: Name of automatic module 'spigot' is unstable, it is derived from the module's file name. so im not sure if I should use it or not
Are you using eclipse without a dependency manager?
I do not use a module-info.java. Never have. Your dewfault is set to create one https://stackoverflow.com/questions/57693877/eclipse-why-module-info-matters
Eclipse does have a 'create module-info file' option in the new Java project wizard. Unfortunately it is hidden way on the second page of the wizard and is easy to miss. It defaults to creating the file. โ greg-449 Aug 28 '19 at 14:55
I'd disable that
How do i disable item durability change
@EventHandler
public void onDurabilityChange(PlayerItemDamageEvent e) {
e.setCancelled(true);
}
have that
but it doesnt work
i want it for EVERYTHING
Did you register the Listener Class in your Main Class ?
yea
Try printing out a Message to see if it even calls the Method ?
hmm
it works now
o
Yeah that would've been my next suggestion
now trying to figure out this
Groups of what
groups of mobs as locations
Just take an object oriented approach.
For example:
Class SpawnLocation
Location location;
int currentActiveMobs;
long lastSpawnTime;
Class SpawnDomain
Map<UUID, SpawnLocation>
Class SpawnManager
Map<CustomMobType, SpawnDomain>
Then iterate over all SpawnLocation instances and spawn mobs when needed. (Using warmup and cooldown timers)
am I able to disable it?
We dont know... Are you?
pretty sure if you have no file it won;t use it
Most of my plugins have been compatible with java 8 and module-info.java came in java 9. More recently I moved to Maven which is a dependency manager, so again uses no module-info.java
but if you are stuck on basic Eclipse projects, that post says its hidden on the second page of new project wizard.
hey, anyone knows how to fire code when player equips or unequips armor ? (like helmet). i'm stuck because the code i tested when searching on google simply doesnt work
You basically have to listen for several events.
Every event that could modify the players inventory.
i'm basically trying this
{
Player player = event.getPlayer();
ItemStack helmet = player.getInventory().getHelmet();
if (helmet.getType() == Material.CHAINMAIL_HELMET)
{
player.sendMessage("you put on a helmet");
}
}```
armorequipevent is a library i found on google
Send it. Im pretty sure that the ItemStack is not in the slot at the time the event fires.
Get the ArmorType from the event instead of searching for it in the players inventory
Thats a rule you should follow: First search in the event for information.
The Lib also has a Usage right there https://i.imgur.com/6aN0o37.png
yep i saw the usage
But you decided to ignore it?
So you should prob. use these Methods stated in there
but didnt quite understand it
Basically
getNewArmorPiece >> What the Player changed the Slot to
getOldArmorPiece >> What it got changed from
Is how I'm understanding it
how can i make this work
thanks both, i'mma try this right away
Try \[ ?
Escape the char
\\ *
Two times \
I dont have brain atm haha
ye
If your IDE style is set up like this then yes
I've tried for a couple of days to make a door to break when right clicked and it always breaks in half
Check if the upper / lower Block is also a Door Block and break that one too
actually this is technically correct
but one more \ is added to escape the \ behind during compilation
this tho ^-^
I think you can get the other block from the BlockState and break it too
ye
I told you two days ago, cast the door to Bisected and you can get top and bottom to break both.
I'm trying to make a bedwars plugin and I want to stop people from breaking blocks that weren't placed during the match, anyone have an idea of how I could do this?
I found a post with someone asking the same thing, but it was with metadata
add any Blocks placed to a Set<Block>, if the block is in the Set allow it to be broken and remove it
Guys I'm making a rank sys , but when I change the num of rank , the rank don't change ,why ? Using player.yml config
I'd guess at sunspots interfering.
Explain More
It measn you literally gave zero information for anyone to work with
You may as well have just said "it doesn't work, why"
I'm making a rank sys but the server don't detect the change of the rank var in the file @eternal oxide
we'll start at teh beginning then... Is the server turned on?
You are going to have to show some code, any errors, what happens and what you expect to happen
also it might be possible you have issues with the config, do you read it correctly?
@sand rune I played minecraft half way and my plugin cannot load, you know why?
Did u put
@Override
public function onEnable
good point
yes i did, but the @Override is not needed just sayin
Don't remove it to make the func work
ok im done
I like to keep it as it can show up other errors if you do things like, forget to extend JavaPlugin
?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.
theres probably been enough people asking questions here with an empty plugins folder
There is no err , I expect to see the rank changed , non expected nothing happened , the code is from stream on YT
๐ค
Without code we can't help
no no, you just have to imagine it being there
It's like going to the dentist and refusing to open your mouth
๐
at the very least even a link to entire remote repository helps
?paste your code
after config file is changed
he probably not reading from plugin folder lol
and reading from the jar's resource
I'd bet on not saving
or maybe he overwrites everytime the resource is loaded
how are stairs and trapdoor bisected
How can I catch this? io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: no further information: bungee
I've never used yaml before I started making plugins, should getConfigurationSection("itemshop.categories") get the categories section under itemshop?
YML structures:
itemshop:
categories:
category1:
.categories
Would that work even with another thing being above itemshop?
Sorry, should have added that
size: 54
itemshop:
catergories:
they are not
Then getConfigurationSection("itemshop.categories") will still only give you section under "itemshop.categories"?
Which event do I need to listen for?
how can i add a "comment" in my config file? Because when it builds nothing that i write shows?
I use "// Message"
only door qualifies for bisected
ive also tryed #
it is #
hmm
oh trapdoor is if it it teh top half of the block or teh bottom
same block
stairs is the same, which way up
if you save sth into the yml, comments after first section gets removed
ahh ok
shit description then
Hello everyone! I'm new to Bukkit and Java, so help me please. I posted on Bukkit.org, but the post has been awaiting moderation for 20 hours now, so i decided to ask for help here. My post:
I want to make some code run every 10 ticks in my Commands class (the trigger is in Commands, and i don't know how to move it to Main). I tried using runTaskTimer() and it says that the method is deprecated, although no errors found. Also, i need the task to cancel itself 10 minutes after start.
This is what i was trying to do:
Bukkit.getServer().getScheduler().runTaskTimer(Main.getPlugin(Main.class), new BukkitRunnable(){//some code//}, 0L, 10L)
Any help is appreciated, thanks.
That shouldn't be deprecated afaik, what is your IDE saying?
method runTaskTimer is deprecated
wait a sec im gonna check it
Maybe its because im using BukkitRunnable?
Maybe, try using a lambda
true
i used it just that day
It is not deprecated
?scheduling
'runTaskTimer(org.bukkit.plugin.Plugin, org.bukkit.scheduler.BukkitRunnable, long, long)' is deprecated
I think it wants a Runnable instead of a BukkitRunnable
Thanks! it looks like a useful documentation, reading rn
I'm gonna try that
You can do new BukkitRunnable(){code}.runTask
Yeah i read the documentation, thanks!
damn this is a neat feature
๐
i dont see anything about webscraping in the forum rules, so... can i do it?
Looks like this was the solution, thanks everyone! Actually i have another question, how can i make a boolean that is set true when the BukkitRunnable is started and set to false when its cancelled?
I tried to create a normal boolean but IDE says something about accessing from inner class and final
I was told by a forums staff that it was against the rules, so idk.
Variable 'GameOn' is accessed from within inner class, needs to be final or effectively final - this exactly
Is it fine for it to be static?

I think yes
and ifi do ill be banned or what. I will not check it a thousand times a second or something, it wont be DoS, it will be once a day, max
Better solution would be to have some method which is called once the game finishes
OnGameFinished for example
probably a ban
Ok im gonna try that
?paste since you cant use codeblocks correctly
Then pass the object with that method (e.g. GameManager), which should be final
In your runnable you can then call methods on the object
Ok im gonna try that
Cool gl
Bukkit.getPluginManager().isPluginEnabled("x") is it too early to do it in onEnable?
@fluid cypress
First of all, get your update ID. id=2 replace that with your plugin ID.
https://api.spigotmc.org/simple/0.2/index.php?action=getResourceUpdates&id=2&page=1
Then the URL for your JAR file is literally just:
https://www.spigotmc.org/resources/pluginname.pluginid/download?version=updateId
I guess Do not access the forums via automated mechanisms. @fluid cypress would be the rule
But yeah really questioning if thatโs bannable myself
its possible without webscraping so I guess if you go that route, no it isn't
you still cant download plugins automatically tho afaik
^
try what I sent. That works
I want to put cooldown in a item but it doesn't work when before it works, can someone help me please?
Is someone able to look at my issue?
Make a plugin with the jars for all other plugins and then extract them if enabled as modules
(/s)
But I mean yeah, you should really wait until https://github.com/SpigotMC/XenforoResourceManagerAPI offers a proper download API instead of hijacking what the backend of the spigot site use
how do i get the id? the numbers after the . in the link?
yeah, just save that as a field somewhere in your plugin
^ When someone has the time could you look at my error?
with update ID you mean resource_id?
i mean, just id
I think your commands section of the plugin.yml is incorrect
@fluid cypress No, the updateId is the ID of the specific update you get through https://api.spigotmc.org/simple/0.2/index.php?action=getResourceUpdates&id=2&page=1
yea, the id key i mean
can someone help me please?
and how do i know how many pages there are
it is resource id from spigot page
idk
will have to guess that
or just continue searching until you find your desired version
my desired version is the latest version
@fluid cypress i have this, it works
thats only an update checker
thats not what they want
what they want?
they want to actually download updates automatically
i think its imposible to do
sounds like a hassle
the ids of the response of this dont match the version ids
https://api.spigotmc.org/simple/0.2/index.php?action=getResourceUpdates&id=4216&page=29
the latest for that plugin for example is 410087 but that doesnt even appear on any page
but this https://api.spigotmc.org/legacy/update.php?resource=4216 plus some little subtle scraping may work mmm
again scraping is against the rules
what if i load a page once an hour
are you automating it?
i want to
?paste
then its against the rules... Do not access the forums via automated mechanisms.
My plugin won't enable, I feel like I did something blatantly wrong here, anyone got any ideas?
https://paste.md-5.net/hopodaqige.cpp
what is line 87?
I sent what's on line 87 in the first paste
Wait
The material value isn't in a string in the yml
you've sent a code block
Changed nothing
not line 87
I sent line 87 and everything it does*
and on enable 39 is what?
Basically class.GUIInfo
but plugin pages or whatever they are called, are not part of the forum
It worked for the GUI I did before
okay well
since your code isnt saying anything about your error
because you cant just sent those line alone
i need to guess
either its your itemShopConfig, your configuration section, anything within your config
they are though
Here's what line 87 is in
https://paste.md-5.net/oducukayuz.cs
and now i have to search line 87? damn, just sent it
Bedwars.itemShopConfig.getConfig().getConfigurationSection("itemshop.categories").getKeys(false).forEach(category -> {?
is this your line 87?
Yes, and that's what I sent before...
no you've sent a codeblock. not a single line. a codeblock
:/
GodCipher being GodCipher againโฆ
check if itemShopConfig is not null. check if the file exists, check if the configuration section is not null.
Guys this is what console said when i loaded the plugin
Help me please, i don't understand whats wrong
[00:25:35] [Server thread/ERROR]: Could not load 'plugins\MobHunt.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: Cannot find main class `com.giovolo.mobhunt.MobHunt'
your plugin.yml has com.giovolo.mobhunt.MobHunt, but that class doesn't actually exist in your project
but it does
no it doesn't
Oh my god
Sorry guys im dumb
I fixed it first attempt but was building it in wrong folder
Thanks
anyone has an idea of a plugin
anyone knows if its possible to convert the encrypted authme passwords back to plain text somehow?
Well if it is encrypted you just need the key
But if it is hashed - not really no
Well
It is possible
Ok then no
The way it works is that you compare the output of the hash together
And you never store the password d
yea i know but my question is more about, someone who knows about the plugin more than me, maybe there is a way idk, or at least i want to know what algorithm it uses or how does it do it, to use it in my own auth plugin. i want to change a couple of things, and also maybe use it to authenticate from somewhere else, a website for example. i also want the pw in plain text bc im tired of people forgetting it and believing that i can tell it to them somehow. but well, at least i could save the attempts before hashing it, and if the hashes match, save little by little the correct password of each user in plaintext or encrypted, instead of hashed, in case they forget it in the future
Someone here who has a good ProtocolLib knowledge ?
just ask your question
I want to make a formed cobble (lava cast) to air after 6 sec
@EventHandler
public void onBlockForm(BlockFormEvent event) {
if (event.getBlock().equals(Material.COBBLESTONE)) {
BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
scheduler.scheduleSyncDelayedTask(smpUtilities, new Runnable() {
@Override
public void run() {
event.getBlock().setType(Material.AIR);
}
}, 300);
}
}
this code doesnt work
post it in one channel
sorry
getBlock().getType()
I think
what exactly doesnt work
it doesnt set it to air
nothing
Block will never be equal to a Material
hence you'd have to compare the material cobblestone against this (called from BlockEvent subclass)
Shouldn't your IDE warn you about that ๐
oh i didn't even saw that

Is there anyway to check if a block drops an item regardless if a player breaks it or not? For example, when the bottom of a sugar cane is broken, any other sugar cane will break and drop its item.
my maven tab on the right of the screen disappeared for some reason, how can i put it back?
is there an event that can give you the location where a snowball is breaked after its thrown?
okay and how can i get the location?
getHitBlock()
getHitEntity()
declaration: package: org.bukkit.event.entity, class: ProjectileHitEvent
How to get the value of a persistent data container
?pdc
Still cant figure it out
how not
guess the tutorial was trash ๐ข
or they just misunderstood it, it is a good tutorial 
thanks โค๏ธ
like

getPersistentDataContainer().get(namespacedKey, persistentDataType)
e.getPlayer().getPersistentDataContainer().set(new NamespacedKey(GenderColor.INSTANCE, "gender"), PersistentDataType.STRING, "E");
i wanna get E
e.getPlayer().getPersistentDataContainer().get(genderKey, PersistentDataType.STRING)
oh ok
Jesus christ
Incompatible equality constraint: Boolean and String
if(e.getPlayer().getPersistentDataContainer().get(new NamespacedKey(GenderColor.INSTANCE, "gender"), PersistentDataType.STRING)){
?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.
what is the easiest way to get the nearest block that is not air from a location?
it returns a string not a boolean

No shot you've done that
No way..
if (string)
^ this doesnt make sense
can any body help me
im trying to make my spigot server multiplayer and i did the port forwarding and i put my ipv4 in the server propeties i dont know what i did wrong
not the channel
Hello !
Is there a way to simply translate hex color codes please ?
(Im using spigot 1.16)
I've found no method :/
I think I have to code it by myself
What do you mean translate?
You can use the vanilla style hex colors
I mean, turns #123456 to a color code
@eternal night YOU'RE WHO MADE THAT RESOURCE LMAO
THANKS LOL
i just realized when i was closing the tab
thanks very much
ChatColor#of(string hex) (the bungee chat ver)
Yeah i've found it, but there is no method for spigot xD ... ๐ญ
lol xD
Is there anything wrong with this code? Yes, i am registering it to the plugin
You forgot the @EventHandler
@quaint mantle
...
im f-ing stupid
thanks for getting rid of my depression
I'm trying to find a way to obtain the mods of someone trying to proceed with the Forge handshaking, but having difficulties, does anyone here know how FML2 protocol works? and how to retrieve the mods?
i'm specifically looking for forge sending the mods and not trying to acquire the mods thru a bytebuf, yet.
I think wiki.vg has some information but other than that I'm not sure if anyone here knows much about it
There is an open source plugin you can take a look at however
wiki.vg does not explain fml2 protocol....
it only explains fml1 protocol which is <1.12
Oh you want the new one
I mean you could ask in the Forge discord or take a look at their github page
Sent
Hi! Is it possible to return a argument in a message.
So if I use /command example1 example2
It says:
[Info] Example1 has opened. Click to warp
Example2 will be used as arg the /warp command โฆ).command, โ/warp โ + argument
If that makes any sense
Sounds possible if I understand it correctly
Im not sure exactly what you mean but like you want an arg in a message?
If so it's a string so you could just fine
he wants a clickable message
Oh I understand
using arg[0] as the Example1 for the text, and arg[1] to be used in the /warp arg[1]
clickable text command
too busy here to tell him how to use text components though
@EventHandler
public void onBlockForm(BlockFormEvent event) {
if (event.getBlock().getType().equals(Material.COBBLESTONE)) {
BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
scheduler.scheduleSyncDelayedTask(smpUtilities, () -> event.getBlock().setType(Material.AIR), 300);
}
}```
still doesnt wotk, I want to set cobble (caused by lava casting) to air after 6 seconds.
Thats fine I think I understand it now. Thanks for your help. It was just the little push I needed!
there is no event by the time your task runs, store teh block in a final variable to pass into your task
thanks
@EventHandler
public void onBlockForm(BlockFormEvent event) {
if (event.getBlock().getType().equals(Material.COBBLESTONE)) {
Block block = event.getBlock();
BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
scheduler.scheduleSyncDelayedTask(smpUtilities, () -> block.setType(Material.AIR), 300);
}
}```
this didnt work
Did you register the listener?
@Override
public void onEnable() {
getServer().getPluginManager().registerEvents(new EventListener(this), this);
}```
Try some debugging messages.
- Does the event get called when cobble is created
- Is the method executed later on
make the Block variable final and add some sysout to make sure it all runs
getCooldown returns the cooldown of items like ender pearls
Not the swing cd
so, before it works, now no
and i don't know how it has stopped working
gotta make sure we have a player XD
it is because if i dont put player != null if throws an error
This here is the most masochistic thing you can do in java coding. You are hiding all your errors. So if something stops working you have no idea why
all works fine less cooldown
Your check is obsolete. If the player is null at that point then the method crashed way way before.
The very first thing i want you to do is remove the entire try catch clause and the player != null check
Btw what IDE do you use?
what do you mean with IDE?
Eclipse, Intellij, Netbeans.... Notepad
eclipse
notepad++
Then i want you to go into your class and hit
Ctrl + Shift + F
Then remove the try catch clause and the player null check.
what it does?
Formats your code so its readable
Hi, is normal that first command argument is ignored, when command is too short?
No. Nothing is just ignored. But you would have to elaborate on that.
do you add the command in plugin.yml?
Yes
register it in the method onEnable?
Yes
Please show your code and tell us what you expect it to do and what you observed it currently does.
could you pass the code usin ?paste?
Did you format your file and removed the code that is a metaphorical shot to your own knee yet?
yeah, i do it, but still no working the cooldown
Show us your updated code pls and keep an eye out for any stack traces you can send.
-> @SuppressWarnings({ "deprecation" }) this should never occur in spigot code. If spigot deprecates a method then there is a cleaner alternative implemented.
Ok can you narrow down the problem to some lines that you suspect do cause the problem and also look out for errors in your console?
so, if i delete it how can i do to detect if a player right click on a sword?
You just delete the try catch clause. The code in it stays
when a player right click an iron sword that i give when join, it will be teleport to a coords that admin put, remove the inventory and put in the inventory a full iron armor, diamond sword bow and arrow and put in the diamond sword a cooldown to teleport back to the spawn when right click, before y change the messages to a file messages.yml the cooldown will stop work
Im trying to save a item to a config, along with its NBT, lore, and name, etc. How do?
I have tried ItemStack.serialize()
but it doesnt fucking make sense
i delete it, so, deprecate is for item in hand detect
config.set("item", itemStack)
that doesnt work either...
If you want to save it into a yml file just... sniped by ElgarL
what doesn;t work about it?
Let me try it
But i tried it a month ago
and took a break from the project
cause it made no sense
What spigot version are you on?
its how to store ItemStacks. Always has been
1.17
1.13
Then you should have no problems just throwing that into a yml config
Did you remove the try catch by now?
[15:17:09] [Server thread/ERROR]: [SafeCheck] Exception while handling click event in inventory 'Blocks', slot=11, item=BLACK_STAINED_GLASS_PANE
java.lang.IllegalArgumentException: Cannot set to an empty path
https://paste.md-5.net/gipitajoha.cs here is deleted
at me.silentprogram.safecheck.inventory.GuiClass.lambda$createBlocksGui$10(GuiClass.java:188) ~[?:?]
plugin.getConfig().set("blocks." + item.getItemMeta().getDisplayName(), item);
line 188
item.getItemMeta().getDisplayName() is an empty String
do items have a default display name?
Like
if i take a aok log
would its display name be Oak Log
The ItemMeta only contains a display name if it was set earlier
how do yo do put messages like this?
thanks
Then try again and look out for any errors
how do i get the items name then
no throws any error in console
only the cooldown doesn't work
is like the code jump the cooldown
If it doesnt have a display name then you might just use the Material enum.
i don't understand why
aight bet
wait
but
Hmm, what would the best way to do this
If i have blocks.NAME.item in my yml file
What should i put for name
You dont need to read the displayname yourself afterwards anywas as the ItemStack gets serialized into the path.
Its probably better to just throw a List<ItemStack> into the config
fuck your right
๐
selfrole Add or remove a selfrole from yourself.
cleanup Base command for deleting messages.
embedset Commands for toggling embeds on or off.
info Shows info about CafeBabe.
licenseinfo Get info about Red's licenses.
mydata Commands which interact with the data CafeBabe has about...
set Commands for changing CafeBabe's settings.
uptime Shows CafeBabe's uptime.
customcom Base command for Custom Commands management.
findcog Find which cog a command comes from.
names Show previous names and nicknames of a member.
casesfor Display cases for the specified member.
listcases List cases for the specified member.
reason Specify a reason for a modlog case.
permissions Command permission management tools.
You should probably return true in your command. Other than that it looks fine. What exactly doesnt work?
no throws any error, all works less the cooldown
When I use /gamemode, args are normal, but when I type /gm, it always shows args length as 1
Im sorry but im really not in the mood to touch this if else mess right now
List<ItemStack> items = (List<ItemStack>) plugin.getConfig().getList("blocks");
items.add(item);
plugin.getConfig().set("blocks", items);
@lost matrix
Very weird. Print out what the content of your array is.
Looks alright. But you should probably keep the List in memory and only save/load on start/shutdown
Doesn't matter what I type, using /gm it always shows 1 args
This in a click event is just a lag machine for your server
Ah nvm. FileConfiguration is in memory anyways.
alright
Thought you would load the File from disk again
ItemStack i : plugin.getConfig().getList("blocks") how would i cast this list to an itemstack?
Again: Print out the content of your args array.
im having some trouble
Just cast the List<?> to a List<ItemStack>
I dont think that applys here
Leme send context
List<ItemStack> items = (List<ItemStack>)plugin.getConfig().getList("blocks");
items.add(item);
plugin.getConfig().set("blocks", items);
for (ItemStack i : plugin.getConfig().getList("blocks")) {
i just want to loop through the itemstack list i put in the config
List<ItemStack> items = (List<ItemStack>)plugin.getConfig().getList("blocks");
for (ItemStack item : items) {
}
Or:
for (ItemStack item : (List<ItemStack>)plugin.getConfig().getList("blocks")) {
}
[00:29:52 INFO]: 1
[00:29:52 INFO]: asdgf```
I was trying to cast to ItemStack ๐คฆโโ๏ธ
Pls show the full code to this
List#remove(thing)
Well doesnt it have to be a number?
It doesnt. If its an Object then the list will be iterated and for each Object in there .equals() will be called until a matching one is found
Aweseome
I could now go about time complexities and how bad this method is, but i think for your case its fine. As long as the list doesnt contain like a thousand elements.
this is a specific question but are there any people here who are experienced with creating fan wikis or wikis in general, so far I've consistently used the github wiki but it's starting to become clear that I need a different (and hopefully better) wiki for users specifically at this time
the only such system I know is wikia now known as fandom but I've never really used it, any other recommendations?
I don't have the time to make a website from scratch myself
Share if you found something nice. Im having the same problem.
Nope. Im currently at the point where i got a udemy course for advanced React.js to just write my own wiki lib XD
yeah I just don't have that kind of time rn
I started working on a react website but that thing is massive time sink
TNT exploding calls the EntityExplodeEvent, but how is the BlockExplodeEvent called?
isn't that event for getting blocks that got blown up?
no i think thats in the event.blocklist
oh wait, idk what else it is, but it is called when u right click a bed in the nether or end
Bed for example. Or if someone calls World#createExplosion()
ok ty
event.getAction().equals(Action.RIGHT_CLICK_BLOCK) && player.getInventory().getItemInMainHand().getType().equals(diamond_sword1)
yeah was going to say beds are the only exploding block I am aware of
if i put like this should detect the item that the player right cliking no?
This detects if the Material of the ItemStack the player is currently holding is equal to this "diamond_sword1" Material
yeah, diamond_sword1 is Material.DIAMOND_SWORD
Tested on clean server, without any other plugins
And now if you just type in /gm what messages do you get?
[00:44:51 INFO]: 1
[00:44:51 INFO]: asdf
[00:44:54 INFO]: Axer22 issued server command: /gamemode asdf asdf asdf
[00:44:54 INFO]: 3
[00:44:54 INFO]: asdf
[00:44:54 INFO]: asdf
[00:44:54 INFO]: asdf```
I can send jar
Have you tried just using aliases instead of registering the command twice?
When squaring a negative integer value in Kotlin, it seems like it returns a negative result. Does anyone else have that issue?
Use brackets before squaring
But show some code pls
like (-3)^2
So basically I have code that does the following: ```kotlin
val dxSquared = (dx * dx)
val dzSquared = (dz * dz)
This should not return negative numbers.
I know. But the dzSquared value is negative when the dz is negative
In clear defiance of all mathematical rules
Thats just the xor operator
Did you print out the value of "dxSquared" right after the multiplication?
I dont see how something like this is possible...
Neither do I
And I have started to think if there could be a serious bug within Kotlin itself
Is the operator overloaded?
Probably not...
What do you mean by "operator overloaded"?
Kotlin supports operator overloading
Try printing the type of dx pls
And also show some more code...
Is the resulting number correlated with the actual number that should result out of the equation? (Like same value just with a negative sign)
val vec = Immutable2dVector.fromLocation(loc)
val dx = loc.blockX - center.x
val dz = loc.blockZ - center.z
var newX : Int = vec.x
var newZ : Int = vec.z
Bukkit.broadcastMessage("centerX: ${center.x} centerZ: ${center.z}")
Bukkit.broadcastMessage("targX: ${loc.blockX} targZ: ${loc.blockZ}")
Bukkit.broadcastMessage("dx: $dx dz: $dz")
if (ellipsoid) {
val dxSquared = (dx * dx)
val dzSquared = (dz * dz)
Bukkit.broadcastMessage("dxSquared: $dxSquared dzSquared: $dzSquared")
val dU = sqrt(dxSquared.toDouble() + dzSquared.toDouble())
val dT = sqrt(dxSquared / xRadiusSquared + dzSquared / zRadiusSquared)
val f = (1 / dT - 1 / dU)
Bukkit.broadcastMessage("dU: $dU dT: $dT f: $f")
newX = (loc.blockX + dx * f).roundToInt()
newZ = (loc.blockZ + dz * f).roundToInt()
?paste
for (ItemStack i : (List<ItemStack>) plugin.getConfig().getList("blocks")) {
ItemStack item = new ItemStack(i);
ItemMeta itemMeta = item.getItemMeta();
List<String> lore = itemMeta.getLore();
lore.add("");
Did you try manually adding ItemStacks into the List?
ItemMeta#getLore will not return an empty list if the item has no lore
it will return null
Ah i see. If the ItemMeta doesnt contain a lore then getLore just returns null
this is documented in the javadocs
blocks:
- ==: org.bukkit.inventory.ItemStack
v: 2730
type: TUFF
ok
List<String> lore = itemMeta.hasLore() ? itemMeta.getLore() : new ArrayList<>();
the center of a block is (x,y,z) + 0.5
bet, thank you
AAAAAAAAA
now itemMeta is null
how do i fix that
because
lore is a arraylist but what is itemMeta
itemMeta is an ItemMeta object
Here is the output of each value: ```
[00:38:32] [Render thread/INFO]: [CHAT] centerX: 0 centerZ: 0
[00:38:33] [Render thread/INFO]: [CHAT] targX: 158 targZ: -895721
[00:38:33] [Render thread/INFO]: [CHAT] dx: 158 dz: -895721
[00:38:33] [Render thread/INFO]: [CHAT] dxSquared: 24964 dzSquared: -842774511
[00:38:33] [Render thread/INFO]: [CHAT] dU: NaN dT: NaN f: NaN
So bc dzSquared is negative, dU, dT and f are all NaN
Thats a simple int overflow...
So I am dealing with an integer overflow?
this isnt working since ItemMeta is abstract
895721 * 895721 is way bigger than 2^31
ItemMeta is only null if the ItemStack is of type AIR
Huh... Then make a simple null check just to be safe
Yes. If the numbers dont go up too much you should be on the safe side with this.
You cant give an ItemStack an ItemMeta.
Every ItemStack except AIR has an ItemMeta.
then why is it null..
Show some code
for (ItemStack i : (List<ItemStack>) plugin.getConfig().getList("blocks")) {
ItemStack item = new ItemStack(i);
ItemMeta itemMeta = item.getItemMeta();
List<String> lore = itemMeta.hasLore() ? itemMeta.getLore() : new ArrayList<>();
lore.add("");
lore.add(ChatColor.RED + "" + ChatColor.BOLD + "Right-click to remove item.");
itemMeta.setLore(lore);
item.setItemMeta(itemMeta);
lore will always be empty
ItemStack item = new ItemStack(i); <- What is this line supposed to do?
create a clone of the item
i guesse
i could do .clone()
No. Use ItemStack#clone() for that.
is your blocks in yoru config Materials?
No its items
ah k
Make sure the ItemMeta didnt get nulled in the config for some reason
ElgarL any other way to store into a players object other than using nbt tag?
It had air in the config...
PDC or NBT tag
PersistentDataContainer
he's on 1.8
wait, no this isnt the issue wtf
- ==: org.bukkit.inventory.ItemStack
v: 2730
type: GRASS_BLOCK
this is giving that itemmeta error
So there isn't any other way?
no
1.8 user 
Use a hundred hashmaps and manually read/write stuff into hundred yml files.
Or just update to a version thats not almost a decade old ^^
You smell
so I should probably use https://www.spigotmc.org/resources/nbt-api.7939/
If you use 1.8 and dont plan on updating you can also just use NMS for that. But this library is quite nice.
it's almost like working with near-decade old versions is a hassle
Its literally:
ItemStack itemStack = ...;
NBTItem nbtitem = new NBTItem(itemStack);
nbtitem.setString("Stringtest", "Teststring");
nbtitem.setInteger("Inttest", 42);
nbtitem.setDouble("Doubletest", 1.5d);
nbtitem.setBoolean("Booleantest", true);
nbtitem.getString("Stringtest");
nbtitem.getInteger("Inttest");
nbtitem.getDouble("Doubletest");
nbtitem.getBoolean("Booleantest");
Does what save in a file?
so for what im doing it would save on the player
The data is written right into the ItemStack and then loaded/unloaded with where ever the ItemStack is stored. So Player invs, Chunks etc
Entities also have NBT data. So if you want to have player specific data then you should store it into the players NBT data. This one is saved when he logs of..
so if I was gonna use this to make a cooldown i'd want to use a itemstack?
If you want to add the cooldown to the itemstack then yes
and it would be separated for each player correct
or is that something i'd need to implement myself
This would require you to Map the cooldown to a player. There are several approaches to this problem.
The NBT data is not temp
I'm not talking about nbt data
.
talking about the player
ima just figure this out later
just gonna have is set to a db for now
Have what set in a db?
their cooldowns
And you gonna check the cd each time they try to use the item then?
I had set it up yesterday and then later on ElgarL mentioned that I can store it in the players object so it's faster
Using a db for life cooldown checks is one of the fastest ways to introduce synthetic crippling lag to your server.
keep it in memory and only save when the player quits. In a db or the nbt data.
Let me make it clear what I'm trying to do
Currently I have a db that I store the players cooldown whenever they pick a kit
Is it possible to disable or modify join/leave messages from a bungeecord plugin?
Sure. Just write a second one with a higher listener priority and clear the messages
Sorry, I don't quite get what you mean :P
So you got some random bungee plugin that adds join messages, right?
Oh haha, I meant I am making a bungeecord plugin, and in that plugin am trying to modify/disable the vanilla join/leave messages
but can't figure out how :P
what lol?
obviously it depends how you use it
well that's nice xD ava.sql.SQLTransientConnectionException: HikariPool-2 - Connection is not available, request timed out after 30000ms.
If its on the main thread then it doesnt
you can store stuff in memory and out of memory when the players not on, definitely the quicker way
why would you ever do anything with the main thread with databases
I believe I made mine on the main thread
You dont.
exactly
Hence my comment
then put it on another thread simple fix
wait
hold up
how do you tell if it's on the main thread
Looking on how I did it. Doesn't look like it's on the main thread
since you dont know
If the methods are called from within an event (that isnt async) then you are on the main thread. Everything you do in spigot basically happens on one thread.
iots probably on the main thread
I think there is a static method somewhere you can call to check if you are currently on the main thread...
Thread.currentThread() ?
Yeah I'm not running it on the main thread
Or use completable futures. This way you have callbacks you can use.
hes just gotta stick to the bukkit scheduler for now lol
Just make sure to sync with the main thread afterwards
I'm not using bukkit scheduler
what are you using to run it on another thread?
Java 7 be like
new Thread() {
}.start();
XD
well I'm using System#currentTimeMillis
Bukkit.isPrimaryThread()
.
so I was right
yep, I'm late reading
All good!
tells you if your current thread is running sync
You back to sql?
Never set up the other thing
k
Nowhere. Thats a very edge case method for really specific use cases.
Wait. I think i lost the thread (in terms of string)
in that case, once the command comes in, instantly spawn off an async thread and return true (to consume) in the command
in your async thread you do all yoru sql query, then decide what you are going to do. Jump back sync to either tell them they are waiting on a timer, or perform the command.
easy to jump back sync, all you do is runTask
so should I still use sql for it
teh scheduler will run it on the next tick sync
where you store your data is upto you
The very first question you should ask yourself: Do you really need a DB?