Add instant-casting to wizards
This commit is contained in:
parent
4988b90d0e
commit
853e6420dd
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -73,10 +73,14 @@ public class SpellMenuPage extends ShopPageBase<WizardSpellMenu, WizardSpellMenu
|
||||
|
||||
for (String lore : spell.getDesc())
|
||||
{
|
||||
builder.addLore(C.cGray + lore, 35);
|
||||
}
|
||||
builder.addLore(C.cGray + lore, 35);
|
||||
}
|
||||
|
||||
if (wizard == null)
|
||||
builder.addLore("");
|
||||
builder.addLore(C.cPurple + C.Bold + "LEFT CLICK" + C.cDGreen + " Bind spell");
|
||||
builder.addLore(C.cGreen + C.Bold + "RIGHT CLICK" + C.cBlue + " Instant Cast");
|
||||
|
||||
if (wizard == null)
|
||||
{
|
||||
addItem(i, new ShopItem(builder.build(), spell.name(), spell.name(), 1, true, true));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user