Interface IGenerator
public interface IGenerator
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddAnimation(IGeneratorAnimation animations) Set the animation of the generator.voidThis only must be called by the arena instance when it restarts.voiddisable()Disable a generator and remove the holograms.voiddropItem(org.bukkit.Location location) This will drop the item at a given location.voidenable()Enable a generator and respawn the holograms.voidEnable generator rotation.intGet 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.doublegetDelay()Get spawn rate delay.Get generator hologram holder (armor stand) containing the rotating item.Get holograms associated to languages for this generator.org.bukkit.LocationGet the generator location.doubleGet seconds before next item spawn.org.bukkit.inventory.ItemStackgetOre()Get generator ore.intGet the spawn limit of the generators.getType()Get generator type.booleanCheck if the generator hologram is enabled.booleanisStack()Check if the dropped items can be stacked.voidrotate()This method is called every tick to manage the animation of the generator.voidsetAmount(int amount) Set how many items should the generator spawn at once.voidsetDelay(double delay) Change item spawn delay.voidsetLocation(org.bukkit.Location location) set the generator location.voidsetNextSpawn(double nextSpawn) Set the remaining time till the next item spawn.voidsetOre(org.bukkit.inventory.ItemStack ore) Change the item that this generator will spawn.voidsetSpawnLimit(int value) This is the limit when the generator will stop spawning new items until they are collected.voidsetStack(boolean stack) Should the dropped items be stacked?voidsetType(GeneratorType type) Set generator type.voidspawn()This will attempt to spawn the items every second.voidupdateHolograms(org.bukkit.entity.Player p) This will update the holograms for one player.voidupgrade()Manage what to do when the generator upgrade is called fromIArena.updateNextEvent()
-
Method Details
-
getLanguageHolograms
Get holograms associated to languages for this generator. -
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.
-