[SPIGOT-1921] Can't cancel void damage. Turns into infinite loop. Created: 13/Mar/16 Updated: 10/Jul/16 Resolved: 10/Jul/16 |
|
| Status: | Resolved |
| Project: | Spigot |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Minor |
| Reporter: | Camden b | Assignee: | Unassigned |
| Resolution: | Cannot Reproduce | Votes: | 1 |
| Labels: | 1.9 | ||
| Environment: |
git-Spigot-6f291ea-55a8535 version 1.9-R0.1-SNAPSHOT Raspbian (Shouldn't effect this bug.) |
||
| Description |
|
Ok so basically you can't cancel the EntityDamageEvent and tp the entity when the entity is hit by void otherwise it will go into an "infinity loop" Code to replicate @EventHandler (priority = EventPriority.LOWEST)
public void onDamage(EntityDamageEvent event) {
if (event.getEntityType() != EntityType.PLAYER) return;
Player player = (Player) event.getEntity();
if (event.getCause() == EntityDamageEvent.DamageCause.VOID) {
player.teleport(spawn);
Bukkit.broadcastMessage("Called!");
}
event.setCancelled(true);
}
|
| Comments |
| Comment by Johnny Joannou [ 20/May/16 ] |
|
Can confirm this issue. |
| Comment by Indy [ 11/Apr/16 ] |
|
I am experiencing this bug as well. |
| Comment by MasterGberry [ 16/Mar/16 ] |
|
Confirming this bug. Experiencing the same issue. EDIT: Teleporting the user one tick later is a temporary work around |
| Comment by Camden b [ 14/Mar/16 ] |
|
Is there anything spigot can do to fix this? |
| Comment by Matthew Steglinski [ 14/Mar/16 ] |
|
The reason why the EntityDamageEvent is called so many times when a player is damaged by void and immediately teleported is because the players location doesn't truly update until the server receives a PacketPlayInTeleportAccept packet. This is a new packet introduced by Mojang in 1.9 which seems to be a synchronization measure for when players teleport. In turn, the players y value remains below -64 (threshold for receiving void damage) until the client tells the server that it has finally teleported. The players y value remaining below the threshold is what causes the server to constantly damage the player with void damage each tick. I'm not sure what the best approach to fixing this would be without creating player location synchronization issues as this is an issue which I assume is in vanilla (but would remain virtually undetectable by players as there are no plugins on vanilla). |
| Comment by Matthew Steglinski [ 14/Mar/16 ] |
|
Output with your listener: [20:39:19 INFO]: Called! [20:39:19 INFO]: Called! [20:39:19 INFO]: Called! [20:39:19 INFO]: Called! [20:39:19 INFO]: Called! [20:39:19 INFO]: Called! [20:39:19 INFO]: Called! [20:39:19 INFO]: Called! [20:39:19 INFO]: Called! [20:39:19 INFO]: Called! [20:39:19 INFO]: Called! [20:39:19 INFO]: Called! [20:39:19 INFO]: Called! [20:39:19 INFO]: Called! [20:39:19 INFO]: Called! [20:39:19 INFO]: Called! No infinite loop created |