Class BukkitBrigadierMapper<C>
java.lang.Object
org.incendo.cloud.bukkit.internal.BukkitBrigadierMapper<C>
- Type Parameters:
C- command sender type
Helper for mapping argument types to their NMS Brigadier counterpart on CraftBukkit platforms.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionBukkitBrigadierMapper(@NonNull Logger logger, @NonNull CloudBrigadierManager<C, ?> brigadierManager) Class that handles mapping argument types to Brigadier for Bukkit (Commodore) and Paper. -
Method Summary
Modifier and TypeMethodDescription<T extends ArgumentParser<C,?>>
voidmapNMS(@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.<T extends ArgumentParser<C,?>>
voidmapNMS(@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.<T extends ArgumentParser<C,?>>
voidmapSimpleNMS(@NonNull TypeToken<T> type, @NonNull String argumentId) <T extends ArgumentParser<C,?>>
voidmapSimpleNMS(@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.voidRegister Brigadier mappings for cloud-bukkit parsers.
-
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 errorsbrigadierManager- TheCloudBrigadierManagerto 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) - Type Parameters:
T- parser type- Parameters:
type- parser typeargumentId- 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 mapargumentId- registry id of argument typeuseCloudSuggestions- 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 mapargumentId- argument type idfactory- 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 mapargumentId- argument type idfactory- Supplier of the NMS argument typecloudSuggestions- whether to use cloud suggestions
-