mirror of
				https://github.com/IntellectualSites/PlotSquared.git
				synced 2025-11-04 03:03:43 +01:00 
			
		
		
		
	Fix command duplication
This commit is contained in:
		@@ -40,6 +40,7 @@ import com.plotsquared.general.commands.CommandDeclaration;
 | 
			
		||||
        permission = "plots.delete",
 | 
			
		||||
        description = "Delete a plot",
 | 
			
		||||
        usage = "/plot delete",
 | 
			
		||||
        aliases = "dispose",
 | 
			
		||||
        category = CommandCategory.ACTIONS,
 | 
			
		||||
        requiredType = RequiredType.NONE
 | 
			
		||||
)
 | 
			
		||||
 
 | 
			
		||||
@@ -124,14 +124,6 @@ public class MainCommand extends CommandManager<PlotPlayer> {
 | 
			
		||||
        createCommand(new Copy());
 | 
			
		||||
        createCommand(new Chat());
 | 
			
		||||
        createCommand(new Trim());
 | 
			
		||||
        
 | 
			
		||||
        if (Settings.ENABLE_CLUSTERS) {
 | 
			
		||||
            createCommand(new Cluster());
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
        // Broken
 | 
			
		||||
//        createCommand(new DebugUUID());
 | 
			
		||||
        
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static boolean no_permission(final PlotPlayer player, final String permission) {
 | 
			
		||||
@@ -141,7 +133,7 @@ public class MainCommand extends CommandManager<PlotPlayer> {
 | 
			
		||||
    
 | 
			
		||||
    public static List<Command<PlotPlayer>> getCommands(final CommandCategory category, final PlotPlayer player) {
 | 
			
		||||
        List<Command<PlotPlayer>> commands = new ArrayList<>();
 | 
			
		||||
        for (Command<PlotPlayer> command : instance.getCommands()) {
 | 
			
		||||
        for (Command<PlotPlayer> command : getInstance().getCommands()) {
 | 
			
		||||
            if (category != null && !command.getCategory().equals(category)) {
 | 
			
		||||
                continue;
 | 
			
		||||
            }
 | 
			
		||||
@@ -330,14 +322,18 @@ public class MainCommand extends CommandManager<PlotPlayer> {
 | 
			
		||||
            args = new String[parts.length - 2];
 | 
			
		||||
            System.arraycopy(parts, 2, args, 0, args.length);
 | 
			
		||||
        }
 | 
			
		||||
        Command<PlotPlayer> cmd = null;
 | 
			
		||||
        cmd = this.commands.get(label);
 | 
			
		||||
        Command<PlotPlayer> cmd;
 | 
			
		||||
        if (label != null) {
 | 
			
		||||
            cmd = getInstance().commands.get(label);
 | 
			
		||||
        }
 | 
			
		||||
        else {
 | 
			
		||||
            cmd = null;
 | 
			
		||||
        }
 | 
			
		||||
        if (cmd == null) {
 | 
			
		||||
            MainUtil.sendMessage(plr, C.NOT_VALID_SUBCOMMAND);
 | 
			
		||||
            {
 | 
			
		||||
                List<Command<PlotPlayer>> cmds = getCommands(null, plr);
 | 
			
		||||
                cmd = new StringComparison<>(label, cmds).getMatchObject();
 | 
			
		||||
                if (cmd == null) {
 | 
			
		||||
                if (label == null || (cmd = new StringComparison<>(label, cmds).getMatchObject()) == null) {
 | 
			
		||||
                    MainUtil.sendMessage(plr, C.DID_YOU_MEAN, "/plot help");
 | 
			
		||||
                }
 | 
			
		||||
                else {
 | 
			
		||||
 
 | 
			
		||||
@@ -78,7 +78,7 @@ public class plugin extends SubCommand {
 | 
			
		||||
                        add(String.format("$2>> $1&lAuthors$2: $1Citymonstret $2& $1Empire92"));
 | 
			
		||||
                        add(String.format("$2>> $1&lWiki$2: $1https://github.com/IntellectualCrafters/PlotSquared/wiki"));
 | 
			
		||||
                        add(String.format("$2>> $1&lWebsite$2: $1http://plotsquared.com"));
 | 
			
		||||
                        add(String.format("$2>> $1&lNewest Version$2: $1" + (PS.get().update == null ? PS.get().IMP.getPluginVersion() : PS.get().update)));
 | 
			
		||||
                        add(String.format("$2>> $1&lNewest Version$2: $1" + (PS.get().update == null ? StringMan.join(PS.get().IMP.getPluginVersion(), ".") : PS.get().update)));
 | 
			
		||||
                    }
 | 
			
		||||
                };
 | 
			
		||||
                for (final String s : strings) {
 | 
			
		||||
 
 | 
			
		||||
@@ -96,6 +96,7 @@ public class Settings {
 | 
			
		||||
     * Default kill road mobs: true
 | 
			
		||||
     */
 | 
			
		||||
    public final static boolean KILL_ROAD_MOBS_DEFAULT = false;
 | 
			
		||||
    public final static boolean KILL_ROAD_VEHICLES_DEFAULT = false;
 | 
			
		||||
    /**
 | 
			
		||||
     * Default mob pathfinding: true
 | 
			
		||||
     */
 | 
			
		||||
@@ -132,6 +133,7 @@ public class Settings {
 | 
			
		||||
     * Kill road mobs?
 | 
			
		||||
     */
 | 
			
		||||
    public static boolean KILL_ROAD_MOBS;
 | 
			
		||||
    public static boolean KILL_ROAD_VEHICLES;
 | 
			
		||||
    /**
 | 
			
		||||
     * mob pathfinding?
 | 
			
		||||
     */
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user