com.nisovin.MagicSpells
Class InstantSpell

java.lang.Object
  extended by com.nisovin.MagicSpells.Spell
      extended by com.nisovin.MagicSpells.InstantSpell
All Implemented Interfaces:
java.lang.Comparable<Spell>
Direct Known Subclasses:
BlinkSpell, BuildSpell, CombustSpell, ConfusionSpell, DrainlifeSpell, EntombSpell, ExplodeSpell, FireballSpell, FirenovaSpell, ForcepushSpell, GateSpell, GeyserSpell, HealSpell, LeapSpell, LightningSpell, PainSpell, PrayerSpell, PurgeSpell, RepairSpell, TelekinesisSpell, VolleySpell, WallSpell, ZapSpell

public abstract class InstantSpell
extends Spell


Nested Class Summary
 
Nested classes/interfaces inherited from class com.nisovin.MagicSpells.Spell
Spell.PostCastAction, Spell.SpellCastState
 
Field Summary
protected  int range
           
 
Fields inherited from class com.nisovin.MagicSpells.Spell
broadcastRange, castItem, cooldown, cost, description, healthCost, internalName, manaCost, name, strCastOthers, strCastSelf, strCost
 
Constructor Summary
InstantSpell(org.bukkit.util.config.Configuration config, java.lang.String spellName)
           
 
Method Summary
 boolean canCastByCommand()
           
 boolean canCastWithItem()
           
protected  org.bukkit.entity.LivingEntity getTargetedEntity(org.bukkit.entity.Player player, int range, boolean targetPlayers, boolean checkLos)
          Gets the living entity a player is currently looking at
protected  org.bukkit.entity.Player getTargetedPlayer(org.bukkit.entity.Player player, int range, boolean checkLos)
          Gets the player a player is currently looking at, ignoring other living entities
protected  boolean inRange(org.bukkit.Location loc1, org.bukkit.Location loc2, int range)
          Checks whether two locations are within a certain distance from each other.
 
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, turnOff
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

range

protected int range
Constructor Detail

InstantSpell

public InstantSpell(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

inRange

protected boolean inRange(org.bukkit.Location loc1,
                          org.bukkit.Location loc2,
                          int range)
Checks whether two locations are within a certain distance from each other.

Parameters:
loc1 - The first location
loc2 - The second location
range - The maximum distance
Returns:
true if the distance is less than the range, false otherwise

getTargetedEntity

protected org.bukkit.entity.LivingEntity getTargetedEntity(org.bukkit.entity.Player player,
                                                           int range,
                                                           boolean targetPlayers,
                                                           boolean checkLos)
Gets the living entity a player is currently looking at

Parameters:
player - player to get target for
range - the maximum range to check
targetPlayers - whether to allow players as targets
checkLos - whether to obey line-of-sight restrictions
Returns:
the targeted LivingEntity, or null if none was found

getTargetedPlayer

protected org.bukkit.entity.Player getTargetedPlayer(org.bukkit.entity.Player player,
                                                     int range,
                                                     boolean checkLos)
Gets the player a player is currently looking at, ignoring other living entities

Parameters:
player - the player to get the target for
range - the maximum range to check
checkLos - whether to obey line-of-sight restrictions
Returns:
the targeted Player, or null if none was found