Fix leash event for boats and elytra#13697
Conversation
paper-server/patches/sources/net/minecraft/world/item/FireworkRocketItem.java.patch
Outdated
Show resolved
Hide resolved
|
I run this and works.. but i find one case where with Elytra+Rockets and a boat leashed not sure how the leash was cut even with the cancel in true... and the console flood with the message added in the event... but maybe that is another thing... @EventHandler
public void onPlayerUnleashEntityEvent(final PlayerUnleashEntityEvent event) {
this.getLogger().info("PlayerUnleashEntityEvent");
this.getLogger().info("event.getPlayer() -> " + event.getPlayer().getName());
this.getLogger().info("event.getEntity() -> " + event.getEntity().getName());
event.setCancelled(true);
}
@EventHandler
public void onEntityUnleashEvent(final EntityUnleashEvent event) {
this.getLogger().info("EntityUnleashEvent");
this.getLogger().info("event.getReason() -> " + event.getReason());
this.getLogger().info("event.getEntity() -> " + event.getEntity().getName());
event.setCancelled(true);
} |
I think I may have found another bug: |
|
@Doc94 Please try your test plugin again, I have pushed a potential fix to the leash breaking even though it was cancelled. |
I think this has been done on purpose see: #4993 and the javadoc of the EntityUnleashEvent |
38e5496 to
a5cf227
Compare
You're absolutely right. Thanks for clearing that up. I removed my change, leaving only the original fix. |
324da0b to
3166311
Compare
paper-server/patches/sources/net/minecraft/world/item/FireworkRocketItem.java.patch
Outdated
Show resolved
Hide resolved
paper-server/patches/sources/net/minecraft/world/entity/vehicle/boat/AbstractBoat.java.patch
Outdated
Show resolved
Hide resolved
ba6a720 to
c6c564f
Compare
|
I couldn't find what happens when any other entity dies, that might be worth investigating too |
Maybe just call the PLAYER_UNLEASH like here? i dont find another case... because things like llama despawn or copper golem turn into statue not call the event for notice... |
e5dca0a to
32148da
Compare
|
@kennytv @Doc94 I found that in Additionally, I found that when an entity changes dimensions, the unleash reason is And when a mob starts riding another entity, the unleash reason is also |
Fixes #13696
This fix needs testing