#help-development
1 messages · Page 592 of 1
?
just learn how to format it properly and then you don't have to use something to do it for you
¯_(ツ)_/¯
?
if you have non standard formatting add .vscode folder and put your formatter changes in the settings there
You can also use eslint and prettier for that
stop dirt turning to grass?
@EventHandler
public void onBlockChange(BlockPhysicsEvent event){
if(event.getSourceBlock().getType()==Material.DIRT&&event.getChangedType()==Material.GRASS_BLOCK)
event.setCancelled(true);
}```
tried this and it didn't help
event.getSourceBlock().getType()==Material.DIRT&&event.getChangedType()==Material.GRASS_BLOCK that formmating is wild
are you sure blockphysics event is trggered
what formatting, you see any formatting ?
zero spaces lol
exactly
y muh code not wurk bruh
Are you registering the event ?
ye
one thing you can do is: put debug messages with the sourceBlock.type and changedType and go to an empty world to try and see what it prints
is there an event for when a player has a new item in his inventory? Like, in any way, taken from a chest, picked up, crafted, given through commands, etc.
no
so, I will have to listen to all kind of events where the player can get an item through?
please tell me somebody has a library that does that
when does PrepareAnvilResult trigger ?
does it trigger following a client request to server ?
or does server find out by itself that the inventory has changed in the anvil ? and therefore prepare a new result
(i need a specific answer)
tbh, it's not THAT much.
How can a player get an item ?
- EntityPickupItemEvent
- InventoryClickEvent (transfering stuff from an inventory to another)
- commands / plugin interferance
Can't think of anything else
it depends on what tracking level you want to be honest
If you agree to occasional misses/untracked items (for whatever reasons, like commands/plugin interferance), then prolly listen to events
Otherwise if it's of UPMOST importance that you don't miss a single one, go with the task ticking at every tick thinggie.
If you're going to do the task, I would advise to do it ASYNC.
How do i launch a player Forward
Because it just keeps highlighting .setVelocity on red
what are you passing to setVelocity?
setVelocity takes a vector
vector is in red as well
?nocode
It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.
V not v on Vector
the set velocity is till red
Seriously?
yh
?basics
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.
Why
I need to add the player into a list while they have that item and remove them once they don't anymore
yeah that's understandable but there is no event that is fired on any change of inventory, I need to listen to like 3 events
I will
ok
I know how to do it, just that 3 events seems a lil too much
is there not an inventory change event?
Seems like not
how to get the player location as a block location?
player get location. getblo k
InventoryAction is not an event
okay thanks
it's an enum, look to what Event it belongs
HI, its possible to set the tab completion for command of another plugin?
Hmm, I think it is, but I don't know how
Get it's JavaPlugin instance, getCommand and setTabCompleter on it
inventory can also change when interacting with armor stands
So, player interact event?
No
Maybe I should just t i c k
can't detect dropping items with Q either
I'm just checking every tick, okay?
I'd check slower
Because I'm not listening twenty events
every 5 ticks or every second
That can not capture something, in theory
you don;t need to detect a change faster than every second for your purposes
Ok
listening to a few events is still better though
just using events will miss changes
like what ones
pressing Q
PlayerDropItemEvent?
I have been using it for the past few years in 1.18+
so idk when it was added
but it exists 120% sure
I can't test at the moment, but last time I tried tracking inventories Q was completely missed
maybe save for the /give command spawning items in your inv you can detect any other change in the player inventory
well I am actively using it in my plugin
Internally minecraft has an event for inventory change
It’s used for advancements
It’d be nice to expose it one day
is it fine to loop through the values() of an enum in a static method within said enum called on a static variable also in said enum or will that cause some initialization error
sorta like this
or would it be better to do that elsewhere
What theme is that
I think thats fine
yeah its eclipse
nice, my memory does not deceive me
i like how varied the colors are because it somehow helps with dyslexia lol
i mean it should be fine
I like colors too
epic
it would be nicer if it was just like a lookup but, meh
The colors are great
I use light themes
Ur crazy
Why
hey can anyone share correct way to add players tab completion on bungeecord commands? Im currently listening to TabCompleteEvent and returning online players names
Where, how, where do I do??
return just player names which name startsWith with that argument
so i have this:
if (args[1] != "*") {
sender.sendMessage(FCore.prefix + ChatColor.RED + "Player is not online");
return true;
}
``` and when i type * it still prints that the player is not on server
Always use .equals for strings
why
i heard that when you use .equals it checks for the memory slot if its the same and not for the string itself
ohhh
but i use == and it works
if (args.length == 1) {}
``` this works
i used equals and still doesn't work
does GenericSpeed attribute change player's speed while he jumping? like slowness potion and jumping? is it will be same or player's speed will be same like he walkin'?
well here you're not comparing String
you will probably want to do !args[1].equals("*")
Note the negation at the start
ohh i forgot about the negation, now it works thanks
how can i create a temp Minecart and make it invincible and invisible?
invisible possible only with a resourcepack
invincible - probably cancel event on your "custom" minecart
But.. why do you need a minecart ?
remember cords, delete it and if u need it - spawn new on this cords
Aren't minecarts entities?
well yes
This seems really straightforward to me as you can just use the two bukkit methods for that
hi boys end gers
So ... What is the catch?
to make the player ride it and apply the velocity to the minecart to prevent the player from changing the direction and velocity
i bad speak english but i will use translate
minecarts can not be given invisibility
That's stupid
you can use a different entity
that can be invisible
Who knows what entity is used to create a plugin for the ball in the bukkit api?
but pigs can. great idea i will give the pig invincibility and invisibility
usually you would use an armor stand I believe
can u ride an armor stand?
or snowball if you need a different trajectory
but wait
with plugins, yes
gravity affects different enitities differently
I'd use bats but it all boils down to the same thing
can i spin the snall ball if i want? I just saw that when you hit the ball, it was spinning or is it such a texture pack?
You can disable gravity to my knowledge
but then i cant move the entity bcz im adding force with velocities
Won't change anything, right?
lemme just check how hypixel did it
So https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/Entity.html#setGravity(boolean) really prevents any movement?
declaration: package: org.bukkit.entity, interface: Entity
it does not
public static Vector getVelocity(Location start, Location end){
double flatDistance = Math.sqrt(Math.pow(end.getX() - start.getX(), 2) + Math.pow(end.getZ() - start.getZ(), 2));
double Y = (flatDistance * 32) / 2;
return end.clone().toVector().subtract(start.toVector()).add(new Vector(0, Y, 0));
}
and the calculations here are broken can anyone take a look at them? they throw the player a few blocks off
and when i say a few i mean 20 blocks
you can still move with getLocation().setZ(69); but thats laggy
you can not throw a player beyond a certain distance. You have to do it incrementally
any solution like PlayerJumpEvent?
no it throws more than what i defined
PME velocity Y > 0 AND player touches ground
GOOD(WORKING) solution?
player stat event > Jumps ?
i will try it, thanks!
Under what scenario does that not work?
when the player falls of an edge
when they take damage ?
Okay yeah
also, don't trust player.isOnGround()
Controlled by client, can be spoofed
?image
?img
Not verified? Upload screenshots here: https://prnt.sc/
Yeah you'd need to get the block below the player and check the Y coord of the player feet
hello, I am trying to recover the face of a block (like south, op, down etc...) (when it is broken) how to do?
player has base 1 damage
is there a way to change the hardness of a block withouth using protocollib and mining fatigue?
no
This is the third time this is being answered this month
it worked, thanks!
is having a for loop in a for loop in a for loop and doing that every second gonna impact performance heavily enough to be notable?
depends on how often you do this, how much you iterate, what you do
uh
every 20 ticks, loop through all players, loop through all their inventory items and loop through a list and do stuff
it does sound very bad to me
well if you have to do this, then you can split the inventory interating for different players on different ticks
but yeah.. it does sound bad
I need an event to know when the player has a new item
no need to iterate the inventory, just use .contains
create an advancement for every item
guess what contains does
yes, but he was about to get teh contents and loop every item
another problem is double jump:
it counts as 1 jump when u press two times jump button
is there any ideas?
minecraft does not have double jumps ?
wouldn't that like take an itemstack?
yes
won't work for me
why?
diamond sword with custom model data with a shit ton of stuff that I'm not checking
i mean when u press jump button once - it works, yeah
but when u press jump button two times - its not working
cause you can't jump if you're not touching ground ?
what are you trying to do
mid-air jumps are usually checked with "player wants to fly" thingie
i wanna disallow player to jump
atleast it works tho
you can add a jump boost potion effect with a level of 250 which just disables jumping on land
I wonder how many players are enough to make that cause any lag
what effects are you applying with these items
how add image here
i won't use potions
it's hard to explain, basically
person wears leggings -> Everybody else#hidePlayer(..., Player wearing leggings);
person that has sword -> show that player but make them invisible and hide their armor and item in hand so that they are hitable
I think I'm gonna do it in a different way
<dependency>
<groupId>com.sk89q.worldguard</groupId>
<artifactId>worldguard-bukkit</artifactId>
<version>7.0.5</version>
<scope>provided</scope>
</dependency>
so many vulnerabilities
if I knew how, I would, but I'm gonna do it in a different way ig
as ItemStack enchants can be set to only activate when worn in a specific slot
I have an idea how I can do it
wth maven trush?
latest is 7.1.0-SNAPSHOT or 7.0.8
Provides transitive vulnerable dependency maven:com.google.code.gson:gson:2.8.0 CVE-2022-25647 7.5 Deserialization of Untrusted Data vulnerability with medium severity found Results powered by Checkmarx(c)
Provides transitive vulnerable dependency maven:com.google.guava:guava:21.0 CVE-2018-10237 5.9 Allocation of Resources Without Limits or Throttling vulnerability pending CVSS allocation CVE-2020-8908 3.3 Incorrect Permission Assignment for Critical Resource vulnerability pending CVSS allocation Results powered by Checkmarx(c)
Provides transitive vulnerable dependency maven:commons-codec:commons-codec:1.11 Cxeb68d52e-5509 3.7 Exposure of Sensitive Information to an Unauthorized Actor vulnerability pending CVSS allocation Results powered by Checkmarx(c)
Provides transitive vulnerable dependency maven:org.apache.commons:commons-compress:1.19 CVE-2021-35515 7.5 Excessive Iteration vulnerability pending CVSS allocation CVE-2021-35516 7.5 Improper Handling of Length Parameter Inconsistency vulnerability pending CVSS allocation CVE-2021-35517 7.5 Improper Handling of Length Parameter Inconsistency vulnerability pending CVSS allocation CVE-2021-36090 7.5 Improper Handling of Length Parameter Inconsistency vulnerability pending CVSS allocation Results powered by Checkmarx(c)
you can ignore most of them
yep
why don't you update your worldguard dependency to latest
7.0.8 and 7.1.0-SNAPSHOT both work on 1.16
also you're not shading any of those dependencies so transitive vulnabirilities don't matter at all for you
i made a custom PlayerJumpEvent, it works based on statistics
when the player presses the jump button 1 time, it works, but when he presses it twice in a row, it skips the jump. any ideas about this?
because they're already in the air
I use this to detect jumps
spigot: https://github.com/JEFF-Media-GbR/JeffLib/blob/master/core/src/main/java/com/jeff_media/jefflib/events/PlayerJumpEvent.java#L98
paper: https://github.com/JEFF-Media-GbR/JeffLib/blob/master/paper-hacks/src/main/java/com/jeff_media/jefflib/events/PaperPlayerJumpEventListener.java
works fine iirc
thenks warning gone
oof i will look at it thanks
i need just figure out it
somebody please create an inventory change event which is fired on any change of the player inventory, because wow this is fucked up
cancel the player move event
will kick players when in mid air though
atleast for me it did
guys, gentlemen, I would like to ask you something. I make my "good" plugin for the hologram, but the problem is (because the hologram is an armourstand) the hologram gets stuck and shifts to the side if it is in some kind of block (I make the plugin for airdrop and the hologram shifts because of the chest)
Is there a way to connect a discord bot to Minecraft plugin? Like a verification, you need to enter a "password" that bot sent you into a Minecraft command. So bot sent u a password, and you need to enter a /verify command on Minecraft server with the password as argument, and then the bot gives you roles etc.
i think you can but dont know how
sounds like something you'd need the JDA for
Make armor stand no gravity
I thought of storing the password inside bot database and checking with the plugin for the password in the passwords database
bro what the hell
I had the same issue
how did u fix it
apparently it was the mc dev plugin
i try this not help
dont i need that tho? or am i crazy
you can work without it
Crazy? I was crazy once
no
They locked me in a room, a rubber room, a rubber room with rats, and rats make me crazy.
well, this is not the channel to be discussing that
Okay sr
Crazy? i was crazy once. They locked me in a room. A rubber room. A rubber room with rats. and rats make me crazy.
Crazy? i was crazy once. They locked me in a room. A rubber room. A rubber room with rats. and rats make me crazy.
can someone help me i am trying to add 3 absoption hearts to an player but i can find any information online on how to do it
the entity is moving anyway
what event do i use to prevent this from happening?
wth how you add vidio ii not can
verified
oh good
Hey, does anyone have any ways I can disable moving completely? I have managed to disable jumping & moving on land but if the place is in water or is submerged, the player moves freely
???
what ???
i dont want you to be able to take out the items
from the other inventory
but u still can with double clicking the item on your own inventory
|| event.getClick() == ClickType.DOUBLE_CLICK || event.isShiftClick() i think this should help
incase of event.getAction() == InventoryAction.COLLECT_TO_CURSOR, how do I know what slot it has been taken away?
thanks i wanted that
nvm it didnt work
wait, can you collect a stack?
How do i make so if you write "test" on the first line of the a sign all the lines will be set to example "123"?
ugh how am I uspposed to add the BSD license to my pom.xml and where do I even find the original text of it o0
Yeah, that's in that wiki page there
Verbatim text you can copy/paste and replace placeholders
?paste
error when running mvn license:update-file-header -> https://paste.md-5.net/epowijamot.sql
pom: https://paste.md-5.net/capijulofe.xml
i alöso don't really understand how someone is supposed to know that buildtools is BSD 3 when it's nowhere mentioned
?
there also doesn't seem to be any official link to the bsd 3 license, at least I couldn't find any
does anyone know how to set absorption hearts in 1.8
guess I'll just go back to GPL3, at least they mention in their license text that it's GPL 3, unlike BSD3 which just mentions some things but doesn't even give its own license a name
what inventory action could be when a player picks up an item in any way?
if the player shift clicks, what action is it?
Well the idea is that the actions are all distinct lol
So you'll have to account for multiple actions
Or rather, probably more appropriately, you can check whether the current item is null and the clicked item is not (the first condition being optional if you want to include swaps)
shift click is inventory click event
pick up from the ground is entityPickupItemEvent or something
Hello, my armor stand I don't have the text of the armor stand displayed, how can I fix this ?java ArmorStand stand = Objects.requireNonNull(location.getWorld()).spawn(location, ArmorStand.class); stand.setInvisible(true); stand.setInvulnerable(true); stand.setGravity(false); stand.setMarker(true); stand.setCustomNameVisible(true); stand.setCustomName(text);
why in realmines it says you could write placeholder "%realmines_secondsleft_MINE%" and it doesn't work
/hd create beacon_count &fMine reset in: &u%realmines_secondsleft_BEACON%
welcome to the wonderful world of minecraft development
I need some help with a plugin. I created a custom mob which spawns randomly on block break and when I do get the boss, from the block it shows an error in the console, but the mob works perfectly fine.
showerror
Caused by: java.lang.IllegalArgumentException: Plugin cannot be null
at com.dumbllama.hb.mobs.MiniSheep.<init>(MiniSheep.java:99) ~[?:?]
at com.dumbllama.hb.SpawnMobs.onBlockBreak(SpawnMobs.java:28) ~[?:?]
this has nothing to do with your issue, but please use consumers when spawning entities with custom data https://blog.jeff-media.com/use-consumers-when-spawning-custom-entities/
I made an instance in my main class, yet its still showing an error. However, this error doesnt appear when I use a command to spawn it.
Only when triggered by an event
I assume it has something to do with the instance, Ill try moving it into the main class
okay thanks
show the stacktrace
nice, I didnt know this 😳
I guess I should take time some day to just read all your blogs
heres the whole error:
Caused by: java.lang.IllegalArgumentException: Plugin cannot be null
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:145) ~[guava-31.1-jre.jar:?]
at org.bukkit.craftbukkit.v1_20_R1.scheduler.CraftScheduler.validate(CraftScheduler.java:464) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3814-Spigot-64b565e-c1279f7]
at org.bukkit.craftbukkit.v1_20_R1.scheduler.CraftScheduler.runTaskTimer(CraftScheduler.java:196) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3814-Spigot-64b565e-c1279f7]
at org.bukkit.craftbukkit.v1_20_R1.scheduler.CraftScheduler.runTaskTimer(CraftScheduler.java:187) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3814-Spigot-64b565e-c1279f7]
at org.bukkit.scheduler.BukkitRunnable.runTaskTimer(BukkitRunnable.java:117) ~[spigot-api-1.20.1-R0.1-SNAPSHOT.jar:?]
at com.dumbllama.hb.mobs.MiniSheep.<init>(MiniSheep.java:99) ~[?:?]
at com.dumbllama.hb.SpawnMobs.onBlockBreak(SpawnMobs.java:28) ~[?:?]
at jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:578) ~[?:?]
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[spigot-api-1.20.1-R0.1-SNAPSHOT.jar:?]
... 23 more
what's MiniSheep line 99?
will probably improve my code by like 20% xD
}.runTaskTimer(plugin,500L,100L);
it has something to do with the instance
I dont get the error when I call the event in the main class
stop abusing static
just pass a reference into the constructor
Then „plugin“ is null
Yeah It worked, I dont get the error anymore. Thank you
I just used Main.getInstance()
owo when was this added or has it always been a thing and I've never seen it because I don't ever have a use for spawning an entity
How can I detect a player attempting to break or take out the item from an item frame that is set as fixed? (You cant break fixed itemframes / take items out of them, and it doesnt trigger the EntityDamageEntity event when hit)
?jd-s (for me)
which is the issue please consider using di going forward
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
why in realmines it says you could write placeholder "%realmines_secondsleft_MINE%" and it doesn't work
/hd create beacon_count &fMine reset in: &u%realmines_secondsleft_BEACON%
I used something similar
@quaint mantle
1.) #help-server for server & non-development plugin help
2.) You'd probably be better off asking in the discord server for this plugin than in spigot.
What event is called when player leaves cuz there's no PlayerLeaveEvent there
I have implemented Listener
PlayerQuitEvent iirc
Ohh I'll try thanks
how can i find realmines discord?
How can I detect a player attempting to break or take out the item from an item frame that is set as fixed? (You cant break fixed itemframes / take items out of them, and it doesnt trigger the EntityDamageEntity event when hit)
yo, i figured it out but the result is same with i did by myself
Hi,
I'm trying to modify a Block Display Entity to make its size or block displayed change. but I don't know how to do it. Can somebody help me ?
@EventHandler
public void onPlayerDamage(EntityDamageByEntityEvent e) {
if (e.getEntity() instanceof Player) {
Player player = (Player) e.getEntity();
//may add only add if damager is a player too (later/vote)
this.cooldown.put(player.getUniqueId(), System.currentTimeMillis());
Bukkit.getScheduler().runTask(FCore.GetInstance(), new Runnable() {
@Override
public void run() {
}
});
}
}
``` how i can stop the task on some other event??
Hey, so Sign block state now has two sides (FRONT and BACK), so getLines() is deprecated in favor of getSide(...).getLines(). But Player::sendSignChange still sends only lines, not sides. Is this because lines should be in a certain order? Or its because it was forgotten in the update or is there now another way to send Sign Change update packet to the player? Thx
put this task on hashmap and then get it and cancel
?conventions
you're a convention
theres a food convention happening in my mouth atleast 3 times a day
yum, food
I have a Set<Chunk> of an area is there a good way to make a bounding box from that
I need a BoundingBox because I'm filtering with #getNearbyEntities which takes in a BoundingBox nvm solved I store everything i need to make a bounding box
3?
i suppose was 1
how i can cancel task inside the task?
Bukkit.getScheduler().scheduleSyncDelayedTask(FCore.GetInstance(), new Runnable() {
@Override
public void run() {
if (System.currentTimeMillis() - cooldown.get(player.getUniqueId()) >= 5000) {
if (bossBars.get(player.getUniqueId()) == null) {
Long TimeLeft = System.currentTimeMillis() - cooldown.get(player.getUniqueId());
String title = "ANTY-LOGOUT: " + Long.toString(System.currentTimeMillis() - cooldown.get(player.getUniqueId()));
BossBar bar = Bukkit.createBossBar(title, BarColor.RED, BarStyle.SEGMENTED_20);
bar.setProgress(TimeLeft);
bar.addPlayer(player);
bar.setVisible(true);
} else {
BossBar selectedBossbar = bossBars.get(player.getUniqueId());
Long TimeLeft = System.currentTimeMillis() - cooldown.get(player.getUniqueId());
String title = "ANTY-LOGOUT: " + Long.toString(System.currentTimeMillis() - cooldown.get(player.getUniqueId()));
selectedBossbar.setProgress(TimeLeft);
selectedBossbar.setVisible(true);
selectedBossbar.setTitle(title);
}
} else {
Bukkit.getScheduler().cancelTask(); //How to get the task id
}
}
});
cancel();
there's no cancel function
use BukkitRunnable
idk what that is
@tribal valve this
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/scheduler/BukkitRunnable.html#runTask(org.bukkit.plugin.Plugin)
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/scheduler/BukkitTask.html
declaration: package: org.bukkit.scheduler, interface: BukkitTask
declaration: package: org.bukkit.scheduler, class: BukkitRunnable
i use that
BukkitTask task = new BukkitRunnable() {
@Override
public void run() {
// code
}
}.runBlaBla();
hashmap.put(key, task); // you can now call cancel(); inside ur runnable and everywhere you want just with this hashmap
like this for example
@ancient plank
what is the
god damn
packet
for
clicking the leave bed button
u ask me as if I have done anything with packets
You aren't the packet god?
It's not entity_action, not use_item, not client_command, not window_clickk, not use_entity, not struct, not close_window
5.0 of what
com.comphenix.protocol
i have a client side block and I cancel the event for when they do it
Is there a packet I need to send back to the client because when they break it, it disappears
class PacketListener : PacketListenerAbstract(PacketListenerPriority.HIGHEST) {
override fun onPacketReceive(event: PacketReceiveEvent?) {
if (event == null) return
if (event.packetType == PacketType.Play.Client.PLAYER_DIGGING) {
val wrappedPacket = WrapperPlayClientPlayerDigging(event)
Bukkit.broadcastMessage("Received a packet digging.")
// TODO: we may need to send a block Ack packet (Agnowledge)
if (BlockTracker.isPacketBlock((event.player as Player).uniqueId, wrappedPacket.blockPosition, (event.player as Player).world.name)) {
event.isCancelled = true
}
} else if (event.packetType == PacketType.Play.Client.PLAYER_BLOCK_PLACEMENT) {
val wrappedPacket = WrapperPlayClientPlayerBlockPlacement(event)
if (BlockTracker.isPacketBlock((event.player as Player).uniqueId, wrappedPacket.blockPosition, (event.player as Player).world.name)) {
event.isCancelled = true
}
}
}
}
@young knoll where does it actually say it is player_command?
?nms
(for me)
i mean
i would love to use nms
for this
but
the issue is i can't listen to nms packets
I am creating a custom creature using a resource pack and display entities. I need to give it a pathfinding algorithm. Should I run the pathfinder asynchronously?
https://github.com/patheloper/pathetic it is with pathetic
coll is pathetic
i dont doubt that
how can I set a bee's flying speed? setting the attribute flying speed does nothing, should I use vectors instead?
This is what happens
Why do you need to listen to packets for this anyway
If I did do the heavy weight piece of the algorithm async, I was thinking of having a synchronous runnable check the locations of blocks and store it, then have the async algorithm review the stored blocks and their locations, then pathfind around them. Does this seem like a good idea to keep things less intensive on the server?
you really dont want to dive into that pool
also to switch to sync, then fetch the blocks and locations aka. the chunksnapshot, on which you can operate async btw, then go back to async to use that information is inefficient as hell
take a look at this. exactly what you need and if you still want to do it yourself, we did all of this already, you could take inspiration of it
So I should just pathfind entirely sync? Should I have the pathfinder run every tick, or have it run periodically, updating the path every few ticks?
what? no
Then what seems like a good solution to minimize lag?
to do it right and async lol
You just said going back in forward between async and non-async is isn’t efficient LOL
because it isnt
But it’s still the best solution?
never said that
once again, you could take a look at pathetic, the currently best open source spigot pathfinder lib, which already did what you want
especially at our snapshotmanagers which do the magic to go fully async
and dont forget to leave a star
just helping out ¯_(ツ)_/¯
Is it possible to set a block in your inventory to be completely unplacable?
I know you can use the PlayerInteractEvent and cancel the event but is it possible to just remove the ability of getting that little animation before the block gets removed in full?
If I was to pathfind async, won’t I need to check the surroundings sync?
isn't blockplace stoppin your hand from moving
?learntoread should be a command at this point
hehe
nah it still "places" the block but it instantly vanishes
you can try PlayerAnimationEvent tho
will look into it
could be a packets thing
maybe you can cancel it from anim event
would BlockPlaceEvent stop the animation
you need to catch both
gocha
cancel block place and cancel right hand anim
@ivory sleet make it possible
Dude, what didn’t I read XD
maybe this
and this
and this
boop
@remote swallow is this resource up to date? https://wiki.vg/Protocol whats the website you showed me yesetrday to check packets?
yes?
?learntoread https://i.imgur.com/VFXOCm4.png
i just checked it on a mappings site
no
Is it worth learning kotlin for plugin development if i already know java?
no
less people would help you there
No, no, and no
With java like 99% of people can help you
Kotlin is a preference
With kotlin maybe 10
kotlin sucks
cuz it's harder to read kotlin for guys who spent years on java
Okay yeah thanks
@ancient plank
i'm used to languages like java, c#, typescript
… I may have missed that
you could also just use pathetic 🤔
for how much
Wondering if anyone knew what is going on with this. I've checked and all values seem to not be null, and I checked by print. https://imgur.com/a/S6CaFFk
Is there an event for when a player's main hand item changes. Not like JUST when they swap with offhand but ANY time that the main hand of the player changes to a different item?
try looking through javadocs
i don't remember event like this
you probably will have to check it yourself, i think that's too specific
if there isnt one. its not hard to get around it. you could just run a runnable and constantly check through all online players inventoriies and handle what you want that way.
Can I update to jdk +16 using spigot 1.8?
1.8 has to use java 8
Player PlayerItemHeldEvent triggers when a player holds a new item. If it does trigger when the player holds a new item in the offhand, do event#getNewSlot If the slot int isn’t the offhand slot, it’s the main hand
i wanted to use patters on instanceof
cast it
then don't use 1..8
already done xd
I need 1.8
if (something instanceof somethingelse) {
somethingelse else = (somethingelse) something
so I just cast and done
ye ye I know
I forget how taskTimer always works. does delay mean it delays the timer for x amount of ticks every x period
delay is before it runs, period is how long between runs
/lay plugin
I would like to listen to that packet so when a player is /lay ing
They can click the leave bed button
And actually stand up
Rn they just have to use the command again
look at how gsit does it
so this code would just run the task every tick right?
task.runTaskTimer(plugin, 1L, 1L);
yeah
ugh the wording in the docs always confuse the shit out of me
im pretty sure they make you ride something so you press shift to get out
Link me
yeah I tried this but for some reason it flat out doesnt work at all
I registered event and everything
but when I scroll through hotbar the event does not trigger
Send a screenshot of the code
?paste
those methods dont fire at all
if anyone has an idea for this please lmk. BlockBreakEvent also and it gives the same effect as cancelling the PlayerInteractEvent
paste is bad
you are
nah
probably not possible
It shouldn’t be static I don’t think
yea thats what they all say
use naming conventions
I fixed it btw
What event gets called when an item frame breaks from being inside a block?
What do you mean by inside a block?
you can place a block against a blockface that has an itemframe
then the itemframe will break
Huh, didn’t know that
Yeah
The only way to cancel that I have found is to make it unbreakable by players in survival, which makes it so I can't get an EntityDamageEntity of it when a player hits it to do the functionality I want to, so that isn't really an option.
This is just a guess, but since item frames are entities, you can do EntityDeathEvent. If the entity is an item frame, check the coordinates of the entity’s death. Get the material of the block at those coordinates, and if it isn’t air, trigger whatever you want
Is there any way when translation back to the chunk I can get the opposite edge I'm getting right now? basically I'm getting these to points, but I really want the ones on the opposite side of the chunk
catch Event and print which event class got fired
HangingBreakEvent
I'd just wanna cancel the death event from running, but it isn't cancellable
That's for when a player breaks it
Tbh I have no clue how to do that
pretty sure there was a way
think it was just adding 16 in each direction and %= 15
or adding 15 and %= 16
something like that
I feel dumb now
I have been at this for hours and tried to work with that event and it was that simple
Or I hope it works now atleast
Isn't that one comma too much?
Doesn't matter for enums
Bad practice, looks ugly
Thanks
Your name literally means "beginner" in portuguese
Don't stress it 😛
Yes
I'm aware, it comes from when I was like "hmm, what would be a good username... I'm really dumb sometimes, let's throw "Noob" into google translate and see if something nice sounding comes out... Ooh Novato that sounds smooth"
that extra comma is good actually
mostly for version control reasons
since then you only have to edit 1 line to add a new constant
So.. redundant
yes
but in a good way
I think its either a comma or a semicolon
unless its not needed
I'd expect it on the material enum not in some obscure event
This plugin doesn’t actually make you lay down when you /lay
Though
It doesn’t put you in a bed view
Like in an MC bed
With the leave bed button
type /lay on a bed
hey I have a question!
I want to make a command, which is only accessable for players with a specific tag. is that possible?
Or what else do I do?
So it doesn’t handle that
doing that is just extra unneeded work
Break it down
Yes…
Wdym by tag? Aren't permissions sufficient?
its a server where you have different classes. I want to make a command for Fairys so they can fly and only players with the tag fairy can use it
Yeah so break it down
Make a fairy permission group and add them to the group when they chose the class. That would be the easiest.
You can however use the PlayerCommandPreProcessEvent to cancel command executions if you prefer that
That's just overcomplicated
make a command, couple checks to see the player's tag
if it's not fairy, throw an error message
that still makes the command show up for autocompletion since they have the permission
yeah but idk how i do that xD you see i just started with this haha
Not that hard to run a command that adds them to a permission group once they pick the class
oh so the class plugin is not yours then?
there are no commands to add me to the class yet. i just have some datapacks that give me custom team name and stuff if my ingame tag is like fairy
Is running this asynchronously safe? world.getChunkAt(0,0).getChunkSnapshot()
yes
What does #getChunkSnapshot even do
declaration: package: org.bukkit, interface: ChunkSnapshot
Huh can I just access it async and then process things with Chunk-Data?
Well in that case you have to work with that. I thought you made the datapack before.
You use the https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/player/PlayerCommandPreprocessEvent.html
and inside of it call #getPlayer() and check the tags. If they match you cancel the event
declaration: package: org.bukkit.event.player, class: PlayerCommandPreprocessEvent
It basically creates a copy of the chunk, yes
k thx
But completely async?
If I’m creating an async pathfinding algorithm, should I use this to iterate through the blocks to determine pathfinding? Would that be a good method?
I never used it but I'd assume so
Thats great
nope
Snapshot's read only
snapshot's a read-only copy that's fine with async
I meant that you can do async checks on world.getBlockAt() as long as you don't modify it
pretty sure you can't
How would I check block materials async then?
create a snapshot
for each chunk you're processing
And then you can check that snapshot's blocks async
Oh sorry I misread what @flint coyote said
Thanks
Does anybody know how I can get a TrimMaterial/Pattern by inputting a String?
Example:
I have the String AMETHYST and want to get the corresponding TrimMaterial. How would I do it?
Imma do that with all important chunks on boot, thats great
why does the event not fire
@EventHandler
public void onPlayerPickupItem(EntityPickupItemEvent event) {
if(!(event.getEntity() instanceof Player player)) return;
Bukkit.getPluginManager().callEvent(new PlayerItemAcquireEvent(player,
event.getItem().getItemStack(),
player.getInventory().first(event.getItem().getItemStack()),
event.isCancelled()));
}```
I just checked. It does work
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> System.out.println(Bukkit.getWorld("world").getBlockAt(0, 60 ,0).getType()));
this does work
and it even updates (I run it in the BlockBreakEvent)
something tells me you're running a funky paper fork
oh true, the server is based on paper since it boots up faster. Lemme check spigot
Still might not be the best idea to work on something actively changing. Creating a snapshot allows you to work with a copy, without tampering with the original chunk itself.
Well if he just wants to create a path it probably won't change too much. But yes it comes with a little risk.
Creating a chunksnapshot is a pretty heavy operation though
Shouldn't be that heavy
did you register it? Does it implement listener?
That flood-fill code I posted managed to do like 300k blocks per second
single-thread was like 20k
it is registered and it does implement Listener
wait, the event does not fire for some reason and I dunno why
Are both listeners registered
In a pathfinding refresh, I only check a few hundred blocks, so would it be damaging to performance?
snapshots might be wasteful at a certain point
It's the kind of thing where you do both and make a graph
mm I really hate this but it should work
it should but it does not
Wdym
I really know nothing about coding plugins, but I have a little experience with datapacks, and I'm wondering if anybody can help me figure out how to make a custom plugin?
Let's say your distance between A and B is like 4 blocks
Making a whole snapshot can be wasteful
if at the end you only need to pathfind those 4 blocks
I swear, spigot events are cursed
Might come across as arrogant but ?learnjava
b o t pls
?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.
There ya go
something must be missing I guess
what could be missing
I know how to code java lmao, that doesn't tell me anything about integrating it with minecraft and plugins
Ah
Ah makes sense. So should I just check the blocks directly then, without the snapshot copy?
Keep in mind, the pathfinder is running async
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
I'd start by reading the wiki
and it doesn't help most plugin tutorials on youtube barely show anything more in depth past just responding to a certain phrase in chat
can't decide on building vehicles and start with a spaceship I guess
There are tons of events and the chat one is quite intuitive
So we start with the chat one
You can then just pick another event and play with it
Maybe get multiple listeners working together.. That's why youtubers make entire series
lemme just check the async thing on spigot then we can hop in a voicechat and check if you want to. Probably has to be a private call since no screenshare is allowed on spigot (for whatever reason)
IDK if these are any good anymore, as I watched them a while ago. But this is what got me started https://youtube.com/playlist?list=PLDhiRTZ_vnoUvdrkTnaWP_hPmbj2JfPAF
Maybe some kind of config where it picks between async and sync
Yeah that's fair, I'm trying to make one that I can't imagine not being fairly simple
Start slow and work your way up
I did try to make minigames at the 1 year mark and it just went poorly
And then again at the 3 year mark, slightly less worse
Fair, I'm trying to make one that bares resemblence to the lifesteal plugin, but is pretty different
hearing "years" must really make people feel unmotivated but it's kinda true. Programming is a looong process
I've been coding for 12 years and making plugins for the past 6
i think hearing decades is worse lol
oh gosh, spigot is cursed
Yeah I'm coding for 8-9 years now. Started with plugins like a year after. I did have breaks from spigot and coded other stuff though
Only now I decided to start touching minigames and making really really fancy particle effects
But once you have a good structure, things will flow smoothly
I made TNT tag in like an hour last night :p
did u find it?
Add souts everywhere
I'm doing that rn
odd
everything after registerListener isn't working
Why wouldn't it? It's a read-only operation
try reading at an unloaded chunk
im working with just packets do I need to send a block back to the player when they break it?
(those blocks im right clciking and mining are packet based and client side)
Just like with files you can also have infinity threads reading it but only one can write
I originally wanted to do the pathfinding async because if it took a while to process it wouldn’t delay vanilla server updates. What benefit would running it sync have?
that won't work. At least that's what I'd expect. Or just return air
less memory footprint
And maybe less spiking
When a player breaks a block, it sends a packet saying it has "finished digging" with the block position
And sets the block as air internally
Good point
You can send the block back if you want, or just do whatever
I cancel that https://pastebin.com/c7Vt7Eza
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Don't I so spigopt never gets any packets related to those blocks
does work and seems to load the chunk (synchronously)
I mean ofc you have to register both
You can't cancel the packet like that
It's a packet sent from the client -> server
cancelling it just means the server won't process it
Yeah so spigot should never set it to air in theory?
When you cancel an event, it sends packets reverting the action
yeah what packet do I need to send to revert them breaking a block?
This is what we did at work
I just registered them the normal way instead of static register function and it worked
fourteen will scream at you for the static instance
a static function should work as long as it's called from the onEnable
the pixelated stuff?
yeah
Not my fault
Hello, when I want to use BuildTools for 1.16.5, I get this errors :
https://pastebin.com/S9b1e5J4
as you can see, it didn't
I only wrote the packet stuff, everything else was made by someone else and I didn't have time to DI everything
but honestly I already had an instance so idk
Weird thing that an asynchronous operation does a synchronous chunk load to access data. Still better than an error I suppose
maybe I'm just dumb
what funny thing can I do in my onDisable
print out random millis that stuff take
wdym by funny?
eg, how long it took to register listeners, how long startup too, how long an event lasts, literally just a random amount of millus
like, something to entertain me when I enter stop in the console and something confuse people who use my plugin
"You telling me that this server is stopping without a crash?"
I should probably not say what is what and try guessing stuff
"You dare to shut me down?!"
or just generate some random numbers and claim it's a memory leak
and also print it in a random sequence
"Data sent to the chinese government: 28.4TB"
throw an exception every second on a new thread for the entire shutdown
just do new Throwable().printStackTrace
that's cursed
I should make an error which will basically be "Server is shutting down, Error code: 0"
for (int i = 0; i < Integer.MAX_VALUE; i++) {
new Throwable().printStackTrace();
}
Or you just add a random "common password list" and do some interesting fact aka "Did you know that McDonalds123 is a pretty common password?"
Gotta teach safety on disable
can someone help me please ?
okay so I have a center location
I want to find every block (EMERALD) with underlaying block (DIAMONDBL) connected to the center
what algorithm should I use to make it the most efficient?
Flood Fill?>
what command did you use to launch? It just builds latest for me when launching it without parameters
well start millis is less than current
@echo off
title SpigotMC BuildTools Builder
IF NOT EXIST BuildTools (
mkdir BuildTools
)
cd BuildTools
curl -z BuildTools.jar -o BuildTools.jar https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar
set /p Input=Enter the version: || set Input=latest
set /p Java=Java 8 or Java 16 (for 1.17.1 only) or Java 17? || set Java=17
if %Java%==8 "C:\Program Files\Zulu\zulu-8\bin\java" -jar BuildTools.jar --rev %Input%
if %Java%==16 "C:\Program Files\Java\jdk-17\bin\java" -jar BuildTools.jar --rev 1.17.1
if %Java%==17 "C:\Program Files\Java\jdk-17\bin\java" -jar BuildTools.jar --rev %Input%
if NOT %Java%==8 if NOT %Java%==17 if NOT %Java%==16 echo "Please rerun the .bat file and input 8 or 17 or 16 in java version"
echo "Done!"
pause```
Does 1.16.5 even support java 8?
it does afaik
yup seems so
yes 1.17 needs java 16 and 1.17.1+ needs java 17
did that script work before? Did you try calling
C:\Program Files\Zulu\zulu-8\bin\java -jar BuildTools.jar --rev 1.16.5 directly?
might need the quotes around the path, not sure.
In that case
"C:\Program Files\Zulu\zulu-8\bin\java" -jar BuildTools.jar --rev 1.16.5
hehehe
I'll try
Next question of the day. How can I make an entity pathfind to a specific location?
Same...
hmm did you try using another network? E.g. mobile data?
Also make sure to not use any VPN
I'll try disconnecting my Eternet cable
(and using wifi)
That probably won't change anything. Try using your phones data, if you have that
it's working 
well
strange
weird, good for your though xD
my pc is ethernitically not compatible I think 
maybe an ant inside your ethernet cable is eating all the packets
interesting theory
sorry it just tastes so godo
Imagine 
yummy packets
what is the most efficient way to check if player stepped on a block of some type?
Probably an early return PlayerMoveEvent
Just make sure to use e.getTo() instead of player.getLocation()
oh right
tysm
Hi guys so im making TablistManager which will just be used to put on header and footer to players tablist and most likely just put prefix to the players tablist so yeah i need ChatComponent type which comes with net.minecraft.server... so i had to add my server.jar as dependency to my project right and im using intellij and i went in project structure i found where my module is and i went in dependencies tab and added my server.jar as dependency but it seems not to be working for some reason i mean it is not loading as dependency so i cant use it in my project any help maybe if someone is familiar ?
Well I changed it to also send a ClientboundBlockUpdatePacket to the player no still disappears
newer versions use maven/gradle dependency
not a .jar dependency
also isn't component part of api already
oh it's paper shit
you can use adventure then
what is maven dependency for that
?nms
chatcomponents
part of adventure
if you need nms, follow this guide
Does anyone know what this packet is called ?
PlayerAction myb
you want to send that packet ?
its Serverbound i think
unless ur trying to send it to other players uhhh idr
oh shit u right it is Serverbound
silly
Do you know what the name is on packet events?
mojang name is ServerboundPlayerActionPacket
does packet events not use the proper names?
When you call the updateIniduvually how did you get that to work?
(player as CraftPlayer).handle.connection.send(
ClientboundBlockUpdatePacket(BlockPos(blockPosition.x, blockPosition.y, blockPosition.z), block!!)
)
Play.Client.PLAYER_DIGGING -> {
val wrappedPacket = WrapperPlayClientPlayerDigging(event)
if (!wrappedPacket.action.name.contains("DIG")) return
Bukkit.broadcastMessage("Received a packet digging.")
// TODO: we may need to send a block Ack packet (Agnowledge)
if (BlockTracker.isPacketBlock((event.player as Player).uniqueId, wrappedPacket.blockPosition, (event.player as Player).world.name)) {
event.isCancelled = true
RenderHandler.updateSingle(event.player as Player, wrappedPacket.blockPosition, (event.player as Player).world.name)
}
}
BlockDamageEvent
On packet events? What
not sure what you mean on packet events then, assumed maybe you wanted to know what it was in the api
packetevents is a lib like protocollib
using a bukkit like event system for packets
Im just tryna figure out why it is not stopping a block from being mined client side and not reppearing
well there isn't much that can be done on the client side as the client still has predictive code
so it really depends
but I send a block update to the client when they try and break the block?
do I need to be delaying by a tick or smth?
if you don't want to deal with code for stopping a block from being mined
you could always set the NBT tag for it
No I would like to deal with stopping a block from being mined
but there is api methods though in spigot to stop such things, which is the blockbreakevent
is there an event for new day in the world?
yes but my blocks arent real
so not sure why you are attempting to do this from the NMS at the packet level
hmm thats the exact same thing im doing for the most part
ah
I know your issue then
there is like 5 or so packets you are going to need to deal with then
I deal with block place and dig
any updates to the chunk or blocks need to be intercepted
if any of these packets makes it to the client, the client will realize your blocks are fake and remove them
nope, this is your issue
minecraft sends the whole chunk? when u break block/
i see
the server sends neighboring chunk updates too
so if you break a block in 1 chunk, it could send updates for 4 other chunks too
but chunk packets are not the only things that cause the client to update either
there is a few other packets which I don't remember them all
ty for that I will skim wiki.vg for the others
I didnt even think that this would break this exact issue
Wait this shouldn't break this tho since minecraft never would update the chunk when I break a block
since only I know this block exists
I'm still trying to figure this out. How the hell do I correct for the coordinates being off from what I want at chunks in a predictable manner.
(1215, -895) reduces into (75, -56) [this is intended]
(75, -56) expands into (1200, -880) [this is not intended]
I need to find a solution to get (1200, -880) to become (1215, -895)
(1168, -848) reduces into (73, -54) [this is intended]
(73, -54) expands into (1168, -863) [this is not intended]
I need to find a solution to get (1168, -863) to become (1168, -848)
this is the code I'm using to get into a bounding box
public BoundingBox asBoundingBox() {
final World world = Bukkit.getWorld(this.corner1.getWorld());
if (world == null) {
throw new IllegalStateException("The world of this area is not loaded");
}
Location lc1 = corner1.asLocation(world.getMaxHeight());
Location lc2 = corner2.asLocation(world.getMinHeight());
return BoundingBox.of(lc1, lc2);
}```
```java
public Location asLocation(final int y) {
final World world = Bukkit.getWorld(this.world);
if (world == null) {
throw new IllegalStateException("World of location is not present");
}
return new Location(world, this.x << 4, y, this.z << 4);
}
probably something to do with lowest possible corner
who know c++ help me
I don't think so
wait
yeah its def that
before there was a bug in my code causing it to be off even more, so I just noticed
how to scammer cpp folder through visualStudio cpp files it doesn't see
the hard part here then would be how do I preserve the lossy operation of blockX >> 4 because I don't technically know where my post is. All I know is they form a square
add 15
works in some cases and not others no?
I mean in one of my examples its only off by 15, the other one is off by 15 in each direction
wait

yeah no I'm still stumped
I mean if its different in each scenario idk what to do
wait so is it still that opposing corners thing
yeah I need to get the points where the 2 corner chunks are furthest apart
just add 15 in the relative X and Z axis and %= that by 16
Basically just
int relX = x - chunkX * 16
int relZ = z - chunkZ * 16
int oppositeX = chunkX * 16 + ((relX + 15) % 16);
int oppositeZ = chunkZ * 16 + ((relZ + 15) % 16);
don't ask why it works
might cause weird issues actually
I would do this with both corners right
I start where the red block is
I want to get blocks that connected in someway to the main location and are Emerald blocks
this is my current run on the Flood-Fill, but it results in absurt big results:
yeah sure
lest hope it works
Here's code for a flood fill
oh my
tysm
It's optimized for large areas
pretty sure I ran it on areas that were a few million blocks in volume
You'll also need a main thread executor
ye thats not a problem
since u know the code better
how could I adapt it to also check the block below the upper block and only add if it's Diamond Block?
this works because chunk coords are only divisible by 16
Why am i getting so many errors with this?
It dosent understand: e.getAction(), e.getClickedBlock(), b.getType(), b.getType and b.getState
@Override
public void onSignChange(SignChangeEvent e){
if (e.getAction() != Action.RIGHT_CLICK_BLOCK) {
return;
}
Player p = e.getPlayer();
(!(isPlayerInGroup(player, "admin") || isPlayerInGroup(player, "h-admin"))) {
Block b = e.getClickedBlock();
if (b.getType() == Material.SIGN_POST || b.getType() == Material.WALL_SIGN) {
Sign sign = (Sign) b.getState();
if (ChatColor.stripColor(sign.getLine(0)).equalsIgnoreCase("[WARP]")) {
if(sign.getLine(2) != null && !sign.getLine(2).equals("")) {
String warp = ChatColor.stripColor(sign.getLine(2));
Bukkit.dispatchCommand(p, "warp " + testWarp);
}
}
}
}
}
declaration: package: org.bukkit.event.block, class: SignChangeEvent
because none of those methods exist
(for the event, that is)
Im using 1.8
they also don't exist in 1.8
is x and z the x and z I want it to be on?
ye
I don't know that kind of but, the code you gave does have a side affect which is beneficial an idea
I have an issue again with this plugin, so what I wanted to do was when a player has a certain helmet on, it gives a 10 percent change to give double drops. But it doesnt recognize that I have the helmet on or doesnt run the code thru.
identify your custom items through PDC tags
PDC tags?
you could just store a boolean in your item, e.g. "is-my-custom-helmet"
private isMyHelmetKey = new NamespacedKey(myPlugin, "is-my-custom-helmet");
// Save tag on item
ItemMeta myItemMeta = myHelmetItemStack.getItemMeta();
myItemMeta.getPersistentDataContainer().set(isMyHelmetKey, PersistentDataType.BOOLEAN, true);
myHelmetItemStack.setItemMeta(myItemMeta);
// Check if its your custom helmet
if(myItemMeta.getPersistentDataContainer().has(isMyHelmetKey, PersistentDataType.BOOLEAN)) {
// It is my helmet!
}
nobody there uses "getAction()" or "getClickedBLock()" on a SignChangeEvent
There is
Of you scrool down on the code at onInteract you can see if (e.getAction() == Action.RIGHT_CLICK_BLOCK)
im dumb af
I adapted it a bit to also check for bottom block if it matches another material
but I can't seem to get it to work at all
it just created CFs and does nothing
modifying is at your own discretion ¯_(ツ)_/¯
@tender shard still nothing lmao
show your code