From 26e5b68a7d64455412e01dfd1cf09de797221542 Mon Sep 17 00:00:00 2001 From: Tobias Ottenweller Date: Sun, 17 Feb 2013 12:20:04 +0100 Subject: [PATCH] Updated the 'senderMustBePlayer' attribute of all commands. --- .../craftinc/gates/commands/BaseCommand.java | 26 +++++-------------- .../craftinc/gates/commands/CommandClose.java | 2 ++ .../gates/commands/CommandCreate.java | 2 ++ .../gates/commands/CommandDelete.java | 2 ++ .../craftinc/gates/commands/CommandHelp.java | 1 + .../craftinc/gates/commands/CommandInfo.java | 1 + .../craftinc/gates/commands/CommandList.java | 1 + .../craftinc/gates/commands/CommandOpen.java | 1 + .../gates/commands/CommandRename.java | 1 + .../gates/commands/CommandSetExit.java | 1 + .../gates/commands/CommandSetHidden.java | 1 + .../gates/commands/CommandSetLocation.java | 1 + .../gates/commands/CommandSetVisible.java | 1 + 13 files changed, 22 insertions(+), 19 deletions(-) diff --git a/src/de/craftinc/gates/commands/BaseCommand.java b/src/de/craftinc/gates/commands/BaseCommand.java index ef44908..4e8ab05 100644 --- a/src/de/craftinc/gates/commands/BaseCommand.java +++ b/src/de/craftinc/gates/commands/BaseCommand.java @@ -13,37 +13,25 @@ import de.craftinc.gates.util.TextUtil; public abstract class BaseCommand { - protected List aliases; - protected List requiredParameters; - protected List optionalParameters; + protected List aliases = new ArrayList(); + protected List requiredParameters = new ArrayList(); + protected List optionalParameters = new ArrayList(); - protected String helpDescription; + protected String helpDescription = "no description"; protected List parameters; protected CommandSender sender; protected Player player; protected Gate gate; - protected boolean senderMustBePlayer; - protected boolean hasGateParam; + protected boolean senderMustBePlayer = true; + protected boolean hasGateParam = true; protected String requiredPermission; protected boolean needsPermissionAtCurrentLocation; protected boolean shouldPersistToDisk; - - - public BaseCommand() - { - aliases = new ArrayList(); - requiredParameters = new ArrayList(); - optionalParameters = new ArrayList(); - - senderMustBePlayer = true; - hasGateParam = true; - - helpDescription = "no description"; - } + public List getAliases() { return aliases; diff --git a/src/de/craftinc/gates/commands/CommandClose.java b/src/de/craftinc/gates/commands/CommandClose.java index 36da43c..c45e681 100644 --- a/src/de/craftinc/gates/commands/CommandClose.java +++ b/src/de/craftinc/gates/commands/CommandClose.java @@ -21,6 +21,8 @@ public class CommandClose extends BaseCommand needsPermissionAtCurrentLocation = false; shouldPersistToDisk = true; + + senderMustBePlayer = false; } diff --git a/src/de/craftinc/gates/commands/CommandCreate.java b/src/de/craftinc/gates/commands/CommandCreate.java index fb5d3a1..df3f7f2 100644 --- a/src/de/craftinc/gates/commands/CommandCreate.java +++ b/src/de/craftinc/gates/commands/CommandCreate.java @@ -26,6 +26,8 @@ public class CommandCreate extends BaseLocationCommand needsPermissionAtCurrentLocation = true; shouldPersistToDisk = true; + + senderMustBePlayer = true; } diff --git a/src/de/craftinc/gates/commands/CommandDelete.java b/src/de/craftinc/gates/commands/CommandDelete.java index 78c7769..3835b7f 100644 --- a/src/de/craftinc/gates/commands/CommandDelete.java +++ b/src/de/craftinc/gates/commands/CommandDelete.java @@ -24,6 +24,8 @@ public class CommandDelete extends BaseCommand needsPermissionAtCurrentLocation = false; shouldPersistToDisk = true; + + senderMustBePlayer = false; } diff --git a/src/de/craftinc/gates/commands/CommandHelp.java b/src/de/craftinc/gates/commands/CommandHelp.java index ac4afc8..0d852c8 100644 --- a/src/de/craftinc/gates/commands/CommandHelp.java +++ b/src/de/craftinc/gates/commands/CommandHelp.java @@ -25,6 +25,7 @@ public class CommandHelp extends BaseCommand hasGateParam = false; needsPermissionAtCurrentLocation = false; shouldPersistToDisk = false; + senderMustBePlayer = false; } diff --git a/src/de/craftinc/gates/commands/CommandInfo.java b/src/de/craftinc/gates/commands/CommandInfo.java index 3cdace5..01f3170 100644 --- a/src/de/craftinc/gates/commands/CommandInfo.java +++ b/src/de/craftinc/gates/commands/CommandInfo.java @@ -22,6 +22,7 @@ public class CommandInfo extends BaseCommand needsPermissionAtCurrentLocation = false; shouldPersistToDisk = false; + senderMustBePlayer = false; } diff --git a/src/de/craftinc/gates/commands/CommandList.java b/src/de/craftinc/gates/commands/CommandList.java index f0dbbbb..2f551ab 100644 --- a/src/de/craftinc/gates/commands/CommandList.java +++ b/src/de/craftinc/gates/commands/CommandList.java @@ -27,6 +27,7 @@ public class CommandList extends BaseCommand requiredPermission = Plugin.permissionInfo; shouldPersistToDisk = false; + senderMustBePlayer = false; } diff --git a/src/de/craftinc/gates/commands/CommandOpen.java b/src/de/craftinc/gates/commands/CommandOpen.java index d87f67b..749cafa 100644 --- a/src/de/craftinc/gates/commands/CommandOpen.java +++ b/src/de/craftinc/gates/commands/CommandOpen.java @@ -21,6 +21,7 @@ public class CommandOpen extends BaseCommand needsPermissionAtCurrentLocation = false; shouldPersistToDisk = true; + senderMustBePlayer = false; } diff --git a/src/de/craftinc/gates/commands/CommandRename.java b/src/de/craftinc/gates/commands/CommandRename.java index 89b69cb..d0caad0 100644 --- a/src/de/craftinc/gates/commands/CommandRename.java +++ b/src/de/craftinc/gates/commands/CommandRename.java @@ -26,6 +26,7 @@ public class CommandRename extends BaseCommand needsPermissionAtCurrentLocation = false; shouldPersistToDisk = true; + senderMustBePlayer = false; } diff --git a/src/de/craftinc/gates/commands/CommandSetExit.java b/src/de/craftinc/gates/commands/CommandSetExit.java index 44e7614..b5f3f8d 100644 --- a/src/de/craftinc/gates/commands/CommandSetExit.java +++ b/src/de/craftinc/gates/commands/CommandSetExit.java @@ -23,6 +23,7 @@ public class CommandSetExit extends BaseCommand needsPermissionAtCurrentLocation = true; shouldPersistToDisk = true; + senderMustBePlayer = true; } diff --git a/src/de/craftinc/gates/commands/CommandSetHidden.java b/src/de/craftinc/gates/commands/CommandSetHidden.java index 19b5279..3f7e24c 100644 --- a/src/de/craftinc/gates/commands/CommandSetHidden.java +++ b/src/de/craftinc/gates/commands/CommandSetHidden.java @@ -22,6 +22,7 @@ public class CommandSetHidden extends BaseCommand needsPermissionAtCurrentLocation = false; shouldPersistToDisk = true; + senderMustBePlayer = false; } diff --git a/src/de/craftinc/gates/commands/CommandSetLocation.java b/src/de/craftinc/gates/commands/CommandSetLocation.java index 06b7142..6757e15 100644 --- a/src/de/craftinc/gates/commands/CommandSetLocation.java +++ b/src/de/craftinc/gates/commands/CommandSetLocation.java @@ -25,6 +25,7 @@ public class CommandSetLocation extends BaseLocationCommand needsPermissionAtCurrentLocation = true; shouldPersistToDisk = true; + senderMustBePlayer = true; } diff --git a/src/de/craftinc/gates/commands/CommandSetVisible.java b/src/de/craftinc/gates/commands/CommandSetVisible.java index 17bfc25..9b4de69 100644 --- a/src/de/craftinc/gates/commands/CommandSetVisible.java +++ b/src/de/craftinc/gates/commands/CommandSetVisible.java @@ -21,6 +21,7 @@ public class CommandSetVisible extends BaseCommand needsPermissionAtCurrentLocation = false; shouldPersistToDisk = true; + senderMustBePlayer = false; }