Package com.sijobe.spc.wrapper

Examples of com.sijobe.spc.wrapper.Player


         throw new CommandException("Could not find specified effect.");
      }
      if (id != null && id < 1) {
         throw new CommandException("Invalid effect specified.");
      }
      Player player = super.getSenderAsPlayer(sender);
      // Removes the specified effect
      if (((String)params.get(0)).equalsIgnoreCase("remove")) {
         if (id == null) {
            player.removeAllPotionEffects();
         } else {
            player.removePotionEffect(id);
         }
         // Adds the specified effect
      } else if (((String)params.get(0)).equalsIgnoreCase("add")) {
         int duration = 1;
         int strength = 1;
         if (args.length > 1) {
            try {
               duration = Integer.parseInt(args[1]);
            } catch (NumberFormatException e) {
               throw new CommandException("Could not parse duration argument.");
            }
         }
         if (args.length > 2) {
            try {
               strength = Integer.parseInt(args[2]);
            } catch (NumberFormatException e) {
               throw new CommandException("Could not parse strength argument.");
            }
         }
         if (id == null) {
            for (Integer i : Potion.getPotions().values()) {
               player.addPotionEffect(i, duration * 20, strength);
            }
         } else {
            player.addPotionEffect(id, duration * 20, strength);
         }
      } else {
         throw new CommandException("Invalid argument specified.");
      }
   }
View Full Code Here


            achievements += name + ", ";
         }
         achievements = achievements.substring(0, achievements.length() - 2);
         sender.sendMessageToPlayer(achievements);
      } else if (((String)params.get(0)).equalsIgnoreCase("unlock")) {
         Player player = Minecraft.getPlayer();
         if (params.size() == 2) {
            if (player.addAchievement((String)params.get(1))) {
               player.sendChatMessage("The " + FontColour.AQUA + (String)params.get(1)
                        + FontColour.WHITE + " achievement was unlocked.");
            }
         } else {
            for (String name : Stats.getAchievementNames()) {
               player.addAchievement(name);
            }
         }
      } else {
         assert false : "Unknown achievement argument provided.";
      }
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 {
      Player player = getSenderAsPlayer(sender);
      double radius = 128.0D;
      String entityType = "item";
      if(params.size() > 0) {
         entityType = (String)params.get(0);
         if(Entity.getEntityClass(entityType) == null) {
            try {
               radius = Double.parseDouble((String)params.get(0));
               sender.sendMessageToPlayer("Setting radius to: " + radius);
               entityType = "item";
            } catch (NumberFormatException nfe) {
               throw new CommandException("Unknown entity specified.");
            }
         }
         if(params.size() > 1) {
            radius = (Integer)params.get(1);
         }
      }
      if(radius <=0 || radius > 256) {
         throw new CommandException("Radius should be between 0 and 256.");
      }
      List<net.minecraft.src.Entity> foundEntities = Entity.findEntities(entityType, player.getPosition(), player.getWorld(), radius);
      net.minecraft.src.Vec3 vec3d = player.getMinecraftPlayer().getLook(1.0F);
      double d = 5.0D;
      double offsetY = player.getMinecraftPlayer().posY + player.getMinecraftPlayer().getEyeHeight();
      double d1 = player.getMinecraftPlayer().posX + vec3d.xCoord * d;
      double d2 = offsetY + vec3d.yCoord * d;
      double d3 = player.getMinecraftPlayer().posZ + vec3d.zCoord * d;
      for(net.minecraft.src.Entity entity : foundEntities) {
         if(entity == player.getMinecraftPlayer()) {
            continue; // don't allow the player to bring themselves
         }
         entity.setPosition(d1, d2 + 0.5D, d3);
      }
      sender.sendMessageToPlayer(foundEntities.size() + " entities brought.");
View Full Code Here

    */
   private static final int MAX_AIR = 300;

   @Override
   public void execute(CommandSender sender, List<?> params) throws CommandException {
      Player player = super.getSenderAsPlayer(sender);
      Settings config = super.loadSettings(player);
      boolean value = config.getBoolean("scuba", false);
      if (params.size() > 0) {
         value = !(Boolean)params.get(0);
      }
      if (!value) {
         config.set("scuba", true);
         player.sendChatMessage("Scuba mode is " + FontColour.AQUA + "enabled");
      } else {
         config.set("scuba", false);
         player.sendChatMessage("Scuba mode is " + FontColour.AQUA + "disabled");
      }
      config.save();
   }
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 {
      Player player = super.getSenderAsPlayer(sender);
      Coordinate coord = new Coordinate(player.getPosition().getBlockX(), player.getPosition().getBlockY() - 1, player.getPosition().getBlockZ());
      player.getWorld().setBlock(coord, BLOCK_GLASS);
   }
View Full Code Here

)
public class Noclip extends StandardCommand {

