Remove commands and hopefully permissions from registered information if not used, mainly applies to api version and disabled commands.
This commit is contained in:
@@ -16,12 +16,16 @@ import me.libraryaddict.disguise.utilities.LibsPremium;
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandMap;
|
||||
import org.bukkit.command.SimpleCommandMap;
|
||||
import org.bukkit.configuration.InvalidConfigurationException;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.*;
|
||||
import org.bukkit.inventory.EquipmentSlot;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.plugin.SimplePluginManager;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
@@ -1853,6 +1857,34 @@ public class ReflectionManager {
|
||||
}
|
||||
}
|
||||
|
||||
public static Map<String, Command> getCommands(CommandMap map) {
|
||||
try {
|
||||
Field field = SimpleCommandMap.class.getDeclaredField("knownCommands");
|
||||
field.setAccessible(true);
|
||||
|
||||
return (Map<String, Command>) field.get(map);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static SimpleCommandMap getCommandMap() {
|
||||
try {
|
||||
Field commandMap = SimplePluginManager.class.getDeclaredField("commandMap");
|
||||
commandMap.setAccessible(true);
|
||||
|
||||
return (SimpleCommandMap) commandMap.get(Bukkit.getPluginManager());
|
||||
}
|
||||
catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static String[] splitReadable(String string) {
|
||||
String[] split = string.split("_");
|
||||
|
||||
|
Reference in New Issue
Block a user