|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.nisovin.MagicSpells.Spell
public abstract class Spell
| Nested Class Summary | |
|---|---|
protected static class |
Spell.PostCastAction
|
protected static class |
Spell.SpellCastState
|
| Field Summary | |
|---|---|
protected int |
broadcastRange
|
protected int |
castItem
|
protected int |
cooldown
|
protected org.bukkit.inventory.ItemStack[] |
cost
|
protected java.lang.String |
description
|
protected int |
healthCost
|
protected java.lang.String |
internalName
|
protected int |
manaCost
|
protected java.lang.String |
name
|
protected java.lang.String |
strCastOthers
|
protected java.lang.String |
strCastSelf
|
protected java.lang.String |
strCost
|
| Constructor Summary | |
|---|---|
Spell(org.bukkit.util.config.Configuration config,
java.lang.String spellName)
|
|
| Method Summary | |
|---|---|
protected void |
addListener(org.bukkit.event.Event.Type eventType)
Makes this spell listen for the specified event |
abstract boolean |
canCastByCommand()
|
abstract boolean |
canCastWithItem()
|
Spell.SpellCastState |
cast(org.bukkit.entity.Player player)
|
Spell.SpellCastState |
cast(org.bukkit.entity.Player player,
java.lang.String[] args)
|
boolean |
castFromConsole(org.bukkit.command.CommandSender sender,
java.lang.String[] args)
This method is called when the spell is cast from the console. |
protected abstract Spell.PostCastAction |
castSpell(org.bukkit.entity.Player player,
Spell.SpellCastState state,
java.lang.String[] args)
This method is called when a player casts a spell, either by command, with a wand item, or otherwise. |
int |
compareTo(Spell spell)
|
static java.lang.String |
formatMessage(java.lang.String message,
java.lang.String... replacements)
Formats a string by performing the specified replacements. |
int |
getCastItem()
|
protected boolean |
getConfigBoolean(java.lang.String key,
boolean defaultValue)
Access a boolean config value for this spell. |
protected int |
getConfigInt(java.lang.String key,
int defaultValue)
Access an integer config value for this spell. |
protected java.util.List<java.lang.Integer> |
getConfigIntList(java.lang.String key,
java.util.List<java.lang.Integer> defaultValue)
|
protected java.lang.String |
getConfigString(java.lang.String key,
java.lang.String defaultValue)
Access a String config value for this spell. |
protected java.util.List<java.lang.String> |
getConfigStringList(java.lang.String key,
java.util.List<java.lang.String> defaultValue)
|
protected int |
getCooldown(org.bukkit.entity.Player player)
Get how many seconds remain on the cooldown of this spell for the specified player |
java.lang.String |
getCostStr()
|
java.lang.String |
getDescription()
|
int |
getHealthCost()
|
java.lang.String |
getInternalName()
|
int |
getManaCost()
|
java.lang.String |
getName()
|
org.bukkit.inventory.ItemStack[] |
getReagentCost()
|
protected boolean |
hasReagents(org.bukkit.entity.Player player)
Checks if a player has the reagents required to cast this spell |
protected boolean |
hasReagents(org.bukkit.entity.Player player,
org.bukkit.inventory.ItemStack[] cost)
Checks if a player has the specified reagents |
protected boolean |
hasReagents(org.bukkit.entity.Player player,
org.bukkit.inventory.ItemStack[] reagents,
int healthCost,
int manaCost)
Checks if a player has the specified reagents, including health and mana |
protected void |
initialize()
This method is called immediately after all spells have been loaded into the plugin. |
void |
onBlockBreak(org.bukkit.event.block.BlockBreakEvent event)
|
void |
onBlockPlace(org.bukkit.event.block.BlockPlaceEvent event)
|
protected boolean |
onCooldown(org.bukkit.entity.Player player)
Check whether this spell is currently on cooldown for the specified player |
void |
onEntityCombust(org.bukkit.event.entity.EntityCombustEvent event)
|
void |
onEntityDamage(org.bukkit.event.entity.EntityDamageEvent event)
|
void |
onEntityTarget(org.bukkit.event.entity.EntityTargetEvent event)
|
void |
onExplosionPrime(org.bukkit.event.entity.ExplosionPrimeEvent event)
|
void |
onItemHeldChange(org.bukkit.event.player.PlayerItemHeldEvent event)
|
void |
onPlayerCommandPreprocess(org.bukkit.event.player.PlayerCommandPreprocessEvent event)
|
void |
onPlayerInteract(org.bukkit.event.player.PlayerInteractEvent event)
|
void |
onPlayerJoin(org.bukkit.event.player.PlayerJoinEvent event)
|
void |
onPlayerMove(org.bukkit.event.player.PlayerMoveEvent event)
|
void |
onPlayerQuit(org.bukkit.event.player.PlayerQuitEvent event)
|
void |
onPlayerTeleport(org.bukkit.event.player.PlayerTeleportEvent event)
|
void |
onPlayerToggleSneak(org.bukkit.event.player.PlayerToggleSneakEvent event)
|
protected void |
removeListener(org.bukkit.event.Event.Type eventType)
Makes this spell stop listening for the specified event |
protected void |
removeReagents(org.bukkit.entity.Player player)
Removes the reagent cost of this spell from the player's inventoryy. |
protected void |
removeReagents(org.bukkit.entity.Player player,
org.bukkit.inventory.ItemStack[] reagents)
Removes the specified reagents from the player's inventoryy. |
protected void |
removeReagents(org.bukkit.entity.Player player,
org.bukkit.inventory.ItemStack[] reagents,
int healthCost,
int manaCost)
Removes the specified reagents, including health and mana, from the player's inventory. |
static void |
sendMessage(org.bukkit.entity.Player player,
java.lang.String message)
Sends a message to a player. |
static void |
sendMessage(org.bukkit.entity.Player player,
java.lang.String message,
java.lang.String... replacements)
Sends a message to a player, first making the specified replacements. |
protected void |
sendMessageNear(org.bukkit.entity.Player player,
java.lang.String message)
Sends a message to all players near the specified player, within the configured broadcast range. |
protected void |
sendMessageNear(org.bukkit.entity.Player player,
java.lang.String message,
int range)
Sends a message to all players near the specified player, within the specified broadcast range. |
protected void |
setCooldown(org.bukkit.entity.Player player)
Begins the cooldown for the spell for the specified player |
protected void |
turnOff()
This methid is called when the plugin is being disabled, for any reason. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.lang.String internalName
protected java.lang.String name
protected java.lang.String description
protected int castItem
protected org.bukkit.inventory.ItemStack[] cost
protected int healthCost
protected int manaCost
protected int cooldown
protected int broadcastRange
protected java.lang.String strCost
protected java.lang.String strCastSelf
protected java.lang.String strCastOthers
| Constructor Detail |
|---|
public Spell(org.bukkit.util.config.Configuration config,
java.lang.String spellName)
| Method Detail |
|---|
protected int getConfigInt(java.lang.String key,
int defaultValue)
key - The key of the config valuedefaultValue - The value to return if it does not exist in the config
protected boolean getConfigBoolean(java.lang.String key,
boolean defaultValue)
key - The key of the config valuedefaultValue - The value to return if it does not exist in the config
protected java.lang.String getConfigString(java.lang.String key,
java.lang.String defaultValue)
key - The key of the config valuedefaultValue - The value to return if it does not exist in the config
protected java.util.List<java.lang.Integer> getConfigIntList(java.lang.String key,
java.util.List<java.lang.Integer> defaultValue)
protected java.util.List<java.lang.String> getConfigStringList(java.lang.String key,
java.util.List<java.lang.String> defaultValue)
public final Spell.SpellCastState cast(org.bukkit.entity.Player player)
public final Spell.SpellCastState cast(org.bukkit.entity.Player player,
java.lang.String[] args)
protected abstract Spell.PostCastAction castSpell(org.bukkit.entity.Player player,
Spell.SpellCastState state,
java.lang.String[] args)
player - the player casting the spellstate - the state of the spell cast (normal, on cooldown, missing reagents, etc)args - the spell arguments, if cast by command
public boolean castFromConsole(org.bukkit.command.CommandSender sender,
java.lang.String[] args)
sender - the console sender.args - the command arguments
public abstract boolean canCastWithItem()
public abstract boolean canCastByCommand()
public java.lang.String getCostStr()
protected boolean onCooldown(org.bukkit.entity.Player player)
player - The player to check
protected int getCooldown(org.bukkit.entity.Player player)
player - The player to check
protected void setCooldown(org.bukkit.entity.Player player)
player - The player to set the cooldown forprotected boolean hasReagents(org.bukkit.entity.Player player)
player - the player to check
protected boolean hasReagents(org.bukkit.entity.Player player,
org.bukkit.inventory.ItemStack[] cost)
player - the player to checkcost - the reagents to look for
protected boolean hasReagents(org.bukkit.entity.Player player,
org.bukkit.inventory.ItemStack[] reagents,
int healthCost,
int manaCost)
player - the player to checkreagents - the inventory item reagents to look forhealthCost - the health cost, in half-heartsmanaCost - the mana cost
protected void removeReagents(org.bukkit.entity.Player player)
player - the player to remove reagents from
protected void removeReagents(org.bukkit.entity.Player player,
org.bukkit.inventory.ItemStack[] reagents)
player - the player to remove the reagents fromreagents - the inventory item reagents to remove
protected void removeReagents(org.bukkit.entity.Player player,
org.bukkit.inventory.ItemStack[] reagents,
int healthCost,
int manaCost)
player - the player to remove the reagents fromreagents - the inventory item reagents to removehealthCost - the health to removemanaCost - the mana to remove
public static java.lang.String formatMessage(java.lang.String message,
java.lang.String... replacements)
message - the string to formatreplacements - the replacements to make, in pairs.
public static void sendMessage(org.bukkit.entity.Player player,
java.lang.String message,
java.lang.String... replacements)
player - the player to send the message tomessage - the message to sendreplacements - the replacements to be made, in pairs
public static void sendMessage(org.bukkit.entity.Player player,
java.lang.String message)
player - the player to send the message tomessage - the message to send
protected void sendMessageNear(org.bukkit.entity.Player player,
java.lang.String message)
player - the "center" player used to find nearby playersmessage - the message to send
protected void sendMessageNear(org.bukkit.entity.Player player,
java.lang.String message,
int range)
player - the "center" player used to find nearby playersmessage - the message to sendrange - the broadcast rangepublic java.lang.String getInternalName()
public java.lang.String getName()
public int getCastItem()
public java.lang.String getDescription()
public org.bukkit.inventory.ItemStack[] getReagentCost()
public int getManaCost()
public int getHealthCost()
protected void addListener(org.bukkit.event.Event.Type eventType)
eventType - the event to listen forprotected void removeListener(org.bukkit.event.Event.Type eventType)
eventType - the eventprotected void initialize()
protected void turnOff()
public void onPlayerJoin(org.bukkit.event.player.PlayerJoinEvent event)
public void onPlayerQuit(org.bukkit.event.player.PlayerQuitEvent event)
public void onPlayerInteract(org.bukkit.event.player.PlayerInteractEvent event)
public void onItemHeldChange(org.bukkit.event.player.PlayerItemHeldEvent event)
public void onPlayerMove(org.bukkit.event.player.PlayerMoveEvent event)
public void onPlayerTeleport(org.bukkit.event.player.PlayerTeleportEvent event)
public void onPlayerToggleSneak(org.bukkit.event.player.PlayerToggleSneakEvent event)
public void onPlayerCommandPreprocess(org.bukkit.event.player.PlayerCommandPreprocessEvent event)
public void onBlockBreak(org.bukkit.event.block.BlockBreakEvent event)
public void onBlockPlace(org.bukkit.event.block.BlockPlaceEvent event)
public void onEntityDamage(org.bukkit.event.entity.EntityDamageEvent event)
public void onEntityTarget(org.bukkit.event.entity.EntityTargetEvent event)
public void onEntityCombust(org.bukkit.event.entity.EntityCombustEvent event)
public void onExplosionPrime(org.bukkit.event.entity.ExplosionPrimeEvent event)
public int compareTo(Spell spell)
compareTo in interface java.lang.Comparable<Spell>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||