mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-11-03 01:00:20 +01:00
Potential fix(es) for flying after respawning
This commit is contained in:
parent
61d89d78d8
commit
a4bb515ee0
@ -3,7 +3,7 @@ name: NoCheat
|
||||
author: Evenprime
|
||||
|
||||
main: cc.co.evenprime.bukkit.nocheat.NoCheat
|
||||
version: 1.06
|
||||
version: 1.06a
|
||||
|
||||
softdepend: [ Permissions, CraftIRC ]
|
||||
|
||||
|
@ -392,7 +392,7 @@ public class MovingCheck extends Check {
|
||||
final Location l = data.lastLocation;
|
||||
|
||||
// Player is currently changing worlds
|
||||
if(l.getWorld() != from.getWorld()) {
|
||||
if(!l.getWorld().equals(from.getWorld())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -462,7 +462,7 @@ public class MovingCheck extends Check {
|
||||
if(!event.isCancelled()) {
|
||||
data.lastLocation = event.getTo();
|
||||
data.jumpPhase = 0;
|
||||
data.setBackPoint = event.getTo();
|
||||
data.setBackPoint = event.getTo().clone();
|
||||
}
|
||||
}
|
||||
|
||||
@ -472,7 +472,8 @@ public class MovingCheck extends Check {
|
||||
*/
|
||||
public void respawned(PlayerRespawnEvent event) {
|
||||
MovingData data = MovingData.get(event.getPlayer());
|
||||
data.lastLocation = event.getRespawnLocation(); // We expect the player to be there next
|
||||
data.lastLocation = event.getRespawnLocation();
|
||||
data.setBackPoint = event.getRespawnLocation().clone();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -525,12 +526,15 @@ public class MovingCheck extends Check {
|
||||
double y = data.setBackPoint.getY();
|
||||
|
||||
// search for the first solid block up to 5 blocks below the setbackpoint and teleport the player there
|
||||
for(int i = 0; i < 20; i++) {
|
||||
int i = 0;
|
||||
for(; i < 20; i++) {
|
||||
if(playerIsOnGround(data.setBackPoint, -0.5*i) != MovingData.NONSOLID) {
|
||||
y -= 0.5*i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
y -= 0.5*i;
|
||||
|
||||
data.setBackPoint.setY(y);
|
||||
|
||||
// Remember the location we send the player to, to identify teleports that were started by us
|
||||
data.teleportTo = new Location(data.setBackPoint.getWorld(), data.setBackPoint.getX(), y, data.setBackPoint.getZ(), event.getTo().getYaw(), event.getTo().getPitch());
|
||||
|
@ -86,5 +86,4 @@ public class MovingData {
|
||||
|
||||
return data.moving;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user