Package com.sijobe.spc.wrapper

Examples of com.sijobe.spc.wrapper.Player


   @Override
   public void execute(CommandSender sender, List<?> params) throws CommandException {
      if (params.size() != 0 && params.size() < 3) {
         throw new CommandException("Usage: " + getUsage(sender));
      }
      Player player = getSenderAsPlayer(sender);
      if (params.size() == 0) {
         player.getWorld().setSpawn(player.getPosition());
      } else {
         player.getWorld().setSpawn(new Coordinate((Integer)params.get(0),(Integer)params.get(1),(Integer)params.get(2)));
      }
      Coordinate spawn = player.getWorld().getSpawn();
      player.sendChatMessage("Spawn point set to "
               + FontColour.AQUA + spawn.getBlockX() + FontColour.WHITE + ","
               + FontColour.AQUA + spawn.getBlockY() + FontColour.WHITE + ","
               + FontColour.AQUA + spawn.getBlockZ()
      );
   }
View Full Code Here


            }
            );
  
   @Override
   public void execute(CommandSender sender, List<?> params) throws CommandException {
      Player player = super.getSenderAsPlayer(sender);
      String type = (String)params.get(0);
      if (type.equalsIgnoreCase("normal")) {
         player.changeDimension(DIMENSION_NORMAL);
      } else if (type.equalsIgnoreCase("nether")) {
         player.changeDimension(DIMENSION_NETHER);
      } else if (type.equalsIgnoreCase("end")) {
         player.changeDimension(DIMENSION_END);
      } else {
         throw new CommandException("Unknown dimension specified");
      }
   }
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);
      String playerName = player.getPlayerName();
      checkWorld(player);
     
      if (params.size() >= 1) {
         String args[] = ((String)params.get(0)).split("(\\^|:)");
         int block = -1;
         int size = 3;
         int meta = 0;
        
         try {
            block = Integer.parseInt(args[0]);
         } catch (NumberFormatException e) {
            block = -1;
         }
        
         if (block == -1) {
            block = Item.getItemId((args[0]).replace('_', ' '));
         }

         if (args[0].equalsIgnoreCase("air")) {
            block = 0;
         }

         if (!player.getWorld().isValidBlockType(block) && block != 0) { // isValidBlockType should be static
            throw new CommandException("Unknown block: " + args[0]);
         }
        
         if(args.length > 1) {
            try {
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(!(player.getMinecraftPlayer() instanceof EntityPlayerMP)) {
         throw new CommandException("Command must be executed by non-client player.");
      }
      EntityPlayerMP playerEntity = (EntityPlayerMP)player.getMinecraftPlayer();
      if(params.size() == 0) {
         sender.sendMessageToPlayer("Current block reach distance: " +
            ForgeHelper.getBlockReachDistance(playerEntity.theItemInWorldManager));
      } else {
         double newReach = (Double)params.get(0);
View Full Code Here

   /**
    * @see com.sijobe.spc.wrapper.CommandBase#execute(net.minecraft.src.ICommandSender, java.util.List)
    */
   @Override
   public void execute(CommandSender sender, List<?> params) {
      Player player = super.getSenderAsPlayer(sender);
      player.setHealth(0);
      player.getMinecraftPlayer().onDeath(DamageSource.generic);
      sender.sendMessageToPlayer("Ouch. That looks like it hurt.");
   }
View Full Code Here

      return !Minecraft.isSinglePlayer();
   }*/
  
   @Override
   public void execute(CommandSender sender, List<?> params) throws CommandException {
      Player su = (Player)params.get(0);
      String command = (String)params.get(1);
      if (params.size() == 3) {
         command += " " + (String)params.get(2);
      }
      CommandManager.runCommand(new CommandSender(su), command);
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);
      DecimalFormat f = new DecimalFormat("#.##");
      sender.sendMessageToPlayer("Player position: " +
               FontColour.AQUA + f.format(player.getPosition().getX()) + FontColour.WHITE + ", " +
               FontColour.GREEN + f.format(player.getPosition().getY()) + FontColour.WHITE + ", " +
               FontColour.AQUA + f.format(player.getPosition().getZ())
      );
   }
View Full Code Here

    * @see com.sijobe.spc.wrapper.CommandBase#execute(net.minecraft.src.ICommandSender, java.util.List)
    */
   @Override
   public void execute(CommandSender sender, List<?> params) {
      String action = (String)params.get(0);
      Player player = super.getSenderAsPlayer(sender);
      if (action.equalsIgnoreCase("empty")) {
         player.setHunger(0);
      } else if (action.equalsIgnoreCase("full")) {
         player.setHunger(20);
      } else if (action.equalsIgnoreCase("infinite")) {
         player.setHunger(Short.MAX_VALUE);
      } else if (action.equalsIgnoreCase("enable")) {
         player.sendChatMessage(FontColour.ORANGE + "Cannot enable/disable hunger");
         return;
      } else if (action.equalsIgnoreCase("disable")) {
         player.sendChatMessage(FontColour.ORANGE + "Cannot enable/disable hunger");
         return;
      }
      player.sendChatMessage("Your hunger level is set at " + FontColour.AQUA + player.getHunger());
   }
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 c = player.getPosition();
      player.setPosition(new Coordinate((Double)params.get(0), (Double)params.get(1), (Double)params.get(2)));
      sender.sendMessageToPlayer("Moved from " +
               FontColour.AQUA + c.getBlockX() + FontColour.WHITE + ", " +
               FontColour.AQUA + c.getBlockY() + FontColour.WHITE + ", " +
               FontColour.AQUA + c.getBlockZ() + FontColour.WHITE + " to " +
               FontColour.AQUA + player.getPosition().getBlockX() + FontColour.WHITE + ", " +
               FontColour.AQUA + player.getPosition().getBlockY() + FontColour.WHITE + ", " +
               FontColour.AQUA + player.getPosition().getBlockZ()
      );
   }
View Full Code Here

)
public class Fly extends StandardCommand {

   @Override
   public void execute(CommandSender sender, List<?> params) throws CommandException {
      Player player = CommandBase.getSenderAsPlayer(sender);
      if (params.size() == 0) {
         player.setAllowFlying(!player.getAllowFlying());
      } else {
         player.setAllowFlying((Boolean)params.get(0));
      }
      player.sendChatMessage("Flying is now " + FontColour.AQUA + (player.getAllowFlying() ? "permitted" : "disabled"));
   }
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.