mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-01 14:38:56 +00:00
Fixed NPE on interact and fixed ender pearl false-positive
This commit is contained in:
1 parent
fbb05b927c
commit
8054b03240
2 files changed
+22
-2
No files matched your search
@@ -37,6 +37,8 @@ import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerKickEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||
import org.bukkit.event.player.PlayerToggleSneakEvent;
|
||||
import org.bukkit.event.player.PlayerToggleSprintEvent;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
@@ -56,6 +58,15 @@ public class PlayerListener extends EventListener
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerTeleport(PlayerTeleportEvent event)
|
||||
{
|
||||
if(event.getCause() == TeleportCause.ENDER_PEARL)
|
||||
{
|
||||
backend.logTeleport(event.getPlayer());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerToggleSneak(PlayerToggleSneakEvent event)
|
||||
{
|
||||
@@ -121,8 +132,11 @@ public class PlayerListener extends EventListener
|
||||
backend.logEatingStart(player);
|
||||
}
|
||||
}
|
||||
Distance distance = new Distance(event.getPlayer().getLocation(), event.getClickedBlock().getLocation());
|
||||
backend.checkLongReachBlock(distance.getXDifference(), distance.getYDifference(), distance.getZDifference());
|
||||
if(event.getClickedBlock() != null)
|
||||
{
|
||||
Distance distance = new Distance(event.getPlayer().getLocation(), event.getClickedBlock().getLocation());
|
||||
backend.checkLongReachBlock(distance.getXDifference(), distance.getYDifference(), distance.getZDifference());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
|
||||
@@ -36,6 +36,7 @@ public class Backend
|
||||
{
|
||||
public static final int ENTERED_EXTITED_TIME = 20;
|
||||
public static final int SNEAK_TIME = 5;
|
||||
public static final int TELEPORT_TIME = 50;
|
||||
public static final int EXIT_FLY_TIME = 40;
|
||||
public static final int INSTANT_BREAK_TIME = 100;
|
||||
public static final int JOIN_TIME = 40;
|
||||
@@ -667,6 +668,11 @@ public class Backend
|
||||
public void logToggleSneak(final Player player)
|
||||
{
|
||||
logEvent(movingExempt,player,SNEAK_TIME);
|
||||
}
|
||||
|
||||
public void logTeleport(final Player player)
|
||||
{
|
||||
logEvent(movingExempt,player,TELEPORT_TIME);
|
||||
}
|
||||
|
||||
public void logExitFly(final Player player)
|
||||
|
||||
Reference in new issue
Block a user