Package org.bukkit

Examples of org.bukkit.Location


    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 se = new Location(worldMock, -64, 64, -64);

    // Act
    Location existingCorner1 = new Location(worldMock, 0, 64, 0);
    volume.setCornerOne(existingCorner1); // corner 1 already set
    volume.setSoutheast(se);
  }
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 se = new Location(worldMock, 64, 64, -64);

    // Act
    Location existingCorner2 = new Location(worldMock, 0, 64, 0);
    volume.setCornerTwo(existingCorner2); // corner 2 already set
    volume.setSoutheast(se);

    // Assert
    // first corner shouldn't move
    assertEquals(existingCorner2, volume.getCornerTwo());

    Location movedSe = new Location(worldMock, 64, 0, -64);
    assertEquals(movedSe, 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 se = new Location(worldMock, 64, 64, 64);

    // Act
    Location existingCorner2 = new Location(worldMock, 0, 64, 0);
    volume.setCornerTwo(existingCorner2); // corner 2 already set
    volume.setSoutheast(se);
  }
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 se = new Location(worldMock, -64, 64, -64);

    // Act
    Location existingCorner2 = new Location(worldMock, 0, 64, 0);
    volume.setCornerTwo(existingCorner2); // corner 2 already set
    volume.setSoutheast(se);
  }
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 se = new Location(worldMock, 64, 64, -64);

    // Act
    Location existingCorner1 = new Location(worldMock, -32, 32, 32); // nw
    volume.setCornerOne(existingCorner1); // corner 1 already set
    Location existingCorner2 = new Location(worldMock, 32, 96, -32); // se
    volume.setCornerTwo(existingCorner2); // corner 2 already set
    volume.setSoutheast(se);

    // Assert
    // first corner shouldn't move
    assertEquals(existingCorner1, volume.getCornerOne());

    // second corner should move but not along y
    Location movedTwo = new Location(worldMock, 64, 96, -64);
    assertEquals(movedTwo, volume.getCornerTwo());
  }
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 se = new Location(worldMock, 64, 64, -64);

    // Act
    Location existingCorner1 = new Location(worldMock, 32, 32, -32); // se
    volume.setCornerOne(existingCorner1); // corner 1 already set
    Location existingCorner2 = new Location(worldMock, -32, 96, 32); // nw
    volume.setCornerTwo(existingCorner2); // corner 2 already set
    volume.setSoutheast(se);

    // Assert
    // first corner should move but not along y
    Location movedOne = new Location(worldMock, 64, 32, -64);
    assertEquals(movedOne, volume.getCornerOne());

    // second corner shouldn't move
    assertEquals(existingCorner2, volume.getCornerTwo());
  }
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 se = new Location(worldMock, 64, 64, -64);

    // Act
    Location existingCorner1 = new Location(worldMock, -32, 32, -32); // ne
    volume.setCornerOne(existingCorner1); // corner 1 already set
    Location existingCorner2 = new Location(worldMock, 32, 96, 32); // sw
    volume.setCornerTwo(existingCorner2); // corner 2 already set
    volume.setSoutheast(se);

    // Assert
    // first corner should move along z but not along x or y
    Location movedOne = new Location(worldMock, -32, 32, -64);
    assertEquals(movedOne, volume.getCornerOne());

    // second corner should move along x but not along y or z
    Location movedTwo = new Location(worldMock, 64, 96, 32);
    assertEquals(movedTwo, volume.getCornerTwo());
  }
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 se = new Location(worldMock, 64, 64, -64);

    // Act
    Location existingCorner1 = new Location(worldMock, 32, 32, 32); // sw
    volume.setCornerOne(existingCorner1); // corner 1 already set
    Location existingCorner2 = new Location(worldMock, -32, 96, -32); // ne
    volume.setCornerTwo(existingCorner2); // corner 2 already set
    volume.setSoutheast(se);

    // Assert
    // first corner should move along x but not along y or z
    Location movedOne = new Location(worldMock, 64, 32, 32);
    assertEquals(movedOne, volume.getCornerOne());

    // second corner should move along z but not along x or y
    Location movedTwo = new Location(worldMock, -32, 96, -64);
    assertEquals(movedTwo, volume.getCornerTwo());
  }
View Full Code Here

  public boolean isOpponentSpawnPeripheryBlock(Team team, Block block) {
    for (Team maybeOpponent : this.getTeams()) {
      if (maybeOpponent != team) {
        for (Volume teamSpawnVolume : maybeOpponent.getSpawnVolumes().values()) {
          Volume periphery = new Volume(new Location(
              teamSpawnVolume.getWorld(),
              teamSpawnVolume.getMinX() - 1,
              teamSpawnVolume.getMinY() - 1,
              teamSpawnVolume.getMinZ() - 1), new Location(
              teamSpawnVolume.getWorld(),
              teamSpawnVolume.getMaxX() + 1,
              teamSpawnVolume.getMaxY() + 1,
              teamSpawnVolume.getMaxZ() + 1));
          if (periphery.contains(block)) {
View Full Code Here

    this.setLocation(location);
  }

  public void addCakeBlocks() {
    // make air (old two-high above floor)
    Volume airGap = new Volume(new Location(this.volume.getWorld(),
        this.volume.getCornerOne().getX(), this.volume.getCornerOne()
            .getY() + 1, this.volume.getCornerOne().getZ()),
        new Location(this.volume.getWorld(), this.volume.getCornerTwo()
            .getX(), this.volume.getCornerOne().getY() + 2,
            this.volume.getCornerTwo().getZ()));
    airGap.setToMaterial(Material.AIR);
   
    int x = this.location.getBlockX();
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.