Package org.bukkit

Examples of org.bukkit.Location


              return true;
            }
          }
          String foundWarpName = "";
          Integer numWarps = 0;
          Location l = null;
          ResultSet res = SQLManager.query_res("SELECT * FROM " + SQLManager.prefix + "warps WHERE (warp_name = ? OR warp_name LIKE ?)", warpForSQL, warpForSQL + "%");

          while (res.next()) {
            numWarps++;
            foundWarpName = res.getString("warp_name");
            // check if player is allowed to go to this warp
            if (!sender.hasPermission("cex.warp.any") && !res.getBoolean("is_public") && !res.getString("owner_name").equals(sName) && !sender.hasPermission("cex.warp." + foundWarpName)) {
              // player is not allowed in
              LogHelper.showWarning("warpNotAllowed", sender);
              return true;
            } else if (res.getString("owner_name").equals(sName) && !Permissions.checkPermEx(sender, "cex.warp.own")) {
              // the player is trying to warp to his own warp but doesn't have permissions
              LogHelper.showWarning("warpNotAllowed", sender);
              return true;
            }

            // assemble location for the warp point
            l = new Location(CommandsEX.plugin.getServer().getWorld(res.getString("world_name")), res.getDouble("x"), res.getDouble("y"), res.getDouble("z"), (float) res.getDouble("yaw"), (float) res.getDouble("pitch"));
            if (l.getWorld() == null){
              LogHelper.showInfo("warpWorldNotExist", sender, ChatColor.RED);
              return true;
            }

            // if the name matches exactly what we've been looking for, adjust numHomes and break the loop
View Full Code Here


                            }
                        } else {
                            target = player;
                        }

                        delayedTeleport(target, new Location(player.getWorld(), new Double(args[0]), new Double(args[1]), new Double(args[2])));

                        LogHelper.showInfo("tpLocMsgToTarget#####[" + args[0].toString() + " " + args[1].toString() + " " + args[2].toString(), sender, ChatColor.AQUA);
                        if (player != target){
                            LogHelper.showInfo("tpLocSuccess#####[" + target.getName() + " #####tpLocToCoords#####[" + args[0].toString() + " " + args[1].toString() + " " + args[2].toString(), sender, ChatColor.GREEN);
                        }
View Full Code Here

  }
 
  @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
  public void onEntityExplode(EntityExplodeEvent e){
    Entity entity = e.getEntity();
    Location loc = e.getLocation();
   
    // Check what entity caused the explosion, and is it set to block that kind of explosion in the config?
    if ((entity instanceof Creeper && CommandsEX.getConf().getBoolean("blockCreeperExplosions")) || (entity instanceof TNTPrimed && CommandsEX.getConf().getBoolean("blockTNTExplosions")) || ((entity instanceof Fireball || entity instanceof SmallFireball) && CommandsEX.getConf().getBoolean("blockFireballExplosions"))){
      // Clear the blocks the explosion will break
      e.blockList().clear();
      // Create the fancy explosion particles
      loc.getWorld().createExplosion(loc, 0);
    }
   
  }
