mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
Misc
This commit is contained in:
parent
35821a75c9
commit
4d7b646f3d
@ -54,7 +54,17 @@ public class TFM_BlockListener extends BlockListener
|
|||||||
Location player_pos = p.getLocation();
|
Location player_pos = p.getLocation();
|
||||||
Location block_pos = event.getBlock().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();
|
playerdata.incrementFreecamDestroyCount();
|
||||||
if (playerdata.getFreecamDestroyCount() > plugin.freecamTriggerCount)
|
if (playerdata.getFreecamDestroyCount() > plugin.freecamTriggerCount)
|
||||||
@ -62,11 +72,11 @@ public class TFM_BlockListener extends BlockListener
|
|||||||
p.setOp(false);
|
p.setOp(false);
|
||||||
p.setGameMode(GameMode.SURVIVAL);
|
p.setGameMode(GameMode.SURVIVAL);
|
||||||
p.getInventory().clear();
|
p.getInventory().clear();
|
||||||
|
|
||||||
TFM_Util.bcastMsg(p.getName() + " has been flagged for possible freecam nuking.", ChatColor.RED);
|
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.");
|
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()));
|
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), String.format("tempban %s 1m", p.getName()));
|
||||||
|
|
||||||
playerdata.resetFreecamDestroyCount();
|
playerdata.resetFreecamDestroyCount();
|
||||||
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
@ -95,15 +105,25 @@ public class TFM_BlockListener extends BlockListener
|
|||||||
public void onBlockPlace(BlockPlaceEvent event)
|
public void onBlockPlace(BlockPlaceEvent event)
|
||||||
{
|
{
|
||||||
Player p = event.getPlayer();
|
Player p = event.getPlayer();
|
||||||
|
|
||||||
if (plugin.nukeMonitor)
|
if (plugin.nukeMonitor)
|
||||||
{
|
{
|
||||||
TFM_UserInfo playerdata = TFM_UserInfo.getPlayerData(p, plugin);
|
TFM_UserInfo playerdata = TFM_UserInfo.getPlayerData(p, plugin);
|
||||||
|
|
||||||
Location player_pos = p.getLocation();
|
Location player_pos = p.getLocation();
|
||||||
Location block_pos = event.getBlock().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();
|
playerdata.incrementFreecamPlaceCount();
|
||||||
if (playerdata.getFreecamPlaceCount() > plugin.freecamTriggerCount)
|
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);
|
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.");
|
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()));
|
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), String.format("tempban %s 1m", p.getName()));
|
||||||
|
|
||||||
playerdata.resetFreecamPlaceCount();
|
playerdata.resetFreecamPlaceCount();
|
||||||
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
playerdata.incrementBlockPlaceCount();
|
playerdata.incrementBlockPlaceCount();
|
||||||
if (playerdata.getBlockPlaceCount() > plugin.nukeMonitorCountPlace)
|
if (playerdata.getBlockPlaceCount() > plugin.nukeMonitorCountPlace)
|
||||||
{
|
{
|
||||||
@ -138,7 +158,7 @@ public class TFM_BlockListener extends BlockListener
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemStack is = new ItemStack(event.getBlockPlaced().getType(), 1, (short) 0, event.getBlockPlaced().getData());
|
ItemStack is = new ItemStack(event.getBlockPlaced().getType(), 1, (short) 0, event.getBlockPlaced().getData());
|
||||||
if (is.getType() == Material.LAVA || is.getType() == Material.STATIONARY_LAVA)
|
if (is.getType() == Material.LAVA || is.getType() == Material.STATIONARY_LAVA)
|
||||||
{
|
{
|
||||||
|
@ -344,7 +344,7 @@ public class TFM_PlayerListener extends PlayerListener
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TFM_Util.bcastMsg(p.getName() + " is a verified superadmin.", ChatColor.GREEN);
|
//TFM_Util.bcastMsg(p.getName() + " is a verified superadmin.", ChatColor.GREEN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user