Class BanActionData

java.lang.Object
fr.andross.banitem.actions.BanActionData

public final class BanActionData extends Object
This class offers a way to store the ban actions data.

Example: the messages, if the action should be logged, any item.

The data type is written as description in BanDataType description. I've also included some clear api methods to get them, at the bottom.

Version:
3.1
Author:
Andross
  • Constructor Details

    • BanActionData

      public BanActionData()
      Instantiation of the ban action data.
  • Method Details

    • getData

      @Nullable public <T> T getData(@NotNull @NotNull BanDataType type)
      Gets the data from this map.
      Type Parameters:
      T - the expected return type associated with the given type
      Parameters:
      type - the type of data to retrieve, as defined in BanDataType
      Returns:
      the data cast to the expected type, or null if not found or if the cast is invalid
    • contains

      public boolean contains(@Nullable @Nullable BanData data)
      Check if a data is present in this ban action data. This is accepted only for Set data, described in BanDataType.
      Parameters:
      data - the ban data to check
      Returns:
      true if the data matches, otherwise false
    • serialize

      @NotNull public @NotNull Map<String,Object> serialize()
      Serializing the data (to save them into config files).
      Returns:
      a non null serialized map
    • serialize

      @NotNull public @NotNull List<String> serialize(@NotNull @NotNull Collection<Object> c)
      This will serialize a collection of object. Mainly used to parse the maps into a config file.
      Parameters:
      c - collection of objects
      Returns:
      a list of serialized object from the collection
    • getCooldown

      public long getCooldown()
      Trying to get a cooldown added for this action.
      Returns:
      a cooldown long (millis)
    • getEntities

      @Nullable public @Nullable Set<org.bukkit.entity.EntityType> getEntities()
      Trying to get a set of entitytype added for this action.
      Returns:
      the set of entitytype, null if there is none added
    • getEnchantments

      @Nullable public @Nullable Set<EnchantmentWrapper> getEnchantments()
      Trying to get a set of enchantmentwrapper added for this action.
      Returns:
      the set of enchantmentwrapper, null if there is none added
    • getGamemodes

      @Nullable public @Nullable Set<org.bukkit.GameMode> getGamemodes()
      Trying to get a set of gamemodes added for this action.
      Returns:
      the set of gamemodes, null if there is none added
    • getInventoryFrom

      @Nullable public @Nullable Set<org.bukkit.event.inventory.InventoryType> getInventoryFrom()
      Trying to get a set of inventory-from added for this action.
      Returns:
      the set of InventoryType, null if there is none added
    • getInventoryTo

      @Nullable public @Nullable Set<org.bukkit.event.inventory.InventoryType> getInventoryTo()
      Trying to get a set of inventory-to added for this action.
      Returns:
      the set of InventoryType, null if there is none added
    • getMaterial

      @Nullable public @Nullable Set<org.bukkit.Material> getMaterial()
      Trying to get a set of materials added for this action.
      Returns:
      the set of material, null if there is none added
    • getLog

      public boolean getLog()
      Trying to check if the action should be logged.
      Returns:
      true if the action is logged, otherwise false
    • getMessages

      @Nullable public @Nullable List<String> getMessages()
      Trying to get the messages added for this action.
      Returns:
      the list of messages, null if there is no messages added
    • getRun

      @Nullable public @Nullable List<String> getRun()
      Trying to get the commands run for this action.
      Returns:
      the list of commands run, null if there is no commands added
    • getCooldowns

      @NotNull public @NotNull Map<UUID,Long> getCooldowns()
      Map containing players cooldowns time.
      Returns:
      map containing players cooldowns time
    • getMap

      @NotNull public @NotNull Map<BanDataType,Object> getMap()
      Get the map.
      Returns:
      the map