Package com.sijobe.spc.wrapper

Examples of com.sijobe.spc.wrapper.CommandException


   public void execute(CommandSender sender, List<?> params) throws CommandException {
      Player player = super.getSenderAsPlayer(sender); // Why super.? Meh, Cannon has it like that
      Player clientPlayer = Minecraft.getPlayer();
     
      if(clientPlayer == null) {
         throw new CommandException("No client player!");
      }
     
      World clientWorld = clientPlayer.getWorld();
     
      if(player.getWorld().getMinecraftWorld().hashCode() != litWorld) {
View Full Code Here


         list = list.substring(0, list.length() - 2);
         sender.sendMessageToPlayer(FontColour.GREEN + "Enchantments [name (id)]:");
         sender.sendMessageToPlayer(list);
      } else if (argument.equalsIgnoreCase("add")) {
         if (params.size() == 1) {
            throw new CommandException(getUsage(sender));
         }
         int id = -1;
         try {
            id = Integer.parseInt((String)params.get(1));
         } catch (Exception e) {
            id = getEnchantmentId((String)params.get(1));
         }
         if (id < 0) {
            throw new CommandException("Invalid enchantment specified.");
         }
         int level = 1;
         if (params.size() == 3) {
            level = (Integer)params.get(2);
         }
         String name = null;
         if ((name = Item.addEnchantmentToCurrentItem(getSenderAsPlayer(sender), id, level)) == null) {
            throw new CommandException("Unable to add the specified enchantment with ID " + id);
         }
         getSenderAsPlayer(sender).sendChatMessage("The " + FontColour.AQUA +
                  name + FontColour.WHITE + " command was successfully added.");
      } else {
         Item.removeEnchantmentsOnCurrentItem(getSenderAsPlayer(sender));
View Full Code Here

                  break;
               case 2:
                  value = "adventure";
                  break;
               default:
                  throw new CommandException("Unknown gamemode type.");
            }
         } catch (Exception e) {
         }
      } else {
         if (player.isCreativeMode()) {
            value = "survival";
         } else {
            value = "creative";
         }
      }
     
      if (!player.setGameType(value)) {
         throw new CommandException("Unknown gamemode type");
      }
     
      sender.sendMessageToPlayer("Gamemode changed to " + FontColour.AQUA + value);
   }
View Full Code Here

   @Override
   public void execute(CommandSender sender, List<?> params) throws CommandException {
      Player player = getSenderAsPlayer(sender);
      Coordinate hit = player.trace(128);
      if (hit == null) {
         throw new CommandException("No block in sight.");
      }
      int y = hit.getBlockY() + 1;
      while (y < 260) {
         if (player.isClear(new Coordinate(hit.getBlockX(), y++, hit.getBlockZ()))) {
            player.setPosition(new Coordinate(hit.getBlockX() + 0.5F, --y, hit.getBlockZ() + 0.5F));
View Full Code Here

    * @see com.sijobe.spc.wrapper.CommandBase#execute(com.sijobe.spc.wrapper.CommandSender, java.util.List)
    */
   @Override
   public void execute(CommandSender sender, List<?> params) throws CommandException {
      super.getSenderAsPlayer(sender).setSkin(URL_PREFIX + (String)params.get(0) + URL_POSTFIX);
      throw new CommandException("This command is currently broken. Sorry for the inconvenience.");
   }
View Full Code Here

         config.set(CONFIG_KEY, DEFAULT_SPEED);
      } else {
         try {
            config.set(CONFIG_KEY, Double.parseDouble((String)params.get(0)));
         } catch (Exception e) {
            throw new CommandException("Could not parse " + (String)params.get(0) + " as a speed.");
         }
      }
      config.save();
      sender.sendMessageToPlayer("Player speed set to " + FontColour.AQUA
               + config.getDouble(CONFIG_KEY, DEFAULT_SPEED) + FontColour.WHITE + "x normal speed");
View Full Code Here

         }
         config.set("instantMine", instantMine);
         super.saveSettings(player);
         player.sendChatMessage("Instant mining " + (instantMine?"enabled.":"disabled."));
      } else {
         throw new CommandException("Non-client command");
      }
   }
View Full Code Here

TOP

Related Classes of com.sijobe.spc.wrapper.CommandException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.