#help-development
1 messages Β· Page 1573 of 1
i think you might need to specify somewhere if its in maven repo or not
and im not sure how
it keeps trying to download from maven central π€£
thing is it works fine with intellij run button
but idk if that uses ant or not
this is returning false in a wall sign Block signBlock.getBlockData() instanceof Directional, what am i doing wrong?
.setHelmet
@fluid cypress Sign is a Rotatable, Directional are for stairs for exemple
Deprecated, I use 1.17 spigot, is there a new method?
Does armorStand.getEquipment().setHelmet work ?
Hmm
Ooh yes it does! Thank you
can someone help me fix this error please? https://i.imgur.com/DcFiSoZ.png
for some reason when i compile i get that
still false
My bad, Sign is a Rotatable however WallSign is Directional
well, its false with Directional anyway
so... another way of checking if its a wall sign?
i finally got it to build but idk if i accidently shaded in the whole of lwjgl
i shaded in lwjgl
xd
with REFLECTION i can access it perfectly fine no errors
@fluid cypress You can always check if material is a wall sign
it (the block data) will be an instance of WallSign https://hub.spigotmc.org/javadocs/spigot/org/bukkit/block/data/type/WallSign.html
declaration: package: org.bukkit.block.data.type, interface: WallSign
What event should I listen to for a player teleporting with an end portal ? PlayerPortalEvent doesn't seam to work
Is there a way to cycle through a players inventory and check if there is a certain item in it. Then see how many of that item there is?
if (inv.getItem(i).getType().equals(steak)) {
steakSlot = i;//Sets steakSlot to location of steak
}
}```
I tried that but it doesnt seem to work^
What is steak
tasty
No one move to general
how do I set a blocks breaking power
Pretty sure that's client side?
It can be done with NMS I think
is it possible to make it so if your holding a certain item you get mining fatigue
Pretty sure you have to schedule a thing every certain amount of ticks using bukkitscheduler and just check every players holding item
Any idea please ?
EntityPortalEnterEvent?
you could check on click block
if holding the item
thengive them mining atige
He wants it so if you hold lol
so you dont have the constant check
is it possible to remove a block from an AsyncPlayerChatEvent callback without having an exception? if not whats the proper way of doing that?
the not async version of the chat event is deprecated afaik, right?
I want to set the destination so I don't think it would work
It throws a expection because your not allowed to use bukkit in a async I think
Just teleport the player lol
For context I have a main world and a generated world that I want it to be deleted and regenerated at a point. What I'm trying to do is to link the generated world with it's nether and end
Or try PlayerPortalEvent?
It's working fine with nether portals, but it doesn't fires with end portals idk why
Code?
Just a sysout inside the event
@EventHandler
public void onPortal(PlayerPortalEvent event) {
System.out.println(event.getFrom().getWorld().getName());
}
yea i know, then whats the way to do it? isnt there a sync chat event?
I'm so confused. Working with vault, making an economy plugin. The issue is, other plugins will not interact with it. If I take the SAME economy code, and put it into a different project, the other plugins have no issues. But in my main project, they just won't interact. It will interact with its self with economy commands, and is hooking into vault it seems.....
So I'm at a loss. Any thoughts?
What are you trying to do?
I will consider using entity enter portal event just for the end portal, since it's an instant teleportation anyway. I will teleport them to their bed location
get some stuff from the player writing stuff in the chat, and later put a block and some other things with that data, its a shop
Hmm not sure
i mean, i could make a list and push in there the data, and then do all things from the main thread, consuming from that list, but maybe there is a non deprecated sync chat event or something, idk
There isn't since the reason why the PlayerChatEvent got deprecated is this
Might be better of storing data somewhere and accessing it on the main thread
what event would I use to see if a player is holding something?
There isn't one
I'm pretty sure
I can see if a player has something in there inventory but idk how to see if they are holding it
You would have to use the bukkitscheduler schedule a thing to happen every 20 ticks (1 second) loop through all players check if they holding a item then if that player is then give them the potion effect
would that lag the server if I had multiple checks doing that for multiple items?
Reuse the for loop and the scheduled task
yeah but I want to use diffrent effects for diffrent items like mining fatigue 1 then 2 then 3 for diffrent items
Ahh okay ty for the help
the chat in minecraft is threaded by default?
I don't know
Pretty sure minecraft is 1 thread
Spigot I think adds multithreading
But idk
huh?
show the entire class
ok hold on
you have a condition, which if not satisfied your function wont return
Hence the missing return
oh you right
What difference between BukkitScheduler#runTask() and BukkitScheduler#runTaskLater() with delay 0?
Are they different or not?
I don't think so.
Using the docs:
BukkitRunnable#runTask:
Schedules this in the Bukkit scheduler to run on next tick.
And BukkitRunnable#runTaskLater:
Schedules this to run after the specified number of server ticks.
So, they are different
Pretty sure it's different
Yes
anyone know the worldguard flag that will allow playerinteractevent
when i right click with any item that has specific lore on a block it gives me an item works fine without worldguard but doesn't work with worldguard
Either the flag use or Interact
You should put this in help server tho
oh alright mb
i think if you make ur plugin load before worldguard it will work
im not sure
should I be concerned?
No it's just a warning
ok
Pretty sure that won't do anything
List<NamespacedKey> keyList = new ArrayList<>();
public RecipeManager(StupidItems stupidItems) {
ShapedRecipe remote = new ShapedRecipe(stupidItems.redstoneRemote);
remote.shape("*&*","%B%","*^*");
remote.setIngredient('*', Material.IRON_INGOT);
remote.setIngredient('&', Material.REDSTONE_TORCH);
remote.setIngredient('%', Material.REDSTONE);
remote.setIngredient('B', Material.ENDER_EYE);
remote.setIngredient('^', Material.AMETHYST_SHARD);
Bukkit.getServer().addRecipe(remote);
keyList.add(remote.getKey());
}
public void sendRecipes(Player player) {
for (NamespacedKey key : keyList) {
player.getDiscoveredRecipes().add(key);
}
}```
Excuse the sloppy code, I'm in proof of concept mode. Currently I'm trying to send a custom recipe to the player but I'm getting a NPE.
https://paste.md-5.net/ehoxidifaj.sql
Anyone know what the issue might be?
There is no method in ShapedRecipe to set a NamespacedKey either
I know that sending custom recipes to the recipe book is doable, I've seen it on a server before
guys how do u get th block a player is facing? π³ i cant find it
i know thers getFacing() but tahts just a blockface
Turns out I'm an idiot, apparently the key is the first parameter for ShapedRecipe.
ShapedRecipe remote = new ShapedRecipe(REDSTONE_REMOTE_CRAFTING, stupidItems.redstoneRemote);
i mean it will register its events before worldguard
so maybe?
WTF
this was fine one second and then the next it just breaks
...
huh
I hate intelliJ so much
now it's saying that about all my classes
WTF
the server waits untill all onDisable stuff is done before shuting down?
yes
even if it takes forever? will it kick all players before all onDisable stuff is done or after?
before
Run a mvn clean install, if that soesnt work, restart with invalidate caches
Shouldnt you use addAll?
even so, don't assume there is no one online in the onDisable
how would I do this?
this.cancel(); should work
How did you refrain from commenting on any other part of that π
Ray trace
what if i want to get a player inventory then? the player object is still available for the rest of the tick or something like that?
assuming all of the onDisable stuff is executed on the same tick
any idea why the split doesnt work?
String[] lines = shop.holographicText.split("\\n");
for (String line : lines) {
System.out.println(line);
hologram.appendTextLine(line);
}
[02:23:47 INFO]: asdads\nadha
"\n" doesnt work either
Guys, how do I increase attack damage of skeleton using the attributes ? Iβm using just Monster#getAttribute()#setValue(), but it works for other mobs rather then skeleton
you're escaping \n lol
do i need \\\\?
no, \\\\ was what i need
i hate scaping scape characters for regex, i always forget that

