diff --git a/src/main/java/me/totalfreedom/totalfreedommod/AutoEject.java b/src/main/java/me/totalfreedom/totalfreedommod/AutoEject.java index 63c9818a..2e84035a 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/AutoEject.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/AutoEject.java @@ -85,6 +85,10 @@ public class AutoEject extends FreedomService player.kickPlayer(kickMessage); break; } + default: + { + FLog.warning("Unrecognized EjectMethod " + method.name() + " found, defaulting to STRIKE_THREE"); + } case STRIKE_THREE: { plugin.bm.addBan(Ban.forPlayerFuzzy(player, Bukkit.getConsoleSender(), null, kickMessage)); diff --git a/src/main/java/me/totalfreedom/totalfreedommod/banning/IndefiniteBan.java b/src/main/java/me/totalfreedom/totalfreedommod/banning/IndefiniteBan.java index 8f9eb229..ba80fa8f 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/banning/IndefiniteBan.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/banning/IndefiniteBan.java @@ -43,6 +43,7 @@ public class IndefiniteBan implements IConfig @Override public void saveTo(ConfigurationSection cs) { + // The indefinite ban list is only intended to be modified manually. It is not intended to save. } @Override diff --git a/src/main/java/me/totalfreedom/totalfreedommod/blocking/BlockBlocker.java b/src/main/java/me/totalfreedom/totalfreedommod/blocking/BlockBlocker.java index db80dff9..746ce186 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/blocking/BlockBlocker.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/blocking/BlockBlocker.java @@ -171,6 +171,11 @@ public class BlockBlocker extends FreedomService } break; } + default: + { + // Do nothing + break; + } } if (Groups.BANNERS.contains(event.getBlockPlaced().getType())) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/blocking/InteractBlocker.java b/src/main/java/me/totalfreedom/totalfreedommod/blocking/InteractBlocker.java index c8f6efb6..2e53f9de 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/blocking/InteractBlocker.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/blocking/InteractBlocker.java @@ -36,10 +36,9 @@ public class InteractBlocker extends FreedomService break; } - case LEFT_CLICK_AIR: - case LEFT_CLICK_BLOCK: + default: { - // + // Do nothing break; } } @@ -158,6 +157,11 @@ public class InteractBlocker extends FreedomService event.setCancelled(true); break; } + default: + { + // Do nothing + break; + } } } } \ No newline at end of file diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cage.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cage.java index 2ba3812d..5cc72009 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cage.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_cage.java @@ -83,6 +83,10 @@ public class Command_cage extends FreedomCommand msg("Invalid block!", ChatColor.RED); break; } + default: + { + return false; + } } } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_manageshop.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_manageshop.java index 60c786c3..1c0a7a81 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_manageshop.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_manageshop.java @@ -35,8 +35,8 @@ public class Command_manageshop extends FreedomCommand } switch (args[1]) { - case "add": + { try { int amount = Math.max(0, Math.min(1000000, Integer.parseInt(args[2]))); @@ -75,7 +75,9 @@ public class Command_manageshop extends FreedomCommand msg("Invalid number: " + args[2], ChatColor.RED); return true; } + } case "remove": + { try { int amount = Math.max(0, Math.min(1000000, Integer.parseInt(args[2]))); @@ -122,7 +124,9 @@ public class Command_manageshop extends FreedomCommand msg("Invalid number: " + args[2], ChatColor.RED); return true; } + } case "set": + { try { int amount = Math.max(0, Math.min(1000000, Integer.parseInt(args[2]))); @@ -147,6 +151,11 @@ public class Command_manageshop extends FreedomCommand msg("Invalid number: " + args[2], ChatColor.RED); return true; } + } + default: + { + return false; + } } } else if (args[0].equals("items")) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_notes.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_notes.java index 8a4754b2..4a4cd2ab 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_notes.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_notes.java @@ -116,8 +116,12 @@ public class Command_notes extends FreedomCommand msg("Cleared " + count + " notes.", ChatColor.GREEN); return true; } + + default: + { + return false; + } } - return false; } @Override diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_potion.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_potion.java index 0f30f24d..feab9776 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_potion.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_potion.java @@ -29,6 +29,7 @@ public class Command_potion extends FreedomCommand switch (args.length) { case 1: + { if (args[0].equalsIgnoreCase("list")) { List potionEffectTypeNames = new ArrayList<>(); @@ -58,8 +59,10 @@ public class Command_potion extends FreedomCommand } } } + } case 2: + { if (args[0].equalsIgnoreCase("clear")) { Player target = playerSender; @@ -95,9 +98,11 @@ public class Command_potion extends FreedomCommand msg("Cleared all active potion effects " + (!target.equals(playerSender) ? "from player " + target.getName() + "." : "from yourself."), ChatColor.AQUA); } break; + } case 4: case 5: + { if (args[0].equalsIgnoreCase("add")) { Player target = playerSender; @@ -167,8 +172,11 @@ public class Command_potion extends FreedomCommand + (!target.equals(playerSender) ? " to player " + target.getName() + "." : " to yourself."), ChatColor.AQUA); } break; + } default: + { return false; + } } return true; } @@ -179,14 +187,17 @@ public class Command_potion extends FreedomCommand switch (args.length) { case 1: + { List arguments = new ArrayList<>(Arrays.asList("list", "clear", "add")); if (plugin.al.isAdmin(sender)) { arguments.add("clearall"); } return arguments; + } case 2: + { if (args[0].equals("clear")) { if (plugin.al.isAdmin(sender)) @@ -199,22 +210,28 @@ public class Command_potion extends FreedomCommand return getAllPotionTypes(); } break; + } case 3: + { if (args[0].equals("add")) { return Collections.singletonList(""); } break; + } case 4: + { if (args[0].equals("add")) { return Collections.singletonList(""); } break; + } case 5: + { if (plugin.al.isAdmin(sender)) { if (args[0].equals("add")) @@ -223,6 +240,12 @@ public class Command_potion extends FreedomCommand } } break; + } + + default: + { + break; + } } return Collections.emptyList(); diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tag.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tag.java index 6f6a1520..0ae1b9d4 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tag.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_tag.java @@ -105,6 +105,11 @@ public class Command_tag extends FreedomCommand } return true; } + + default: + { + return false; + } } } else if (args.length >= 2) @@ -279,6 +284,11 @@ public class Command_tag extends FreedomCommand msg("Tag set to '" + outputTag + ChatColor.GRAY + "'." + (save ? " (Saved)" : "") + from + to); return true; } + + default: + { + return false; + } } } return false; 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 c25ebe9c..712ff7ff 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_toggle.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_toggle.java @@ -16,6 +16,12 @@ import org.bukkit.entity.Player; @CommandParameters(description = "Toggles TotalFreedomMod settings", usage = "/ [option] [value] [value]") public class Command_toggle extends FreedomCommand { + private final List toggles = Arrays.asList( + "waterplace", "fireplace", "lavaplace", "fluidspread", "lavadmg", "firespread", "frostwalk", + "firework", "prelog", "lockdown", "petprotect", "entitywipe", "nonuke [range] [count]", + "explosives [radius]", "unsafeenchs", "bells", "armorstands", "structureblocks", "jigsaws", "grindstones", + "jukeboxes", "spawners", "4chan", "beehives", "respawnanchors", "autotp", "autoclear", "minecarts", "mp44", + "landmines", "tossmob", "gravity"); @Override public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) @@ -23,38 +29,10 @@ public class Command_toggle extends FreedomCommand if (args.length == 0) { msg("Available toggles: "); - msg("- waterplace"); - msg("- fireplace"); - msg("- lavaplace"); - msg("- fluidspread"); - msg("- lavadmg"); - msg("- firespread"); - msg("- frostwalk"); - msg("- firework"); - msg("- prelog"); - msg("- lockdown"); - msg("- petprotect"); - msg("- entitywipe"); - msg("- nonuke [range] [count]"); - msg("- explosives [radius]"); - msg("- unsafeenchs"); - msg("- bells"); - msg("- armorstands"); - msg("- structureblocks"); - msg("- jigsaws"); - msg("- grindstones"); - msg("- jukeboxes"); - msg("- spawners"); - msg("- 4chan"); - msg("- beehives"); - msg("- respawnanchors"); - msg("- autotp"); - msg("- autoclear"); - msg("- minecarts"); - msg("- landmines"); - msg("- mp44"); - msg("- tossmob"); - msg("- gravity"); + for (String toggle : toggles) + { + msg("- " + toggle); + } return false; } @@ -304,6 +282,16 @@ public class Command_toggle extends FreedomCommand toggle("Block gravity is", ConfigEntry.ALLOW_GRAVITY); break; } + + default: + { + msg("Available toggles: "); + for (String toggle : toggles) + { + msg("- " + toggle); + } + return false; + } } return true; } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/fun/ItemFun.java b/src/main/java/me/totalfreedom/totalfreedommod/fun/ItemFun.java index 55c4ec94..08ae5252 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/fun/ItemFun.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/fun/ItemFun.java @@ -128,7 +128,7 @@ public class ItemFun extends FreedomService LivingEntity livingEntity = (LivingEntity)event.getRightClicked(); EntityType entityType = livingEntity.getType(); - if (!(entityType == fPlayer.mobThrowerCreature())) + if (entityType != fPlayer.mobThrowerCreature()) { return; } @@ -304,6 +304,11 @@ public class ItemFun extends FreedomService } break; } + default: + { + // Do nothing + break; + } } } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/fun/Landminer.java b/src/main/java/me/totalfreedom/totalfreedommod/fun/Landminer.java index bf9c8bde..fc249df9 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/fun/Landminer.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/fun/Landminer.java @@ -73,7 +73,7 @@ public class Landminer extends FreedomService continue; } - if (!(player.getLocation().distanceSquared(location) <= (landmine.radius * landmine.radius))) + if (player.getLocation().distanceSquared(location) > (landmine.radius * landmine.radius)) { break; } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/httpd/module/Module_list.java b/src/main/java/me/totalfreedom/totalfreedommod/httpd/module/Module_list.java index 8ee00487..33573926 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/httpd/module/Module_list.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/httpd/module/Module_list.java @@ -79,11 +79,20 @@ public class Module_list extends HTTPDModule switch (admin.getRank()) { case ADMIN: + { admins.add(player.getName()); break; + } case SENIOR_ADMIN: + { senioradmins.add(player.getName()); break; + } + default: + { + // Do nothing + break; + } } } } diff --git a/src/main/java/me/totalfreedom/totalfreedommod/httpd/module/Module_players.java b/src/main/java/me/totalfreedom/totalfreedommod/httpd/module/Module_players.java index 3ae3fbbe..61f8b819 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/httpd/module/Module_players.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/httpd/module/Module_players.java @@ -51,11 +51,20 @@ public class Module_players extends HTTPDModule switch (admin.getRank()) { case ADMIN: + { admins.add(username); break; + } case SENIOR_ADMIN: + { senioradmins.add(username); break; + } + default: + { + // Do nothing + break; + } } }