mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-26 17:05:01 +00:00
Remove getCommandMap() method in CommandBlocker
This commit is contained in:
parent
b4dd35c4df
commit
794a25ba16
@ -30,24 +30,6 @@ public class CommandBlocker extends FreedomService
|
|||||||
private final Map<String, CommandBlockerEntry> entryList = Maps.newHashMap();
|
private final Map<String, CommandBlockerEntry> entryList = Maps.newHashMap();
|
||||||
private final List<String> unknownCommands = Lists.newArrayList();
|
private final List<String> unknownCommands = Lists.newArrayList();
|
||||||
|
|
||||||
public static CommandMap getCommandMap()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
SimplePluginManager simplePluginManager = (SimplePluginManager)Bukkit.getServer().getPluginManager();
|
|
||||||
|
|
||||||
Field commandMapField = SimplePluginManager.class.getDeclaredField("commandMap");
|
|
||||||
commandMapField.setAccessible(true);
|
|
||||||
|
|
||||||
return (SimpleCommandMap)commandMapField.get(simplePluginManager);
|
|
||||||
}
|
|
||||||
catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException e)
|
|
||||||
{
|
|
||||||
FLog.severe("Failed to get command map field (" + e.getMessage() + ")");
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
@ -65,7 +47,7 @@ public class CommandBlocker extends FreedomService
|
|||||||
entryList.clear();
|
entryList.clear();
|
||||||
unknownCommands.clear();
|
unknownCommands.clear();
|
||||||
|
|
||||||
final CommandMap commandMap = getCommandMap();
|
final CommandMap commandMap = Bukkit.getCommandMap();
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
List<String> blockedCommands = (List<String>)ConfigEntry.BLOCKED_COMMANDS.getList();
|
List<String> blockedCommands = (List<String>)ConfigEntry.BLOCKED_COMMANDS.getList();
|
||||||
|
Loading…
Reference in New Issue
Block a user