3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-26 16:12:42 +01:00

Improve paper patch to allow for latency in towering up.

Dieser Commit ist enthalten in:
Myles 2016-03-27 13:56:06 +01:00
Ursprung 0e4df51613
Commit f926113c66

Datei anzeigen

@ -26,9 +26,7 @@ public class PaperPatch implements Listener {
UserConnection userConnection = ((ViaVersionPlugin) ViaVersion.getInstance()).getConnection(e.getPlayer()); UserConnection userConnection = ((ViaVersionPlugin) ViaVersion.getInstance()).getConnection(e.getPlayer());
if (userConnection == null) return; if (userConnection == null) return;
if (!userConnection.get(ProtocolInfo.class).getPipeline().contains(Protocol1_9TO1_8.class)) return; if (!userConnection.get(ProtocolInfo.class).getPipeline().contains(Protocol1_9TO1_8.class)) return;
Location diff = e.getPlayer().getLocation().subtract(e.getBlock().getLocation().add(0.5D, 0, 0.5D)); Location diff = e.getPlayer().getLocation().subtract(e.getBlock().getLocation().add(0.5D, 0, 0.5D));
if (e.getPlayer().getLocation().getBlock().equals(e.getBlock())) { if (e.getPlayer().getLocation().getBlock().equals(e.getBlock())) {
e.setCancelled(true); e.setCancelled(true);
} else { } else {
@ -40,6 +38,14 @@ public class PaperPatch implements Listener {
// Are they on the edge / shifting ish // Are they on the edge / shifting ish
if(diff.getY() <= 0.1D && diff.getY() >= -0.1D){ if(diff.getY() <= 0.1D && diff.getY() >= -0.1D){
e.setCancelled(true); e.setCancelled(true);
return;
}
BlockFace relative = e.getBlockAgainst().getFace(e.getBlock());
// Are they towering up, (handles some latency)
if(relative == BlockFace.UP){
if(diff.getY() <= 1.1D && diff.getY() >= 0D){
e.setCancelled(true);
}
} }
} }
} }