mirror of
https://github.com/plexusorg/Plex.git
synced 2024-12-22 17:17:37 +00:00
a
This commit is contained in:
parent
ed1abb1fc0
commit
a2f7394c88
@ -20,4 +20,5 @@ public class PlayerCache
|
||||
{
|
||||
return plexPlayerMap;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,8 +1,16 @@
|
||||
package me.totalfreedom.plex.util;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import me.totalfreedom.plex.Plex;
|
||||
import me.totalfreedom.plex.storage.StorageType;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.PluginCommandYamlParser;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
public class PlexUtils
|
||||
{
|
||||
@ -32,4 +40,24 @@ public class PlexUtils
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isPluginCMD(String cmd, String pluginName)
|
||||
{
|
||||
Plugin plugin = Bukkit.getServer().getPluginManager().getPlugin(pluginName);
|
||||
if (plugin == null)
|
||||
{
|
||||
PlexLog.error(pluginName + " can not be found on the server! Make sure it is spelt correctly!");
|
||||
return false;
|
||||
}
|
||||
List<Command> cmds = PluginCommandYamlParser.parse(plugin);
|
||||
for (Command pluginCmd : cmds)
|
||||
{
|
||||
List<String> cmdAliases = pluginCmd.getAliases().size() > 0 ? pluginCmd.getAliases().stream().map(String::toLowerCase).collect(Collectors.toList()) : null;
|
||||
if (pluginCmd.getName().equalsIgnoreCase(cmd) || (cmdAliases != null && cmdAliases.contains(cmd.toLowerCase())))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user