mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2025-07-02 04:56:40 +00:00
fix wildcard and clean up command executor
This commit is contained in:
@ -1,8 +1,11 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import java.nio.channels.FileLock;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
@ -30,16 +33,30 @@ public class Command_wildcard extends FreedomCommand
|
||||
return false;
|
||||
}
|
||||
|
||||
FreedomCommand command = plugin.cl.getByName(args[0]);
|
||||
if (command == null)
|
||||
Command runCmd = server.getPluginCommand(args[0]);
|
||||
FreedomCommand fCmd = plugin.cl.getByName(args[0]);
|
||||
boolean alias = plugin.cl.isAlias(args[0]);
|
||||
if (runCmd == null && fCmd == null && !alias)
|
||||
{
|
||||
msg("Unknown command: " + args[0], ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
|
||||
List<String> aliases = new ArrayList<>();
|
||||
|
||||
if (runCmd != null)
|
||||
{
|
||||
aliases = runCmd.getAliases();
|
||||
}
|
||||
|
||||
if (fCmd != null)
|
||||
{
|
||||
aliases = Arrays.asList(fCmd.getAliases().split(","));
|
||||
}
|
||||
|
||||
for (String blockedCommand : BLOCKED_COMMANDS)
|
||||
{
|
||||
if (blockedCommand.equals(command.getName()) || command.getAliases().contains(blockedCommand))
|
||||
if (blockedCommand.equals(args[0].toLowerCase()) || aliases.contains(blockedCommand))
|
||||
{
|
||||
msg("Did you really think that was going to work?", ChatColor.RED);
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user