Interface DropType
-
Method Summary
Modifier and TypeMethodDescriptionReturns the original materials as they were configured.Returns the name of the spawner exactly the same as it has been configured.Returns the plural name of the spawner exactly the same as it has been configured.@Nullable CustomDropTypeHandlerReturns a custom handler that'll overtake the spawning process.@Nullable ConfigurationSectionReturns the configuration of the custom handler.@Nullable StringReturns the id of the custom handler.doublegetDropDuration(Arena arena) Returns the interval between the spawns in seconds for a given arena.Returns the mathematical expression that calculates the interval between the spawns in seconds.Returns the materials that will be dropped.intgetHoldingAmount(Player player) Returns the amount of dropped spawners that the player is currently holding in his inventory.@Nullable ItemStackThe material of the hologram that will be shown above the spawner ingame.getIcon()Returns the item that shall be shown in GUIs.getId()Returns the identifier for this type.intReturns the max amount of items that can be near the spawner until it's stops spawning any further.default StringgetName()ReturnsgetConfigName(), but formats it into the default configured language.getName(@Nullable CommandSender sender) ReturnsgetConfigName(), but formats it and translates it to the givensender.getName(@Nullable CommandSender sender, int amount) ReturnsgetConfigName()orgetConfigPluralName(), depending on the amount but formats it and translates it to the givensender.default StringReturnsgetConfigPluralName(), but formats it into the default configured language.getPluralName(@Nullable CommandSender sender) ReturnsgetConfigPluralName(), but formats it and translates it to the givensender.intReturns the amount of items that should be spawned at the start of the game.@Nullable VarParticleThe effect that should be played whenever it drops something.intGet the radius in which the item may randomly spawns.@Nullable VarSoundThe sound that should be played whenever it drops something.booleanReturns whether or not it merges with other items.booleanReturns whether or not it has been added to the registry.booleanReturns whether or not the item is tranquil.voidsetConfigDroppingMaterials(ItemStack[] droppingMaterials) Set the items that will be dropped.voidsetConfigName(String name) Set the unformatted name of the config.voidsetConfigPluralName(String name) Set the unformatted plural name of the config.voidsetCustomHandler(@Nullable CustomDropTypeHandler handler) Changes the custom handler that'll overtake the spawning process.voidChanges the id of the custom handler.voidsetDropDuration(double dropDuration) Set the interval between the spawns in seconds.voidsetDropDurationExpression(String expression) Set the mathematical expression that calculates the interval between the spawns in seconds.voidsetHologramMaterial(@Nullable ItemStack material) Set the material of the hologram that will be shown above the spawner ingame.voidSet the icon that will be shown inside GUIs.voidsetMaxNearbyItems(int maxNearby) Set the amount of items that can lay near the spawner until it stops spawning more items.voidsetMerging(boolean merge) Set whether or not it should merge with other items.voidsetSpawnAtStart(int amount) Set the amount of items that should be spawned at the start of the game.voidsetSpawnEffect(@Nullable VarParticle particle) Set the effect that it should play whenever it drops something.voidsetSpawnRadius(int radius) Set the radius in which the item may randomly spawns.voidsetSpawnSound(@Nullable VarSound sound) Set the sound that it should play whenever it drops something.voidsetTranquil(boolean tranquil) Set whether the item is tranquil or not.
-
Method Details
-
getId
String getId()Returns the identifier for this type.- Returns:
- The identifier
-
getName
ReturnsgetConfigName(), but formats it into the default configured language.- Returns:
- The name in the default language
-
getName
ReturnsgetConfigName(), but formats it and translates it to the givensender.- Parameters:
sender- The person from which it should look up the language. Null if it should take the default language- Returns:
- The name in the language of the sender
-
getName
ReturnsgetConfigName()orgetConfigPluralName(), depending on the amount but formats it and translates it to the givensender.- Parameters:
sender- The person from which it should look up the language. Null if it should take the default languageamount- used to desied if the plural or non-plural name should be sent- Returns:
- The name in the language of the sender
-
getPluralName
ReturnsgetConfigPluralName(), but formats it into the default configured language.- Returns:
- The plural name in the default language
-
getPluralName
ReturnsgetConfigPluralName(), but formats it and translates it to the givensender.- Parameters:
sender- The person from which it should look up the language. Null if it should take the default language- Returns:
- The plural name in the language of the sender
-
getConfigName
String getConfigName()Returns the name of the spawner exactly the same as it has been configured.- Returns:
- The raw name
-
getConfigPluralName
String getConfigPluralName()Returns the plural name of the spawner exactly the same as it has been configured.- Returns:
- The raw plural name
-
setConfigName
Set the unformatted name of the config.- Parameters:
name- The new raw name
-
setConfigPluralName
Set the unformatted plural name of the config.- Parameters:
name- The new raw plural name
-
getDroppingMaterials
ItemStack[] getDroppingMaterials()Returns the materials that will be dropped.- Returns:
- The dropping materials
-
getConfigDroppingMaterials
ItemStack[] getConfigDroppingMaterials()Returns the original materials as they were configured. Doesn't contain any included name and etc.- Returns:
- The original dropping materials
-
setConfigDroppingMaterials
Set the items that will be dropped.- Parameters:
droppingMaterials- The new materials
-
setIcon
Set the icon that will be shown inside GUIs.- Parameters:
icon- The new icon
-
getIcon
ItemStack getIcon()Returns the item that shall be shown in GUIs.- Returns:
- The icon
-
getDropDuration
Returns the interval between the spawns in seconds for a given arena.Evaluates the formula with the given arena.
Keep in mind that this might differ with an actual spawner as their duration is modifiable during a match. Use
Spawner.getCurrentDropDuration()to return the actual value of a match.- Returns:
- The general spawn duration
-
getDropDurationExpression
String getDropDurationExpression()Returns the mathematical expression that calculates the interval between the spawns in seconds.Keep in mind that this might differ with an actual spawner as their duration is modifiable during a match. Use
Spawner.getCurrentDropDuration()to return the actual value of a match.- Returns:
- The general spawn duration math expression
-
setDropDurationExpression
Set the mathematical expression that calculates the interval between the spawns in seconds.Keep in mind that this might differ with an actual spawner as their duration is modifiable during a match. Use
Spawner.getCurrentDropDuration()to return the actual value of a match.- Parameters:
expression- The new general spawn duration math expression- See Also:
-
setDropDuration
void setDropDuration(double dropDuration) Set the interval between the spawns in seconds.Keep in mind that this might differ with an actual spawner as their duration is modifiable during a match. Use
Spawner.getCurrentDropDuration()to return the actual value of a match.- Parameters:
dropDuration- The new general spawn duration
-
getSpawnSound
The sound that should be played whenever it drops something. Returnsnullif it doesn't play any sound.- Returns:
- The sound it plays
-
setSpawnSound
Set the sound that it should play whenever it drops something. Passnullwhen you don't want it to play anything.- Parameters:
sound- The new sound it shall play whenever it drops something
-
getSpawnEffect
The effect that should be played whenever it drops something. Returnsnullif it doesn't play anything.- Returns:
- The effect it plays
-
setSpawnEffect
Set the effect that it should play whenever it drops something. Passnullwhen you don't want it to play anything.- Parameters:
particle- The new effect it shall play whenever it drops something
-
getSpawnRadius
int getSpawnRadius()Get the radius in which the item may randomly spawns. The center is the set Location atSpawner.getLocation().- Returns:
- The spawn radius
-
setSpawnRadius
void setSpawnRadius(int radius) Set the radius in which the item may randomly spawns. The center is the set Location atSpawner.getLocation().- Parameters:
radius- The new spawn raadius
-
isTranquil
boolean isTranquil()Returns whether or not the item is tranquil.truemeans that it will stay at it's location and won't fly away in the x and z directions.- Returns:
- If it's tranquil or not
-
setTranquil
void setTranquil(boolean tranquil) Set whether the item is tranquil or not.truemeans that it will stay at it's location and won't fly away in the x and z directions.- Parameters:
tranquil- The new tranquil value
-
isMerging
boolean isMerging()Returns whether or not it merges with other items.It does that by giving every item an unique lore, which prevents it from merging with other items. MBedwars will nevertheless merge them when there are too many items at the spawn location to prevent lag.
- Returns:
- Whether or not it merges with other items
-
setMerging
void setMerging(boolean merge) Set whether or not it should merge with other items.It does that by giving every item an unique lore, which prevents it from merging with other items. MBedwars will nevertheless merge them when there are too many items at the spawn location to prevent lag.
- Parameters:
merge- The new merge value
-
getHologramMaterial
The material of the hologram that will be shown above the spawner ingame.nullmeans that none will be spawned.- Returns:
- The material of the hologram
-
setHologramMaterial
Set the material of the hologram that will be shown above the spawner ingame.nullmeans that none will be spawned.- Parameters:
material- The new material of the hologram
-
getMaxNearbyItems
int getMaxNearbyItems()Returns the max amount of items that can be near the spawner until it's stops spawning any further.0or less if there's no limit.- Returns:
- Max amount of nearby laying items till it stops spawning any further
-
setMaxNearbyItems
void setMaxNearbyItems(int maxNearby) Set the amount of items that can lay near the spawner until it stops spawning more items.0or less to set no limit.- Parameters:
maxNearby- Max amount of nearby laying items till it stops spawning any further
-
getSpawnAtStart
int getSpawnAtStart()Returns the amount of items that should be spawned at the start of the game.- Returns:
- The amount of items that should be spawned at the start of the game
-
setSpawnAtStart
void setSpawnAtStart(int amount) Set the amount of items that should be spawned at the start of the game.- Parameters:
amount- The amount of items that should be spawned at the start of the game
-
getCustomHandlerId
Returns the id of the custom handler.This method can return a
non-nullvalue even ifgetCustomHandler()returns null as the custom handler might hasn't been registered yet.- Returns:
- The id of the custom handler
-
setCustomHandlerId
Changes the id of the custom handler. Will also automatically update thesetCustomHandler(CustomDropTypeHandler)when the custom handler has been found.- Parameters:
id- The new id
-
getCustomHandler
Returns a custom handler that'll overtake the spawning process. Materials will get dropped as usual when it returns null- Returns:
- The custom spawning handler
- Throws:
IllegalStateException- If the handler hasn't been registered yet withGameAPI.registerCustomSpawnerHandler(CustomDropTypeHandler)
-
setCustomHandler
Changes the custom handler that'll overtake the spawning process. Make sure that the given handler is registered, otherwise no change will be applied.Materials will continue to drop as usual when setting null. It'll also automatically update
setCustomHandlerId(String).- Parameters:
handler- The new custom handler
-
getCustomHandlerConfig
Returns the configuration of the custom handler.Admins are optionally able to pass a config section to the spawner. This if for
getCustomHandler()to use.- Returns:
- A given config.
nullif none has been set
-
getHoldingAmount
Returns the amount of dropped spawners that the player is currently holding in his inventory.Also supports custom handlers.
- Parameters:
player- The player we want to check- Returns:
- The amount the player is holding
-
isRegistered
boolean isRegistered()Returns whether or not it has been added to the registry.- Returns:
- If it has been added to the mbedwars system
-