Skip to content

CommandUtils

Fulminazzo edited this page Oct 2, 2023 · 1 revision

CommandUtils are a series of function created to help working with Bukkit commands system. Those are mainly used by BearCommand objects to load and unload themselves on the fly. While many of these should not bother you, there are some functions to be taken into consideration:

  • syncCommands(): sends to the player the latest map of commands;
  • getBukkitCommands(): returns a ReflObject containing the result of getCommandMap().getCommands();
  • getKnownCommands(): returns a ReflObject containing the result of getCommandMap().getKnownCommands();
  • getBukkitCommands(): returns a ReflObject containing the result of Bukkit.getServer().commandMap;
  • executeBungeeCommand(Player player, String command): as the name suggests, this function forces the player to execute a BungeeCord command. NOTE: this will only work if there is a BungeeCord (or Velocity) counterpart to reach to, because it uses MessagingChannels to work.