-
New Feature
-
Resolution: Unresolved
-
Minor
-
None
-
None
-
Java 17
Spigot 1.18.1 built today with buildtools.
This server is running CraftBukkit version 3378-Spigot-8965a50-0ba6b90 (MC: 1.18.1) (Implementing API version 1.18.1-R0.1-SNAPSHOT)
-
1.18.1
-
Yes
When you step into a tripwire, this tripwire gets powered. This is a server-side event. I want to disable this mechanic (I am working on a plugin which allows to replace some strings variations to simulate new blocks via a resourcepack). According to CraftBukkit source code this should be feasible by disabling PlayerInteractEvent, but this event is not called.
Here is a block created using this method (you can see powered:false at the right):
If I step inside the block, it gets powered:
Here is CraftBukkit code from buildtools (net.minecraft.world.level.block.BlockTripWire.java), see line 165:
{{ // If all of the events are cancelled block the tripwire trigger, else allow}}
https://www.toptal.com/developers/hastebin/akudumigol.kotlin
Here is a minimal example:
@EventHandler public void tripwireEvent1(PlayerInteractEvent event) { event.setCancelled(true); Logs.logInfo("triggered 1"); } @EventHandler public void tripwireEvent2(EntityInteractEvent event) { event.setCancelled(true); Logs.logInfo("triggered 2"); }
Those events are successfully registered (I see "triggered 1" when right clicking on a block for example), but strangely, they are not triggered when you step into a tripwire which prevents me from disabling this mechanism.