mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-01-19 08:55:25 +01:00
Add your command caller back
This commit is contained in:
parent
6df9024ff1
commit
56fbeb60e5
@ -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;
|
||||
|
@ -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",
|
||||
|
@ -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(
|
||||
|
@ -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",
|
||||
|
@ -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",
|
||||
|
@ -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(
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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",
|
||||
|
@ -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",
|
||||
|
@ -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",
|
||||
|
@ -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(
|
||||
|
@ -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",
|
||||
|
@ -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",
|
||||
|
@ -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(
|
||||
|
@ -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(
|
||||
|
@ -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;
|
||||
|
@ -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",
|
||||
|
@ -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",
|
||||
|
@ -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",
|
||||
|
@ -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;
|
||||
|
@ -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",
|
||||
|
@ -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",
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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(
|
||||
|
@ -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;
|
||||
|
@ -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",
|
||||
|
@ -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;
|
||||
|
@ -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",
|
||||
|
@ -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",
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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(
|
||||
|
@ -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",
|
||||
|
@ -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<String>(args[0], commands).getBestMatch();
|
||||
caller.message(C.DID_YOU_MEAN, "/plot " + bestMatch);
|
||||
}
|
||||
return CommandHandlingOutput.NOT_FOUND;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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",
|
||||
|
@ -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",
|
||||
|
@ -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;
|
||||
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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",
|
||||
|
@ -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",
|
||||
|
@ -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;
|
||||
|
@ -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",
|
||||
|
@ -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
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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(
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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",
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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",
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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"),
|
||||
|
||||
|
@ -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",
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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",
|
||||
|
@ -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;
|
||||
|
@ -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",
|
||||
|
@ -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"),
|
||||
|
@ -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",
|
||||
|
@ -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(
|
||||
|
@ -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;
|
||||
|
@ -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<PS> {
|
||||
@Override
|
||||
|
@ -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<PlotPlayer> {
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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",
|
||||
|
@ -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;
|
||||
|
@ -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<T> {
|
||||
init(input, objects);
|
||||
}
|
||||
|
||||
public StringComparison(String input, final Collection<T> objects) {
|
||||
init(input, (T[]) objects.toArray());
|
||||
}
|
||||
|
||||
/**
|
||||
* You should call init(...) when you are ready to get a String comparison value
|
||||
*/
|
||||
|
@ -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) {
|
||||
|
@ -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<String> 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<Command>());
|
||||
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<Command>());
|
||||
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<String> getAliases() {
|
||||
return this.aliases;
|
||||
}
|
||||
|
||||
|
@ -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<T> {
|
||||
|
||||
boolean hasPermission(String permission);
|
||||
|
||||
void message(String message);
|
||||
|
||||
T getSuperCaller();
|
||||
|
||||
void message(C c, String ... args);
|
||||
|
||||
void sendRequiredArgumentsList(CommandManager manager, Command cmd, Argument[] required);
|
||||
}
|
@ -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<Command> commands;
|
||||
protected final ConcurrentHashMap<String, Command> commands;
|
||||
protected final Character initialCharacter;
|
||||
|
||||
public CommandManager() {
|
||||
@ -18,12 +18,18 @@ public class CommandManager {
|
||||
}
|
||||
|
||||
public CommandManager(Character initialCharacter, List<Command> 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<Command> getCommands() {
|
||||
return this.commands;
|
||||
final public Collection<Command> 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;
|
||||
}
|
||||
|
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user