Hello why it happened?
Code:
https://paste.md-5.net/qamebuputu.java
Someone can help me? Please
Why did what happen
wondering... because i tried this earlier, in Skript you can make toggling commands like...
/exampletoggle, and if {variable} is true, it'll set it to false, and then if the variable is false.. it sets to true, etc.
i was wondering if this is possible in Java? i tried it a little bit.. but it seemed to not work
i removed the code seeing as this was near 8 hours ago
hoewver i was wondering how something like this could be achieveable
is it litearlly the same?
If(boolean){
stuff
}
else{
more stuff
}
? or is it more complicated
considering i did the if(boolean).. hours ago, and didnt work.. im curious
Deaths:
1
2
and on kdr too
it need to be Deaths:
2
but it dont remove the old value from the scorebiard
well considering skript was made in java. Yes.
boolean toggle = false;
{
//command stuff
toggle = !toggle;
if(toggle){
//stuff
}else{
//other stuff
}
}```
keep in mind that is not a per-player toggle. you would have to incorporate a map for that
Is there a reason when you broadcast a message to every player and you do like [no] the text is invisble
ahhhh, yeah.. i knew it'd be possible im just not sure why it wasnt working lol
keep in mind that is not a per-player toggle you would ha...
and yeah ofc
could you give an example?
which pathfinder do move entity to a location that i give it ?
yes
Set it on the same score
uh so if you sent a message to every: "hello people look at this [hi]" | [hi] will be invibisble
? :/
wait really? It could be json interfering
ive never seen that before though
yea
which pathfinder do move entity to a location that i give it ?
does any body now this ? :l
PathfinderGoalGotoTarget or PathfinderGoalMoveTowardsTarget maybe?
let me check
They take in an entity though, I'm not really sure how you can get them to move to a Location
do you now the parameter ?
Are you using IntelliJ?
ye
Ctrl click the method, it'll go to the declaration
Thq
both GotoTarget and MoveTowardsTarget have some strange params
So how i update sidebar entry? like from 0 to 1 and to 2 abd more (not score)
PathfinderGoalMoveTowardsTarget(EntityCreature var0, double var1, float var3)
hmmm how it take location ?
this.a = var0;
this.b = var1;
this.i = var3;
this.f = 0;
this.j = var4;
a(EnumSet.of(PathfinderGoal.Type.MOVE, PathfinderGoal.Type.JUMP));
}``` for goto target
seems more useable
neither seem right
I'm having a bit of an odd issue rn. So Im making a plugin where theres a 'safari' which is where my pokemon will spawn (armor stand w/a custom head. Every 20mins the safari needs to refresh (remove all existing ones, spawn new ones). This all works when a player is online, it cycles through, removes all the existing ones, spawns new ones and teleports the new ones into the ground.
The issue occurs when theres no players online/loading the chunks where a pokemon spawns, in this case the pokemon spawn, fall (don't get teleported into the ground), and then doesn't remove. I've tried loading the chunks whenever I spawn one but it doesnt seem to be working...
Spawn method: https://paste.md-5.net/obolujokiw.cs (with attempt @ loading chunk)
1.17 has a MoveToBlockGoal π€ not sure what it's equivalent is before 1.17 (and remapped)
How are you making your Scoreboard?
oops
Why do you want them to be spawned if there's no players online?
I've ran into that issue many times. The best course of action is check if players are in the area, then proceed to spawn
the only thing is that they dont remove either w/out a player
and they have to be cycled
Just don't spawn them if the chunk isn't loaded
this.goalSelector.a(0, new PathfinderGoalGotoTarget(this, 0, 0) {
@Override
protected boolean a(IWorldReader iWorldReader, BlockPosition blockPosition) {
return false;
}
});
``` so how it works ?
Well you're just telling to to move to itself
yes, but if player goes to the safari > spawns pokemon > player leaves > pokemon cannot be removed
Remove the Pokemon using ChunkUnloadEvent
So when the chunk unloads, so are all the Pokemon within that Chunk.
No, because you put this, that argument is the EntityCreature to move towards
what should i put ?
i want to move it to a location
how to get command senders ign instead of CraftPlayer{name=BunkDev2}
Cast to a Player and use getName
ah mk
What version are you on
1.16
have there for loop of online players and when player join it add him the scoreboard to sidebar
Player player = (Player) sender;
wat to chyange it to
where you want to get the name
^

so where i put player
hmmm answer my q ? :l
i put player.getName();
π
@hasty prawn so what to do?
or if its easier
Player player = (Player) sender);
String name = player.getName();
Send code for the Scoreboard creation
@hasty prawn what should I do ? :l
Actually, I don't think it's a Goal, it's a method called getNavigation I think
Yeah, it exists in EntityInsentient
Okay, and then how are you updating the Scoreboard?
so what should I do
how can i use this method
just reset the scores and re add them
How?
resetScores
declaration: package: org.bukkit.scoreboard, interface: Scoreboard
Ok thanks
because you are treating the score as an index so the scoreboard is seeing 0 and 1 as different scores, not the value themselves
Ok Thanks
PathEntity path = navigation.a(loc.getX(), loc.getZ(), loc.getZ()); is it correct ?
Cannot resolve method 'a(double, double, double)`
maybe takes a float?
Cannot resolve method 'a(float, float, float)'
@Nullable
public final PathEntity a(double var0, double var2, double var4, int var6) {
return a(new BlockPosition(var0, var2, var4), var6);
}```
theres quite a few overloads for a
also one that takes 4 doubles
what the var6 is actually do ?
not sure honestly
Lemme see if I can find out
@Nullable
protected PathEntity a(Set<BlockPosition> var0, int var1, boolean var2, int var3) {
if (var0.isEmpty())
return null;
if (this.a.locY() < 0.0D)
return null;
if (!a())
return null;
if (this.c != null && !this.c.c() && var0.contains(this.p))
return this.c;
this.b.getMethodProfiler().enter("pathfind");
float var4 = (float)this.a.b(GenericAttributes.FOLLOW_RANGE);
BlockPosition var5 = var2 ? this.a.getChunkCoordinates().up() : this.a.getChunkCoordinates();
int var6 = (int)(var4 + var1);
ChunkCache var7 = new ChunkCache(this.b, var5.b(-var6, -var6, -var6), var5.b(var6, var6, var6));
PathEntity var8 = this.s.a(var7, this.a, var0, var4, var3, this.r);
this.b.getMethodProfiler().exit();
if (var8 != null && var8.m() != null) {
this.p = var8.m();
this.q = var3;
f();
}
return var8;
}```
var3 in this context
reachRange
What input i need put in there i cant put variable because it changable no?
so how i do it if it changable?
Hey quick question about JDBC: I have the following three classes:
https://hastebin.com/lorenovuhu.java
https://hastebin.com/inetugipum.java
https://hastebin.com/ukoletoxit.kotlin
and I was told I still need a DataSource Field. Unfortunately I don't know how and where to create it in this case. Can anyone help me with this?
? What do you mean if it's changeable
like i do
getScore(kills_variable)
so it can be 0,1,5,6 and more
so same on resetScores no?
resetScores resets all of them
Read the docs on it, might help, I don't remember it all off the top of my head tbh
so try do
board.resetScores(kills_var)?
Try it
How do I increase attack damage of skeleton using the attributes ? Iβm using just Monster#getAttribute()#setValue(), but it works for other mobs rather then skeleton\
Other mobs are physical attacks, Skellys use a bow
Doesnt works :(
I think the entry is just the text, so use that or use getEntries
getEntries().map?
what kind of data value is an entity?
An object, I guess? What are you asking
getEntries should return a list of all the entries in the Scoreboard, loop through those and reset their scores, then set the scores again
So... how do i power it up?
I'd guess enchant the bow or increase teh skellys attack speed
or you could watch for the EntityDamageByEntityEvent, when its a projectile from a skelly increase the damage.
I am stupid
Sounds a bit weird
I think
he is trying to say
How to detect and change the powering stage of the bow of an skeleton
Its an arrow doing damage so you probably have no other option
Thanks it works!
is there a way to fix this: when i enter an command, my own /ban command and i press tab it doesnt show an online player list
Are you returning an empty array
even if i enter the first letter of my name and press tab nothing happens
you need to populate the tab completer
lemme check something first
Sure. But if you return null it'll default to the online player list π
or don;t implement teh tab completer and it will alwasy offer players
Even if you do; returning null will offer the player list
true
ah also something wrong with the tabcomplete
you need to check the length of args to see what complete you should offer

π¦
like this?
Yes
works thanks
@eternal oxide Sorry but can you help me again? You helped me yesterday with a problem with JDBC. It was about DataSources. You told me to create a DataSource field. But unfortunately I don't know exactly how and where I should create the field in this case.
hover over your code that is underlined red this.datasource and use the options it presents you to create a Field, not a local variable.
ohh ok
And what should I do about the rest of the error messages? I can also send you a screenshot of what is still marked in red
yes an SS
I'm having a big error, my server crashes. I'm using HikariCP and when I add like 20+ things in my database my server crashes with this error:
https://paste.md-5.net/ufimayereg.md
Do I have to close my connections somewhere?
The error points on this:
https://paste.md-5.net/huvoquvocu.java
you don;t need any of that. I did say, you are only interested in the MySQL section inside the try/catch
@burnt current
and the setting options
which is it?
all the lines in the try/catch excluding the this.currentServer line
you will need to provide values for the ConnectTimeout etc
but those you can easily google for suitable settings
where is a this.currentServer line in the try/catch?
in your screenshot
oh you mean in the first screenshot
you mean this.currentServer=serviceDescriptor.getId(); right?
What about my error?
I'd still need help with this, im rly stuck with this
How many entries in Utils.getAllUsertagsLength()?
public static int getAllUsertagsLength() throws SQLException {
try (
final Connection connection = MySQL.getConnection();
final ResultSet rs = connection.prepareStatement("SELECT COUNT(*) FROM all_usertags;").executeQuery()
) {
int rowCount = 0;
while (rs.next()) {
rowCount = rs.getInt(1);
}
return rowCount;
} catch (final SQLException e) {
e.printStackTrace();
}
return -1;
}
thats the method
Why do two queries when you can simply do one and loop it once?
SELECT * FROM all_usertags
then while (rs.next())
its a single query instead of one to get teh count, then a seperate query to get each usertag
as you are testing them all just get them all
You are doing the first query to get the count for your for loop
which you don;t need
just get all_usertags as you are parsing each one anyway
you are running a separate query for every tag
public static int getAllUsertagsLength() throws SQLException {
try (
final Connection connection = MySQL.getConnection();
final ResultSet rs = connection.prepareStatement("SELECT * FROM all_usertags;").executeQuery()
) {
int rowCount = 0;
while (rs.next()) {
rowCount = rs.getInt(1);
}
return rowCount;
} catch (final SQLException e) {
e.printStackTrace();
}
return -1;
}
so like this?
No
you do not need the length at all
scrap that whole method
and remove the for loop in the other
Hello guys,
Coming with a strange question but anyway ^^ Does someone know how to remove the "transparent black" box of nametags (including holograms for instance: see the screenshot) with a resource pack? Is it even possible?
Okay?
Nope
Pretty sure that's client sided
You might need a modified client for that
Oh okay :/ Thanks anyway !
Oh
So pretty much the method is useless
as as long as rs.next is true it still adds the itemstack to the gui?
If you want it ordered just add an ORDER BY NUMBER to the end of the query
So SELECT * FROM all_usertags ORDER BY NUMBER
Okay so that will add the items in the gui in the right order as it is in the table?
yes
Okay but
my mysql table has a number system
and every number has its own tag
and im grabbing the number from the database to add its own displayname to every single tag
so everysingle tag in the gui has its own displayname pretty much
and I cant do that without my for loop
Yeah but i need to get the number in a variable
Why? You never use it in yoru code
you only ever use it in your query
try (
final Connection connection = MySQL.getConnection();
final ResultSet rs = connection.prepareStatement("SELECT * FROM all_usertags ORDER BY NUMBER;").executeQuery()
) {
while (rs.next()) {
final String userTag = rs.getString("USERTAG");
final String permission = rs.getString("PERMISSION").toLowerCase();
if (p.hasPermission("cubicxpchat." + permission)) {
final ItemStack item = new ItemStack(Config.getTagItem());
final ItemMeta im = item.getItemMeta();
im.setDisplayName(Config.getTagDisplayName(userTag));
im.setLocalizedName(userTag);
item.setItemMeta(im);
allItems.add(item);
}
}
} catch (final SQLException x) {
x.printStackTrace();
}
Okay so thats what you mean tright?
Get rid of the for loop
yes
And the query change
yes
now instead of 11 queries for 10 items you have one query.
Your server locking up was due to the lag caused performing SQL queries on the main thread + the overhead of doing a separate query for each item.
Yeah now I see.
Hello, what is a "NamespacedKey"? I have come across it several times and do not know what it is.
You can use it in PersistentDataContainers
its a Unique identifier
So usually MySQL stuff in general is not done on main thread?
The thing is I havent learned a thing about thread
I just know that you should use async only in spigot related stuff
Or it was otherway around
and what do the two Strings in the Constructor?
public NamespacedKey(@NotNull String namespace, @NotNull String key)
It tells you in the names of the two strings?
so first i just need to delete this.currenServer=serviceDescriptor.getId();.
Should i delete currentServer=null; too?
uhh i forgot but for maven to add an api i need to add an repo and deprendency to my pom.xml and do i need to do something else?
why am I getting getExecutor()' in 'org.bukkit.command.PluginCommand' cannot be applied?
You need to use #setExecutor()
instead of getExecutor
But now 0 usertags gets added to my gui even though i have existing usertags
ohh typo
I'm trying to add support for WG6 and WG7, how can I do that? (without using any libs)
?paste your current code
does your sysout display?
yea
but it displays twice
it couldnt be the permission tho
I have op
so it shouldnt matter at all
and the permission worked perfectly before
It basically displays me only the usertags i have access to
take the final off your local variables, not needed
Intellij adds it back for me
the ones in the while anyway
thats nice of it to tell you how to code
Won;t be long before it writes the plugins for you
ok, if your sysout is showing the usertag and permission then yoru error must be in adding the items
you could always move the variable declarations outside the while loop so they get reused.
Mhm did it.
idk what this is
what is your allItems variable?
Its a normal arrayList
Do you then add all those to your UI?
Thats where i add them to my gui:
for (final ItemStack item : PageUtil.getPageItems(allItems, page, Utils.getAllUsertagsLength())) {
gui.setItem(gui.firstEmpty(), item);
}
Yes, I do.
public static List<ItemStack> getPageItems(final List<ItemStack> items, final int page, final int slots) {
final int upperBound = page * slots;
final int lowerBound = upperBound - slots;
final List<ItemStack> newItems = new ArrayList<ItemStack>();
for (int i = lowerBound; i < upperBound; i++) {
try {
newItems.add(items.get(i));
} catch (final IndexOutOfBoundsException x) {
continue;
}
}
return newItems;
}
Why use Utils.getAllUsertagsLength() again? You have all of them in allItems
just do a size on allItems
Changed that.
Now do a sysout after your while loop to see how many items you created
no, do it after as you won;t know how many are in it until the while loop finishes
after the whole while loop
yep
Idk why but it all of a sudden started to work lmao
I think the only thing i changed
That you told me
to create a variable before while loop
and initialize it in the while loop
Oh and
when i try to launch the start.bat it just says this Unable to access jarfile spigot-1.17.jar and i press y to restart and it says it again
Thank you!
what can i do to fix this
ensure you have a spigot-1.17.jar with yoru bat file
public void addItemsToMenu(ItemStack item){
int[] amount = {1,5,10,32,64};
int slot = 20;
for (int i : amount){
item.setAmount(i);
ItemMeta meta = item.getItemMeta();
ArrayList<String> lore = new ArrayList<>();
StringBuilder sb = new StringBuilder();
for (String l: Objects.requireNonNull(meta.getLore())){
if (l.contains("Coins")){
for (char c : l.toCharArray()){
if (Character.isDigit(c)){
sb.append(c);
}
}
int price = Integer.parseInt(String.valueOf(sb));
price = price * i;
String nl = "&6" + price + " " + "Coins";
l = nl;
nl = Utils.color(l);
lore.add(nl);
}
else {lore.add(l);}
}
meta.setLore(lore);
item.setItemMeta(meta);
secondaryMenu.setItem(slot, item);
slot++;
}
item.setAmount(1);
}
i do
Then you need #help-server
he cross posted
Guys what I should write in the
p.setGamemode();
Google your question before asking it:
https://www.google.com/
player.setGameMode(GameMode.SURVIVAL);
Oh thanks !@quaint mantle
bruh make them use google and the docs first
oh okay, and also see my problem if you can (:
does someone knows how to check if a player is in a worldguard region?
i'm stuck in the api
No
@eternal oxide ?
I'm not writing it for you sorry. I've shown you all the code you need. You just have to put it together.
I don't want you to write it for me.
Hello, is there a way to get the list of blocks that are powered by the BlockRedstoneEvent?
can you not listen to events in an abstract class?
I don't think methods in parent classes are registered no
Ah yeah and then we got EventHandler which isnβt annotated with @Inherited
In case you wanna inherit or smtng
Guys how to send player to another server from gui
read up on bungee plugin channels
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Anyone haves the NuVotifier Maven repo
@eternal night
I didn't understand anything
Why does nuvotifier not work on pyterodatyl but geyser does
Does anyone know how I can define persistent data in a mob? That is not removed after reboot.
Nbt?
how to use?
Is there any way that doesn't need the API?
I'm pretty sure you use nms if you don't want to use it
Your better of using nbtapi
For nbt
Pretty sure the nms class for nbt tho is NBTTagCompound
The API is really useful, cuz it works from 1.7.10 all the way to 1.17 with just some minor incompatibilities and has a lot of utilities
I personally use it and have found it to be very reliable and nice to use from a developer standpoint
Sorry, I have a really random question, Im trying to use Block#setType()
To set an air block to a spruce door:
loc.getBlock.setType(Material.SPRUCE_DOOR)
However it only creates the bottom half of the door, Would anyone know of any ways to get around this?
I think you have to place the upper part too
Ive tried that however it just destroys the lower part for me
Place the top first?
Oh that could work, Ill try that
Yep that works, Thank You!
I am trying to create a plugin to link discord and Minecraft (ik these already exist, but I want to add a bit to this one) and was wondering how I could add a library to the plugin. I tried and got this error on server startup:
https://pastebin.com/Rvf9wL7t
maven or gradle?
You need to include the discord bot jar into the jar
I did
org.bukkit.plugin.InvalidPluginException: java.lang.NoClassDefFoundError: net/dv8tion/jda/api/JDABuilder
Not necessarily, but it is the most logical reason
Idk how to do it on gradle but for maven you use maven shade plugin
Hello error:
Error on Console:
java.lang.ArrayIndexOutOfBoundsExeption: 0
Error on Minecraft:
An internal error occurred while attempting to perform this command.
code: https://haste-bin.xyz/unoculezut.java
Line: 34
ResultSet name = PVP.plugin.getManager().getSQL().query("SELECT * FROM names WHERE uuid = ('" + array[0] + "')");
Someone can help me? Thanks
Well yeah but it says no class found so I just straight away say it's not shaded in
on gradle you use the shadow plugin
your array doesn't have the index of zero
Never trust the classloader, never trust it
Lol
Sometimes it finds it but is being an ass and says that it isn't there.
Ruined a week once
Thanks
I cant send a screenshot, but I added it as an external Jar. (same way I added the spigot build tools)
F
Verify
maven or gradle?
But adding it as external jar doesn't mean it's shades in
it seems like it randomly fails at times, drives me crazy
It cannot be! if you are including the jar while build the project. the java will find the class you are looking for
but in your case, it cannot be found
Or did you use JDT / the IntelliJ equivalent (please don't)?
If latter, you are without help (outside of the libraries declaration in the plugin.yml)
Hello! Where is CraftPluginManager class? I mean, ScoreboardManager implemented by CraftScoreboardManager, then what about the implementation class of PluginManager?
Is That a nms class?
I can't find it in craftbukkit
it's called SimplePluginManager i think
I would bet that it is implemented by bukkit and not craftbukkit
class SimplePluginManager
I actually can't find what class that just a name relate to Plugin in craftbukkit package
org/bukkit/plugin
org.bukkit.plugin.SimplePluginManager
It inside bukkit instead of craftbukkit
CB doesn't implement any plugin stuff
Ok thank you I'll check it!
Maven gave tons of errors and idk how to convert it to Maven. (Still sorta new to this)
I suggest the plugin.yml file, but that will only help in like 80% of instances; I am pretty sure here it does not apply
You probs did something wrong
Doesnt works
full error: https://haste-bin.xyz/bepibiyuna.java
Your array is empty
what is in line 34 [Top.class] !
Probably. Like I said, I am very new...
it's fine
every one here come to learn
Would Maven make this whole process easier?
nyes
I never used maven or gradle in minecraft plugin development
It will be easier, but also less convenient at the same time
if you are used to it i find it much more convenient
I just wanna know how annotated @EventHandler function works. Why bukkit can call unknown functions, but just has an annotation.
when you are register your class, the bukkit foreach all the methods and check if it has the @EventHandler annotation
Ohh, maybe because I don't know about that foreach methods
you can for each methods with Class#class#getDeclaredMethods() or Class#class#getMethods()
getDeclaredMethods and getMethods are different
Okk thank you!
ResultSet name = PVP.plugin.getManager().getSQL().query("SELECT * FROM names WHERE uuid = ('" + array[0] + "')");
are you making database requests on the main thread?
He does

The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
@quaint mantle
the thing you are doing here
if the result has more than 10 stats
the array will reach the limit and you get an error
I figured out how to do it will eclipse. Ty tho
No I believe that's eclipse lmao so he's using ant
Why ANT of all things?
I'm pretty sure eclipse uses ant?
Eclipse uses it's own build system by default, called JDT
Thought it was ant
Or at least I call it that
well i do not see an ant buildfile there
Eclipse Java Development Tools could be an ant wrapper, but I highly doubt it
You should use ArrayList in this case and check put a Limit for the query
you are getting all the stats ,
`SELECT * FROM `PVP_stats` ORDER BY `kills` DESC LIMIT 10`
I have trouble with player.openWorkbench can someone help me
@tight jolt explain
if i want to start the server the plugin crashes and shut down
if you want to open the workbench?
Without a stacktrace?
no if I start the Server
(or any other paste service)
?paste
You can add ant to eclipse if you wanted to, but im not gonna
ΠΊΠ°ΠΊ ΡΠ΄Π΅Π»Π°ΡΡ ΡΠ°ΠΊ ,ΡΡΠΎΠ±Ρ ΠΊΠΎΠ³Π΄Π° Ρ Π½Π°Π΄Π΅Π²Π°Π» ΡΠ»Π΅ΠΌ Π²ΡΠ΄Π°Π²Π°Π»ΡΡ ΡΡΡΠ΅ΠΊΡ Π½ΠΎΡΠ½ΠΎΠ³ΠΎ Π·ΡΠ΅Π½ΠΈΡ, Π° ΠΏΠΎΡΠΎΠΌ ΠΊΠΎΠ³Π΄Π° Ρ ΡΠ½ΠΈΠΌΠ°Π» ΠΏΡΠΎΠΏΠ°Π΄Π°Π»?
Π±Π»ΡΡΡ
I know
how to make sure that when I put on the helmet, the effect of night vision is issued, and then when I took off it disappeared?
@hidden delta oh du bist deutsch xD
java.lang.NullPointerException: Cannot invoke "tv.banko.tutorialreloaded.backpack.BackpackManager.save()" because "this.backpackManager" is null
yes
nope, I got inspired only so I have added the Entwickler in the prefix
ok
and that means?
im new to codeing
na wie gehts
you have an error TutorialReloaded which is this.backpackManager is not defined (null)
and you are trying to access
but if I put away the command Its working and thats not this.backpckManager
at tv.banko.tutorialreloaded.Main.onEnable(Main.java:45) ~[?:?]
what is in line 45?
in Main class
w8
Objects.requireNonNull(getCommand("Crafting")).setExecutor(new CraftingCommand());
how does getCommand("Crafting") get null?
idk im new to codeing
there is something weird
don't use requireNonNull, new to codeing
are you using the latest build
anyways nice to meet you new to codeing
which spigot server you are using? 1.16.4?
1.17
I see
do I have to code everything new?
?paste #help-development message
wow gecko you really gonna do him like that
did you register your command inside the plugin.yml?
yes
well yeah
it cannot be null if you are register it in plugin.yml
you're probably trying to access backpackManager in the CraftingCommand constructor before you set it
the command is fine
can i screenshare to you
join general-1
you cant stream there
read the error
it is in getCommand or in the CraftingCommand
Ok thanks
π
which is probably in the CraftingCommand constructor
the problem is in plugin.yml
miss spelling the command
since he instantiates the backpackManager after the commands
oh i didn't see the error
lol yeah
commands aren't capitalized
change to lowercase in code and in plugin.yml
thak you very much maybe one day I can be like you and can help retardet people π
Hey! quick question: does anyone know how exactly I can connect to a database like the one on the following page? I can't get to grips with the explanation there.
https://github.com/RainbowDashLabs/BasicSQLPlugin#setting-up-a-connection
It explains everything there
how to solve this error?
you need to get the Player by
Player player = (Player)event#getWhoClicked();
and use it with player#addPotionEffect
Player is the class not a field. ^ is correct.
Can I create a plugin from Java Project instead of Maven Project?
Yeah
yeah
Maven is easier though
You just have to depend on the actual jar
What about resources? Where is it located?
?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.
U make it in src iirc
You specify the resources location when you export
depends on your builder
Okay!
Guys how to send player to another server
Using gui
Ah, that is for #help-server
Then read up the documentation of bungee's plugin message channel. I know that wiki.vg has a link to it
If no, if you are beginner on this, don't expect cool thing fast, just first know how to make it work in your plugin purely code, then in your command, then in your GUI
worldpainter goes brrr
how to get exploded blocks with all their state before explode?
Check them in the Entity/Block explode event
@EventHandler(priority = EventPriority.HIGHEST)
public void blockExplode(BlockExplodeEvent e) {
e.blockList().forEach(b -> {
String custom_block = getCBT(b);
if (!custom_block.equals("")) {
breakEvent(b, custom_block, true);
}
});
}
i have this. getCBT(Block) gets metadata and creating it if isn't exists. Break event summons items.
getCockandBallTorture
Replaced on EntityExplodeEvent. Works fine.
how to make the effects disappear when I take off the helmet?
Do you guys recommend looping through all online members then sending them all a message or using Bukkit#broadcastMessage
code:
@EventHandler
public void onArmorWear(InventoryClickEvent event) {
for (Player player : Bukkit.getOnlinePlayers()) {
ItemStack helmet = player.getInventory().getHelmet();
if (helmet == null) continue;
if (helmet.getType() == Material.IRON_HELMET) {
player.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, 20, 1));
}
}
}
}
ouch that is not the way to detect armor equip
use "```"
where?
the only foolproof way is to check it constantly, but paper has an equip event i believe
beginning and end to make it easier to read the code like this
and put java after the one in the beginning
^
?

stupid markip
```java
doesn't work bro```
fuck it
lol: you're stupid```
ΡΠ΅
ΠΎΠ½ ΠΈΠ΄ΠΈΠΎΡ
gecko.setIQ(0)
``` who is stupid now?
ΠΊΠΎΠ΄ ΡΡΠ΄Π°```
ΡΠ° ΠΏΠΎΠΏΡΠΎΠ±ΡΡ
speak english bruh
no
PlayerItemDamageEvent does this event track armor damage as well?
1
and shields
Π²ΠΎΡ
I have this error in my logs Cannot find main class io.github.nightterror04' my main is io/github/nightterror04 is there something I'm doing wrong?
` not '
@EventHandler
public void onArmorWear(InventoryClickEvent event) {
for (Player player : Bukkit.getOnlinePlayers()) {
ItemStack helmet = player.getInventory().getHelmet();
if (helmet == null) continue;
if (helmet.getType() == Material.IRON_HELMET) {
java player.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, 20, 1));
}
}
}
}```
Your main is a package?
congrats
and what is your problem?
how to make the effects disappear when I take off the helmet?
sorry I mean my class path
Cartero and is this a plugin?
yeah
Add a dot and then main class name
ohh okay thanks
Like if it was String it would be java.lang.String
If you do some effects when someone have armor, i recommend to do this :
@EventHandler
public void onInventoryClose(InventoryCloseEvent event){
Player player = (Player) event.getPlayer();
Inventory inventory = event.getInventory();
if(player.getInventory().getHelmet() != null && player.getInventory().getHelmet().isSimilar(new ItemBuilder(Material.DIAMOND_HELMET)
.build())) { // ItemBuilder is a class, do new ItemStack() instead
player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 30, 1));
} else {
if(player.hasPotionEffect(PotionEffectType.SPEED)) player.removePotionEffect(PotionEffectType.SPEED);
}
}
thank you
how would i remove durability damage using PlayerItemDamageEvent
but only if the item is at full durability
Check if the durability is the max durability then set a new durability value.
if i event.getItem().getDurability() is it after the damage
or before
uh idk actually
ill try assuming it is after the damage
Guys, how to use LuckPerms Bungee in my bukkit Plugin
Just use the api
When I use it , chat event don't work
Or well youβd need lp Bukkit for that
Hey, I want to make it so that when you click on an item (GUI), it starts a 1 minute BukkitRunnable. During this 1 minute the player can write something in the chat and it will be saved, if the 1 minute is over and he hasn't written anything, he can't save anything. The problem is that I don't know how to do this because I need both a Listener and a BukkitRunnable.
Oh , but if I setup tebex , and put the same tebex plugin in each bungee server , if one purchase the ranks , does the command run in every server the plugin is in it@ivory sleet
@urban lava
i mean i think theres a way without using bukkitrunnable but idk
but idk
how
Oh okay but idk how too
oh wait you might have to use bukkitscheduler but i think theres a way to just use one instead of using a bunch of them
Okay i will see for bukkitscheduler
i got something in my mind but idk how to explain/code it
Try it would help a lot
You can save them in a map and decrement the map in 1 scheduler and when it hits 0 just remove them
Although if you're not gonna be making too many of them you might as well just make a scheduler for each one
Easier to do it that way
Okay
i mean you could run a bunch of them it would be fine but i think going for the other way is kinda better option because its future proof
True that one probably is more scalable I guess, but idrk how efficient scheduler are. Maybe you can run 300,000 of them and be fine π
it schedules a thing to run on the next tick but idk about the repeating one
I'm trying to make a scheduler but I can't, how do I do it?
search on google
why do ShapelessRecipe and ShapedRecipe both have #getKey() but not Recipe interface ._.
even with this
because i think the Recipe interface is just to add more recipe classes in the future?
idk
by making one
but I think namespaced keys are rather important aspect of the recipe too
it is on google
and I have to class cast it...
Β―_(γ)_/Β―
how to make night vision at night and blindness during the day?
Okay i found it but there are 2 types of Scheduler Bukkit.getScheduler().scheduleSyncRepeatingTask and Bukkit.getScheduler().scheduleSyncDelayedTask
what should i use
omg merchantrecipe doesn't have key....
there are more
the top one if you wanna do the way which is not creating multiple schedulers
but theres other methods
None
?scheduling
Go to the last section of that page
Oh
@ivory sleet do you know how to make a x,y array in java?
Elaborate
a 2D array
oof so i cant it with this private List<Something> screen;?
ah ok
π
Hello how i setup ArrayList?
like
ArrayList array = []
array[0] = something
new ArrayList<>()
?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.
^^ You really should read through these
Any idea why PlayerInteractEvent is running twice? When I right click it sends "Testing" twice and when I left click it only sends once ```public class PlayerInteractListener implements Listener {
@EventHandler
public void onPlayerClick(PlayerInteractEvent e) {
if (e.getClickedBlock().getType() == Material.CRIMSON_PLANKS) {
e.getPlayer().sendMessage("Testing");
}
}
}```
for every hand once
oh danggg
-_-
I know java
Ijust get error of setting up the array abd dont know why
seems like you don't
so why it say me to use array.set
a arraylist is not an array. its simply just a wrapper for an array.
so how i create array type?
which import need..
just like String[] strings = new String[10]; <-- an array of max. 10 strings
you just need to import the object you use for the array
but when i do new String[]
It give error
yeah because you need either to set the max capacity or the values inside
just like new String[] {"", "", ""}
or better String[] strings = {"", "", ""};
so how i create empty array
for what
Lists you can add to, Arrays are fixed size
@dense kestrel i need help from u from dev
String[] array = new String[];
ResultSet result = PVP.plugin.getManager().getSQL().query("SELECT * FROM PVP_stats ORDER BY 'kills' DESC LIMIT 10");
int counter = 0;
while(result.next()) {
array[counter] = result.getString("uuid") + "." + result.getInt("kills");
counter++;
}
@hybrid spoke
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply.
@deep sail ^
Use a List to add them then .toArray if you need an Array
has to be from @dense kestrel
he said me to switch to Strings Array...
You can only use a String array if you know the size to start
if 10, then create it with 10
i want size of 0 in start...
no
so 10?
it would just be an empty array for ever
you MUST create it of the size you intend to use
Ok
most likely the size of your contents
but i guess there is no fixed size, so use a list
just like elgar said
oh, there is a limit of 10. you could then create an array with the size of 10, yes. but i would prefer a list anyways
@dense kestrel help please
hey daddy!
woah i do not feel like being sexualised
docs of List?
Check the javadoc
List<String> contents = new ArrayList<>()
Thanks
why are you handling with database stuff if you don't even know arrays and lists
Entry level to programming is WAY too low these days. Too much hand holding with IDEs.
Spaghetti code 
I've seen assembly line workers who had machines that placed items on boards for them. When those machines broke and they were asked to do it by hand they had no clue how. They just watched the machine do it for them for years.
Thats todays programmers
Lmao
can't wait for the github copilot generation of devs
oh my yep
Copilot is just copy pasting open source right?
almost
Bad enough
I mean it is gpt 3 trained on a ton of open source / stackoverflow
and then you kindly pray
They ran tests where it auto filled in Comment blocks, then they put the cursor above teh comment block, hit tab and it filled in some poor devs security key
Hmm wonder if it could clean up my code architecture
Lmao fr lol
code that can be cleaned by GPT 3 sounds like the spigot community lmfao

