From ff88c7bffec9220d70ea2fcfa6bcef2edfe9c4be Mon Sep 17 00:00:00 2001 From: Steven Lawson Date: Sun, 2 Oct 2011 00:18:52 -0400 Subject: [PATCH] Misc --- .../TotalFreedomMod/RadarData.java | 49 +-- .../TotalFreedomMod/TFUserInfo.java | 9 +- .../TotalFreedomMod/TotalFreedomMod.java | 298 ++++++++++++++---- .../TotalFreedomModBlockListener.java | 110 +++++-- .../TotalFreedomModEntityListener.java | 2 +- .../TotalFreedomModPlayerListener.java | 10 +- src/plugin.yml | 16 +- 7 files changed, 363 insertions(+), 131 deletions(-) diff --git a/src/me/StevenLawson/TotalFreedomMod/RadarData.java b/src/me/StevenLawson/TotalFreedomMod/RadarData.java index 1d822655..ac69212c 100644 --- a/src/me/StevenLawson/TotalFreedomMod/RadarData.java +++ b/src/me/StevenLawson/TotalFreedomMod/RadarData.java @@ -6,26 +6,35 @@ import org.bukkit.entity.Player; public class RadarData implements Comparator { - Player player; - double distance; + Player player; + double distance; Location location; - - public RadarData(Player inplayer, double indistance, Location inlocation) - { - this.player = inplayer; - this.distance = indistance; - this.location = inlocation; - } - - public RadarData() - { - } - @Override - public int compare(RadarData t1, RadarData t2) - { - if (t1.distance > t2.distance) return 1; - else if (t1.distance < t2.distance) return -1; - else return 0; - } + public RadarData(Player inplayer, double indistance, Location inlocation) + { + this.player = inplayer; + this.distance = indistance; + this.location = inlocation; + } + + public RadarData() + { + } + + @Override + public int compare(RadarData t1, RadarData t2) + { + if (t1.distance > t2.distance) + { + return 1; + } + else if (t1.distance < t2.distance) + { + return -1; + } + else + { + return 0; + } + } } diff --git a/src/me/StevenLawson/TotalFreedomMod/TFUserInfo.java b/src/me/StevenLawson/TotalFreedomMod/TFUserInfo.java index 1913a3ba..3103923e 100644 --- a/src/me/StevenLawson/TotalFreedomMod/TFUserInfo.java +++ b/src/me/StevenLawson/TotalFreedomMod/TFUserInfo.java @@ -5,7 +5,7 @@ public class TFUserInfo private boolean user_frozen = false; private int msg_count = 0; private int bd_count = 0; - + public TFUserInfo() { } @@ -14,6 +14,7 @@ public class TFUserInfo { return this.user_frozen; } + public void setFrozen(boolean fr) { this.user_frozen = fr; @@ -23,23 +24,27 @@ public class TFUserInfo { this.msg_count = 0; } + public void incrementMsgCount() { this.msg_count++; } + public int getMsgCount() { return this.msg_count; } - + public void incrementBlockDestroyCount() { this.bd_count++; } + public int getBlockDestroyCount() { return this.bd_count; } + public void resetBlockDestroyCount() { this.bd_count = 0; diff --git a/src/me/StevenLawson/TotalFreedomMod/TotalFreedomMod.java b/src/me/StevenLawson/TotalFreedomMod/TotalFreedomMod.java index 65110f57..fb64429d 100644 --- a/src/me/StevenLawson/TotalFreedomMod/TotalFreedomMod.java +++ b/src/me/StevenLawson/TotalFreedomMod/TotalFreedomMod.java @@ -7,16 +7,20 @@ import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.List; +import java.util.Random; import java.util.logging.Level; import java.util.logging.Logger; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.GameMode; import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.World; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; +import org.bukkit.entity.*; import org.bukkit.event.Event; +import org.bukkit.inventory.ItemStack; import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.util.config.Configuration; @@ -35,20 +39,25 @@ public class TotalFreedomMod extends JavaPlugin public List superadmins = new ArrayList(); public List superadmin_ips = new ArrayList(); public Boolean allowExplosions = false; + public boolean allowFirePlace = false; + public Boolean allowFireSpread = false; public Boolean allowLavaDamage = false; - public Boolean allowFire = false; + public boolean allowLavaPlace = false; + public boolean allowWaterPlace = false; + public boolean autoEntityWipe = false; public double explosiveRadius = 4.0; - public Boolean preprocessLogEnabled = false; public boolean nukeMonitor = true; - public double nukeMonitorRange = 10.0; public int nukeMonitorCount = 40; - public boolean allPlayersFrozen = false; + public double nukeMonitorRange = 10.0; + public Boolean preprocessLogEnabled = false; + public boolean allPlayersFrozen = false; public HashMap userinfo = new HashMap(); public final static String MSG_NO_PERMS = ChatColor.YELLOW + "You do not have permission to use this command."; public final static String YOU_ARE_OP = ChatColor.YELLOW + "You are now op!"; public final static String YOU_ARE_NOT_OP = ChatColor.YELLOW + "You are no longer op!"; + public final static String CAKE_LYRICS = "But there's no sense crying over every mistake. You just keep on trying till you run out of cake."; @Override public void onEnable() @@ -67,25 +76,34 @@ public class TotalFreedomMod extends JavaPlugin "0.0.0.0" }); CONFIG.setProperty("allow_explosions", false); + CONFIG.setProperty("allow_fire_place", false); + CONFIG.setProperty("allow_fire_spread", false); CONFIG.setProperty("allow_lava_damage", false); - CONFIG.setProperty("allow_fire", false); + CONFIG.setProperty("allow_lava_place", false); + CONFIG.setProperty("allow_water_place", false); + CONFIG.setProperty("auto_wipe", false); CONFIG.setProperty("explosiveRadius", 4.0); - CONFIG.setProperty("preprocess_log", false); CONFIG.setProperty("nuke_monitor", true); - CONFIG.setProperty("nuke_monitor_range", 10.0); CONFIG.setProperty("nuke_monitor_count", 40); + CONFIG.setProperty("nuke_monitor_range", 10.0); + CONFIG.setProperty("preprocess_log", false); CONFIG.save(); } CONFIG.load(); superadmins = CONFIG.getStringList("superadmins", null); superadmin_ips = CONFIG.getStringList("superadmin_ips", null); allowExplosions = CONFIG.getBoolean("allow_explosions", false); + allowFirePlace = CONFIG.getBoolean("allow_fire_place", false); + allowFireSpread = CONFIG.getBoolean("allow_fire_spread", false); allowLavaDamage = CONFIG.getBoolean("allow_lava_damage", false); - allowFire = CONFIG.getBoolean("allow_fire", false); + allowLavaPlace = CONFIG.getBoolean("allow_lava_place", false); + allowWaterPlace = CONFIG.getBoolean("allow_water_place", false); + autoEntityWipe = CONFIG.getBoolean("auto_wipe", false); explosiveRadius = CONFIG.getDouble("explosiveRadius", 4.0); - preprocessLogEnabled = CONFIG.getBoolean("preprocess_log", false); - nukeMonitorRange = CONFIG.getDouble("nuke_monitor_range", 10.0); + nukeMonitor = CONFIG.getBoolean("nuke_monitor", true); nukeMonitorCount = CONFIG.getInt("nuke_monitor_count", 40); + nukeMonitorRange = CONFIG.getDouble("nuke_monitor_range", 10.0); + preprocessLogEnabled = CONFIG.getBoolean("preprocess_log", false); PluginManager pm = this.getServer().getPluginManager(); @@ -105,14 +123,16 @@ public class TotalFreedomMod extends JavaPlugin pm.registerEvent(Event.Type.PLAYER_CHAT, playerListener, Event.Priority.Normal, this); log.log(Level.INFO, "[Total Freedom Mod] - Enabled! - Version: " + this.getDescription().getVersion() + " by Madgeek1450"); - log.log(Level.INFO, "[Total Freedom Mod] - Loaded superadmins: " + implodeStringList(", ", superadmins)); + log.log(Level.INFO, "[Total Freedom Mod] - Loaded superadmin names: " + implodeStringList(", ", superadmins)); + log.log(Level.INFO, "[Total Freedom Mod] - Loaded superadmin IPs: " + implodeStringList(", ", superadmins)); + log.log(Level.INFO, "[Total Freedom Mod] - Auto drop deleter is " + (autoEntityWipe ? "enabled" : "disabled") + "."); Bukkit.getServer().getScheduler().scheduleAsyncRepeatingTask(this, new Runnable() { @Override public void run() { - tfm.resetCounts(); + tfm.tfHeartbeat(); } }, 100L, 100L); } @@ -608,7 +628,7 @@ public class TotalFreedomMod extends JavaPlugin return true; } - else if (cmd.getName().equalsIgnoreCase("fire")) + else if (cmd.getName().equalsIgnoreCase("firespread")) { if (player == null || isUserSuperadmin(sender)) { @@ -619,13 +639,40 @@ public class TotalFreedomMod extends JavaPlugin if (args[0].equalsIgnoreCase("on")) { - this.allowFire = true; - sender.sendMessage("Fire is now enabled."); + this.allowFireSpread = true; + sender.sendMessage("Fire spread is now enabled."); } else { - this.allowFire = false; - sender.sendMessage("Fire is now disabled."); + this.allowFireSpread = false; + sender.sendMessage("Fire spread is now disabled."); + } + } + else + { + sender.sendMessage(MSG_NO_PERMS); + } + + return true; + } + else if (cmd.getName().equalsIgnoreCase("fireplace")) + { + if (player == null || isUserSuperadmin(sender)) + { + if (args.length != 1) + { + return false; + } + + if (args[0].equalsIgnoreCase("on")) + { + this.allowFirePlace = true; + sender.sendMessage("Fire placement is now enabled."); + } + else + { + this.allowFirePlace = false; + sender.sendMessage("Fire placement is now disabled."); } } else @@ -662,6 +709,60 @@ public class TotalFreedomMod extends JavaPlugin return true; } + else if (cmd.getName().equalsIgnoreCase("lavaplace")) + { + if (player == null || isUserSuperadmin(sender)) + { + if (args.length != 1) + { + return false; + } + + if (args[0].equalsIgnoreCase("on")) + { + this.allowLavaPlace = true; + sender.sendMessage("Lava placement is now enabled."); + } + else + { + this.allowLavaPlace = false; + sender.sendMessage("Lava placement is now disabled."); + } + } + else + { + sender.sendMessage(MSG_NO_PERMS); + } + + return true; + } + else if (cmd.getName().equalsIgnoreCase("waterplace")) + { + if (player == null || isUserSuperadmin(sender)) + { + if (args.length != 1) + { + return false; + } + + if (args[0].equalsIgnoreCase("on")) + { + this.allowWaterPlace = true; + sender.sendMessage("Water placement is now enabled."); + } + else + { + this.allowWaterPlace = false; + sender.sendMessage("Water placement is now disabled."); + } + } + else + { + sender.sendMessage(MSG_NO_PERMS); + } + + return true; + } else if (cmd.getName().equalsIgnoreCase("radar")) { if (player == null) @@ -709,19 +810,10 @@ public class TotalFreedomMod extends JavaPlugin } else if (cmd.getName().equalsIgnoreCase("rd")) { - if (player == null) + if (player == null || sender.isOp()) { - sender.sendMessage("This command can only be used in-game."); - return true; - } - - if (sender.isOp()) - { - sender.sendMessage(ChatColor.GRAY + "Using WorldEdit to remove all dropped items, arrows, and TNT."); - - Bukkit.getServer().dispatchCommand(sender, "remove items -1"); - Bukkit.getServer().dispatchCommand(sender, "remove arrows -1"); - Bukkit.getServer().dispatchCommand(sender, "remove tnt -1"); + sender.sendMessage(ChatColor.GRAY + "Removing all dropped items, arrows, exp. orbs and TNT..."); + sender.sendMessage(ChatColor.GRAY + String.valueOf(wipeDropEntities()) + " dropped enties removed."); } else { @@ -732,17 +824,24 @@ public class TotalFreedomMod extends JavaPlugin } else if (cmd.getName().equalsIgnoreCase("mp")) { - if (player == null) + if (player == null || sender.isOp()) { - sender.sendMessage("This command can only be used in-game."); - return true; - } + sender.sendMessage(ChatColor.GRAY + "Purging all mobs..."); - if (sender.isOp()) - { - sender.sendMessage(ChatColor.GRAY + "Using MobLimiter to purge all mobs."); + int removed = 0; + for (World world : Bukkit.getWorlds()) + { + for (Entity ent : world.getEntities()) + { + if (ent instanceof Creature || ent instanceof Ghast || ent instanceof Slime) + { + ent.remove(); + removed++; + } + } + } - Bukkit.getServer().dispatchCommand(sender, "moblimiter purge"); + sender.sendMessage(ChatColor.GRAY + String.valueOf(removed) + " mobs removed."); } else { @@ -795,7 +894,7 @@ public class TotalFreedomMod extends JavaPlugin { if (mode.equals("list")) { - sender.sendMessage(ChatColor.GOLD + "[Real Name]:[Display Name] - Hash:"); + sender.sendMessage(ChatColor.GRAY + "[ Real Name ] : [ Display Name ] - Hash:"); } for (Player p : Bukkit.getOnlinePlayers()) @@ -803,7 +902,7 @@ public class TotalFreedomMod extends JavaPlugin String hash = p.getUniqueId().toString().substring(0, 4); if (mode.equals("list")) { - sender.sendMessage(ChatColor.GOLD + String.format("[%s]:[%s] - %s", + sender.sendMessage(ChatColor.GRAY + String.format("[ %s ] : [ %s ] - %s", p.getName(), ChatColor.stripColor(p.getDisplayName()), hash)); @@ -950,39 +1049,74 @@ public class TotalFreedomMod extends JavaPlugin } else if (cmd.getName().equalsIgnoreCase("nonuke")) { - if (args.length < 1) + if (player == null || isUserSuperadmin(sender)) { - return false; - } + if (args.length < 1) + { + return false; + } - if (args.length >= 2) - { - this.nukeMonitorRange = Double.parseDouble(args[1]); - } - - if (args.length >= 3) - { - this.nukeMonitorCount = Integer.parseInt(args[2]); - } + if (args.length >= 2) + { + this.nukeMonitorRange = Double.parseDouble(args[1]); + } - if (args[0].equalsIgnoreCase("on")) - { - this.nukeMonitor = true; - sender.sendMessage(ChatColor.GRAY + "Nuke monitor is enabled."); - sender.sendMessage(ChatColor.GRAY + "Anti-freecam range is set to " + this.nukeMonitorRange + " blocks."); - sender.sendMessage(ChatColor.GRAY + "Block throttle rate is set to " + this.nukeMonitorCount + " blocks destroyed per 5 seconds."); + if (args.length >= 3) + { + this.nukeMonitorCount = Integer.parseInt(args[2]); + } + + if (args[0].equalsIgnoreCase("on")) + { + this.nukeMonitor = true; + sender.sendMessage(ChatColor.GRAY + "Nuke monitor is enabled."); + sender.sendMessage(ChatColor.GRAY + "Anti-freecam range is set to " + this.nukeMonitorRange + " blocks."); + sender.sendMessage(ChatColor.GRAY + "Block throttle rate is set to " + this.nukeMonitorCount + " blocks destroyed per 5 seconds."); + } + else + { + this.nukeMonitor = false; + sender.sendMessage("Nuke monitor is disabled."); + } + + CONFIG.load(); + CONFIG.setProperty("nuke_monitor", this.nukeMonitor); + CONFIG.setProperty("nuke_monitor_range", this.nukeMonitorRange); + CONFIG.setProperty("nuke_monitor_count", this.nukeMonitorCount); + CONFIG.save(); } else { - this.nukeMonitor = false; - sender.sendMessage("Nuke monitor is disabled."); + sender.sendMessage(MSG_NO_PERMS); } - CONFIG.load(); - CONFIG.setProperty("nuke_monitor", this.nukeMonitor); - CONFIG.setProperty("nuke_monitor_range", this.nukeMonitorRange); - CONFIG.setProperty("nuke_monitor_count", this.nukeMonitorCount); - CONFIG.save(); + return true; + } + else if (cmd.getName().equalsIgnoreCase("cake")) + { + if (player == null || isUserSuperadmin(sender)) + { + StringBuilder output = new StringBuilder(); + Random randomGenerator = new Random(); + + for (String word : CAKE_LYRICS.split(" ")) + { + String color_code = Integer.toHexString(1 + randomGenerator.nextInt(14)); + output.append("ยง").append(color_code).append(word).append(" "); + } + + for (Player p : Bukkit.getOnlinePlayers()) + { + ItemStack heldItem = new ItemStack(Material.CAKE, 1); + p.getInventory().setItem(p.getInventory().firstEmpty(), heldItem); + } + + tfBroadcastMessage(output.toString()); + } + else + { + sender.sendMessage(MSG_NO_PERMS); + } return true; } @@ -1005,6 +1139,16 @@ public class TotalFreedomMod extends JavaPlugin } } + public void tfBroadcastMessage(String message) + { + log.info(ChatColor.stripColor(message)); + + for (Player p : Bukkit.getOnlinePlayers()) + { + p.sendMessage(message); + } + } + public String implodeStringList(String glue, List pieces) { StringBuilder output = new StringBuilder(); @@ -1070,7 +1214,7 @@ public class TotalFreedomMod extends JavaPlugin return false; } - private void resetCounts() + private void tfHeartbeat() { for (Player p : Bukkit.getOnlinePlayers()) { @@ -1081,5 +1225,27 @@ public class TotalFreedomMod extends JavaPlugin playerdata.resetBlockDestroyCount(); } } + + if (this.autoEntityWipe) + { + wipeDropEntities(); + } + } + + public int wipeDropEntities() + { + int removed = 0; + for (World world : Bukkit.getWorlds()) + { + for (Entity ent : world.getEntities()) + { + if (ent instanceof Arrow || ent instanceof TNTPrimed || ent instanceof Item || ent instanceof ExperienceOrb) + { + ent.remove(); + removed++; + } + } + } + return removed; } } diff --git a/src/me/StevenLawson/TotalFreedomMod/TotalFreedomModBlockListener.java b/src/me/StevenLawson/TotalFreedomMod/TotalFreedomModBlockListener.java index 93355d16..6b56c47c 100644 --- a/src/me/StevenLawson/TotalFreedomMod/TotalFreedomModBlockListener.java +++ b/src/me/StevenLawson/TotalFreedomMod/TotalFreedomModBlockListener.java @@ -26,7 +26,7 @@ public class TotalFreedomModBlockListener extends BlockListener @Override public void onBlockBurn(BlockBurnEvent event) { - if (!plugin.allowFire) + if (!plugin.allowFireSpread) { event.setCancelled(true); return; @@ -36,7 +36,7 @@ public class TotalFreedomModBlockListener extends BlockListener @Override public void onBlockIgnite(BlockIgniteEvent event) { - if (!plugin.allowFire) + if (!plugin.allowFirePlace) { event.setCancelled(true); return; @@ -102,54 +102,94 @@ public class TotalFreedomModBlockListener extends BlockListener public void onBlockPlace(BlockPlaceEvent event) { ItemStack is = new ItemStack(event.getBlockPlaced().getType(), 1, (short) 0, event.getBlockPlaced().getData()); + Player p = event.getPlayer(); + if (is.getType() == Material.LAVA || is.getType() == Material.STATIONARY_LAVA) { - Player player = event.getPlayer(); - - int slot = player.getInventory().getHeldItemSlot(); - ItemStack heldItem = new ItemStack(Material.COOKIE, 1); - player.getInventory().setItem(slot, heldItem); - - player.sendMessage(ChatColor.GOLD + "LAVA NO FUN, YOU EAT COOKIE INSTEAD, NO?"); - - event.setCancelled(true); - return; - } - else if (is.getType() == Material.WATER || is.getType() == Material.STATIONARY_WATER) - { - Player player = event.getPlayer(); - - int slot = player.getInventory().getHeldItemSlot(); - ItemStack heldItem = new ItemStack(Material.COOKIE, 1); - player.getInventory().setItem(slot, heldItem); - - player.sendMessage(ChatColor.GOLD + "Does this look like a waterpark to you?"); - - event.setCancelled(true); - return; - } - else if (is.getType() == Material.TNT) - { - Player p = event.getPlayer(); - - if (!plugin.allowExplosions) + if (plugin.allowLavaPlace) { - Player player = event.getPlayer(); + log.info(String.format("%s placed lava @ %s", + p.getName(), + plugin.formatLocation(event.getBlock().getLocation()))); - int slot = player.getInventory().getHeldItemSlot(); + p.getInventory().clear(p.getInventory().getHeldItemSlot()); + } + else + { + int slot = p.getInventory().getHeldItemSlot(); ItemStack heldItem = new ItemStack(Material.COOKIE, 1); - player.getInventory().setItem(slot, heldItem); + p.getInventory().setItem(slot, heldItem); - player.sendMessage(ChatColor.GRAY + "TNT is currently disabled."); + p.sendMessage(ChatColor.GOLD + "LAVA NO FUN, YOU EAT COOKIE INSTEAD, NO?"); event.setCancelled(true); return; } + } + else if (is.getType() == Material.WATER || is.getType() == Material.STATIONARY_WATER) + { + if (plugin.allowWaterPlace) + { + log.info(String.format("%s placed water @ %s", + p.getName(), + plugin.formatLocation(event.getBlock().getLocation()))); + + p.getInventory().clear(p.getInventory().getHeldItemSlot()); + } else + { + int slot = p.getInventory().getHeldItemSlot(); + ItemStack heldItem = new ItemStack(Material.COOKIE, 1); + p.getInventory().setItem(slot, heldItem); + + p.sendMessage(ChatColor.GOLD + "Does this look like a waterpark to you?"); + + event.setCancelled(true); + return; + } + } + else if (is.getType() == Material.FIRE) + { + if (plugin.allowFirePlace) + { + log.info(String.format("%s placed fire @ %s", + p.getName(), + plugin.formatLocation(event.getBlock().getLocation()))); + + p.getInventory().clear(p.getInventory().getHeldItemSlot()); + } + else + { + int slot = p.getInventory().getHeldItemSlot(); + ItemStack heldItem = new ItemStack(Material.COOKIE, 1); + p.getInventory().setItem(slot, heldItem); + + p.sendMessage(ChatColor.GOLD + "It's gettin (too) hot in here..."); + + event.setCancelled(true); + return; + } + } + else if (is.getType() == Material.TNT) + { + if (plugin.allowExplosions) { log.info(String.format("%s placed TNT @ %s", p.getName(), plugin.formatLocation(event.getBlock().getLocation()))); + + p.getInventory().clear(p.getInventory().getHeldItemSlot()); + } + else + { + int slot = p.getInventory().getHeldItemSlot(); + ItemStack heldItem = new ItemStack(Material.COOKIE, 1); + p.getInventory().setItem(slot, heldItem); + + p.sendMessage(ChatColor.GRAY + "TNT is currently disabled."); + + event.setCancelled(true); + return; } } } diff --git a/src/me/StevenLawson/TotalFreedomMod/TotalFreedomModEntityListener.java b/src/me/StevenLawson/TotalFreedomMod/TotalFreedomModEntityListener.java index 6c5c02a3..6a879d27 100644 --- a/src/me/StevenLawson/TotalFreedomMod/TotalFreedomModEntityListener.java +++ b/src/me/StevenLawson/TotalFreedomMod/TotalFreedomModEntityListener.java @@ -41,7 +41,7 @@ public class TotalFreedomModEntityListener extends EntityListener @Override public void onEntityCombust(EntityCombustEvent event) { - if (!plugin.allowFire) + if (!plugin.allowFireSpread) { event.setCancelled(true); return; diff --git a/src/me/StevenLawson/TotalFreedomMod/TotalFreedomModPlayerListener.java b/src/me/StevenLawson/TotalFreedomMod/TotalFreedomModPlayerListener.java index e66a11f0..c78d1b90 100644 --- a/src/me/StevenLawson/TotalFreedomMod/TotalFreedomModPlayerListener.java +++ b/src/me/StevenLawson/TotalFreedomMod/TotalFreedomModPlayerListener.java @@ -88,11 +88,11 @@ class TotalFreedomModPlayerListener extends PlayerListener { Location from = event.getFrom(); Location to = event.getTo().clone(); - + to.setX(from.getX()); to.setY(from.getY()); to.setZ(from.getZ()); - + event.setTo(to); } } @@ -106,18 +106,18 @@ class TotalFreedomModPlayerListener extends PlayerListener public void onPlayerChat(PlayerChatEvent event) { Player p = event.getPlayer(); - + TFUserInfo playerdata = (TFUserInfo) plugin.userinfo.get(p); if (playerdata != null) { playerdata.incrementMsgCount(); - + if (playerdata.getMsgCount() > 10) { p.setOp(false); p.kickPlayer("No Spamming"); plugin.tfBroadcastMessage(p.getName() + " was automatically kicked for spamming chat.", ChatColor.RED); - + event.setCancelled(true); return; } diff --git a/src/plugin.yml b/src/plugin.yml index 76754d01..ba237d22 100644 --- a/src/plugin.yml +++ b/src/plugin.yml @@ -4,6 +4,9 @@ version: 1.4 description: Plugin for the Total Freedom server author: StevenLawson / Madgeek1450 commands: + cake: + description: For the people that are still alive. + usage: / creative: description: Quickly change your own gamemode to creative, or define someone's username to change theirs. usage: / [partialname] @@ -13,8 +16,11 @@ commands: explosives: description: Superadmin command - Enable/disable explosives and set effect radius. usage: / [radius] - fire: - description: Superadmin command - Enable/disable fire. + fireplace: + description: Superadmin command - Enable/disable fire placement. + usage: / + firespread: + description: Superadmin command - Enable/disable fire spread. usage: / fr: description: Superadmin command - Freeze all players (toggles on and off). @@ -28,6 +34,9 @@ commands: lavadmg: description: Superadmin command - Enable/disable lava damage. usage: / + lavaplace: + description: Superadmin command - Enable/disable lava placement. + usage: / list: description: Lists the real names of all online players. usage: / @@ -73,6 +82,9 @@ commands: survival: description: Quickly change your own gamemode to survival, or define someone's username to change theirs. usage: / [partialname] + waterplace: + description: Superadmin command - Enable/disable water placement. + usage: / wildcard: description: Superadmin command - Run any command on all users, username placeholder = ?. usage: / [fluff] ? [fluff] ? \ No newline at end of file