Package com.bergerkiller.bukkit.common

Examples of com.bergerkiller.bukkit.common.BlockLocation


    public boolean next() {
      if (!iter.hasNext()) {
        return true;
      }
      Block nextRail = iter.next();
      BlockLocation newNodeLocation;
      String newNodeName;
      boolean hasFinished = false;
      for (Block signblock : Util.getSignsFromRails(nextRail)) {
        SignActionEvent event = new SignActionEvent(signblock);
        if (event.getMode() != SignActionMode.NONE) {
          if (event.isType("tag", "switcher")){
            newNodeLocation = new BlockLocation(nextRail);
            newNodeName = newNodeLocation.toString();
          } else if (event.isType("destination")) {
            newNodeLocation = new BlockLocation(nextRail);
            newNodeName = event.getLine(2);
          } else if (event.isType("blocker") && event.isWatchedDirection(iter.currentDirection()) && event.isPowerAlwaysOn()) {
            hasFinished = true;
            break;
          } else {
View Full Code Here


  @Override
  public BlockLocation getLocation() {
    MinecartMember<?> member = this.getHolder();
    if (member != null) {
      return new BlockLocation(member.getEntity().getLocation().getBlock());
    } else {
      // Offline member?
      OfflineMember omember = OfflineGroupManager.findMember(this.getTrainProperties().getTrainName(), this.getUUID());
      if (omember == null) {
        return null;
      } else {
        // Find world
        World world = Bukkit.getWorld(omember.group.worldUUID);
        if (world == null) {
          return new BlockLocation("Unknown", omember.cx << 4, 0, omember.cz << 4);
        } else {
          return new BlockLocation(world, omember.cx << 4, 0, omember.cz << 4);
        }
      }
    }
  }
View Full Code Here

      //create from location
      return getOrCreate(event.getRails());
    }
  }
  public static PathNode getOrCreate(Block location) {
    return getOrCreate(new BlockLocation(location));
  }
View Full Code Here

  }
  public static PathNode getOrCreate(BlockLocation location) {
    return getOrCreate(location.toString(), location);
  }
  public static PathNode getOrCreate(final String name, Block location) {
    return getOrCreate(name, new BlockLocation(location));
  }
View Full Code Here

        nodes = new HashMap<String, PathNode>(count);
        blockNodes.clear();
        PathNode[] parr = new PathNode[count];
        for (int i = 0; i < count; i++) {
          String name = stream.readUTF();
          BlockLocation loc = new BlockLocation(stream.readUTF(), stream.readInt(), stream.readInt(), stream.readInt());
          if (name.isEmpty()) {
            name = loc.toString();
          }
          parr[i] = new PathNode(name, loc);
          parr[i].addToMapping();
        }
        //generating connections
View Full Code Here

    if (prop.hasDestination()) {
      message.newLine().yellow("This minecart will attempt to reach: ").white(prop.getDestination());
    }
    message.newLine().yellow("Players entering trains: ").white(prop.getPlayersEnter() ? "Allowed" : "Denied");
    message.newLine().yellow("Can be exited by players: ").white(prop.getPlayersExit());
    BlockLocation loc = prop.getLocation();
    if (loc != null) {
      message.newLine().yellow("Current location: ").white("[", loc.x, "/", loc.y, "/", loc.z, "] in world ", loc.world);
    }
  }
View Full Code Here

    } else if (cmd.equals("teleport") || cmd.equals("tp")) {
      Permission.COMMAND_TELEPORT.handle(p);
      if (!prop.restore()) {
        p.sendMessage(ChatColor.RED + "Train location could not be found: Train is lost");
      } else {
        BlockLocation bloc = prop.getLocation();
        World world = bloc.getWorld();
        if (world == null) {
          p.sendMessage(ChatColor.RED + "Train is on a world that is not loaded (" + bloc.world + ")");
        } else {
          EntityUtil.teleport(p, new Location(world, bloc.x + 0.5, bloc.y + 0.5, bloc.z + 0.5));
        }
View Full Code Here

    } else if (cmd.equals("teleport") || cmd.equals("tp")) {
      Permission.COMMAND_TELEPORT.handle(p);
      if (!prop.restore()) {
        p.sendMessage(ChatColor.RED + "Cart location could not be found: Cart is lost");
      } else {
        BlockLocation bloc = prop.getLocation();
        World world = bloc.getWorld();
        if (world == null) {
          p.sendMessage(ChatColor.RED + "Cart is on a world that is not loaded (" + bloc.world + ")");
        } else {
          EntityUtil.teleport(p, new Location(world, bloc.x + 0.5, bloc.y + 0.5, bloc.z + 0.5));
        }
View Full Code Here

        Player p = event.getPlayer();
        p.sendMessage(ChatColor.RED + "Another destination with the same name already exists!");
        p.sendMessage(ChatColor.RED + "Please remove either sign and use /train reroute to fix");

        // Send location message
        BlockLocation loc = node.location;
        StringBuilder locMsg = new StringBuilder(100);
        locMsg.append(ChatColor.RED).append("Other sign is ");
        if (loc.getWorld() != event.getPlayer().getWorld()) {
          locMsg.append("on world ").append(ChatColor.WHITE).append(node.location.world);
          locMsg.append(' ').append(ChatColor.RED);
        }
        locMsg.append("at ").append(ChatColor.WHITE);
        locMsg.append('[').append(loc.x).append('/').append(loc.y);
View Full Code Here

  public boolean remove(final String world, IntVector3 coord) {
    return this.remove(world, coord.x, coord.y, coord.z);
  }

  public boolean remove(final String world, final int x, final int y, final int z) {
    return super.remove(new BlockLocation(world, x, y, z));
  }
View Full Code Here

TOP

Related Classes of com.bergerkiller.bukkit.common.BlockLocation

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.