Package fr.andross.banitem.actions
Class BanActionData
java.lang.Object
fr.andross.banitem.actions.BanActionData
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Check if a data is present in this ban action data.long
Trying to get a cooldown added for this action.Map containing players cooldowns time.<T> T
getData
(@NotNull BanDataType type) Gets the data from this map.@Nullable Set
<EnchantmentWrapper> Trying to get a set of enchantmentwrapper added for this action.@Nullable Set
<org.bukkit.entity.EntityType> Trying to get a set of entitytype added for this action.@Nullable Set
<org.bukkit.GameMode> Trying to get a set of gamemodes added for this action.@Nullable Set
<org.bukkit.event.inventory.InventoryType> Trying to get a set of inventory-from added for this action.@Nullable Set
<org.bukkit.event.inventory.InventoryType> Trying to get a set of inventory-to added for this action.boolean
getLog()
Trying to check if the action should be logged.@NotNull Map
<BanDataType, Object> getMap()
Get the map.@Nullable Set
<org.bukkit.Material> Trying to get a set of materials added for this action.Trying to get the messages added for this action.getRun()
Trying to get the commands run for this action.Serializing the data (to save them into config files).serialize
(@NotNull Collection<Object> c) This will serialize a collection of object.
-
Constructor Details
-
BanActionData
public BanActionData()Instantiation of the ban action data.
-
-
Method Details
-
getData
Gets the data from this map.- Type Parameters:
T
- the expected return type associated with the giventype
- Parameters:
type
- the type of data to retrieve, as defined inBanDataType
- Returns:
- the data cast to the expected type, or
null
if not found or if the cast is invalid
-
contains
Check if a data is present in this ban action data. This is accepted only for Set data, described inBanDataType
.- Parameters:
data
- the ban data to check- Returns:
- true if the data matches, otherwise false
-
serialize
Serializing the data (to save them into config files).- Returns:
- a non null serialized map
-
serialize
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
Trying to get a set of entitytype added for this action.- Returns:
- the set of entitytype, null if there is none added
-
getEnchantments
Trying to get a set of enchantmentwrapper added for this action.- Returns:
- the set of enchantmentwrapper, null if there is none added
-
getGamemodes
Trying to get a set of gamemodes added for this action.- Returns:
- the set of gamemodes, null if there is none added
-
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
Trying to get a set of inventory-to added for this action.- Returns:
- the set of InventoryType, null if there is none added
-
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
Trying to get the messages added for this action.- Returns:
- the list of messages, null if there is no messages added
-
getRun
Trying to get the commands run for this action.- Returns:
- the list of commands run, null if there is no commands added
-
getCooldowns
Map containing players cooldowns time.- Returns:
- map containing players cooldowns time
-
getMap
Get the map.- Returns:
- the map
-