diff --git a/src/config.yml b/src/config.yml index 5374f8cf..602fa0b5 100644 --- a/src/config.yml +++ b/src/config.yml @@ -14,7 +14,8 @@ auto_wipe: true # Nuking prevention: nuke_monitor: true -nuke_monitor_count: 100 +nuke_monitor_count_break: 100 +nuke_monitor_count_place: 25 nuke_monitor_range: 10.0 freecam_trigger_count: 10 diff --git a/src/me/StevenLawson/TotalFreedomMod/TFM_BlockListener.java b/src/me/StevenLawson/TotalFreedomMod/TFM_BlockListener.java index cb94dc5d..83f0b5d4 100644 --- a/src/me/StevenLawson/TotalFreedomMod/TFM_BlockListener.java +++ b/src/me/StevenLawson/TotalFreedomMod/TFM_BlockListener.java @@ -91,13 +91,13 @@ public class TFM_BlockListener extends BlockListener if (plugin.nukeMonitor) { + TFM_UserInfo playerdata = TFM_UserInfo.getPlayerData(p, plugin); + Location player_pos = p.getLocation(); Location block_pos = event.getBlock().getLocation(); if (player_pos.distance(block_pos) > plugin.nukeMonitorRange) { - TFM_UserInfo playerdata = TFM_UserInfo.getPlayerData(p, plugin); - playerdata.incrementFreecamPlaceCount(); if (playerdata.getFreecamPlaceCount() > plugin.freecamTriggerCount) { @@ -113,6 +113,20 @@ public class TFM_BlockListener extends BlockListener return; } } + + playerdata.incrementBlockPlaceCount(); + if (playerdata.getBlockPlaceCount() > plugin.nukeMonitorCountPlace) + { + TFM_Util.tfm_broadcastMessage(p.getName() + " is placing blocks too fast!", ChatColor.RED); + + p.setOp(false); + p.setGameMode(GameMode.SURVIVAL); + p.getInventory().clear(); + p.kickPlayer("You are placing blocks too fast."); + + event.setCancelled(true); + return; + } } ItemStack is = new ItemStack(event.getBlockPlaced().getType(), 1, (short) 0, event.getBlockPlaced().getData()); diff --git a/src/me/StevenLawson/TotalFreedomMod/TFM_Cmds_OP.java b/src/me/StevenLawson/TotalFreedomMod/TFM_Cmds_OP.java index e230c940..af667434 100644 --- a/src/me/StevenLawson/TotalFreedomMod/TFM_Cmds_OP.java +++ b/src/me/StevenLawson/TotalFreedomMod/TFM_Cmds_OP.java @@ -1,7 +1,6 @@ package me.StevenLawson.TotalFreedomMod; import java.util.Arrays; -import java.util.Set; import java.util.logging.Logger; import org.bukkit.Bukkit; import org.bukkit.ChatColor; diff --git a/src/me/StevenLawson/TotalFreedomMod/TFM_Heartbeat.java b/src/me/StevenLawson/TotalFreedomMod/TFM_Heartbeat.java index 92db0778..023e1b15 100644 --- a/src/me/StevenLawson/TotalFreedomMod/TFM_Heartbeat.java +++ b/src/me/StevenLawson/TotalFreedomMod/TFM_Heartbeat.java @@ -21,6 +21,7 @@ public class TFM_Heartbeat implements Runnable TFM_UserInfo playerdata = TFM_UserInfo.getPlayerData(p, plugin); playerdata.resetMsgCount(); playerdata.resetBlockDestroyCount(); + playerdata.resetBlockPlaceCount(); } if (plugin.autoEntityWipe) diff --git a/src/me/StevenLawson/TotalFreedomMod/TFM_PlayerListener.java b/src/me/StevenLawson/TotalFreedomMod/TFM_PlayerListener.java index 2a02b60a..6a4bcfa8 100644 --- a/src/me/StevenLawson/TotalFreedomMod/TFM_PlayerListener.java +++ b/src/me/StevenLawson/TotalFreedomMod/TFM_PlayerListener.java @@ -5,7 +5,6 @@ import java.util.regex.Pattern; import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; -import org.bukkit.entity.CreatureType; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.block.Action; diff --git a/src/me/StevenLawson/TotalFreedomMod/TFM_UserInfo.java b/src/me/StevenLawson/TotalFreedomMod/TFM_UserInfo.java index 247d8bff..11a0f5a8 100644 --- a/src/me/StevenLawson/TotalFreedomMod/TFM_UserInfo.java +++ b/src/me/StevenLawson/TotalFreedomMod/TFM_UserInfo.java @@ -14,6 +14,7 @@ public class TFM_UserInfo private boolean user_frozen = false; private int msg_count = 0; private int block_destroy_total = 0; + private int block_place_total = 0; private int freecam_destroy_count = 0; private int freecam_place_count = 0; private boolean forced_death = false; @@ -27,8 +28,8 @@ public class TFM_UserInfo private boolean mob_thrower_enabled = false; private CreatureType mob_thrower_creature = CreatureType.PIG; private double mob_thrower_speed = 4.0; - private List mobqueue = new ArrayList(); - private int schedule_id = -1; + private List mob_thrower_queue = new ArrayList(); + private int mp44_schedule_id = -1; public TFM_UserInfo() { @@ -186,6 +187,21 @@ public class TFM_UserInfo { this.block_destroy_total = 0; } + + public void incrementBlockPlaceCount() + { + this.block_place_total++; + } + + public int getBlockPlaceCount() + { + return this.block_place_total; + } + + public void resetBlockPlaceCount() + { + this.block_place_total = 0; + } public void incrementFreecamDestroyCount() { @@ -246,10 +262,10 @@ public class TFM_UserInfo public void enqueueMob(LivingEntity mob) { - mobqueue.add(mob); - if (mobqueue.size() > 4) + mob_thrower_queue.add(mob); + if (mob_thrower_queue.size() > 4) { - LivingEntity oldmob = mobqueue.remove(0); + LivingEntity oldmob = mob_thrower_queue.remove(0); if (oldmob != null) { oldmob.damage(20); @@ -259,15 +275,15 @@ public class TFM_UserInfo void startArrowShooter(int schedule_id) { - this.schedule_id = schedule_id; + this.mp44_schedule_id = schedule_id; } void stopArrowShooter() { - if (this.schedule_id != -1) + if (this.mp44_schedule_id != -1) { - Bukkit.getScheduler().cancelTask(this.schedule_id); - this.schedule_id = -1; + Bukkit.getScheduler().cancelTask(this.mp44_schedule_id); + this.mp44_schedule_id = -1; } } } diff --git a/src/me/StevenLawson/TotalFreedomMod/TotalFreedomMod.java b/src/me/StevenLawson/TotalFreedomMod/TotalFreedomMod.java index 444dc754..06fdf578 100644 --- a/src/me/StevenLawson/TotalFreedomMod/TotalFreedomMod.java +++ b/src/me/StevenLawson/TotalFreedomMod/TotalFreedomMod.java @@ -63,6 +63,7 @@ public class TotalFreedomMod extends JavaPlugin public boolean autoEntityWipe = true; public boolean nukeMonitor = true; public int nukeMonitorCountBreak = 100; + public int nukeMonitorCountPlace = 25; public double nukeMonitorRange = 10.0D; public int freecamTriggerCount = 10; public Boolean preprocessLogEnabled = true; @@ -86,7 +87,8 @@ public class TotalFreedomMod extends JavaPlugin explosiveRadius = config.getDouble("explosiveRadius", explosiveRadius); autoEntityWipe = config.getBoolean("auto_wipe", autoEntityWipe); nukeMonitor = config.getBoolean("nuke_monitor", nukeMonitor); - nukeMonitorCountBreak = config.getInt("nuke_monitor_count", nukeMonitorCountBreak); + nukeMonitorCountBreak = config.getInt("nuke_monitor_count_break", nukeMonitorCountBreak); + nukeMonitorCountPlace = config.getInt("nuke_monitor_count_place", nukeMonitorCountPlace); nukeMonitorRange = config.getDouble("nuke_monitor_range", nukeMonitorRange); freecamTriggerCount = config.getInt("freecam_trigger_count", freecamTriggerCount); preprocessLogEnabled = config.getBoolean("preprocess_log", preprocessLogEnabled);