event.getItem().setDurability(0); this shoudl work to set the durabliiyt of the item to max
idc that its deprecated i have no idea how to use the itemmeta stuff
No presumably not
Probably as durability I believe is really a damage counter
I am 8 years programmer of javascript
So iknow what is database
Java i know only 3 years
so i need some help in new things...
event#getItem probably returns a CraftItemStack which if I am right wonβt reflect itβs changes a jack shit to the inventory itβs contained in
Years sounds like a bad measurement strategy
no i think it does cuz when i did setdurability to the max, which should make the item break instantly
it broke instantly
Get to my age and you start counting decades π¦
Oh fair then epicmania
starting with java and pausing for 3 years doesn't mean you programmed 3 years in java
or did you heard 3 years ago from java so you know it by the name?
anyway, learning is good. Keep going
i am getting rude. leaving the chat
Just google more π
cya
yeah but this one doesnt work
which is what is confusing me
also my ide is throwing the error that it doesnt accept int
but that also doesnt work
You're setting the Durability?
tryna remove durability damage
so nothing takes damage
Why not go with the ItemMeta
Use setUnbreakable
^
i dont understand how to write that into code
Uh well let me hop on pc
?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.
I learn 8 years of javascript then learn 3 years of java i didnt stops...
someone dont need remember everything
have docs and have ppls can help
so if someone ask dumb question dont lough on him, just help him
Thanks you
The packages changed in 1.17
{
ItemStack stack = ...;
ItemMeta meta = wew.getItemMeta();
if (meta instanceof Damageable damageable) {
damageable.setDamage(99999999999999);
}
stack.setItemMeta(meta);
}
``` @urban lava
?spoon ;/
Spoonfeed a newbie for a day and they'll come back with more questions. Teach them to find their own answers and you'll both be better off: you won't get stuck answering the easy questions and they'll be much more productive than before.
Shouldn't it be setDamage(0)
^^
it was an example lol
Fair enough lol
alexy nms versions are gone in 1.17
where i can find new packages to replace these?
< official mojang mappings
he likes being spooned π
wow
remove the import Alexy, should give you a suggestion what to import alternatively
Package names are now the same as vanilla
the name of that might had a change also lol
oof
