public abstract class CTFBattleClass
extends java.lang.Object
Bukkit imports and ctf.*.Location, World argument should be
getGameWorld().getPlayer().abstract methods of this
class, as that will impact overall server performance. In general each
implementation should use maximum one lightweight timer registration.onInitialization() method.setDamager(Player). Direct hits are registered
automatically, so it is not recommended to set damager in
CTFBattleClass#onEntityHit(Entity, double) to save performance.public static String field with variable name Description and
assign String object that contains description.Block.setMaterial(Material)
or Block.setData(byte) is not recommended. Better solution is to call
modifyBlock(Block, Material, byte, int). AssertionException or ExceptionInInitializerError.
registerBukkitHandler()
and register events as would be done in normal Bukkit plugin.Eclipse:MyBattleClass extends CTFBattleClass).Eclipse will ask to add unimplemented
methods or to make created class abstract, option to add unimplemented
methods should be chosen.public static String field with name Description.
String object with desired description should be assigned.
| Modifier and Type | Method and Description |
|---|---|
int |
createExplosion(org.bukkit.Location location,
float power)
Creates explosion in specified location and returns affected blocks in an
array.
No blocks are destroyed in the game world. |
org.bukkit.entity.Item |
dropItem(org.bukkit.Location location,
org.bukkit.inventory.ItemStack itemstack,
int removedelay)
Drops an item in game world.
Negative values of removedelay will not start remove trigger. |
org.bukkit.entity.Item |
dropItemNaturally(org.bukkit.Location location,
org.bukkit.inventory.ItemStack itemstack,
int removedelay)
Drops item with random offset in game world.
Negative values of removedelay will not start remove trigger. |
abstract org.bukkit.inventory.ItemStack[] |
getArmor()
This method must return armor contents array.
Contents of returned array will not be modified in any way. Null values represent no armor for the slot.[0] = Helmet [1] = Chestplate [2] = Leggings [3] = Boots |
abstract org.bukkit.inventory.ItemStack[] |
getEquipment()
This method must return inventory contents array.
Contents of returned array will not be modified in any way. Null values represent no item for the slot.Indexes of items in the returned array will correspond to placement of those items in the inventory. |
org.bukkit.World |
getGameWorld()
Gets current gameworld.
|
org.bukkit.entity.Player |
getLastDamager()
Gets last player that damaged this player.
|
org.bukkit.entity.Player |
getPlayer()
Gets player that chose this class.
|
TickTimer[] |
getRegisteredTimers()
Gets immutable array of currently active timers this
CTFBattleClass instance has registered. |
void |
modifyBlock(org.bukkit.block.Block block,
org.bukkit.Material material,
byte data,
int repairdelay)
Sets target block's material and byte data.
|
abstract void |
onAirLeftClick()
Called when this player left-clicks no block.
|
abstract void |
onAirRightClick()
Called when this player right-clicks no block.
|
abstract void |
onBlockLeftClick(org.bukkit.block.Block block)
Called when this player left-clicks a block.
|
abstract void |
onBlockRightClick(org.bukkit.block.Block block)
Called when this player right-clicks a block.
|
abstract void |
onDefeat(org.bukkit.entity.Player successor)
Called when this player is killed by another player.
|
abstract void |
onDropItem(org.bukkit.entity.Item item)
Called when this players drops an item (default: Q).
|
abstract void |
onEntityHit(org.bukkit.entity.Entity victim,
double damage,
CancelState cancel)
Called when this player hits another entity.
|
abstract void |
onEntityRightClick(org.bukkit.entity.Entity victim)
Called when another entity gets right-clicked by this player.
|
abstract void |
onExplosionCreated(int id,
org.bukkit.block.Block[] blocks)
Called when explosion happens that was earlier created by this instance.
|
abstract void |
onGetHit(org.bukkit.entity.Entity damager,
double damage)
Called when this player is hit by another entity.
|
abstract void |
onInitialization()
Called when this class is first instantiated.
This method can be safely used to add special effects to this player, register essential timers. |
abstract void |
onPlayerKill(org.bukkit.entity.Player victim)
Called when this player kills another player.
|
void |
playEffect(org.bukkit.Location location,
org.bukkit.Effect effect,
int paramInt)
Plays specified effect in game world.
|
void |
playSound(org.bukkit.Location location,
org.bukkit.Sound sound,
float paramFloat1,
float paramFloat2)
Plays specified sound in game world.
|
void |
registerBukkitHandler()
Deprecated.
Handling Bukkit events directly can break CTF Game Handler
mechanics.
|
TickTimer |
registerNewRepeatingTask(java.lang.Runnable runnable,
int delay)
Registers new timer to be run at specified rate.
|
void |
resetBlock(org.bukkit.block.Block block)
Resets specified block to it's initial state if it was modified with
modifyBlock(Block, Material, byte, int) call. |
void |
setDamager(org.bukkit.entity.Player victim)
Sets this player as last damager of specfied player.
|
org.bukkit.entity.Arrow |
spawnArrow(org.bukkit.Location location,
org.bukkit.util.Vector vector,
float paramFloat1,
float paramFloat2,
int removedelay)
Spawns an arrow in game world.
Negative values of removedelay will not start remove trigger.Arrows have special support to be removed when in ground. |
org.bukkit.entity.LivingEntity |
spawnCreature(org.bukkit.Location location,
org.bukkit.entity.CreatureType creaturetype,
int removedelay)
Spawns living entity in game world.
Negative values of removedelay will not start remove trigger. |
org.bukkit.entity.Entity |
spawnEntity(org.bukkit.Location location,
org.bukkit.entity.EntityType entitytype,
int removedelay)
Spawns an entity in game world.
Negative values of removedelay will not start remove trigger. |
void |
strikeLightningEffect(org.bukkit.Location location)
Plays lightning strike effect in game world.
|
void |
unregisterBukkitHandler()
Deprecated.
|
public final org.bukkit.entity.Entity spawnEntity(org.bukkit.Location location,
org.bukkit.entity.EntityType entitytype,
int removedelay)
throws InstanceDisposedException
removedelay will not start remove trigger.location - location of spawned entityentitytype - type of entity to spawnremovedelay - delay in ticks after which spawned item will be removedInstanceDisposedExceptionpublic final org.bukkit.entity.LivingEntity spawnCreature(org.bukkit.Location location,
org.bukkit.entity.CreatureType creaturetype,
int removedelay)
throws InstanceDisposedException
removedelay will not start remove trigger.location - location of spawned entitycreaturetype - type of entityremovedelay - delay in ticks after which spawned item will be removedInstanceDisposedExceptionpublic final org.bukkit.entity.Arrow spawnArrow(org.bukkit.Location location,
org.bukkit.util.Vector vector,
float paramFloat1,
float paramFloat2,
int removedelay)
throws InstanceDisposedException
removedelay will not start remove trigger.location - location of spawned arrowvector - direction of spawned arrowparamFloat1 - undocumentedparamFloat2 - undocumentedremovedelay - delay in ticks after which spawned item will be removedInstanceDisposedExceptionpublic final org.bukkit.entity.Item dropItem(org.bukkit.Location location,
org.bukkit.inventory.ItemStack itemstack,
int removedelay)
throws InstanceDisposedException
removedelay will not start remove trigger.location - location of the dropitemstack - itemstack of the dropremovedelay - delay in ticks after which spawned item will be removedInstanceDisposedExceptionpublic final org.bukkit.entity.Item dropItemNaturally(org.bukkit.Location location,
org.bukkit.inventory.ItemStack itemstack,
int removedelay)
throws InstanceDisposedException
removedelay will not start remove trigger.location - location of the dropitemstack - itemstack of the dropremovedelay - delay in ticks after which spawned item will be removedInstanceDisposedExceptionpublic final void playEffect(org.bukkit.Location location,
org.bukkit.Effect effect,
int paramInt)
throws InstanceDisposedException
location - location of the effecteffect - effect typeparamInt - undocumentedInstanceDisposedExceptionpublic final void playSound(org.bukkit.Location location,
org.bukkit.Sound sound,
float paramFloat1,
float paramFloat2)
throws InstanceDisposedException
location - location of sound effectsound - sound typeparamFloat1 - undocumentedparamFloat2 - undocumentedInstanceDisposedExceptionpublic final void strikeLightningEffect(org.bukkit.Location location)
throws InstanceDisposedException
location - location of lightning strike effectInstanceDisposedExceptionpublic final int createExplosion(org.bukkit.Location location,
float power)
throws InstanceDisposedException
location - location of explosionpower - strength of explosionInstanceDisposedExceptionpublic final TickTimer registerNewRepeatingTask(java.lang.Runnable runnable, int delay) throws InstanceDisposedException
runnable - repeating task to be rundelay - delay between task invocations, must be more than 0TickTimer object to control this timer.InstanceDisposedExceptionpublic final TickTimer[] getRegisteredTimers() throws InstanceDisposedException
CTFBattleClass instance has registered.InstanceDisposedException@Deprecated
public final void registerBukkitHandler()
throws java.lang.UnsupportedOperationException
java.lang.UnsupportedOperationException - if this CTF Battle class implementation does not
implement Bukkit Listener.@Deprecated
public final void unregisterBukkitHandler()
throws java.lang.UnsupportedOperationException
registerBukkitHandler()java.lang.UnsupportedOperationException - if this CTF Battle class implementation does not
implement Bukkit Listener.public final void modifyBlock(org.bukkit.block.Block block,
org.bukkit.Material material,
byte data,
int repairdelay)
throws InstanceDisposedException
repairdelay ticks elapse. To cancel repair specify
negative repairdelay. To revert block to it's initial state call
resetBlock(Block).block - target blockmaterial - new materialdata - new datarepairdelay - delay after which target block will be repairedInstanceDisposedExceptionresetBlock(Block)public final void resetBlock(org.bukkit.block.Block block)
throws InstanceDisposedException
modifyBlock(Block, Material, byte, int) call.
Otherwise this call will have no effect on target block.block - block to resetInstanceDisposedExceptionpublic final org.bukkit.World getGameWorld()
World is acceptable.public final void setDamager(org.bukkit.entity.Player victim)
victim - player to set damagerpublic final org.bukkit.entity.Player getLastDamager()
throws InstanceDisposedException
InstanceDisposedExceptionpublic final org.bukkit.entity.Player getPlayer()
throws InstanceDisposedException
InstanceDisposedExceptionpublic abstract org.bukkit.inventory.ItemStack[] getArmor()
Null values represent no armor for the slot.public abstract org.bukkit.inventory.ItemStack[] getEquipment()
Null values represent no item for the slot.public abstract void onPlayerKill(org.bukkit.entity.Player victim)
victim - killed playerpublic abstract void onDefeat(org.bukkit.entity.Player successor)
successor - player that killed this playerpublic abstract void onEntityHit(org.bukkit.entity.Entity victim,
double damage,
CancelState cancel)
victim - entity that was hitdamage - damage done to entitycancel - CancelState object that monitors whether event is canceledpublic abstract void onGetHit(org.bukkit.entity.Entity damager,
double damage)
damager - another entity that hit this playerdamage - damage that was donepublic abstract void onEntityRightClick(org.bukkit.entity.Entity victim)
victim - entity that was right-clickedpublic abstract void onBlockRightClick(org.bukkit.block.Block block)
block - block that was right-clickedpublic abstract void onBlockLeftClick(org.bukkit.block.Block block)
block - block that was left-clickedpublic abstract void onAirRightClick()
public abstract void onAirLeftClick()
public abstract void onDropItem(org.bukkit.entity.Item item)
item - item that would be dropped.public abstract void onExplosionCreated(int id,
org.bukkit.block.Block[] blocks)
id - ID number of explosionpublic abstract void onInitialization()