Interface Spawner
-
Method Summary
Modifier and TypeMethodDescriptionaddDropDurationModifier
(String id, Plugin plugin, SpawnerDurationModifier.Operation operation, double value) Adds a new modifier to the top ofgetDropDurationModifiers()
.default void
drop()
Make the spawner do its thing.default void
drop
(boolean overrideLimit) Make the spawner do its thing.void
Make the spawner do its thing.boolean
exists()
Returns if the spawner still exists on the arena.getArena()
Returns the arena in which the spawner was added.double
Returns the time in seconds it takes until it drops something again.@Nullable SpawnerDurationModifier
Tries to locate a modifier that has been added to this spawner by it's id.UseSpawnerDurationModifier
s to modify the time until something gets dropped.Returns the type of the spawner.@Nullable HologramEntity
Gets the hologram that is used to display i.a. the remaining time and the block.int
Returns the time in ticks of the internal clock that's being used for this spawner.Returns where the spawner has been added.int
Returns the max amount of spawner items that can be in this spawner before it stops spawning new itemsint
Counts all the items that are currently uncollected in the spawner.@Nullable String[]
While generally all hologram lines are basically the same you may make them unique per spawner using this spawner usingsetOverridingHologramLines(String[])
.int
Returns the time in ticks until the spawner drops something againboolean
remove()
Tries to remove the spawner from the arena.boolean
Removes an existing modifier.void
setMaxNearbyItems
(int max) Change the max nearby items for this spawner.void
setOverridingHologramLines
(@Nullable String[] lines) While generally all hologram lines are basically the same you may make them unique per spawner using this spawner using this method.
-
Method Details
-
getArena
Arena getArena()Returns the arena in which the spawner was added.- Returns:
- The arena on which the spawner has been added
-
getLocation
XYZ getLocation()Returns where the spawner has been added.- Returns:
- The location of the spawner
-
getDropType
DropType getDropType()Returns the type of the spawner.- Returns:
- The drop type
-
getCurrentDropDuration
double getCurrentDropDuration()Returns the time in seconds it takes until it drops something again.- Returns:
- Duration in seconds until it drops something
-
getDropDurationModifiers
List<SpawnerDurationModifier> getDropDurationModifiers()UseSpawnerDurationModifier
s to modify the time until something gets dropped. Plugin goes through them from bottom to top to calculategetCurrentDropDuration()
.It's NOT safe to modify this List.
Default ones only initiate with the start of a match.
- Returns:
- The list containing all modifiers for calculating the drop duration
-
addDropDurationModifier
SpawnerDurationModifier addDropDurationModifier(String id, Plugin plugin, SpawnerDurationModifier.Operation operation, double value) Adds a new modifier to the top ofgetDropDurationModifiers()
. Through this you're able to change the duration until something gets dropped.It's safe to have multiple modifiers with the same name, but it's not recommended to do so. Additionally it's not a must for the id to follow a specific format. It's recommended to follow plugin:action_name
Keep in mind that they get reset with every start of a match
- Parameters:
id
- The unique id of what this spawner is doingplugin
- The plugin that's invoking thisoperation
- What mathematical operation shall be done with the previous number to obtain the new onevalue
- Used in combination withoperation
to calculate the final number (in seconds)- Returns:
- The new modifier that has been to the top of
getDropDurationModifiers()
-
removeDropDurationModifier
Removes an existing modifier.Modifiers are being used to modify the time until something gets dropped.
- Parameters:
modifier
- The modifier instance that shall be removed- Returns:
true
if has been found and removed
-
getDropDurationModifier
Tries to locate a modifier that has been added to this spawner by it's id.It's possible that there are multiple modifiers with an id, this method will only return one of them.
Default ones only initiate with the start of a match.
- Parameters:
id
- The id that the modifier has- Returns:
- The modifier instance that has the given id.
null
if none has been found
-
getInternalClock
int getInternalClock()Returns the time in ticks of the internal clock that's being used for this spawner. The returned value might differ from other spawners. It's being used to determinate when the next drop should occur. It does not increase when the game is not running and gets reset when the game end.- Returns:
- The internal time of this spawner in ticks
-
getRemainingNextDropTime
int getRemainingNextDropTime()Returns the time in ticks until the spawner drops something again- Returns:
- The time in ticks that needs to pass until something drops
-
getOverridingHologramLines
While generally all hologram lines are basically the same you may make them unique per spawner using this spawner usingsetOverridingHologramLines(String[])
. This method returns the currently set ones, ornull
if none has been set.- Returns:
- The lines that (possibly) will be shown above the spawners during a game instead of the global variant
-
setOverridingHologramLines
While generally all hologram lines are basically the same you may make them unique per spawner using this spawner using this method. You may passnull
to instead again use the default one.Keep in mind that these are specific to this spawner and that they'll disappear after the arena or the spawner gets unloaded.
- Parameters:
lines
- The new lines that (possibly) will be shown above the spawners during a game instead of the global variant
-
drop
default void drop()Make the spawner do its thing.This will do the exact same thing as if the game would drop it naturally. By this
SpawnerDropEvent
and everything else is also getting called.Keep in mind that properties, such as
DropType.getMaxNearbyItems()
, can prevent the thing from being spawned -
drop
default void drop(boolean overrideLimit) Make the spawner do its thing.This will do the exact same thing as if the game would drop it naturally. By this
SpawnerDropEvent
and everything else is also getting called.Keep in mind that properties, such as
DropType.getMaxNearbyItems()
, can prevent the thing from being spawned- Parameters:
overrideLimit
- weather or not the spawn limit should be overridden
-
drop
Make the spawner do its thing.This will do the exact same thing as if the game would drop it naturally. By this
SpawnerDropEvent
and everything else is also getting called. *Keep in mind that properties, such as
DropType.getMaxNearbyItems()
, can prevent the thing from being spawned- Parameters:
overrideLimit
- weather or not the spawn limit should be overriddendroppingMaterials
- an array of ItemStacks the spawner should drop. Note that only ItemStacks native to the spawner will count towards the maxNearbyItems count (or gen cap) of this spawner
-
getNearbyItemsCount
int getNearbyItemsCount()Counts all the items that are currently uncollected in the spawner.Note: this count only includes items native to this spawner that have never been picked up by a player before.
- Returns:
- return the number of items in the spawner waiting for pickup
-
setMaxNearbyItems
void setMaxNearbyItems(int max) Change the max nearby items for this spawner. By default, the spawner is using the value attached to the DropType, but you can change it with this method- Parameters:
max
- The number of items that can be in the spawner at the same time.
-
getMaxNearbyItems
int getMaxNearbyItems()Returns the max amount of spawner items that can be in this spawner before it stops spawning new items- Returns:
- The max amount of items that can be in a spawner at once.
-
getHologram
Gets the hologram that is used to display i.a. the remaining time and the block.May be
null
if e.g. the round hasn't started yet or it has been disabled.- Returns:
- Get the visual hologram of this spawner. May be
null
-
exists
boolean exists()Returns if the spawner still exists on the arena.- Returns:
- It's existence
-
remove
boolean remove()Tries to remove the spawner from the arena.Can fail when the spawner already doesn't exist.
- Returns:
true
if it was successful
-