   @Override
   public void execute(CommandSender sender, List<?> params) throws CommandException {
      Player player = CommandBase.getSenderAsPlayer(sender);

      System.out.println(player.getUsername() + " " + MinecraftServer.getServer().getServerOwner());
      /*if(!player.getUsername().equals(MinecraftServer.getServer().getServerOwner())) {
         throw new CommandException("Must be server host");
      }*/
      if(!player.getMinecraftPlayer().capabilities.isFlying && !player.getMinecraftPlayer().noClip) {
         throw new CommandException("Must be flying");
      }

      if (params.size() == 0) {
         player.getMinecraftPlayer().noClip ^= true;
      } else {
         player.getMinecraftPlayer().noClip = (Boolean)params.get(0);
      }

      // replace server handler
      if(player.getMinecraftPlayer() instanceof EntityPlayerMP) {
         updateServerHandler((EntityPlayerMP)player.getMinecraftPlayer());
      } else {
         player.getMinecraftPlayer().noClip = false;
         throw new CommandException("Noclip unavailable");
      }

      if(player.getMinecraftPlayer().noClip == false) {
         ascendPlayer(player);
      }
      Minecraft.getMinecraft().thePlayer.noClip = player.getMinecraftPlayer().noClip;
      player.sendChatMessage("Noclip is now " + FontColour.AQUA + (!player.getMinecraftPlayer().noClip ? "disabled" : "enabled"));
   }
View Full Code Here

      if(player.noClip && !player.capabilities.isFlying) {
         player.noClip = false;
         Minecraft.getMinecraft().thePlayer.noClip = false;
         player.addChatMessage("Noclip auto-disabled. (Player not flying)");
         updateServerHandler(player);
         ascendPlayer(new Player(player));
      }
   }
View Full Code Here

)
public class Cheats extends StandardCommand {

   @Override
   public void execute(CommandSender sender, List<?> params) throws CommandException {
      Player player = CommandBase.getSenderAsPlayer(sender);
      if (params.size() == 0) {
         player.getWorld().setCheats(!player.getWorld().isCheats());
      } else {
         player.getWorld().setCheats((Boolean)params.get(0));
      }
      player.sendChatMessage("Cheats are " + FontColour.AQUA
               + (player.getWorld().isCheats() ? "enabled" : "disabled"));
   }
View Full Code Here

   @Override
   public void execute(CommandSender sender, List<?> params) throws CommandException {
      @SuppressWarnings("unchecked")
      Map<Integer, ItemStack> smelt = FurnaceRecipes.smelting().getSmeltingList();

      Player player = getSenderAsPlayer(sender);
      boolean all = false;

      if (params.size() != 0) {
         all = true;
      }

      ItemStack[] mainInventory = player.getMinecraftPlayer().inventory.mainInventory;

      int length = all ? mainInventory.length : 1;
      int start = all ? 0 : player.getCurrentSlot(); // currentItem

      for (int i = start; i < start + length; i++) {
         ItemStack oldStack = mainInventory[i];
         if (oldStack == null) {
            continue;
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 {
      Player player = getSenderAsPlayer(sender);
      if (params.size() == 0) {
         Item.resetDamageOnItem(player, player.getCurrentSlot());
      } else {
         for (int i = 0; i < INVENTORY_SIZE; i++) {
            Item.resetDamageOnItem(player, i);
         }
      }
View Full Code Here

TOP

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

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.