mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-03 14:38:46 +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.PlayerJoinEvent;
|
||||||
import org.bukkit.event.player.PlayerKickEvent;
|
import org.bukkit.event.player.PlayerKickEvent;
|
||||||
import org.bukkit.event.player.PlayerMoveEvent;
|
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.PlayerToggleSneakEvent;
|
||||||
import org.bukkit.event.player.PlayerToggleSprintEvent;
|
import org.bukkit.event.player.PlayerToggleSprintEvent;
|
||||||
import org.bukkit.inventory.PlayerInventory;
|
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
|
@EventHandler
|
||||||
public void onPlayerToggleSneak(PlayerToggleSneakEvent event)
|
public void onPlayerToggleSneak(PlayerToggleSneakEvent event)
|
||||||
{
|
{
|
||||||
@@ -121,8 +132,11 @@ public class PlayerListener extends EventListener
|
|||||||
backend.logEatingStart(player);
|
backend.logEatingStart(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Distance distance = new Distance(event.getPlayer().getLocation(), event.getClickedBlock().getLocation());
|
if(event.getClickedBlock() != null)
|
||||||
backend.checkLongReachBlock(distance.getXDifference(), distance.getYDifference(), distance.getZDifference());
|
{
|
||||||
|
Distance distance = new Distance(event.getPlayer().getLocation(), event.getClickedBlock().getLocation());
|
||||||
|
backend.checkLongReachBlock(distance.getXDifference(), distance.getYDifference(), distance.getZDifference());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(ignoreCancelled = true)
|
@EventHandler(ignoreCancelled = true)
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ public class Backend
|
|||||||
{
|
{
|
||||||
public static final int ENTERED_EXTITED_TIME = 20;
|
public static final int ENTERED_EXTITED_TIME = 20;
|
||||||
public static final int SNEAK_TIME = 5;
|
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 EXIT_FLY_TIME = 40;
|
||||||
public static final int INSTANT_BREAK_TIME = 100;
|
public static final int INSTANT_BREAK_TIME = 100;
|
||||||
public static final int JOIN_TIME = 40;
|
public static final int JOIN_TIME = 40;
|
||||||
@@ -669,6 +670,11 @@ public class Backend
|
|||||||
logEvent(movingExempt,player,SNEAK_TIME);
|
logEvent(movingExempt,player,SNEAK_TIME);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void logTeleport(final Player player)
|
||||||
|
{
|
||||||
|
logEvent(movingExempt,player,TELEPORT_TIME);
|
||||||
|
}
|
||||||
|
|
||||||
public void logExitFly(final Player player)
|
public void logExitFly(final Player player)
|
||||||
{
|
{
|
||||||
logEvent(movingExempt,player,EXIT_FLY_TIME);
|
logEvent(movingExempt,player,EXIT_FLY_TIME);
|
||||||
|
|||||||
Reference in new issue
Block a user