= Fixed an issue with the ladders/vines and the falling check

= Fixed an NPE when the block in the event is null
This commit is contained in:
NeatMonster 2012-04-09 10:56:24 +02:00
parent b08db5bd4b
commit 1c649112ae
3 changed files with 12 additions and 5 deletions

View File

@ -4,7 +4,7 @@
<!-- Informations -->
<name>NoCheatPlus</name>
<version>3.5.4</version>
<version>3.5.4_1</version>
<description>Detect and fight the exploitation of various flaws/bugs in Minecraft.</description>
<url>http://dev.bukkit.org/server-mods/nocheatplus</url>

View File

@ -141,6 +141,10 @@ public class BlockBreakCheckListener implements Listener, EventManager {
ignoreCancelled = true, priority = EventPriority.MONITOR)
public void blockInteract(final PlayerInteractEvent event) {
// Do not care about null blocks
if (event.getClickedBlock() == null)
return;
final NoCheatPlusPlayer player = plugin.getPlayer(event.getPlayer());
final BlockBreakData data = BlockBreakCheck.getData(player);
// Remember this location. Only blockbreakevents for this specific

View File

@ -73,14 +73,18 @@ public class MovingCheckListener implements Listener, EventManager {
// Do not do the check if it's disabled, if flying is allowed, if the player is
// allowed to fly because of its game mode or if he has the required permission.
if (!cc.tracker || cc.allowFlying || bukkitPlayer.getGameMode() == GameMode.CREATIVE
|| bukkitPlayer.getAllowFlight() || bukkitPlayer.hasPermission(Permissions.MOVING_RUNFLY))
|| bukkitPlayer.getAllowFlight() || bukkitPlayer.hasPermission(Permissions.MOVING_RUNFLY)) {
data.fallingSince = 0;
return;
}
// If the player is in water or in vines, then do not run the check
if (bukkitPlayer.getLocation().getBlock().getType() == Material.WATER
|| bukkitPlayer.getLocation().getBlock().getType() == Material.STATIONARY_WATER
|| bukkitPlayer.getLocation().getBlock().getType() == Material.VINE)
|| bukkitPlayer.getLocation().getBlock().getType() == Material.VINE) {
data.fallingSince = 0;
return;
}
// If the player isn't falling or jumping
if (Math.abs(bukkitPlayer.getVelocity().getY()) > 0.1D) {
@ -95,8 +99,7 @@ public class MovingCheckListener implements Listener, EventManager {
bukkitPlayer.kickPlayer("Flying isn't enabled on this server!");
data.fallingSince = 0;
}
} else // The player isn't falling/jumping, check if he was previous on the air
if (data.fallingSince > 0)
} else
// Reset the timer
data.fallingSince = 0;
}