Don't keep old velocity changes, prevent 2 velocities

This commit is contained in:
libraryaddict 2020-01-06 16:01:05 +13:00
parent 4f140fce9b
commit 7f725d26bd
No known key found for this signature in database
GPG Key ID: 052E4FBCD257AEA4
2 changed files with 11 additions and 3 deletions

View File

@ -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();
}
} }
/** /**

View File

@ -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) {