Don't keep old velocity changes, prevent 2 velocities
This commit is contained in:
		| @@ -78,7 +78,8 @@ public class DisguiseUtilities { | ||||
|     private static File profileCache = new File("plugins/LibsDisguises/GameProfiles"), savedDisguises = new File( | ||||
|             "plugins/LibsDisguises/SavedDisguises"); | ||||
|     private static Gson gson; | ||||
|     private static boolean pluginsUsed, commandsUsed, copyDisguiseCommandUsed, grabSkinCommandUsed, saveDisguiseCommandUsed; | ||||
|     private static boolean pluginsUsed, commandsUsed, copyDisguiseCommandUsed, grabSkinCommandUsed, | ||||
|             saveDisguiseCommandUsed; | ||||
|     private static long libsDisguisesCalled; | ||||
|     /** | ||||
|      * Keeps track of what tick this occured | ||||
| @@ -94,9 +95,14 @@ public class DisguiseUtilities { | ||||
|     } | ||||
|  | ||||
|     public static void setPlayerVelocity(Player player) { | ||||
|         if (player == null) { | ||||
|             velocityID = 0; | ||||
|             velocityTime = 0; | ||||
|         } else { | ||||
|             velocityID = player.getEntityId(); | ||||
|             velocityTime = player.getWorld().getTime(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Returns if this velocity is due to a PlayerVelocityEvent | ||||
|   | ||||
| @@ -180,6 +180,8 @@ public class PacketListenerViewSelfDisguise extends PacketAdapter { | ||||
|                 // The player only sees velocity changes when there is a velocity event. As the method claims there | ||||
|                 // was no velocity event... | ||||
|                 event.setCancelled(true); | ||||
|                 // Clear old velocity, this should only occur once. | ||||
|                 DisguiseUtilities.setPlayerVelocity(null); | ||||
|             } | ||||
|         } | ||||
|         catch (Exception ex) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user