Archived
0

Moved "util" package contents into correct "utils" package

This commit is contained in:
Pepich
2017-05-30 11:52:34 +02:00
parent 8c59af9ec3
commit c0fab2a72e
8 changed files with 61 additions and 44 deletions

View File

@@ -0,0 +1,22 @@
package com.redstoner.utils;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.SimpleCommandMap;
import org.bukkit.plugin.SimplePluginManager;
import java.lang.reflect.Field;
import java.util.Map;
public class CommandMap {
public static Map<String, Command> getCommandMap() throws ReflectiveOperationException, ClassCastException {
Field field = SimplePluginManager.class.getDeclaredField("commandMap");
field.setAccessible(true);
Object map = field.get(Bukkit.getPluginManager());
field = SimpleCommandMap.class.getDeclaredField("knownCommands");
field.setAccessible(true);
return (Map<String, Command>) field.get(map);
}
}