Interface IGenerator
public interface IGenerator
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addAnimation
(IGeneratorAnimation animations) Set the animation of the generator.void
This only must be called by the arena instance when it restarts.void
disable()
Disable a generator and remove the holograms.void
dropItem
(org.bukkit.Location location) This will drop the item at a given location.void
enable()
Enable a generator and respawn the holograms.void
Enable generator rotation.int
Get the amount of items that are dropped once.Get the animation of the generator.getArena()
Get the arena assigned to this generator.Get the team assigned to this generator.double
getDelay()
Get spawn rate delay.Get generator hologram holder (armor stand) containing the rotating item.org.bukkit.Location
Get the generator location.double
Get seconds before next item spawn.org.bukkit.inventory.ItemStack
getOre()
Get generator ore.Get holograms associated to players and generatorsint
Get the spawn limit of the generators.getType()
Get generator type.boolean
Check if the generator hologram is enabled.boolean
isStack()
Check if the dropped items can be stacked.void
rotate()
This method is called every tick to manage the animation of the generator.void
setAmount
(int amount) Set how many items should the generator spawn at once.void
setDelay
(double delay) Change item spawn delay.void
setLocation
(org.bukkit.Location location) set the generator location.void
setNextSpawn
(double nextSpawn) Set the remaining time till the next item spawn.void
setOre
(org.bukkit.inventory.ItemStack ore) Change the item that this generator will spawn.void
setSpawnLimit
(int value) This is the limit when the generator will stop spawning new items until they are collected.void
setStack
(boolean stack) Should the dropped items be stacked?void
setType
(GeneratorType type) Set generator type.void
spawn()
This will attempt to spawn the items every second.void
updateHolograms
(org.bukkit.entity.Player p) This will update the holograms for one player.void
upgrade()
Manage what to do when the generator upgrade is called fromIArena.updateNextEvent()
-
Method Details
-
getPlayerHolograms
Get holograms associated to players and generators -
disable
void disable()Disable a generator and remove the holograms. -
enable
void enable()Enable a generator and respawn the holograms. -
upgrade
void upgrade()Manage what to do when the generator upgrade is called fromIArena.updateNextEvent()
-
spawn
void spawn()This will attempt to spawn the items every second. -
dropItem
void dropItem(org.bukkit.Location location) This will drop the item at a given location.- Parameters:
location
- You can customize this location in order to drop items near a player if it's a base generator with multiple teammates.
-
setOre
void setOre(org.bukkit.inventory.ItemStack ore) Change the item that this generator will spawn. -
getArena
IArena getArena()Get the arena assigned to this generator. -
getAnimations
List<IGeneratorAnimation> getAnimations()Get the animation of the generator.- Returns:
- the animation of the generator
-
addAnimation
Set the animation of the generator.- Parameters:
animations
- the animation of the generator
-
rotate
void rotate()This method is called every tick to manage the animation of the generator. -
setDelay
void setDelay(double delay) Change item spawn delay. In seconds. Internally any corrections will be made to compensate for the increased speed -
setAmount
void setAmount(int amount) Set how many items should the generator spawn at once. -
getLocation
org.bukkit.Location getLocation()Get the generator location. -
setLocation
void setLocation(org.bukkit.Location location) set the generator location.- Parameters:
location
- new generator drop location.
-
getOre
org.bukkit.inventory.ItemStack getOre()Get generator ore. -
updateHolograms
void updateHolograms(org.bukkit.entity.Player p) This will update the holograms for one player. Holograms are only visible to players in the same world.- Parameters:
p
- player to update holograms for.This method only works for generators that are not team generators, executing it on a team generator will do nothing.
-
enableRotation
void enableRotation()Enable generator rotation. Make sure it has a helmet set. DIAMOND and EMERALD generator types will get the rotation activated when the arena starts. If you want to have a different rotating type you should call this manually atGameStateChangeEvent
-
setSpawnLimit
void setSpawnLimit(int value) This is the limit when the generator will stop spawning new items until they are collected. -
getBedWarsTeam
ITeam getBedWarsTeam()Get the team assigned to this generator.- Returns:
- null if this is not a team generator.
-
getHologramHolder
GeneratorHolder getHologramHolder()Get generator hologram holder (armor stand) containing the rotating item.- Returns:
- null if there is no rotating item.
-
getType
GeneratorType getType()Get generator type. -
getAmount
int getAmount()Get the amount of items that are dropped once. -
getDelay
double getDelay()Get spawn rate delay. -
getNextSpawn
double getNextSpawn()Get seconds before next item spawn. -
getSpawnLimit
int getSpawnLimit()Get the spawn limit of the generators. If there is this amount of items dropped near the generator it will stop spawning new items. -
setNextSpawn
void setNextSpawn(double nextSpawn) Set the remaining time till the next item spawn.- Parameters:
nextSpawn
- time to next spawn in seconds
-
setStack
void setStack(boolean stack) Should the dropped items be stacked? -
isStack
boolean isStack()Check if the dropped items can be stacked. -
isHologramEnabled
boolean isHologramEnabled()Check if the generator hologram is enabled. -
setType
Set generator type. This may break things. -
destroyData
void destroyData()This only must be called by the arena instance when it restarts. Do never call it unless you have a custom arena. Manage your data destroy.
-