From 4d7b646f3d6ffd1d8b5f777c58d90eeda43b8264 Mon Sep 17 00:00:00 2001 From: Steven Lawson Date: Mon, 24 Oct 2011 20:00:48 -0400 Subject: [PATCH] Misc --- .../Listener/TFM_BlockListener.java | 38 ++++++++++++++----- .../Listener/TFM_PlayerListener.java | 2 +- 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/src/me/StevenLawson/TotalFreedomMod/Listener/TFM_BlockListener.java b/src/me/StevenLawson/TotalFreedomMod/Listener/TFM_BlockListener.java index 3b123c90..8de9eb9a 100644 --- a/src/me/StevenLawson/TotalFreedomMod/Listener/TFM_BlockListener.java +++ b/src/me/StevenLawson/TotalFreedomMod/Listener/TFM_BlockListener.java @@ -54,7 +54,17 @@ public class TFM_BlockListener extends BlockListener Location player_pos = p.getLocation(); Location block_pos = event.getBlock().getLocation(); - if (player_pos.distance(block_pos) > plugin.nukeMonitorRange) + boolean out_of_range = false; + if (!player_pos.getWorld().equals(block_pos.getWorld())) + { + out_of_range = true; + } + else if (player_pos.distance(block_pos) > plugin.nukeMonitorRange) + { + out_of_range = true; + } + + if (out_of_range) { playerdata.incrementFreecamDestroyCount(); if (playerdata.getFreecamDestroyCount() > plugin.freecamTriggerCount) @@ -62,11 +72,11 @@ public class TFM_BlockListener extends BlockListener p.setOp(false); p.setGameMode(GameMode.SURVIVAL); p.getInventory().clear(); - + TFM_Util.bcastMsg(p.getName() + " has been flagged for possible freecam nuking.", ChatColor.RED); p.kickPlayer("Freecam (extended range) block breaking is not permitted on this server."); Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), String.format("tempban %s 1m", p.getName())); - + playerdata.resetFreecamDestroyCount(); event.setCancelled(true); @@ -95,15 +105,25 @@ public class TFM_BlockListener extends BlockListener public void onBlockPlace(BlockPlaceEvent event) { Player p = event.getPlayer(); - + if (plugin.nukeMonitor) { TFM_UserInfo playerdata = TFM_UserInfo.getPlayerData(p, plugin); - + Location player_pos = p.getLocation(); Location block_pos = event.getBlock().getLocation(); + + boolean out_of_range = false; + if (!player_pos.getWorld().equals(block_pos.getWorld())) + { + out_of_range = true; + } + else if (player_pos.distance(block_pos) > plugin.nukeMonitorRange) + { + out_of_range = true; + } - if (player_pos.distance(block_pos) > plugin.nukeMonitorRange) + if (out_of_range) { playerdata.incrementFreecamPlaceCount(); if (playerdata.getFreecamPlaceCount() > plugin.freecamTriggerCount) @@ -115,14 +135,14 @@ public class TFM_BlockListener extends BlockListener TFM_Util.bcastMsg(p.getName() + " has been flagged for possible freecam building.", ChatColor.RED); p.kickPlayer("Freecam (extended range) block building is not permitted on this server."); Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), String.format("tempban %s 1m", p.getName())); - + playerdata.resetFreecamPlaceCount(); event.setCancelled(true); return; } } - + playerdata.incrementBlockPlaceCount(); if (playerdata.getBlockPlaceCount() > plugin.nukeMonitorCountPlace) { @@ -138,7 +158,7 @@ public class TFM_BlockListener extends BlockListener return; } } - + ItemStack is = new ItemStack(event.getBlockPlaced().getType(), 1, (short) 0, event.getBlockPlaced().getData()); if (is.getType() == Material.LAVA || is.getType() == Material.STATIONARY_LAVA) { diff --git a/src/me/StevenLawson/TotalFreedomMod/Listener/TFM_PlayerListener.java b/src/me/StevenLawson/TotalFreedomMod/Listener/TFM_PlayerListener.java index 208012ea..39f967e5 100644 --- a/src/me/StevenLawson/TotalFreedomMod/Listener/TFM_PlayerListener.java +++ b/src/me/StevenLawson/TotalFreedomMod/Listener/TFM_PlayerListener.java @@ -344,7 +344,7 @@ public class TFM_PlayerListener extends PlayerListener } else { - TFM_Util.bcastMsg(p.getName() + " is a verified superadmin.", ChatColor.GREEN); + //TFM_Util.bcastMsg(p.getName() + " is a verified superadmin.", ChatColor.GREEN); } } }