com.nisovin.MagicSpells
Class BuffSpell

java.lang.Object
  extended by com.nisovin.MagicSpells.Spell
      extended by com.nisovin.MagicSpells.BuffSpell
All Implemented Interfaces:
java.lang.Comparable<Spell>
Direct Known Subclasses:
FlamewalkSpell, FrostwalkSpell, GillsSpell, InvulnerabilitySpell, LifewalkSpell, LightwalkSpell, MinionSpell, SafefallSpell, StealthSpell, StonevisionSpell, WindwalkSpell

public abstract class BuffSpell
extends Spell


Nested Class Summary
 
Nested classes/interfaces inherited from class com.nisovin.MagicSpells.Spell
Spell.PostCastAction, Spell.SpellCastState
 
Field Summary
protected  boolean cancelOnRecast
           
protected  int duration
           
protected  int healthCost
           
protected  int manaCost
           
protected  int numUses
           
protected  java.lang.String strFade
           
protected  org.bukkit.inventory.ItemStack[] useCost
           
protected  int useCostInterval
           
 
Fields inherited from class com.nisovin.MagicSpells.Spell
broadcastRange, castItem, cooldown, cost, description, internalName, name, strCastOthers, strCastSelf, strCost
 
Constructor Summary
BuffSpell(org.bukkit.util.config.Configuration config, java.lang.String spellName)
           
 
Method Summary
protected  int addUse(org.bukkit.entity.Player player)
          Adds a use to the spell for the player.
 boolean canCastByCommand()
           
 boolean canCastWithItem()
           
protected  boolean chargeUseCost(org.bukkit.entity.Player player)
          Removes this spell's use cost from the player's inventory.
protected  boolean isExpired(org.bukkit.entity.Player player)
          Checks whether the spell's duration has expired for a player
protected  void startSpellDuration(org.bukkit.entity.Player player)
          Begins counting the spell duration for a player
protected abstract  void turnOff()
          This methid is called when the plugin is being disabled, for any reason.
protected  void turnOff(org.bukkit.entity.Player player)
          Turns off this spell for the specified player.
 
Methods inherited from class com.nisovin.MagicSpells.Spell
addListener, cast, cast, castFromConsole, castSpell, compareTo, formatMessage, getCastItem, getConfigBoolean, getConfigInt, getConfigIntList, getConfigString, getConfigStringList, getCooldown, getCostStr, getDescription, getHealthCost, getInternalName, getManaCost, getName, getReagentCost, hasReagents, hasReagents, hasReagents, initialize, onBlockBreak, onBlockPlace, onCooldown, onEntityCombust, onEntityDamage, onEntityTarget, onExplosionPrime, onItemHeldChange, onPlayerCommandPreprocess, onPlayerInteract, onPlayerJoin, onPlayerMove, onPlayerQuit, onPlayerTeleport, onPlayerToggleSneak, removeListener, removeReagents, removeReagents, removeReagents, sendMessage, sendMessage, sendMessageNear, sendMessageNear, setCooldown
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

useCost

protected org.bukkit.inventory.ItemStack[] useCost

healthCost

protected int healthCost

manaCost

protected int manaCost

useCostInterval

protected int useCostInterval

numUses

protected int numUses

duration

protected int duration

cancelOnRecast

protected boolean cancelOnRecast

strFade

protected java.lang.String strFade
Constructor Detail

BuffSpell

public BuffSpell(org.bukkit.util.config.Configuration config,
                 java.lang.String spellName)
Method Detail

canCastWithItem

public boolean canCastWithItem()
Specified by:
canCastWithItem in class Spell

canCastByCommand

public boolean canCastByCommand()
Specified by:
canCastByCommand in class Spell

startSpellDuration

protected void startSpellDuration(org.bukkit.entity.Player player)
Begins counting the spell duration for a player

Parameters:
player - the player to begin counting duration

isExpired

protected boolean isExpired(org.bukkit.entity.Player player)
Checks whether the spell's duration has expired for a player

Parameters:
player - the player to check
Returns:
true if the spell has expired, false otherwise

addUse

protected int addUse(org.bukkit.entity.Player player)
Adds a use to the spell for the player. If the number of uses exceeds the amount allowed, the spell will immediately expire. This does not automatically charge the use cost.

Parameters:
player - the player to add the use for
Returns:
the player's current number of uses (returns 0 if the use counting feature is disabled)

chargeUseCost

protected boolean chargeUseCost(org.bukkit.entity.Player player)
Removes this spell's use cost from the player's inventory.

Parameters:
player - the player to remove the cost from
Returns:
true if the reagents were removed, or if the use cost is disabled, false otherwise

turnOff

protected void turnOff(org.bukkit.entity.Player player)
Turns off this spell for the specified player. This can be called from many situations, including when the spell expires or the uses run out. When overriding this function, you should always be sure to call super.turnOff(player).

Parameters:
player -

turnOff

protected abstract void turnOff()
Description copied from class: Spell
This methid is called when the plugin is being disabled, for any reason.

Overrides:
turnOff in class Spell