MagicAPI
MagicAPI provides utility methods for managing magic-related functionalities, including autocasting spells and handling home teleport cooldowns.
ClassRLPlugins API
public class MagicAPIMembers
Static methods
- voidcast(Spell)
Casts the specified spell if it is valid and can be cast.
- voidcast(Spell, ItemEx)
Casts the specified spell on an inventory item.
- voidcast(Spell, NpcEx)
Casts the specified spell on an NPC target.
- voidcast(Spell, PlayerEx)
Casts the specified spell on a player target.
- voidcast(Spell, TileItemEx)
Casts the specified spell on a ground item target.
- voidcast(Spell, TileObjectEx)
Casts the specified spell on a tile object target.
- Spellcomparator()
Compares available offensive spells and returns the best one that can be cast based on the player's current magic level.
- voiddeselectSelectedSpell()
Clears the current selected spell.
- SpellgetAutocastSpell()
Gets the currently autocast spell.
- InstantgetLastHomeTeleportUsage()
Retrieves the timestamp of the last home teleport usage.
- booleanisAutoCasting()
Checks if autocasting is currently enabled.
- booleanisAutoCastUsable()
Whether you can pick an autocast spell right now.
- booleanisDefensiveCasting()
Whether defensive casting is picked and no spell is on autocast.
- booleanisHomeTeleportOnCooldown()
Checks if the home teleport is currently on cooldown.
- booleanisSpellSelected()
Checks whether a magic spell widget is selected for a cast-on action.
- voidsetBestAutoCast()
Sets the best available spell for autocasting based on the player's magic level.
cast(Spell)static
public static void cast(Spell spell)Casts the specified spell if it is valid and can be cast.
Parameters
spell- The spell to be cast.
cast(Spell, ItemEx)static
public static void cast(Spell spell, ItemEx item)Casts the specified spell on an inventory item.
Parameters
spell- The spell to cast.
item- The item target.
cast(Spell, NpcEx)static
public static void cast(Spell spell, NpcEx target)Casts the specified spell on an NPC target.
Parameters
spell- The spell to cast.
target- The NPC target.
cast(Spell, PlayerEx)static
public static void cast(Spell spell, PlayerEx player)Casts the specified spell on a player target.
Parameters
spell- The spell to cast.
player- The player target.
cast(Spell, TileItemEx)static
public static void cast(Spell spell, TileItemEx tileItem)Casts the specified spell on a ground item target.
Parameters
spell- The spell to cast.
tileItem- The ground item target.
cast(Spell, TileObjectEx)static
public static void cast(Spell spell, TileObjectEx tileObject)Casts the specified spell on a tile object target.
Parameters
spell- The spell to cast.
tileObject- The tile object target.
comparator()static
public static Spell comparator()Compares available offensive spells and returns the best one that can be cast based on the player's current magic level.
Returns
The best available Spell that can be cast, or null if none are available.
deselectSelectedSpell()static
public static void deselectSelectedSpell()Clears the current selected spell.
getAutocastSpell()static
public static Spell getAutocastSpell()Gets the currently autocast spell.
Returns
Autocast spell, or null when autocast is disabled or not mapped.
getLastHomeTeleportUsage()static
public static Instant getLastHomeTeleportUsage()Retrieves the timestamp of the last home teleport usage.
Returns
An Instant representing the last home teleport usage time.
isAutoCasting()static
public static boolean isAutoCasting()Checks if autocasting is currently enabled.
Returns
True if autocasting is enabled, false otherwise.
isAutoCastUsable()static
public static boolean isAutoCastUsable()Whether you can pick an autocast spell right now.
isDefensiveCasting()static
public static boolean isDefensiveCasting()Whether defensive casting is picked and no spell is on autocast.
isHomeTeleportOnCooldown()static
public static boolean isHomeTeleportOnCooldown()Checks if the home teleport is currently on cooldown.
Returns
True if the home teleport is on cooldown, false otherwise.
isSpellSelected()static
public static boolean isSpellSelected()Checks whether a magic spell widget is selected for a cast-on action.
Returns
True when the selected widget belongs to the spellbook.
setBestAutoCast()static
public static void setBestAutoCast()Sets the best available spell for autocasting based on the player's magic level.
Also allowed
Every class has these, as in plain Java.
equals, toString