Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

spigot get commandmap

    public final void setupCommandMap() {
        try {
            final Field bukkitCommandMap = Bukkit.getServer().getClass().getDeclaredField("commandMap"); // Get command map from server.
            bukkitCommandMap.setAccessible(true); // Set command map accessible.
            commandMap = (CommandMap) bukkitCommandMap.get(Bukkit.getServer()); // Get editable command map, and set it's instance.
        } catch (final Exception exception) {
            exception.printStackTrace(); // Print warning, if failed.
        }
    }
 
PREVIOUS NEXT
Tagged: #spigot #commandmap
ADD COMMENT
Topic
Name
4+5 =