use of com.elmakers.mine.bukkit.api.wand.Wand in project MagicPlugin by elBukkit.
the class WandCommandExecutor method onWandDestroy.
public boolean onWandDestroy(CommandSender sender, Player player) {
Wand wand = checkWand(sender, player);
if (wand == null) {
return true;
}
Mage mage = controller.getMage(player);
wand.deactivate();
wand.unenchant();
player.getInventory().setItemInMainHand(wand.getItem());
mage.sendMessage(api.getMessages().get("wand.unenchanted"));
if (sender != player) {
sender.sendMessage(api.getMessages().getParameterized("wand.player_unenchanted", "$name", player.getName()));
}
return true;
}
use of com.elmakers.mine.bukkit.api.wand.Wand in project MagicPlugin by elBukkit.
the class WandCommandExecutor method onWandName.
public boolean onWandName(CommandSender sender, Player player, String[] parameters) {
if (parameters.length < 1) {
sender.sendMessage("Use: /wand name <name>");
return true;
}
Wand wand = checkWand(sender, player);
if (wand == null) {
return true;
}
Mage mage = controller.getMage(player);
wand.setName(StringUtils.join(parameters, " "));
wand.saveState();
mage.sendMessage(api.getMessages().get("wand.renamed"));
if (sender != player) {
sender.sendMessage(api.getMessages().getParameterized("wand.player_renamed", "$name", player.getName()));
}
return true;
}
use of com.elmakers.mine.bukkit.api.wand.Wand in project MagicPlugin by elBukkit.
the class WandCommandExecutor method onWandDuplicate.
public boolean onWandDuplicate(CommandSender sender, Player player) {
Wand wand = checkWand(sender, player, false, false);
if (wand == null) {
return true;
}
Mage mage = controller.getMage(player);
Wand newWand = wand.duplicate();
api.giveItemToPlayer(player, newWand.getItem());
mage.sendMessage(api.getMessages().get("wand.duplicated"));
if (sender != player) {
sender.sendMessage(api.getMessages().getParameterized("wand.player_duplicated", "$name", player.getName()));
}
return true;
}
use of com.elmakers.mine.bukkit.api.wand.Wand in project MagicPlugin by elBukkit.
the class WandCommandExecutor method onWandRemove.
public boolean onWandRemove(CommandSender sender, Player player, String[] parameters) {
if (parameters.length < 1) {
sender.sendMessage("Use: /wand remove <spell|material> [material:data]");
return true;
}
Wand wand = checkWand(sender, player);
if (wand == null) {
return true;
}
Mage mage = controller.getMage(player);
String spellName = parameters[0];
if (spellName.equals("material") || spellName.equals("brush")) {
if (parameters.length < 2) {
sender.sendMessage("Use: /wand remove brush <material:data>");
return true;
}
String materialKey = parameters[1];
if (wand.removeBrush(materialKey)) {
mage.sendMessage("Brush '" + materialKey + "' has been removed from your wand");
if (sender != player) {
sender.sendMessage("Removed brush '" + materialKey + "' from " + player.getName() + "'s wand");
}
wand.saveState();
} else {
if (sender != player) {
sender.sendMessage(player.getName() + "'s wand does not have brush " + materialKey);
}
}
return true;
}
if (wand.removeSpell(spellName)) {
SpellTemplate template = api.getSpellTemplate(spellName);
if (template != null) {
spellName = template.getName();
}
mage.sendMessage("Spell '" + spellName + "' has been removed from your wand");
if (sender != player) {
sender.sendMessage("Removed '" + spellName + "' from " + player.getName() + "'s wand");
}
wand.saveState();
} else {
if (sender != player) {
sender.sendMessage(player.getName() + "'s wand does not have " + spellName);
}
}
return true;
}
use of com.elmakers.mine.bukkit.api.wand.Wand in project MagicPlugin by elBukkit.
the class WandCommandExecutor method onWandConfigure.
public boolean onWandConfigure(CommandSender sender, Player player, String[] parameters, boolean safe) {
Wand wand = checkWand(sender, player);
if (wand == null) {
return true;
}
boolean result = onConfigure("wand", wand, sender, player, parameters, safe);
Mage mage = controller.getMage(player);
wand.deactivate();
mage.checkWand();
return result;
}
Aggregations