From 56fbeb60e5fd6641e2722fff1eeeae7f3a7a860b Mon Sep 17 00:00:00 2001 From: boy0001 Date: Mon, 27 Jul 2015 14:30:50 +1000 Subject: [PATCH] Add your command caller back --- .../plot/commands/Add.java | 2 +- .../plot/commands/Auto.java | 2 +- .../plot/commands/Buy.java | 2 +- .../plot/commands/Chat.java | 2 +- .../plot/commands/Claim.java | 2 +- .../plot/commands/Clear.java | 2 +- .../plot/commands/Cluster.java | 2 +- .../plot/commands/Comment.java | 2 +- .../plot/commands/Condense.java | 2 +- .../plot/commands/Confirm.java | 2 +- .../plot/commands/Copy.java | 2 +- .../plot/commands/CreateRoadSchematic.java | 2 +- .../plot/commands/Database.java | 2 +- .../plot/commands/Debug.java | 2 +- .../plot/commands/DebugAllowUnsafe.java | 2 +- .../plot/commands/DebugClaimTest.java | 2 +- .../plot/commands/DebugClear.java | 2 +- .../plot/commands/DebugExec.java | 2 +- .../plot/commands/DebugFill.java | 2 +- .../plot/commands/DebugFixFlags.java | 2 +- .../plot/commands/DebugLoadTest.java | 2 +- .../plot/commands/DebugPaste.java | 2 +- .../plot/commands/DebugRoadRegen.java | 2 +- .../plot/commands/DebugSaveTest.java | 2 +- .../plot/commands/DebugSetup.java | 2 +- .../plot/commands/DebugUUID.java | 2 +- .../plot/commands/Delete.java | 2 +- .../plot/commands/Deny.java | 2 +- .../plot/commands/Download.java | 2 +- .../plot/commands/FlagCmd.java | 2 +- .../plot/commands/Help.java | 2 +- .../plot/commands/Home.java | 2 +- .../plot/commands/Inbox.java | 2 +- .../plot/commands/Info.java | 2 +- .../plot/commands/Kick.java | 2 +- .../plot/commands/Load.java | 2 +- .../plot/commands/MainCommand.java | 8 ++-- .../plot/commands/Merge.java | 2 +- .../plot/commands/Move.java | 2 +- .../plot/commands/MusicSubcommand.java | 2 +- .../plot/commands/Purge.java | 2 +- .../plot/commands/Rate.java | 2 +- .../plot/commands/RegenAllRoads.java | 2 +- .../plot/commands/Reload.java | 2 +- .../plot/commands/Remove.java | 2 +- .../plot/commands/Save.java | 2 +- .../plot/commands/SchematicCmd.java | 2 +- .../plot/commands/Set.java | 2 +- .../plot/commands/SetOwner.java | 2 +- .../plot/commands/Setup.java | 2 +- .../plot/commands/Swap.java | 2 +- .../plot/commands/TP.java | 2 +- .../plot/commands/Target.java | 2 +- .../plot/commands/Template.java | 2 +- .../plot/commands/Toggle.java | 2 +- .../plot/commands/Trim.java | 2 +- .../plot/commands/Trust.java | 2 +- .../plot/commands/Unclaim.java | 2 +- .../plot/commands/Undeny.java | 2 +- .../plot/commands/Unlink.java | 2 +- .../plot/commands/Untrust.java | 2 +- .../plot/commands/Update.java | 2 +- .../plot/commands/Visit.java | 2 +- .../plot/commands/WE_Anywhere.java | 2 +- .../plot/commands/callers/ConsoleCaller.java | 2 +- .../commands/callers/PlotPlayerCaller.java | 2 +- .../plot/commands/list.java | 2 +- .../plot/commands/plugin.java | 2 +- .../plot/util/MainUtil.java | 2 +- .../plot/util/StringComparison.java | 5 +++ .../plot/util/StringMan.java | 26 +++++++++++++ .../intellectualsites/commands/Command.java | 20 +++++----- .../commands/CommandCaller.java | 19 ++++++++++ .../commands/CommandManager.java | 37 ++++++++++--------- .../commands/util/StringUtil.java | 26 ------------- 75 files changed, 152 insertions(+), 125 deletions(-) create mode 100644 src/main/java/com/intellectualsites/commands/CommandCaller.java diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Add.java b/src/main/java/com/intellectualcrafters/plot/commands/Add.java index 72fc69455..f7e1bfc4f 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Add.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Add.java @@ -33,7 +33,7 @@ import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.Permissions; import com.intellectualsites.commands.Argument; import com.intellectualsites.commands.CommandDeclaration; -import com.intellectualsites.commands.callers.CommandCaller; +import com.intellectualsites.commands.CommandCaller; import com.plotsquared.bukkit.util.UUIDHandler; import com.plotsquared.bukkit.util.bukkit.uuid.SQLUUIDHandler; diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Auto.java b/src/main/java/com/intellectualcrafters/plot/commands/Auto.java index f619f22cb..29fbdd69c 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Auto.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Auto.java @@ -34,7 +34,7 @@ import com.intellectualcrafters.plot.util.EconHandler; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.Permissions; import com.intellectualsites.commands.CommandDeclaration; -import com.intellectualsites.commands.callers.CommandCaller; +import com.intellectualsites.commands.CommandCaller; @CommandDeclaration( command = "auto", diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Buy.java b/src/main/java/com/intellectualcrafters/plot/commands/Buy.java index f9e328034..bb04ad6a8 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Buy.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Buy.java @@ -35,7 +35,7 @@ import com.intellectualcrafters.plot.object.PlotWorld; import com.intellectualcrafters.plot.util.EconHandler; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualsites.commands.CommandDeclaration; -import com.intellectualsites.commands.callers.CommandCaller; +import com.intellectualsites.commands.CommandCaller; import com.plotsquared.bukkit.util.UUIDHandler; @CommandDeclaration( diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Chat.java b/src/main/java/com/intellectualcrafters/plot/commands/Chat.java index 0054a0c6f..efe9e89d1 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Chat.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Chat.java @@ -5,7 +5,7 @@ import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.PlotWorld; import com.intellectualsites.commands.CommandDeclaration; -import com.intellectualsites.commands.callers.CommandCaller; +import com.intellectualsites.commands.CommandCaller; @CommandDeclaration( command = "chat", diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Claim.java b/src/main/java/com/intellectualcrafters/plot/commands/Claim.java index 4d937918a..3b81ffd6f 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Claim.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Claim.java @@ -35,7 +35,7 @@ import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.SchematicHandler; import com.intellectualcrafters.plot.util.SchematicHandler.Schematic; import com.intellectualsites.commands.CommandDeclaration; -import com.intellectualsites.commands.callers.CommandCaller; +import com.intellectualsites.commands.CommandCaller; @CommandDeclaration( command = "claim", diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Clear.java b/src/main/java/com/intellectualcrafters/plot/commands/Clear.java index 1db2d4465..d2d3ab44f 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Clear.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Clear.java @@ -35,7 +35,7 @@ import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.TaskManager; import com.intellectualsites.commands.CommandDeclaration; -import com.intellectualsites.commands.callers.CommandCaller; +import com.intellectualsites.commands.CommandCaller; import com.plotsquared.bukkit.util.UUIDHandler; @CommandDeclaration( diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Cluster.java b/src/main/java/com/intellectualcrafters/plot/commands/Cluster.java index 90213c1aa..f8893f727 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Cluster.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Cluster.java @@ -29,7 +29,7 @@ import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.generator.PlotGenerator; import com.intellectualsites.commands.CommandDeclaration; -import com.intellectualsites.commands.callers.CommandCaller; +import com.intellectualsites.commands.CommandCaller; import com.plotsquared.bukkit.generator.AugmentedPopulator; import com.plotsquared.bukkit.generator.HybridGen; import com.intellectualcrafters.plot.object.BlockLoc; diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Comment.java b/src/main/java/com/intellectualcrafters/plot/commands/Comment.java index 207ae0245..6471542fe 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Comment.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Comment.java @@ -23,7 +23,7 @@ package com.intellectualcrafters.plot.commands; import java.util.Arrays; import com.intellectualsites.commands.CommandDeclaration; -import com.intellectualsites.commands.callers.CommandCaller; +import com.intellectualsites.commands.CommandCaller; import org.apache.commons.lang.StringUtils; import com.intellectualcrafters.plot.config.C; diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Condense.java b/src/main/java/com/intellectualcrafters/plot/commands/Condense.java index fdfd5b3b6..a3218e509 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Condense.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Condense.java @@ -27,7 +27,7 @@ import java.util.List; import java.util.Set; import com.intellectualsites.commands.CommandDeclaration; -import com.intellectualsites.commands.callers.CommandCaller; +import com.intellectualsites.commands.CommandCaller; import org.apache.commons.lang.StringUtils; import com.intellectualcrafters.plot.PS; diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Confirm.java b/src/main/java/com/intellectualcrafters/plot/commands/Confirm.java index c53d56e08..8270fe9f8 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Confirm.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Confirm.java @@ -28,7 +28,7 @@ import com.intellectualcrafters.plot.util.CmdConfirm; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.TaskManager; import com.intellectualsites.commands.CommandDeclaration; -import com.intellectualsites.commands.callers.CommandCaller; +import com.intellectualsites.commands.CommandCaller; @CommandDeclaration( command = "confirm", diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Copy.java b/src/main/java/com/intellectualcrafters/plot/commands/Copy.java index 289b39945..1010f10d1 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Copy.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Copy.java @@ -29,7 +29,7 @@ import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.Permissions; import com.intellectualsites.commands.Argument; import com.intellectualsites.commands.CommandDeclaration; -import com.intellectualsites.commands.callers.CommandCaller; +import com.intellectualsites.commands.CommandCaller; @CommandDeclaration( command = "copy", diff --git a/src/main/java/com/intellectualcrafters/plot/commands/CreateRoadSchematic.java b/src/main/java/com/intellectualcrafters/plot/commands/CreateRoadSchematic.java index 1ad4dcfb4..415350ddd 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/CreateRoadSchematic.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/CreateRoadSchematic.java @@ -29,7 +29,7 @@ import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualsites.commands.CommandDeclaration; -import com.intellectualsites.commands.callers.CommandCaller; +import com.intellectualsites.commands.CommandCaller; @CommandDeclaration( command = "createroadschematic", diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Database.java b/src/main/java/com/intellectualcrafters/plot/commands/Database.java index 23d6435eb..16bc80951 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Database.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Database.java @@ -15,7 +15,7 @@ import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.StringComparison; import com.intellectualcrafters.plot.util.TaskManager; import com.intellectualsites.commands.CommandDeclaration; -import com.intellectualsites.commands.callers.CommandCaller; +import com.intellectualsites.commands.CommandCaller; import com.plotsquared.bukkit.util.UUIDHandler; @CommandDeclaration( diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Debug.java b/src/main/java/com/intellectualcrafters/plot/commands/Debug.java index a9aa15832..eeec759e7 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Debug.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Debug.java @@ -27,7 +27,7 @@ import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.util.Lag; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualsites.commands.CommandDeclaration; -import com.intellectualsites.commands.callers.CommandCaller; +import com.intellectualsites.commands.CommandCaller; @CommandDeclaration( command = "debug", diff --git a/src/main/java/com/intellectualcrafters/plot/commands/DebugAllowUnsafe.java b/src/main/java/com/intellectualcrafters/plot/commands/DebugAllowUnsafe.java index 147848964..fdc6d9d00 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/DebugAllowUnsafe.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/DebugAllowUnsafe.java @@ -9,7 +9,7 @@ import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualsites.commands.CommandDeclaration; -import com.intellectualsites.commands.callers.CommandCaller; +import com.intellectualsites.commands.CommandCaller; @CommandDeclaration( command = "debugallowunsafe", diff --git a/src/main/java/com/intellectualcrafters/plot/commands/DebugClaimTest.java b/src/main/java/com/intellectualcrafters/plot/commands/DebugClaimTest.java index 8f3a641f7..94732474c 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/DebugClaimTest.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/DebugClaimTest.java @@ -40,7 +40,7 @@ import com.intellectualcrafters.plot.util.ChunkManager; import com.intellectualcrafters.plot.util.EventUtil; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualsites.commands.CommandDeclaration; -import com.intellectualsites.commands.callers.CommandCaller; +import com.intellectualsites.commands.CommandCaller; import com.plotsquared.bukkit.util.UUIDHandler; @CommandDeclaration( diff --git a/src/main/java/com/intellectualcrafters/plot/commands/DebugClear.java b/src/main/java/com/intellectualcrafters/plot/commands/DebugClear.java index 7e5804671..083d6e5aa 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/DebugClear.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/DebugClear.java @@ -32,7 +32,7 @@ import com.intellectualcrafters.plot.util.ChunkManager; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.Permissions; import com.intellectualsites.commands.CommandDeclaration; -import com.intellectualsites.commands.callers.CommandCaller; +import com.intellectualsites.commands.CommandCaller; import com.plotsquared.bukkit.util.UUIDHandler; @CommandDeclaration( diff --git a/src/main/java/com/intellectualcrafters/plot/commands/DebugExec.java b/src/main/java/com/intellectualcrafters/plot/commands/DebugExec.java index c6f244921..8f024bf44 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/DebugExec.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/DebugExec.java @@ -32,7 +32,7 @@ import java.util.UUID; import com.intellectualcrafters.plot.commands.callers.PlotPlayerCaller; import com.intellectualsites.commands.CommandDeclaration; -import com.intellectualsites.commands.callers.CommandCaller; +import com.intellectualsites.commands.CommandCaller; import com.plotsquared.bukkit.util.UUIDHandler; import org.apache.commons.lang.StringUtils; import org.bukkit.Bukkit; diff --git a/src/main/java/com/intellectualcrafters/plot/commands/DebugFill.java b/src/main/java/com/intellectualcrafters/plot/commands/DebugFill.java index badfdca02..2aefaed87 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/DebugFill.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/DebugFill.java @@ -30,7 +30,7 @@ import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.SetBlockQueue; import com.intellectualcrafters.plot.util.TaskManager; import com.intellectualsites.commands.CommandDeclaration; -import com.intellectualsites.commands.callers.CommandCaller; +import com.intellectualsites.commands.CommandCaller; @CommandDeclaration( command = "fill", diff --git a/src/main/java/com/intellectualcrafters/plot/commands/DebugFixFlags.java b/src/main/java/com/intellectualcrafters/plot/commands/DebugFixFlags.java index 740b88a9c..5280f7bd3 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/DebugFixFlags.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/DebugFixFlags.java @@ -35,7 +35,7 @@ import com.intellectualcrafters.plot.util.BlockManager; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualsites.commands.Argument; import com.intellectualsites.commands.CommandDeclaration; -import com.intellectualsites.commands.callers.CommandCaller; +import com.intellectualsites.commands.CommandCaller; @CommandDeclaration( command = "debugfixflags", diff --git a/src/main/java/com/intellectualcrafters/plot/commands/DebugLoadTest.java b/src/main/java/com/intellectualcrafters/plot/commands/DebugLoadTest.java index 14692bd3f..abb9c6dc5 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/DebugLoadTest.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/DebugLoadTest.java @@ -27,7 +27,7 @@ import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualsites.commands.CommandDeclaration; -import com.intellectualsites.commands.callers.CommandCaller; +import com.intellectualsites.commands.CommandCaller; @CommandDeclaration( command = "debugloadtest", diff --git a/src/main/java/com/intellectualcrafters/plot/commands/DebugPaste.java b/src/main/java/com/intellectualcrafters/plot/commands/DebugPaste.java index 9579ce0d2..f67d80ca9 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/DebugPaste.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/DebugPaste.java @@ -1,7 +1,7 @@ package com.intellectualcrafters.plot.commands; import com.intellectualsites.commands.CommandDeclaration; -import com.intellectualsites.commands.callers.CommandCaller; +import com.intellectualsites.commands.CommandCaller; import com.plotsquared.bukkit.BukkitMain; import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.config.C; diff --git a/src/main/java/com/intellectualcrafters/plot/commands/DebugRoadRegen.java b/src/main/java/com/intellectualcrafters/plot/commands/DebugRoadRegen.java index c115d331b..82312472e 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/DebugRoadRegen.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/DebugRoadRegen.java @@ -29,7 +29,7 @@ import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualsites.commands.CommandDeclaration; -import com.intellectualsites.commands.callers.CommandCaller; +import com.intellectualsites.commands.CommandCaller; @CommandDeclaration( command = "debugroadregen", diff --git a/src/main/java/com/intellectualcrafters/plot/commands/DebugSaveTest.java b/src/main/java/com/intellectualcrafters/plot/commands/DebugSaveTest.java index cf71d4395..7317a6ec4 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/DebugSaveTest.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/DebugSaveTest.java @@ -28,7 +28,7 @@ import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualsites.commands.CommandDeclaration; -import com.intellectualsites.commands.callers.CommandCaller; +import com.intellectualsites.commands.CommandCaller; @CommandDeclaration( command = "debugsavetest", diff --git a/src/main/java/com/intellectualcrafters/plot/commands/DebugSetup.java b/src/main/java/com/intellectualcrafters/plot/commands/DebugSetup.java index 8cc5c01a4..7d0d9e1c1 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/DebugSetup.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/DebugSetup.java @@ -25,7 +25,7 @@ import java.util.Map.Entry; import com.intellectualcrafters.plot.commands.callers.PlotPlayerCaller; import com.intellectualcrafters.plot.generator.PlotGenerator; import com.intellectualsites.commands.CommandDeclaration; -import com.intellectualsites.commands.callers.CommandCaller; +import com.intellectualsites.commands.CommandCaller; import org.bukkit.generator.ChunkGenerator; import com.intellectualcrafters.plot.config.C; diff --git a/src/main/java/com/intellectualcrafters/plot/commands/DebugUUID.java b/src/main/java/com/intellectualcrafters/plot/commands/DebugUUID.java index 56306dd0f..d2873a4bc 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/DebugUUID.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/DebugUUID.java @@ -30,7 +30,7 @@ import java.util.UUID; import com.intellectualsites.commands.Argument; import com.intellectualsites.commands.CommandDeclaration; -import com.intellectualsites.commands.callers.CommandCaller; +import com.intellectualsites.commands.CommandCaller; import com.plotsquared.bukkit.util.UUIDHandler; import org.bukkit.Bukkit; diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Delete.java b/src/main/java/com/intellectualcrafters/plot/commands/Delete.java index 211d111f2..eca0d33fa 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Delete.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Delete.java @@ -33,7 +33,7 @@ import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.TaskManager; import com.intellectualsites.commands.CommandDeclaration; -import com.intellectualsites.commands.callers.CommandCaller; +import com.intellectualsites.commands.CommandCaller; import com.plotsquared.bukkit.util.UUIDHandler; @CommandDeclaration( diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Deny.java b/src/main/java/com/intellectualcrafters/plot/commands/Deny.java index fe7b90e1d..024705270 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Deny.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Deny.java @@ -33,7 +33,7 @@ import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.Permissions; import com.intellectualsites.commands.Argument; import com.intellectualsites.commands.CommandDeclaration; -import com.intellectualsites.commands.callers.CommandCaller; +import com.intellectualsites.commands.CommandCaller; import com.plotsquared.bukkit.util.UUIDHandler; import com.plotsquared.bukkit.util.bukkit.uuid.SQLUUIDHandler; diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Download.java b/src/main/java/com/intellectualcrafters/plot/commands/Download.java index e03671cd1..2374665a0 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Download.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Download.java @@ -14,7 +14,7 @@ import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.SchematicHandler; import com.intellectualcrafters.plot.util.TaskManager; import com.intellectualsites.commands.CommandDeclaration; -import com.intellectualsites.commands.callers.CommandCaller; +import com.intellectualsites.commands.CommandCaller; @CommandDeclaration( command = "download", diff --git a/src/main/java/com/intellectualcrafters/plot/commands/FlagCmd.java b/src/main/java/com/intellectualcrafters/plot/commands/FlagCmd.java index cd2a038d9..f5ac0a8d5 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/FlagCmd.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/FlagCmd.java @@ -25,7 +25,7 @@ import java.util.Arrays; import java.util.HashMap; import com.intellectualsites.commands.CommandDeclaration; -import com.intellectualsites.commands.callers.CommandCaller; +import com.intellectualsites.commands.CommandCaller; import org.apache.commons.lang.StringUtils; import com.intellectualcrafters.plot.config.C; diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Help.java b/src/main/java/com/intellectualcrafters/plot/commands/Help.java index 25215ac65..81ff2375c 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Help.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Help.java @@ -8,7 +8,7 @@ package com.intellectualcrafters.plot.commands; import com.intellectualsites.commands.CommandDeclaration; -import com.intellectualsites.commands.callers.CommandCaller; +import com.intellectualsites.commands.CommandCaller; @CommandDeclaration( command = "help", diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Home.java b/src/main/java/com/intellectualcrafters/plot/commands/Home.java index 669a31b01..2ab2a7fbb 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Home.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Home.java @@ -28,7 +28,7 @@ import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualsites.commands.CommandDeclaration; -import com.intellectualsites.commands.callers.CommandCaller; +import com.intellectualsites.commands.CommandCaller; @CommandDeclaration( command = "home", diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Inbox.java b/src/main/java/com/intellectualcrafters/plot/commands/Inbox.java index ad60d654a..8a78c2928 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Inbox.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Inbox.java @@ -24,7 +24,7 @@ import java.util.ArrayList; import java.util.List; import com.intellectualsites.commands.CommandDeclaration; -import com.intellectualsites.commands.callers.CommandCaller; +import com.intellectualsites.commands.CommandCaller; import org.apache.commons.lang.StringUtils; import com.intellectualcrafters.plot.config.C; diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Info.java b/src/main/java/com/intellectualcrafters/plot/commands/Info.java index aa6bf71b8..d6ec58d6f 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Info.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Info.java @@ -28,7 +28,7 @@ import java.util.regex.Matcher; import com.intellectualcrafters.plot.commands.callers.PlotPlayerCaller; import com.intellectualcrafters.plot.flag.Flag; import com.intellectualsites.commands.CommandDeclaration; -import com.intellectualsites.commands.callers.CommandCaller; +import com.intellectualsites.commands.CommandCaller; import com.plotsquared.bukkit.util.UUIDHandler; import org.apache.commons.lang.StringUtils; diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Kick.java b/src/main/java/com/intellectualcrafters/plot/commands/Kick.java index 4ce1a7bf6..97e2de4dc 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Kick.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Kick.java @@ -28,7 +28,7 @@ import com.intellectualcrafters.plot.util.BlockManager; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.Permissions; import com.intellectualsites.commands.CommandDeclaration; -import com.intellectualsites.commands.callers.CommandCaller; +import com.intellectualsites.commands.CommandCaller; import com.plotsquared.bukkit.util.UUIDHandler; @CommandDeclaration( diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Load.java b/src/main/java/com/intellectualcrafters/plot/commands/Load.java index 17066b782..e4f14e961 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Load.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Load.java @@ -17,7 +17,7 @@ import com.intellectualcrafters.plot.util.SchematicHandler; import com.intellectualcrafters.plot.util.SchematicHandler.Schematic; import com.intellectualcrafters.plot.util.TaskManager; import com.intellectualsites.commands.CommandDeclaration; -import com.intellectualsites.commands.callers.CommandCaller; +import com.intellectualsites.commands.CommandCaller; @CommandDeclaration( command = "load", diff --git a/src/main/java/com/intellectualcrafters/plot/commands/MainCommand.java b/src/main/java/com/intellectualcrafters/plot/commands/MainCommand.java index 686b90ebd..47430d03f 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/MainCommand.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/MainCommand.java @@ -37,7 +37,7 @@ import com.intellectualsites.commands.Argument; import com.intellectualsites.commands.Command; import com.intellectualsites.commands.CommandHandlingOutput; import com.intellectualsites.commands.CommandManager; -import com.intellectualsites.commands.callers.CommandCaller; +import com.intellectualsites.commands.CommandCaller; import com.intellectualsites.commands.util.StringUtil; /** @@ -247,7 +247,7 @@ public class MainCommand extends CommandManager { public int handle(CommandCaller caller, String input) { String[] parts = input.split(" "); String[] args; - String command = parts[0]; + String command = parts[0].toLowerCase(); if (parts.length == 1) { args = new String[0]; } else { @@ -256,7 +256,7 @@ public class MainCommand extends CommandManager { } Command cmd = null; for (Command c1 : this.commands) { - if (c1.getCommand().equalsIgnoreCase(command) || StringUtil.inArray(command, c1.getAliases(), false)) { + if (c1.getCommand().equalsIgnoreCase(command) || c1.getAliases().contains(command)) { cmd = c1; break; } @@ -268,7 +268,7 @@ public class MainCommand extends CommandManager { for (int i = 0; i < commands.length; i++) { commands[i] = this.commands.get(i).getCommand(); } - final String bestMatch = new StringComparison(args[0], commands).getBestMatch(); + final String bestMatch = new StringComparison(args[0], commands).getBestMatch(); caller.message(C.DID_YOU_MEAN, "/plot " + bestMatch); } return CommandHandlingOutput.NOT_FOUND; diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Merge.java b/src/main/java/com/intellectualcrafters/plot/commands/Merge.java index 9d1ca7778..d37a6cbab 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Merge.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Merge.java @@ -26,7 +26,7 @@ import java.util.UUID; import com.intellectualsites.commands.Argument; import com.intellectualsites.commands.CommandDeclaration; -import com.intellectualsites.commands.callers.CommandCaller; +import com.intellectualsites.commands.CommandCaller; import com.plotsquared.bukkit.util.UUIDHandler; import org.apache.commons.lang.StringUtils; diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Move.java b/src/main/java/com/intellectualcrafters/plot/commands/Move.java index 36d77fd91..7159f86bd 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Move.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Move.java @@ -31,7 +31,7 @@ import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.Permissions; import com.intellectualsites.commands.Argument; import com.intellectualsites.commands.CommandDeclaration; -import com.intellectualsites.commands.callers.CommandCaller; +import com.intellectualsites.commands.CommandCaller; @CommandDeclaration( command = "move", diff --git a/src/main/java/com/intellectualcrafters/plot/commands/MusicSubcommand.java b/src/main/java/com/intellectualcrafters/plot/commands/MusicSubcommand.java index 5144d24b5..c5bdacee5 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/MusicSubcommand.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/MusicSubcommand.java @@ -32,7 +32,7 @@ import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.util.BlockManager; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualsites.commands.CommandDeclaration; -import com.intellectualsites.commands.callers.CommandCaller; +import com.intellectualsites.commands.CommandCaller; @CommandDeclaration( command = "music", diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Purge.java b/src/main/java/com/intellectualcrafters/plot/commands/Purge.java index b1ed17dda..e0f17534f 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Purge.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Purge.java @@ -32,7 +32,7 @@ import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualsites.commands.CommandDeclaration; -import com.intellectualsites.commands.callers.CommandCaller; +import com.intellectualsites.commands.CommandCaller; import com.plotsquared.bukkit.util.UUIDHandler; diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Rate.java b/src/main/java/com/intellectualcrafters/plot/commands/Rate.java index b1b3a74cb..bb1629f00 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Rate.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Rate.java @@ -27,7 +27,7 @@ import java.util.Map.Entry; import java.util.UUID; import com.intellectualsites.commands.CommandDeclaration; -import com.intellectualsites.commands.callers.CommandCaller; +import com.intellectualsites.commands.CommandCaller; import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.mutable.MutableInt; import org.bukkit.Bukkit; diff --git a/src/main/java/com/intellectualcrafters/plot/commands/RegenAllRoads.java b/src/main/java/com/intellectualcrafters/plot/commands/RegenAllRoads.java index 289676cc7..e2ca3f312 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/RegenAllRoads.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/RegenAllRoads.java @@ -32,7 +32,7 @@ import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.util.ChunkManager; import com.intellectualsites.commands.Argument; import com.intellectualsites.commands.CommandDeclaration; -import com.intellectualsites.commands.callers.CommandCaller; +import com.intellectualsites.commands.CommandCaller; @CommandDeclaration( command = "regenallroads", diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Reload.java b/src/main/java/com/intellectualcrafters/plot/commands/Reload.java index 05e3944f8..c1105b0cd 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Reload.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Reload.java @@ -25,7 +25,7 @@ import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.object.PlotWorld; import com.intellectualsites.commands.CommandDeclaration; -import com.intellectualsites.commands.callers.CommandCaller; +import com.intellectualsites.commands.CommandCaller; @CommandDeclaration( command = "reload", diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Remove.java b/src/main/java/com/intellectualcrafters/plot/commands/Remove.java index 78d39ccf0..5872909d1 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Remove.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Remove.java @@ -32,7 +32,7 @@ import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.Permissions; import com.intellectualsites.commands.Argument; import com.intellectualsites.commands.CommandDeclaration; -import com.intellectualsites.commands.callers.CommandCaller; +import com.intellectualsites.commands.CommandCaller; import com.plotsquared.bukkit.util.UUIDHandler; import com.plotsquared.bukkit.util.bukkit.uuid.SQLUUIDHandler; diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Save.java b/src/main/java/com/intellectualcrafters/plot/commands/Save.java index 23b20c4f2..d88a1b94d 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Save.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Save.java @@ -17,7 +17,7 @@ import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.SchematicHandler; import com.intellectualcrafters.plot.util.TaskManager; import com.intellectualsites.commands.CommandDeclaration; -import com.intellectualsites.commands.callers.CommandCaller; +import com.intellectualsites.commands.CommandCaller; @CommandDeclaration( command = "save", diff --git a/src/main/java/com/intellectualcrafters/plot/commands/SchematicCmd.java b/src/main/java/com/intellectualcrafters/plot/commands/SchematicCmd.java index 7d4f3f7b7..52eb89a9a 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/SchematicCmd.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/SchematicCmd.java @@ -41,7 +41,7 @@ import com.intellectualcrafters.plot.util.SchematicHandler; import com.intellectualcrafters.plot.util.SchematicHandler.Schematic; import com.intellectualcrafters.plot.util.TaskManager; import com.intellectualsites.commands.CommandDeclaration; -import com.intellectualsites.commands.callers.CommandCaller; +import com.intellectualsites.commands.CommandCaller; // TODO Add sub-subcommands diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Set.java b/src/main/java/com/intellectualcrafters/plot/commands/Set.java index e2dd7ecb1..b6b5b014b 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Set.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Set.java @@ -25,7 +25,7 @@ import java.util.Arrays; import java.util.List; import com.intellectualsites.commands.CommandDeclaration; -import com.intellectualsites.commands.callers.CommandCaller; +import com.intellectualsites.commands.CommandCaller; import com.plotsquared.bukkit.util.UUIDHandler; import org.apache.commons.lang.StringUtils; diff --git a/src/main/java/com/intellectualcrafters/plot/commands/SetOwner.java b/src/main/java/com/intellectualcrafters/plot/commands/SetOwner.java index c3c739eba..5b8880d4f 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/SetOwner.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/SetOwner.java @@ -35,7 +35,7 @@ import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.Permissions; import com.intellectualsites.commands.Argument; import com.intellectualsites.commands.CommandDeclaration; -import com.intellectualsites.commands.callers.CommandCaller; +import com.intellectualsites.commands.CommandCaller; import com.plotsquared.bukkit.util.UUIDHandler; @CommandDeclaration( diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Setup.java b/src/main/java/com/intellectualcrafters/plot/commands/Setup.java index b9d436f15..5e59e2ace 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Setup.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Setup.java @@ -28,7 +28,7 @@ import java.util.Map.Entry; import com.intellectualcrafters.plot.commands.callers.PlotPlayerCaller; import com.intellectualcrafters.plot.generator.PlotGenerator; import com.intellectualsites.commands.CommandDeclaration; -import com.intellectualsites.commands.callers.CommandCaller; +import com.intellectualsites.commands.CommandCaller; import org.apache.commons.lang.StringUtils; import org.bukkit.generator.ChunkGenerator; diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Swap.java b/src/main/java/com/intellectualcrafters/plot/commands/Swap.java index 6dab78245..608deb937 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Swap.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Swap.java @@ -34,7 +34,7 @@ import com.intellectualcrafters.plot.util.ClusterManager; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.Permissions; import com.intellectualsites.commands.CommandDeclaration; -import com.intellectualsites.commands.callers.CommandCaller; +import com.intellectualsites.commands.CommandCaller; @CommandDeclaration( command = "swap", diff --git a/src/main/java/com/intellectualcrafters/plot/commands/TP.java b/src/main/java/com/intellectualcrafters/plot/commands/TP.java index 0e1863a59..ac9d80596 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/TP.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/TP.java @@ -22,7 +22,7 @@ package com.intellectualcrafters.plot.commands; import com.intellectualsites.commands.Argument; import com.intellectualsites.commands.CommandDeclaration; -import com.intellectualsites.commands.callers.CommandCaller; +import com.intellectualsites.commands.CommandCaller; import com.plotsquared.bukkit.util.UUIDHandler; import org.apache.commons.lang.StringUtils; diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Target.java b/src/main/java/com/intellectualcrafters/plot/commands/Target.java index 0c47ac3b6..9cd641382 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Target.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Target.java @@ -28,7 +28,7 @@ import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualsites.commands.Argument; import com.intellectualsites.commands.CommandDeclaration; -import com.intellectualsites.commands.callers.CommandCaller; +import com.intellectualsites.commands.CommandCaller; @CommandDeclaration( command = "target", diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Template.java b/src/main/java/com/intellectualcrafters/plot/commands/Template.java index 789dcc2cb..93682bc3b 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Template.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Template.java @@ -42,7 +42,7 @@ import com.intellectualcrafters.plot.object.SetupObject; import com.intellectualcrafters.plot.util.BlockManager; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualsites.commands.CommandDeclaration; -import com.intellectualsites.commands.callers.CommandCaller; +import com.intellectualsites.commands.CommandCaller; import com.plotsquared.bukkit.util.SetupUtils; import com.intellectualcrafters.plot.util.TaskManager; diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Toggle.java b/src/main/java/com/intellectualcrafters/plot/commands/Toggle.java index dfde7ec77..255670315 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Toggle.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Toggle.java @@ -24,7 +24,7 @@ import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualsites.commands.CommandDeclaration; -import com.intellectualsites.commands.callers.CommandCaller; +import com.intellectualsites.commands.CommandCaller; // TOGGLE("toggle", "attribute"), diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Trim.java b/src/main/java/com/intellectualcrafters/plot/commands/Trim.java index b8b20bbc5..32de5592b 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Trim.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Trim.java @@ -40,7 +40,7 @@ import com.intellectualcrafters.plot.util.ChunkManager; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.TaskManager; import com.intellectualsites.commands.CommandDeclaration; -import com.intellectualsites.commands.callers.CommandCaller; +import com.intellectualsites.commands.CommandCaller; @CommandDeclaration( command = "trim", diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Trust.java b/src/main/java/com/intellectualcrafters/plot/commands/Trust.java index b6db5e452..2091c5244 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Trust.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Trust.java @@ -33,7 +33,7 @@ import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.Permissions; import com.intellectualsites.commands.Argument; import com.intellectualsites.commands.CommandDeclaration; -import com.intellectualsites.commands.callers.CommandCaller; +import com.intellectualsites.commands.CommandCaller; import com.plotsquared.bukkit.util.UUIDHandler; import com.plotsquared.bukkit.util.bukkit.uuid.SQLUUIDHandler; diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Unclaim.java b/src/main/java/com/intellectualcrafters/plot/commands/Unclaim.java index da7d41a46..cbdb1bcd2 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Unclaim.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Unclaim.java @@ -30,7 +30,7 @@ import com.intellectualcrafters.plot.util.EconHandler; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.Permissions; import com.intellectualsites.commands.CommandDeclaration; -import com.intellectualsites.commands.callers.CommandCaller; +import com.intellectualsites.commands.CommandCaller; @CommandDeclaration( command = "unclaim", diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Undeny.java b/src/main/java/com/intellectualcrafters/plot/commands/Undeny.java index 1dac76e51..f0a01f976 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Undeny.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Undeny.java @@ -31,7 +31,7 @@ import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.Permissions; import com.intellectualsites.commands.Argument; import com.intellectualsites.commands.CommandDeclaration; -import com.intellectualsites.commands.callers.CommandCaller; +import com.intellectualsites.commands.CommandCaller; import com.plotsquared.bukkit.util.UUIDHandler; import com.plotsquared.bukkit.util.bukkit.uuid.SQLUUIDHandler; diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Unlink.java b/src/main/java/com/intellectualcrafters/plot/commands/Unlink.java index 70b41e0ee..9dae24a5c 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Unlink.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Unlink.java @@ -30,7 +30,7 @@ import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.TaskManager; import com.intellectualsites.commands.CommandDeclaration; -import com.intellectualsites.commands.callers.CommandCaller; +import com.intellectualsites.commands.CommandCaller; @CommandDeclaration( command = "unlink", diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Untrust.java b/src/main/java/com/intellectualcrafters/plot/commands/Untrust.java index dfea00b4b..cf9ca0239 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Untrust.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Untrust.java @@ -31,7 +31,7 @@ import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.Permissions; import com.intellectualsites.commands.Argument; import com.intellectualsites.commands.CommandDeclaration; -import com.intellectualsites.commands.callers.CommandCaller; +import com.intellectualsites.commands.CommandCaller; import com.plotsquared.bukkit.util.UUIDHandler; // UNTRUST("untrust", "ut"), diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Update.java b/src/main/java/com/intellectualcrafters/plot/commands/Update.java index ab6387e8b..c7edf8ca6 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Update.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Update.java @@ -28,7 +28,7 @@ import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualsites.commands.CommandDeclaration; -import com.intellectualsites.commands.callers.CommandCaller; +import com.intellectualsites.commands.CommandCaller; @CommandDeclaration( command = "update", diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Visit.java b/src/main/java/com/intellectualcrafters/plot/commands/Visit.java index 2e918778c..c9b54b536 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Visit.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Visit.java @@ -32,7 +32,7 @@ import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.Permissions; import com.intellectualsites.commands.Argument; import com.intellectualsites.commands.CommandDeclaration; -import com.intellectualsites.commands.callers.CommandCaller; +import com.intellectualsites.commands.CommandCaller; import com.plotsquared.bukkit.util.UUIDHandler; @CommandDeclaration( diff --git a/src/main/java/com/intellectualcrafters/plot/commands/WE_Anywhere.java b/src/main/java/com/intellectualcrafters/plot/commands/WE_Anywhere.java index de2144bc5..7913f9ab2 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/WE_Anywhere.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/WE_Anywhere.java @@ -23,7 +23,7 @@ package com.intellectualcrafters.plot.commands; import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.config.C; import com.intellectualsites.commands.CommandDeclaration; -import com.intellectualsites.commands.callers.CommandCaller; +import com.intellectualsites.commands.CommandCaller; import com.plotsquared.bukkit.listeners.worldedit.WEManager; import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.util.MainUtil; diff --git a/src/main/java/com/intellectualcrafters/plot/commands/callers/ConsoleCaller.java b/src/main/java/com/intellectualcrafters/plot/commands/callers/ConsoleCaller.java index 16eb83ed0..3a44b644f 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/callers/ConsoleCaller.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/callers/ConsoleCaller.java @@ -6,7 +6,7 @@ import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualsites.commands.Argument; import com.intellectualsites.commands.Command; import com.intellectualsites.commands.CommandManager; -import com.intellectualsites.commands.callers.CommandCaller; +import com.intellectualsites.commands.CommandCaller; public class ConsoleCaller implements CommandCaller { @Override diff --git a/src/main/java/com/intellectualcrafters/plot/commands/callers/PlotPlayerCaller.java b/src/main/java/com/intellectualcrafters/plot/commands/callers/PlotPlayerCaller.java index 01ef3d07b..1fbf66826 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/callers/PlotPlayerCaller.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/callers/PlotPlayerCaller.java @@ -5,8 +5,8 @@ import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualsites.commands.Argument; import com.intellectualsites.commands.Command; +import com.intellectualsites.commands.CommandCaller; import com.intellectualsites.commands.CommandManager; -import com.intellectualsites.commands.callers.CommandCaller; public class PlotPlayerCaller implements CommandCaller { diff --git a/src/main/java/com/intellectualcrafters/plot/commands/list.java b/src/main/java/com/intellectualcrafters/plot/commands/list.java index f18fe9e5c..6e07a3ddf 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/list.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/list.java @@ -31,7 +31,7 @@ import java.util.UUID; import com.intellectualcrafters.plot.commands.callers.PlotPlayerCaller; import com.intellectualsites.commands.CommandDeclaration; -import com.intellectualsites.commands.callers.CommandCaller; +import com.intellectualsites.commands.CommandCaller; import com.plotsquared.bukkit.util.UUIDHandler; import org.apache.commons.lang.StringUtils; import org.bukkit.ChatColor; diff --git a/src/main/java/com/intellectualcrafters/plot/commands/plugin.java b/src/main/java/com/intellectualcrafters/plot/commands/plugin.java index fa0c18837..1664f8d14 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/plugin.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/plugin.java @@ -34,7 +34,7 @@ import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.StringMan; import com.intellectualcrafters.plot.util.TaskManager; import com.intellectualsites.commands.CommandDeclaration; -import com.intellectualsites.commands.callers.CommandCaller; +import com.intellectualsites.commands.CommandCaller; @CommandDeclaration( command = "plugin", diff --git a/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java b/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java index 9d28fe669..5bc7bfd91 100644 --- a/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java +++ b/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java @@ -31,7 +31,7 @@ import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.Settings; import com.intellectualcrafters.plot.database.DBFunc; -import com.intellectualsites.commands.callers.CommandCaller; +import com.intellectualsites.commands.CommandCaller; import com.plotsquared.bukkit.listeners.PlotListener; import com.intellectualcrafters.plot.object.BlockLoc; import com.intellectualcrafters.plot.object.ChunkLoc; diff --git a/src/main/java/com/intellectualcrafters/plot/util/StringComparison.java b/src/main/java/com/intellectualcrafters/plot/util/StringComparison.java index 1b55d6e0f..3b5fadea9 100644 --- a/src/main/java/com/intellectualcrafters/plot/util/StringComparison.java +++ b/src/main/java/com/intellectualcrafters/plot/util/StringComparison.java @@ -21,6 +21,7 @@ package com.intellectualcrafters.plot.util; import java.util.ArrayList; +import java.util.Collection; import java.util.Collections; /** @@ -46,6 +47,10 @@ public class StringComparison { init(input, objects); } + public StringComparison(String input, final Collection objects) { + init(input, (T[]) objects.toArray()); + } + /** * You should call init(...) when you are ready to get a String comparison value */ diff --git a/src/main/java/com/intellectualcrafters/plot/util/StringMan.java b/src/main/java/com/intellectualcrafters/plot/util/StringMan.java index 4cd6b9409..8efa09557 100644 --- a/src/main/java/com/intellectualcrafters/plot/util/StringMan.java +++ b/src/main/java/com/intellectualcrafters/plot/util/StringMan.java @@ -26,6 +26,32 @@ public class StringMan { return sb.toString(); } + public static String replaceFirst(char c, String s) { + if (s == null) { + return ""; + } + if (s.isEmpty()) { + return s; + } + char[] chars = s.toCharArray(); + char[] newChars = new char[chars.length]; + int used = 0; + boolean found = false; + for (char cc : chars) { + if (!found && c == cc) { + found = true; + } else { + newChars[used++] = cc; + } + } + if (found) { + chars = new char[newChars.length - 1]; + System.arraycopy(newChars, 0, chars, 0, chars.length); + return String.valueOf(chars); + } + return s; + } + public static String replaceAll(String string, Object... pairs) { StringBuilder sb = new StringBuilder(string); for (int i = 0; i < pairs.length; i+=2) { diff --git a/src/main/java/com/intellectualsites/commands/Command.java b/src/main/java/com/intellectualsites/commands/Command.java index 77f801fdf..286a21e96 100644 --- a/src/main/java/com/intellectualsites/commands/Command.java +++ b/src/main/java/com/intellectualsites/commands/Command.java @@ -1,16 +1,18 @@ package com.intellectualsites.commands; -import com.intellectualcrafters.plot.commands.CommandCategory; -import com.intellectualsites.commands.callers.CommandCaller; - import java.lang.annotation.Annotation; import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +import com.intellectualcrafters.plot.commands.CommandCategory; public abstract class Command extends CommandManager { private Class requiredType = Object.class; private String command, usage = "", description = "", permission = ""; - private String[] aliases = new String[0]; + private Set aliases = new HashSet<>(); private CommandCategory category; protected Argument[] requiredArguments; @@ -47,14 +49,14 @@ public abstract class Command extends CommandManager { public Command(String command, String[] aliases, String usage) { super(null, new ArrayList()); this.command = command; - this.aliases = aliases; + this.aliases = new HashSet<>(Arrays.asList(aliases)); this.usage = usage; } public Command(String command, String[] aliases) { super(null, new ArrayList()); this.command = command; - this.aliases = aliases; + this.aliases = new HashSet<>(Arrays.asList(aliases)); } public Command(String command, String usage, String description, String permission, String[] aliases, Class requiredType) { @@ -63,7 +65,7 @@ public abstract class Command extends CommandManager { this.usage = usage; this.description = description; this.permission = permission; - this.aliases = aliases; + this.aliases = new HashSet<>(Arrays.asList(aliases)); this.requiredType = requiredType; } @@ -82,7 +84,7 @@ public abstract class Command extends CommandManager { this.description = declaration.description(); this.usage = declaration.usage(); this.permission = declaration.permission(); - this.aliases = declaration.aliases(); + this.aliases = new HashSet<>(Arrays.asList(declaration.aliases())); this.requiredType = declaration.requiredType(); this.category = declaration.category(); } @@ -126,7 +128,7 @@ public abstract class Command extends CommandManager { return this.description; } - final public String[] getAliases() { + final public Set getAliases() { return this.aliases; } diff --git a/src/main/java/com/intellectualsites/commands/CommandCaller.java b/src/main/java/com/intellectualsites/commands/CommandCaller.java new file mode 100644 index 000000000..f9b593d00 --- /dev/null +++ b/src/main/java/com/intellectualsites/commands/CommandCaller.java @@ -0,0 +1,19 @@ +package com.intellectualsites.commands; + +import com.intellectualcrafters.plot.config.C; +import com.intellectualsites.commands.Argument; +import com.intellectualsites.commands.Command; +import com.intellectualsites.commands.CommandManager; + +public interface CommandCaller { + + boolean hasPermission(String permission); + + void message(String message); + + T getSuperCaller(); + + void message(C c, String ... args); + + void sendRequiredArgumentsList(CommandManager manager, Command cmd, Argument[] required); +} diff --git a/src/main/java/com/intellectualsites/commands/CommandManager.java b/src/main/java/com/intellectualsites/commands/CommandManager.java index 68d8d68c8..ebda36336 100644 --- a/src/main/java/com/intellectualsites/commands/CommandManager.java +++ b/src/main/java/com/intellectualsites/commands/CommandManager.java @@ -1,16 +1,16 @@ package com.intellectualsites.commands; -import com.intellectualsites.commands.callers.CommandCaller; -import com.intellectualsites.commands.util.StringUtil; - import java.util.ArrayList; -import java.util.Collections; +import java.util.Collection; import java.util.List; +import java.util.concurrent.ConcurrentHashMap; + +import com.intellectualsites.commands.util.StringUtil; @SuppressWarnings("unused") public class CommandManager { - protected final List commands; + protected final ConcurrentHashMap commands; protected final Character initialCharacter; public CommandManager() { @@ -18,12 +18,18 @@ public class CommandManager { } public CommandManager(Character initialCharacter, List commands) { - this.commands = Collections.synchronizedList(commands); + this.commands = new ConcurrentHashMap<>(); + for (Command command : commands) { + addCommand(command); + } this.initialCharacter = initialCharacter; } final public void addCommand(final Command command) { - this.commands.add(command); + this.commands.put(command.getCommand().toLowerCase(), command); + for (String alias : command.getAliases()) { + this.commands.put(alias.toLowerCase(), command); + } } final public boolean createCommand(final Command command) { @@ -34,24 +40,24 @@ public class CommandManager { return false; } if (command.getCommand() != null) { - commands.add(command); + addCommand(command); return true; } return false; } - final public List getCommands() { - return this.commands; + final public Collection getCommands() { + return this.commands.values(); } public int handle(CommandCaller caller, String input) { if (initialCharacter != null && !StringUtil.startsWith(initialCharacter, input)) { return CommandHandlingOutput.NOT_COMMAND; } - input = initialCharacter == null ? input : StringUtil.replaceFirst(initialCharacter, input); + input = initialCharacter == null ? input : input.substring(1); String[] parts = input.split(" "); String[] args; - String command = parts[0]; + String command = parts[0].toLowerCase(); if (parts.length == 1) { args = new String[0]; } else { @@ -59,12 +65,7 @@ public class CommandManager { System.arraycopy(parts, 1, args, 0, args.length); } Command cmd = null; - for (Command c1 : this.commands) { - if (c1.getCommand().equalsIgnoreCase(command) || StringUtil.inArray(command, c1.getAliases(), false)) { - cmd = c1; - break; - } - } + cmd = commands.get(command); if (cmd == null) { return CommandHandlingOutput.NOT_FOUND; } diff --git a/src/main/java/com/intellectualsites/commands/util/StringUtil.java b/src/main/java/com/intellectualsites/commands/util/StringUtil.java index 1f5ad94ab..071540686 100644 --- a/src/main/java/com/intellectualsites/commands/util/StringUtil.java +++ b/src/main/java/com/intellectualsites/commands/util/StringUtil.java @@ -8,32 +8,6 @@ public class StringUtil { return !(s == null || s.isEmpty()) && s.toCharArray()[0] == c; } - public static String replaceFirst(char c, String s) { - if (s == null) { - return ""; - } - if (s.isEmpty()) { - return s; - } - char[] chars = s.toCharArray(); - char[] newChars = new char[chars.length]; - int used = 0; - boolean found = false; - for (char cc : chars) { - if (!found && c == cc) { - found = true; - } else { - newChars[used++] = cc; - } - } - if (found) { - chars = new char[newChars.length - 1]; - System.arraycopy(newChars, 0, chars, 0, chars.length); - return String.valueOf(chars); - } - return s; - } - public static boolean inArray(String s, String[] a, boolean matchCase) { for (String aS : a) { if (matchCase) {