Class BukkitBrigadierMapper<C>

java.lang.Object
org.incendo.cloud.bukkit.internal.BukkitBrigadierMapper<C>
Type Parameters:
C - command sender type

@API(status=INTERNAL) public final class BukkitBrigadierMapper<C> extends Object
Helper for mapping argument types to their NMS Brigadier counterpart on CraftBukkit platforms.
  • Constructor Details

    • BukkitBrigadierMapper

      public BukkitBrigadierMapper(@NonNull Logger logger, @NonNull CloudBrigadierManager<C,?> brigadierManager)
      Class that handles mapping argument types to Brigadier for Bukkit (Commodore) and Paper.
      Parameters:
      logger - logger for errors
      brigadierManager - The CloudBrigadierManager to use for mapping
  • Method Details

    • registerBuiltInMappings

      public void registerBuiltInMappings()
      Register Brigadier mappings for cloud-bukkit parsers.
    • mapSimpleNMS

      public <T extends ArgumentParser<C, ?>> void mapSimpleNMS(@NonNull TypeToken<T> type, @NonNull String argumentId)
      mapSimpleNMS(TypeToken, String, boolean) defaulting cloudSuggestions to false
      Type Parameters:
      T - parser type
      Parameters:
      type - parser type
      argumentId - argument type id
    • mapSimpleNMS

      public <T extends ArgumentParser<C, ?>> void mapSimpleNMS(@NonNull TypeToken<T> type, @NonNull String argumentId, boolean useCloudSuggestions)
      Register a mapping for a Minecraft argument type meeting the following criteria:
      • On versions with CommandBuildContext, has a constructor with no arguments or with a CommandBuildContext as the only argument
      • On versions before CommandBuildContext, has a no-args constructor.
      Type Parameters:
      T - argument parser type
      Parameters:
      type - Type to map
      argumentId - registry id of argument type
      useCloudSuggestions - whether to use cloud suggestions
    • mapNMS

      public <T extends ArgumentParser<C, ?>> void mapNMS(@NonNull TypeToken<T> type, @NonNull String argumentId, @NonNull BukkitBrigadierMapper.ArgumentTypeFactory factory)
      Attempt to register a mapping between a type and a NMS argument type with native suggestions.
      Type Parameters:
      T - argument parser type
      Parameters:
      type - Type to map
      argumentId - argument type id
      factory - Supplier of the NMS argument type
    • mapNMS

      public <T extends ArgumentParser<C, ?>> void mapNMS(@NonNull TypeToken<T> type, @NonNull String argumentId, @NonNull BukkitBrigadierMapper.ArgumentTypeFactory factory, boolean cloudSuggestions)
      Attempt to register a mapping between a type and a NMS argument type.
      Type Parameters:
      T - argument parser type
      Parameters:
      type - Type to map
      argumentId - argument type id
      factory - Supplier of the NMS argument type
      cloudSuggestions - whether to use cloud suggestions