mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
Code quality and consistency improvements
Here's all the changes I've made in this commit: - Resolves FS-44 (AutoEject.java) - Resolves FS-45 (BlockBlocker.java) - Resolves FS-47 and FS-48 (InteractBlocker.java) - Resolves FS-49 (Command_cage.java) - Resolves FS-50 (Command_manageshop.java) - Resolves FS-51 (Command_notes.java) - Resolves FS-52 (Command_potion.java) - Resolves FS-53 (Command_tag.java) - Resolves FS-55 (ItemFun.java) - Resolves FS-56 (Module_list.java) - Resolves FS-57 (Module_players.java) - Removes redundant code from InteractBlocker.java - Misc. code consistency corrections (global)
This commit is contained in:
parent
f4749559d2
commit
62fe72d99b
@ -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));
|
||||
|
@ -171,6 +171,11 @@ public class BlockBlocker extends FreedomService
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
// Do nothing
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (Groups.BANNERS.contains(event.getBlockPlaced().getType()))
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -83,6 +83,10 @@ public class Command_cage extends FreedomCommand
|
||||
msg("Invalid block!", ChatColor.RED);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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])));
|
||||
@ -148,6 +152,11 @@ public class Command_manageshop extends FreedomCommand
|
||||
return true;
|
||||
}
|
||||
}
|
||||
default:
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (args[0].equals("items"))
|
||||
{
|
||||
|
@ -116,9 +116,13 @@ public class Command_notes extends FreedomCommand
|
||||
msg("Cleared " + count + " notes.", ChatColor.GREEN);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
|
||||
|
@ -29,6 +29,7 @@ public class Command_potion extends FreedomCommand
|
||||
switch (args.length)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
if (args[0].equalsIgnoreCase("list"))
|
||||
{
|
||||
List<String> 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,9 +172,12 @@ 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<String> 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("<duration>");
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 4:
|
||||
{
|
||||
if (args[0].equals("add"))
|
||||
{
|
||||
return Collections.singletonList("<amplifier>");
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 5:
|
||||
{
|
||||
if (plugin.al.isAdmin(sender))
|
||||
{
|
||||
if (args[0].equals("add"))
|
||||
@ -225,6 +242,12 @@ public class Command_potion extends FreedomCommand
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -304,6 +304,11 @@ public class ItemFun extends FreedomService
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
// Do nothing
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -79,12 +79,21 @@ 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -51,12 +51,21 @@ 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
masterbuilders.addAll(plugin.pl.getMasterBuilderNames());
|
||||
|
Loading…
Reference in New Issue
Block a user