mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-11-03 01:00:20 +01:00
Got rid of respawn and worldchanged workarounds in favour of more
generic ways to handle that.
This commit is contained in:
parent
7598cecdc9
commit
ed14d23f25
@ -107,7 +107,7 @@ public class NoCheat extends JavaPlugin implements CommandSender {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -167,7 +167,7 @@ public class NoCheat extends JavaPlugin implements CommandSender {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
cleanUpTaskId = Bukkit.getServer().getScheduler().scheduleAsyncRepeatingTask(this, new Runnable() {
|
cleanUpTaskId = Bukkit.getServer().getScheduler().scheduleAsyncRepeatingTask(this, new Runnable() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
NoCheatData.cleanPlayerDataCollection();
|
NoCheatData.cleanPlayerDataCollection();
|
||||||
@ -385,7 +385,7 @@ public class NoCheat extends JavaPlugin implements CommandSender {
|
|||||||
s = s + (!movingCheck.isActive() || movingCheck.allowFlying ? "flying* " : (hasPermission(p, PermissionData.PERMISSION_FLYING, movingCheck.checkOPs) ? "flying " : ""));
|
s = s + (!movingCheck.isActive() || movingCheck.allowFlying ? "flying* " : (hasPermission(p, PermissionData.PERMISSION_FLYING, movingCheck.checkOPs) ? "flying " : ""));
|
||||||
s = s + (!movingCheck.isActive() || movingCheck.allowFakeSneak ? "fakesneak* " : (hasPermission(p, PermissionData.PERMISSION_FAKESNEAK, movingCheck.checkOPs) ? "fakesneak " : ""));
|
s = s + (!movingCheck.isActive() || movingCheck.allowFakeSneak ? "fakesneak* " : (hasPermission(p, PermissionData.PERMISSION_FAKESNEAK, movingCheck.checkOPs) ? "fakesneak " : ""));
|
||||||
s = s + (!movingCheck.isActive() || movingCheck.allowFastSwim ? "fastswim* " : (hasPermission(p, PermissionData.PERMISSION_FASTSWIM, movingCheck.checkOPs) ? "fastswim " : ""));
|
s = s + (!movingCheck.isActive() || movingCheck.allowFastSwim ? "fastswim* " : (hasPermission(p, PermissionData.PERMISSION_FASTSWIM, movingCheck.checkOPs) ? "fastswim " : ""));
|
||||||
|
|
||||||
s = s + (hasPermission(p, PermissionData.PERMISSION_NOTIFY, false) ? "notify " : "");
|
s = s + (hasPermission(p, PermissionData.PERMISSION_NOTIFY, false) ? "notify " : "");
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
@ -406,8 +406,6 @@ public class NoCheat extends JavaPlugin implements CommandSender {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendMessage(String message) {
|
public void sendMessage(String message) {
|
||||||
// we don't receive messages
|
// we don't receive messages
|
||||||
|
@ -384,7 +384,7 @@ public class MovingCheck extends Check {
|
|||||||
private boolean shouldBeIgnored(final Player player, final MovingData data, final Location from, final Location to) {
|
private boolean shouldBeIgnored(final Player player, final MovingData data, final Location from, final Location to) {
|
||||||
|
|
||||||
// First the simple yes/no checks
|
// First the simple yes/no checks
|
||||||
if(data.respawned || data.insideVehicle || player.isInsideVehicle() || data.worldChanged) {
|
if(/*data.respawned ||*/ data.insideVehicle || player.isInsideVehicle()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -453,9 +453,7 @@ public class MovingCheck extends Check {
|
|||||||
public void teleported(PlayerTeleportEvent event) {
|
public void teleported(PlayerTeleportEvent event) {
|
||||||
|
|
||||||
MovingData data = MovingData.get(event.getPlayer());
|
MovingData data = MovingData.get(event.getPlayer());
|
||||||
|
|
||||||
if(data.respawned) data.respawned = false;
|
|
||||||
|
|
||||||
// We can enforce a teleport, if that flag is explicitly set
|
// We can enforce a teleport, if that flag is explicitly set
|
||||||
if(event.isCancelled() && enforceTeleport && event.getTo().equals(data.teleportTo)) {
|
if(event.isCancelled() && enforceTeleport && event.getTo().equals(data.teleportTo)) {
|
||||||
event.setCancelled(false);
|
event.setCancelled(false);
|
||||||
@ -465,8 +463,6 @@ public class MovingCheck extends Check {
|
|||||||
data.lastLocation = event.getTo();
|
data.lastLocation = event.getTo();
|
||||||
data.jumpPhase = 0;
|
data.jumpPhase = 0;
|
||||||
data.setBackPoint = event.getTo();
|
data.setBackPoint = event.getTo();
|
||||||
|
|
||||||
data.worldChanged = !event.getFrom().getWorld().getName().equals(event.getTo().getWorld().getName());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -476,8 +472,7 @@ public class MovingCheck extends Check {
|
|||||||
*/
|
*/
|
||||||
public void respawned(PlayerRespawnEvent event) {
|
public void respawned(PlayerRespawnEvent event) {
|
||||||
MovingData data = MovingData.get(event.getPlayer());
|
MovingData data = MovingData.get(event.getPlayer());
|
||||||
data.respawned = true;
|
data.lastLocation = event.getRespawnLocation(); // We expect the player to be there next
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -29,8 +29,6 @@ public class MovingData {
|
|||||||
public double sneakingLastDistance = 0.0D;
|
public double sneakingLastDistance = 0.0D;
|
||||||
public double swimmingLastDistance = 0.0D;
|
public double swimmingLastDistance = 0.0D;
|
||||||
|
|
||||||
public boolean worldChanged = false;
|
|
||||||
public boolean respawned = false;
|
|
||||||
public boolean insideVehicle = false;
|
public boolean insideVehicle = false;
|
||||||
|
|
||||||
// WORKAROUND for changed PLAYER_MOVE logic
|
// WORKAROUND for changed PLAYER_MOVE logic
|
||||||
|
@ -20,6 +20,5 @@ public class MovingEntityListener extends EntityListener {
|
|||||||
if(event.getEntity() instanceof Player) {
|
if(event.getEntity() instanceof Player) {
|
||||||
check.updateVelocity(event.getEntity().getVelocity(), MovingData.get((Player)event.getEntity()));
|
check.updateVelocity(event.getEntity().getVelocity(), MovingData.get((Player)event.getEntity()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user