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( |     private static File profileCache = new File("plugins/LibsDisguises/GameProfiles"), savedDisguises = new File( | ||||||
|             "plugins/LibsDisguises/SavedDisguises"); |             "plugins/LibsDisguises/SavedDisguises"); | ||||||
|     private static Gson gson; |     private static Gson gson; | ||||||
|     private static boolean pluginsUsed, commandsUsed, copyDisguiseCommandUsed, grabSkinCommandUsed, saveDisguiseCommandUsed; |     private static boolean pluginsUsed, commandsUsed, copyDisguiseCommandUsed, grabSkinCommandUsed, | ||||||
|  |             saveDisguiseCommandUsed; | ||||||
|     private static long libsDisguisesCalled; |     private static long libsDisguisesCalled; | ||||||
|     /** |     /** | ||||||
|      * Keeps track of what tick this occured |      * Keeps track of what tick this occured | ||||||
| @@ -94,8 +95,13 @@ public class DisguiseUtilities { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     public static void setPlayerVelocity(Player player) { |     public static void setPlayerVelocity(Player player) { | ||||||
|         velocityID = player.getEntityId(); |         if (player == null) { | ||||||
|         velocityTime = player.getWorld().getTime(); |             velocityID = 0; | ||||||
|  |             velocityTime = 0; | ||||||
|  |         } else { | ||||||
|  |             velocityID = player.getEntityId(); | ||||||
|  |             velocityTime = player.getWorld().getTime(); | ||||||
|  |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|   | |||||||
| @@ -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 |                 // The player only sees velocity changes when there is a velocity event. As the method claims there | ||||||
|                 // was no velocity event... |                 // was no velocity event... | ||||||
|                 event.setCancelled(true); |                 event.setCancelled(true); | ||||||
|  |                 // Clear old velocity, this should only occur once. | ||||||
|  |                 DisguiseUtilities.setPlayerVelocity(null); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|         catch (Exception ex) { |         catch (Exception ex) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user