From 25aa28194b82f24ba5c297a8881270d8677aef14 Mon Sep 17 00:00:00 2001 From: Telesphoreo Date: Wed, 25 Jul 2018 15:09:35 -0700 Subject: [PATCH] Even more bug fixes (#94) - Clean up /commandlist - /ov now displays proper unknown command message - /toggle doesnt check for case - Trailer will now check if CoreProtect is enabled before trying to log - Temporarily disable master builder world restrictions, causing spam in console everytime a command is one --- .../totalfreedommod/TotalFreedomMod.java | 2 +- .../command/Command_commandlist.java | 6 ++-- .../totalfreedommod/command/Command_ov.java | 2 +- .../command/Command_toggle.java | 28 +++++++++---------- .../totalfreedommod/fun/Trailer.java | 11 ++++---- 5 files changed, 24 insertions(+), 25 deletions(-) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/TotalFreedomMod.java b/src/main/java/me/totalfreedom/totalfreedommod/TotalFreedomMod.java index 772e3076..b873cf36 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/TotalFreedomMod.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/TotalFreedomMod.java @@ -176,7 +176,7 @@ public class TotalFreedomMod extends AeroPlugin nu = services.registerService(AntiNuke.class); as = services.registerService(AntiSpam.class); mbl = services.registerService(MasterBuilderList.class); - mbwr = services.registerService(MasterBuilderWorldRestrictions.class); + //mbwr = services.registerService(MasterBuilderWorldRestrictions.class); pl = services.registerService(PlayerList.class); an = services.registerService(Announcer.class); diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_commandlist.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_commandlist.java index 21176b4b..b673d3a5 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_commandlist.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_commandlist.java @@ -28,13 +28,13 @@ public class Command_commandlist extends FreedomCommand try { PluginDescriptionFile desc = targetPlugin.getDescription(); - Map> map = (Map>) desc.getCommands(); + Map> map = desc.getCommands(); if (map != null) { for (Entry> entry : map.entrySet()) { - String command_name = (String) entry.getKey(); + String command_name = entry.getKey(); commands.add(command_name); } } @@ -46,7 +46,7 @@ public class Command_commandlist extends FreedomCommand Collections.sort(commands); - sender.sendMessage(StringUtils.join(commands, ",")); + sender.sendMessage(StringUtils.join(commands, ", ")); return true; } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_ov.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_ov.java index d74bd81f..e22b6468 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_ov.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_ov.java @@ -34,7 +34,7 @@ public class Command_ov extends FreedomCommand } catch (Exception ignored) { - msg(ChatColor.WHITE + "Unknown command. Type \"help\" for help."); + msg(ChatColor.WHITE + "Unknown command. Type \"/help\" for help."); return true; } } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_toggle.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_toggle.java index b7c4c9f3..b6c9796e 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_toggle.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_toggle.java @@ -36,70 +36,70 @@ public class Command_toggle extends FreedomCommand return false; } - if (args[0].equals("waterplace")) + if (args[0].equalsIgnoreCase("waterplace")) { toggle("Water placement is", ConfigEntry.ALLOW_WATER_PLACE); return true; } - else if (args[0].equals("frostwalk")) + else if (args[0].equalsIgnoreCase("frostwalk")) { toggle("Frost walker enchantment is ", ConfigEntry.ALLOW_FROSTWALKER); return true; } - else if (args[0].equals("fireplace")) + else if (args[0].equalsIgnoreCase("fireplace")) { toggle("Fire placement is", ConfigEntry.ALLOW_FIRE_PLACE); return true; } - else if (args[0].equals("lavaplace")) + else if (args[0].equalsIgnoreCase("lavaplace")) { toggle("Lava placement is", ConfigEntry.ALLOW_LAVA_PLACE); return true; } - else if (args[0].equals("fluidspread")) + else if (args[0].equalsIgnoreCase("fluidspread")) { toggle("Fluid spread is", ConfigEntry.ALLOW_FLUID_SPREAD); return true; } - else if (args[0].equals("lavadmg")) + else if (args[0].equalsIgnoreCase("lavadmg")) { toggle("Lava damage is", ConfigEntry.ALLOW_LAVA_DAMAGE); return true; } - else if (args[0].equals("firespread")) + else if (args[0].equalsIgnoreCase("firespread")) { toggle("Fire spread is", ConfigEntry.ALLOW_FIRE_SPREAD); plugin.gr.setGameRule(GameRuleHandler.GameRule.DO_FIRE_TICK, ConfigEntry.ALLOW_FIRE_SPREAD.getBoolean()); return true; } - else if (args[0].equals("prelog")) + else if (args[0].equalsIgnoreCase("prelog")) { toggle("Command prelogging is", ConfigEntry.ENABLE_PREPROCESS_LOG); return true; } - else if (args[0].equals("lockdown")) + else if (args[0].equalsIgnoreCase("lockdown")) { boolean active = !plugin.lp.isLockdownEnabled(); plugin.lp.setLockdownEnabled(active); FUtil.adminAction(sender.getName(), (active ? "A" : "De-a") + "ctivating server lockdown", true); return true; } - else if (args[0].equals("petprotect")) + else if (args[0].equalsIgnoreCase("petprotect")) { toggle("Tamed pet protection is", ConfigEntry.ENABLE_PET_PROTECT); return true; } - else if (args[0].equals("entitywipe")) + else if (args[0].equalsIgnoreCase("entitywipe")) { toggle("Automatic entity wiping is", ConfigEntry.AUTO_ENTITY_WIPE); return true; } - else if (args[0].equals("firework")) + else if (args[0].equalsIgnoreCase("firework")) { toggle("Firework explosion is", ConfigEntry.ALLOW_FIREWORK_EXPLOSION); return true; } - else if (args[0].equals("nonuke")) + else if (args[0].equalsIgnoreCase("nonuke")) { if (args.length >= 2) { @@ -129,7 +129,7 @@ public class Command_toggle extends FreedomCommand } return true; } - else if (args[0].equals("explosives")) + else if (args[0].equalsIgnoreCase("explosives")) { if (args.length == 2) { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/fun/Trailer.java b/src/main/java/me/totalfreedom/totalfreedommod/fun/Trailer.java index 72147947..b036062d 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/fun/Trailer.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/fun/Trailer.java @@ -48,10 +48,10 @@ public class Trailer extends FreedomService return; } - if (event.getPlayer().getWorld().equals(plugin.wm.masterBuilderWorld.getWorld())) - { - return; - } + //if (event.getPlayer().getWorld().equals(plugin.wm.masterBuilderWorld.getWorld())) + //{ + // return; + //} Block fromBlock = event.getFrom().getBlock(); if (!fromBlock.isEmpty()) @@ -65,7 +65,6 @@ public class Trailer extends FreedomService return; } - final Location location = fromBlock.getLocation(); fromBlock.setType(MaterialGroup.WOOL_COLORS.get(random.nextInt(MaterialGroup.WOOL_COLORS.size()))); byte data = DepreciationAggregator.getData_Block(fromBlock); Material material = Material.getMaterial(String.valueOf(fromBlock.getType())); @@ -75,7 +74,7 @@ public class Trailer extends FreedomService { final Location trail_pos; trail_pos = new Location(event.getPlayer().getWorld(), fromBlock.getX() + x, fromBlock.getY(), fromBlock.getZ() + z); - if (trailPlayers.contains(event.getPlayer().getName())) + if (trailPlayers.contains(event.getPlayer().getName()) && plugin.cpb.isEnabled()) { plugin.cpb.getCoreProtectAPI().logPlacement(event.getPlayer().getName(), trail_pos, material, data); }