From 853e6420ddf6ab4d65e6e2e2dcbfd8a7d36bec12 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Wed, 25 Mar 2015 19:21:20 +1300 Subject: [PATCH] Add instant-casting to wizards --- .../game/games/wizards/SpellButton.java | 48 +++++++++++-------- .../game/games/wizards/SpellMenuPage.java | 10 ++-- 2 files changed, 35 insertions(+), 23 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/SpellButton.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/SpellButton.java index 8069d6ddf..e5a122a07 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/SpellButton.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/SpellButton.java @@ -10,31 +10,39 @@ import org.bukkit.event.inventory.ClickType; public class SpellButton implements IButton { - private SpellType _spell; - private SpellMenuPage _spellPage; + private SpellType _spell; + private SpellMenuPage _spellPage; - public SpellButton(SpellMenuPage spellPage, SpellType spell) - { - _spell = spell; - _spellPage = spellPage; - } + public SpellButton(SpellMenuPage spellPage, SpellType spell) + { + _spell = spell; + _spellPage = spellPage; + } - @Override - public void onClick(Player player, ClickType clickType) - { - Wizard wizard = _spellPage.getWizards().getWizard(player); + @Override + public void onClick(Player player, ClickType clickType) + { + Wizard wizard = _spellPage.getWizards().getWizard(player); - if (wizard != null) - { - wizard.setSpell(player.getInventory().getHeldItemSlot(), _spell); + if (wizard != null) + { + if (clickType.isLeftClick()) + { + wizard.setSpell(player.getInventory().getHeldItemSlot(), _spell); - player.sendMessage(C.cBlue + "Set spell on wand to " + _spell.getElement().getColor() + _spell.getSpellName()); + player.sendMessage(C.cBlue + "Set spell on wand to " + _spell.getElement().getColor() + _spell.getSpellName()); - player.playSound(player.getLocation(), Sound.ORB_PICKUP, 10, 1); + player.playSound(player.getLocation(), Sound.ORB_PICKUP, 10, 1); + } + else + { + _spellPage.getWizards().castSpell(player, wizard, _spell, null); + } - _spellPage.getWizards().drawUtilTextBottom(player); - _spellPage.getWizards().changeWandsTitles(player); - } - } + _spellPage.getWizards().drawUtilTextBottom(player); + _spellPage.getWizards().changeWandsTitles(player); + player.closeInventory(); + } + } } \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/SpellMenuPage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/SpellMenuPage.java index a623eb102..1f824827b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/SpellMenuPage.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/SpellMenuPage.java @@ -73,10 +73,14 @@ public class SpellMenuPage extends ShopPageBase