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 CustomDropTypeHandler
Returns a custom handler that'll overtake the spawning process.@Nullable String
Returns the id of the custom handler.double
Deprecated.Drop durations may now be dynamic.double
getDropDuration
(Arena arena) Deprecated.Drop durations may now be dynamic.Returns the mathematical expression that calculates the interval between the spawns in seconds.Returns the materials that will be dropped.int
getHoldingAmount
(Player player) Returns the amount of dropped spawners that the player is currently holding in his inventory.int
getHoldingAmount
(ItemStack[] inv) Deprecated.UsegetHoldingAmount(Player)
instead, as this one doesn't support custom handlers@Nullable ItemStack
The 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.int
Returns the max amount of items that can be near the spawner until it's stops spawning any further.default String
getName()
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 String
ReturnsgetConfigPluralName()
, but formats it into the default configured language.getPluralName
(@Nullable CommandSender sender) ReturnsgetConfigPluralName()
, but formats it and translates it to the givensender
.@Nullable VarParticle
The effect that should be played whenever it drops something.int
Get the radius in which the item may randomly spawns.@Nullable VarSound
The sound that should be played whenever it drops something.boolean
Returns whether or not it merges with other items.boolean
Returns whether or not it has been added to the registry.boolean
Returns whether or not the item is tranquil.void
setConfigDroppingMaterials
(ItemStack[] droppingMaterials) Set the items that will be dropped.void
setConfigName
(String name) Set the unformatted name of the config.void
setConfigPluralName
(String name) Set the unformatted plural name of the config.void
setCustomHandler
(@Nullable CustomDropTypeHandler handler) Changes the custom handler that'll overtake the spawning process.void
Changes the id of the custom handler.void
setDropDuration
(double dropDuration) Set the interval between the spawns in seconds.void
setDropDurationExpression
(String expression) Set the mathematical expression that calculates the interval between the spawns in seconds.void
setHologramMaterial
(@Nullable ItemStack material) Set the material of the hologram that will be shown above the spawner ingame.void
Set the icon that will be shown inside GUIs.void
setMaxNearbyItems
(int maxNearby) Set the amount of items that can lay near the spawner until it stops spawning more items.void
setMerging
(boolean merge) Set whether or not it should merge with other items.void
setSpawnEffect
(@Nullable VarParticle particle) Set the effect that it should play whenever it drops something.void
setSpawnRadius
(int radius) Set the radius in which the item may randomly spawns.void
setSpawnSound
(@Nullable VarSound sound) Set the sound that it should play whenever it drops something.void
setTranquil
(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
Deprecated.Drop durations may now be dynamic. UsegetDropDurationExpression()
instead.Returns the interval between the spawns in seconds.- Returns:
- The general spawn duration
-
getDropDuration
Deprecated.Drop durations may now be dynamic. UsegetDropDurationExpression()
instead.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. Returnsnull
if it doesn't play any sound.- Returns:
- The sound it plays
-
setSpawnSound
Set the sound that it should play whenever it drops something. Passnull
when 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. Returnsnull
if it doesn't play anything.- Returns:
- The effect it plays
-
setSpawnEffect
Set the effect that it should play whenever it drops something. Passnull
when 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.true
means 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.true
means 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.null
means 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.null
means 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.0
or 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.0
or less to set no limit.- Parameters:
maxNearby
- Max amount of nearby laying items till it stops spawning any further
-
getCustomHandlerId
Returns the id of the custom handler.This method can return a
non-null
value 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
-
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
-
getHoldingAmount
Deprecated.UsegetHoldingAmount(Player)
instead, as this one doesn't support custom handlersReturns the amount of dropped spawners that given inventory is holding.- Parameters:
inv
- The inventory we want to check- Returns:
- The amount the inventory is currently 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
-