View Full Code Here

      LogHelper.showInfo("mobsLimit", sender, ChatColor.RED);
      amount = limit;
    }
   
    for (int i = 0; i < amount; i++){
      Location location = player.getTargetBlock(null, 50).getLocation();
      location.setY(location.getY() + 1);
      Entity entity = player.getWorld().spawnEntity(location, toSpawn);
     
      if (type != null){
        if (type.equalsIgnoreCase("baby")){
          Ageable ageable = (Ageable) entity;
View Full Code Here

      if (Utils.checkCommandSpam(player, "cex_platform")){
        return true;
      }

      Location loc = (player.getLocation());

      // Subtract the Y coords by 1 to get the block at the players feet
      loc.setY(loc.getY() - 1);

      // If there are no args then set the block below to stone
      if (args.length == 0) {
        // Check if there is already a block below the player
        if (loc.getBlock().getTypeId() == 0) {
          LogHelper.showInfo("platformCreated", player, ChatColor.GREEN);
          loc.getBlock().setType(Material.STONE);
        } else {
          LogHelper.showInfo("platformBlockBelow", player, ChatColor.RED);
        }
      } else if (args.length == 1) {
        if (loc.getBlock().getTypeId() == 0) {
          List <Material> list = ClosestMatches.material(args[0]);

          // If the list is empty then display an error messages
          if (list.size() == 0) {
            LogHelper.showInfo("platformBlockNotFound", player, ChatColor.RED);

            // If the list has one match then set the block to that
          } else if (list.size() == 1) {
            // Check the player has permission to use the block specified
            if (player.hasPermission("cex.platform.block." + list.get(0).getId())){
              if (list.get(0).isBlock()){
                loc.getBlock().setType(list.get(0));
                LogHelper.showInfo("platformCreated", player, ChatColor.GREEN);
              } else {
                LogHelper.showInfo("platformNotBlock", player, ChatColor.RED);
              }
            } else {
View Full Code Here

    {
      Util.sendInvalid(cmd, args);
      return;
    }
   
    Location loc = null;
    Player player = (Player) CommandManager.getSender();
   
    if(args[1].equalsIgnoreCase("hpos1"))
    {
      loc = player.getTargetBlock(null, 100).getLocation();
      Util.sendSuccess ("First point selected (" + loc.getBlockX() + ", " + loc.getBlockY() + ", " + loc.getBlockZ() + ")");
      CommandManager.setLocation(loc, 0);
    }
    else if(args[1].equalsIgnoreCase("pos1"))
    {
      loc = player.getLocation();
      Util.sendSuccess ("First point selected (" + loc.getBlockX() + ", " + loc.getBlockY() + ", " + loc.getBlockZ() + ")");
      CommandManager.setLocation(loc, 0);
    }
    else if(args[1].equalsIgnoreCase("hpos2"))
    {
      loc = player.getTargetBlock(null, 100).getLocation();
      Util.sendSuccess ("Second point selected (" + loc.getBlockX() + ", " + loc.getBlockY() + ", " + loc.getBlockZ() + ")");
      CommandManager.setLocation(loc, 1);
    }
    else if(args[1].equalsIgnoreCase("pos2"))
    {
      loc = player.getLocation();
      Util.sendSuccess ("Second point selected (" + loc.getBlockX() + ", " + loc.getBlockY() + ", " + loc.getBlockZ() + ")");
      CommandManager.setLocation(loc, 1);
    }
    else
    {
      Util.sendInvalid(cmd, args);
View Full Code Here

    when(worldMock.getMaxHeight()).thenReturn(256);
    Warzone zoneMock = mock(Warzone.class);
    when(zoneMock.getTeams()).thenReturn(new ArrayList<Team>());
    when(zoneMock.getMonuments()).thenReturn(new ArrayList<Monument>());
    ZoneVolume volume = new ZoneVolume("test", worldMock, zoneMock);
    Location nw = new Location(worldMock, 0, 64, 0);

    // Act
    volume.setNorthwest(nw);

    // Assert
    Location movedOne = new Location(worldMock, 0, 256, 0);
    assertEquals(movedOne, volume.getCornerOne());
  }
View Full Code Here

    World worldMock = mock(World.class);
    Warzone zoneMock = mock(Warzone.class);
    when(zoneMock.getTeams()).thenReturn(new ArrayList<Team>());
    when(zoneMock.getMonuments()).thenReturn(new ArrayList<Monument>());
    ZoneVolume volume = new ZoneVolume("test", worldMock, zoneMock);
    Location nw = new Location(worldMock, -64, 64, -64);

    // Act
    Location existingCorner2 = new Location(worldMock, 0, 64, 0);
    volume.setCornerTwo(existingCorner2); // corner 2 already set
    volume.setNorthwest(nw);
  }
View Full Code Here

    World worldMock = mock(World.class);
    Warzone zoneMock = mock(Warzone.class);
    when(zoneMock.getTeams()).thenReturn(new ArrayList<Team>());
    when(zoneMock.getMonuments()).thenReturn(new ArrayList<Monument>());
    ZoneVolume volume = new ZoneVolume("test", worldMock, zoneMock);
    Location nw = new Location(worldMock, 64, 64, 64);

    // Act
    Location existingCorner2 = new Location(worldMock, 0, 64, 0);
    volume.setCornerTwo(existingCorner2); // corner 2 already set
    volume.setNorthwest(nw);
  }
View Full Code Here

    World worldMock = mock(World.class);
    Warzone zoneMock = mock(Warzone.class);
    when(zoneMock.getTeams()).thenReturn(new ArrayList<Team>());
    when(zoneMock.getMonuments()).thenReturn(new ArrayList<Monument>());
    ZoneVolume volume = new ZoneVolume("test", worldMock, zoneMock);
    Location nw = new Location(worldMock, -5, 64, 5);

    // Act
    Location existingCorner2 = new Location(worldMock, 0, 64, 0);
    volume.setCornerTwo(existingCorner2); // corner 2 already set
    volume.setNorthwest(nw);
  }
View Full Code Here

TOP

Related Classes of org.bukkit.Location

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.