2015-07-26 01:00:37 +02:00
|
|
|
From 8b0fe684b14defdd3f55914bcbcc0502ac3ae95a Mon Sep 17 00:00:00 2001
|
2015-07-23 13:30:13 +02:00
|
|
|
From: Techcable <Techcable@outlook.com>
|
|
|
|
Date: Thu, 23 Jul 2015 04:29:22 -0700
|
|
|
|
Subject: [PATCH] Add PlayerMicroMoveEvent
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
|
2015-07-26 01:00:37 +02:00
|
|
|
index 18d8d2d..47a54a0 100644
|
2015-07-23 13:30:13 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
2015-07-26 01:00:37 +02:00
|
|
|
@@ -63,6 +63,7 @@ import org.bukkit.util.NumberConversions;
|
2015-07-23 13:30:13 +02:00
|
|
|
// CraftBukkit end
|
|
|
|
|
|
|
|
import org.github.paperspigot.PaperSpigotConfig; // PaperSpigot
|
2015-07-23 18:56:24 +02:00
|
|
|
+import org.github.paperspigot.event.player.PlayerMicroMoveEvent; // PaperSpigot
|
2015-07-23 13:30:13 +02:00
|
|
|
|
|
|
|
public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerListBox {
|
|
|
|
|
2015-07-26 01:00:37 +02:00
|
|
|
@@ -258,7 +259,7 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList
|
2015-07-23 13:30:13 +02:00
|
|
|
double delta = Math.pow(this.lastPosX - to.getX(), 2) + Math.pow(this.lastPosY - to.getY(), 2) + Math.pow(this.lastPosZ - to.getZ(), 2);
|
|
|
|
float deltaAngle = Math.abs(this.lastYaw - to.getYaw()) + Math.abs(this.lastPitch - to.getPitch());
|
|
|
|
|
|
|
|
- if ((delta > 1f / 256 || deltaAngle > 10f) && (this.checkMovement && !this.player.dead)) {
|
|
|
|
+ if ((delta > 0 || deltaAngle > 0) && (this.checkMovement && !this.player.dead)) { // PaperSpigot
|
|
|
|
this.lastPosX = to.getX();
|
|
|
|
this.lastPosY = to.getY();
|
|
|
|
this.lastPosZ = to.getZ();
|
2015-07-26 01:00:37 +02:00
|
|
|
@@ -268,7 +269,7 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList
|
2015-07-23 13:30:13 +02:00
|
|
|
// Skip the first time we do this
|
|
|
|
if (true) { // Spigot - don't skip any move events
|
|
|
|
Location oldTo = to.clone();
|
|
|
|
- PlayerMoveEvent event = new PlayerMoveEvent(player, from, to);
|
|
|
|
+ PlayerMoveEvent event = (delta > 1f / 256 || deltaAngle > 10f) ? new PlayerMoveEvent(player, from, to) : new PlayerMicroMoveEvent(player, from, to); // PaperSpigot - PlayerMicroMoveEvent
|
|
|
|
this.server.getPluginManager().callEvent(event);
|
|
|
|
|
|
|
|
// If the event is cancelled we move the player back to their old location.
|
|
|
|
--
|
2015-07-26 01:00:37 +02:00
|
|
|
2.4.5.windows.1
|
2015-07-23 13:30:13 +02:00
|
|
|
|