Package com.sijobe.spc.wrapper

Examples of com.sijobe.spc.wrapper.Coordinate


    * @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();
      int distance = 0;
      try {
         distance = Integer.parseInt((String)params.get(0));
      } catch (NumberFormatException e) {
         throw new CommandException("Could not parse disance specified as integer: " + params.get(0));
      }
     
      if (((String)params.get(1)).toUpperCase().startsWith("N")) {
         player.setPosition(new Coordinate(player.getPosition().getX(), player.getPosition().getY(), player.getPosition().getZ() - distance));
      } else if (((String)params.get(1)).toUpperCase().startsWith("E")) {
         player.setPosition(new Coordinate(player.getPosition().getX() + distance, player.getPosition().getY(), player.getPosition().getZ()));
      } else if (((String)params.get(1)).toUpperCase().startsWith("S")) {
         player.setPosition(new Coordinate(player.getPosition().getX(), player.getPosition().getY(), player.getPosition().getZ() + distance));
      } else if (((String)params.get(1)).toUpperCase().startsWith("W")) {
         player.setPosition(new Coordinate(player.getPosition().getX() - distance, player.getPosition().getY(), player.getPosition().getZ()));
      } else if (((String)params.get(1)).toUpperCase().startsWith("U")) {
         player.setPosition(new Coordinate(player.getPosition().getX(), player.getPosition().getY() + distance, player.getPosition().getZ()));
      } else if (((String)params.get(1)).toUpperCase().startsWith("D")) {
         player.setPosition(new Coordinate(player.getPosition().getX(), player.getPosition().getY() - distance, player.getPosition().getZ() - distance));
      } else {
         throw new CommandException("Invalid direction specified.");
      }

      sender.sendMessageToPlayer("Moved from " +
               FontColour.AQUA + c.getBlockX() + FontColour.WHITE + ", " +
               FontColour.AQUA + c.getBlockX() + FontColour.WHITE + ", " +
               FontColour.AQUA + c.getBlockX() + 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


   @Override
   public void execute(CommandSender sender, List<?> params) throws CommandException {
      Player player = super.getSenderAsPlayer(sender);
      String portalType = (String)params.get(0);
      if (portalType.equalsIgnoreCase("end")) {
         Coordinate coord = player.getPosition();
         int x = MathHelper.floor_double(coord.getX());
         int z = MathHelper.floor_double(coord.getZ());
         EntityDragon entityDragon = new EntityDragon(player.getWorld().getMinecraftWorld()); // EntityDragon
         try {
            Class<?>[] args = new Class<?>[]{Integer.TYPE, Integer.TYPE};
            Method method;
            try {
View Full Code Here

   public void setWaypoint(String name, Player player) {
      if (name == null || player == null) {
         return;
      }
      Settings config = super.loadSettings(player);
      Coordinate position = player.getPosition();
      String value = position.getX() + "," +
                     position.getY() + "," +
                     position.getZ() + "," +
                     player.getYaw() + "," +
                     player.getPitch();
      config.set((PREFIX + name).toLowerCase(), value);
   }
View Full Code Here

      double x = Double.parseDouble(parts[0]);
      double y = Double.parseDouble(parts[1]);
      double z = Double.parseDouble(parts[2]);
      float yaw = Float.parseFloat(parts[3]);
      float pitch = Float.parseFloat(parts[4]);
      player.setPosition(new Coordinate(x, y, z));
      player.setYaw(yaw);
      player.setPitch(pitch);
      return true;
   }
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);
      Coordinate block = player.trace(128);
      if (block == null) {
         throw new CommandException("No block within range.");
      }
      Coordinate fire = new Coordinate(block.getBlockX(), block.getBlockY() + 1, block.getBlockZ());
      if (player.getWorld().getBlockId(fire) == 0) {
         player.getWorld().setBlock(fire, BLOCK_FIRE);
      }
   }
View Full Code Here

  @Override
  public void execute(CommandSender sender, List<?> params)
      throws CommandException {
    Player player = super.getSenderAsPlayer(sender);
    Coordinate c = player.trace(128D);
    if (c == null) {
      throw new CommandException("No block within range.");
    }
   
    Entity.spawnEntity("EnderCrystal", c, player.getWorld());
View Full Code Here

  @Override
  public void execute(CommandSender sender, List<?> params)
      throws CommandException {
    Player player = super.getSenderAsPlayer(sender);
    Coordinate c = player.trace(128D);
    Entity.spawnEntity("FireworksRocketEntity", c, player.getWorld());
  }
View Full Code Here

public class Ascend extends StandardCommand {

   @Override
   public void execute(CommandSender sender, List<?> params) {
      Player player = getSenderAsPlayer(sender);
      Coordinate c = player.getPosition();
      int y = c.getBlockY() + 1;
      while (y < 260) {
         if (player.isClear(new Coordinate(c.getBlockX(), y++, c.getBlockZ()))) {
            player.setPosition(new Coordinate(c.getBlockX() + 0.5F, --y, c.getBlockZ() + 0.5F));
            player.sendChatMessage("You ascended " + FontColour.AQUA + (y - c.getBlockY()) +
                     FontColour.WHITE + " blocks.");
            break;
         }
      }
   }
View Full Code Here

    *
    * @param player - The player that triggered the mouse button
    */
   private void checkLeftButton(Player player) {
      if (Mouse.isButtonDown(0)) {
         Coordinate hit = null;
         if ((hit = player.trace(TRACE_RANGE)) != null) {
            WorldEditCommandSet.getCurrentInstance().handleArmSwing(player);
            if (!hit.equals(left.get(player.getPlayerName()))) {
               left.put(player.getPlayerName(), hit);
               WorldEditCommandSet.getCurrentInstance().handleBlockLeftClick(player, hit);
            }
         }
      }
View Full Code Here

    *
    * @param player - The player that triggered the mouse button
    */
   private void checkRightButton(Player player) {
      if (Mouse.isButtonDown(1)) {
         Coordinate hit = null;
         if ((hit = player.trace(TRACE_RANGE)) != null) {
            WorldEditCommandSet.getCurrentInstance().handleRightClick(player);
            if (!hit.equals(right.get(player.getPlayerName()))) {
               right.put(player.getPlayerName(), hit);
               WorldEditCommandSet.getCurrentInstance().handleBlockRightClick(player, hit);
            }
         }
      }
View Full Code Here

TOP

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

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.