Example #1
0
 @Override
 public void onRightClick(Player player, HumanNPC npc) {
   if (PermissionManager.hasPermission(player, "citizens.wizard.use.interact")) {
     if (UtilityProperties.isHoldingTool("WizardInteractItem", player)) {
       WizardManager.handleRightClick(player, npc, "wizard." + mode.toString());
     } else if (UtilityProperties.isHoldingTool("WizardManaRegenItem", player)) {
       String msg = StringUtils.wrap(npc.getName() + "'s");
       int mana = 0;
       if (mana + 10 < Settings.getInt("WizardMaxMana")) {
         mana = mana + 10;
         msg += " mana has been increased to " + StringUtils.wrap(mana) + ".";
       } else if (mana + 10 == Settings.getInt("WizardMaxMana")) {
         mana = Settings.getInt("WizardMaxMana");
         msg += " mana has been fully replenished.";
       } else {
         msg += " mana cannot be regenerated with that item any further.";
         return;
       }
       InventoryUtils.decreaseItemInHand(player);
       player.sendMessage(msg);
       this.mana = mana;
     }
   } else {
     player.sendMessage(MessageUtils.noPermissionsMessage);
   }
 }
Example #2
0
 @Override
 public void onLeftClick(Player player, HumanNPC npc) {
   if (PermissionManager.hasPermission(player, "citizens.wizard.use.interact")) {
     if (UtilityProperties.isHoldingTool("WizardInteractItem", player)) {
       String msg = ChatColor.GREEN.toString();
       switch (mode) {
         case TELEPORT:
           if (locations.size() > 0) {
             cycle();
             msg += "Location set to " + StringUtils.wrap(getCurrentLocationName());
           } else {
             msg += ChatColor.RED + npc.getName() + " has no locations.";
           }
           break;
         case SPAWN:
           cycle();
           msg += "Mob to spawn set to " + StringUtils.wrap(StringUtils.format(mob));
           break;
         case TIME:
           cycle();
           msg += "Time setting set to " + StringUtils.wrap(time);
           break;
         case WEATHER:
           return;
         default:
           msg = ChatColor.RED + "No valid mode selected.";
       }
       player.sendMessage(msg);
     }
   } else {
     player.sendMessage(MessageUtils.noPermissionsMessage);
   }
 }