Class Shortcuts
- java.lang.Object
-
- com.realtime.crossfire.jxclient.shortcuts.Shortcuts
-
-
Constructor Summary
Constructors Constructor Description Shortcuts(@NotNull CommandQueue commandQueue, @NotNull SpellsManager spellsManager)Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddShortcutsListener(@NotNull ShortcutsListener listener)Adds aShortcutsListener.voidclearShortcuts()Clears all defined shortcuts.voidexecuteShortcut(int index)Executes a shortcut.@Nullable java.nio.file.PathgetFile()Returns the backing file.booleanisModified()Returns whether the shortcuts have been modified since creation or last call toresetModified().@NotNull java.util.Iterator<Shortcut>iterator()voidremoveShortcutsListener(@NotNull ShortcutsListener listener)Removes aShortcutsListener.voidresetModified()Resets the modified state.voidsetCommandShortcut(int index, @NotNull java.lang.String command)Sets aShortcutto a command.voidsetFile(@Nullable java.nio.file.Path file)Sets the backing file.voidsetShortcut(int index, @Nullable Shortcut shortcut)Sets aShortcut.voidsetSpellShortcut(int index, @NotNull Spell spell, boolean cast)Sets aShortcutto a spell.voidsetSpellShortcut(int index, @NotNull java.lang.String spellName, boolean cast)Sets aShortcutto a spell.voidunsetShortcut(int index)Unsets aShortcut.
-
-
-
Constructor Detail
-
Shortcuts
public Shortcuts(@NotNull @NotNull CommandQueue commandQueue, @NotNull @NotNull SpellsManager spellsManager)Creates a new instance.- Parameters:
commandQueue- the command queue for executing commandsspellsManager- the instance to watch
-
-
Method Detail
-
clearShortcuts
public void clearShortcuts()
Clears all defined shortcuts.
-
setShortcut
public void setShortcut(int index, @Nullable @Nullable Shortcut shortcut)Sets aShortcut.- Parameters:
index- the shortcut indexshortcut- the shortcut to set ornullto unset
-
unsetShortcut
public void unsetShortcut(int index)
Unsets aShortcut.- Parameters:
index- the shortcut index
-
setSpellShortcut
public void setSpellShortcut(int index, @NotNull @NotNull java.lang.String spellName, boolean cast)Sets aShortcutto a spell.- Parameters:
index- the shortcut indexspellName- the spell name to cast or invokecast- whether the spell should be cast (true) or invoked (false)
-
setSpellShortcut
public void setSpellShortcut(int index, @NotNull @NotNull Spell spell, boolean cast)Sets aShortcutto a spell.- Parameters:
index- the shortcut indexspell- the spell to cast or invokecast- whether the spell should be cast (true) or invoked (false)
-
setCommandShortcut
public void setCommandShortcut(int index, @NotNull @NotNull java.lang.String command)Sets aShortcutto a command.- Parameters:
index- the shortcut indexcommand- the command to execute
-
executeShortcut
public void executeShortcut(int index)
Executes a shortcut. Does nothing if the shortcut is unset.- Parameters:
index- the shortcut index
-
addShortcutsListener
public void addShortcutsListener(@NotNull @NotNull ShortcutsListener listener)Adds aShortcutsListener.- Parameters:
listener- the listener to add
-
removeShortcutsListener
public void removeShortcutsListener(@NotNull @NotNull ShortcutsListener listener)Removes aShortcutsListener.- Parameters:
listener- the listener to remove
-
isModified
public boolean isModified()
Returns whether the shortcuts have been modified since creation or last call toresetModified().- Returns:
- whether anything was modified
-
resetModified
public void resetModified()
Resets the modified state.
-
getFile
@Nullable public @Nullable java.nio.file.Path getFile()
Returns the backing file.- Returns:
- the backing file or
nullif unknown
-
setFile
public void setFile(@Nullable @Nullable java.nio.file.Path file)Sets the backing file.- Parameters:
file- the backing file ornullif unknown
-
-