Examples of ZoneVolume


Examples of com.tommytony.war.volume.ZoneVolume

    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

Examples of com.tommytony.war.volume.ZoneVolume

    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

Examples of com.tommytony.war.volume.ZoneVolume

  public Warzone(World world, String name) {
    this.world = world;
    this.name = name;
    this.warzoneConfig = new WarzoneConfigBag(this);
    this.teamDefaultConfig = new TeamConfigBag()// don't use ctor with Warzone, as this changes config resolution
    this.volume = new ZoneVolume(name, this.getWorld(), this);
    this.lobbyMaterials = War.war.getWarhubMaterials().clone();
  }
View Full Code Here

Examples of com.tommytony.war.volume.ZoneVolume

   */
  public void setWall(BlockFace newWall) {
    this.createVolumeOrReset(this.warzone.getWorld())// when attached to the warzone, lobby is in same world
    this.wall = newWall;

    ZoneVolume zoneVolume = this.warzone.getVolume();
    this.calculateLobbyWidth();

    Block corner1 = null;
    Block corner2 = null;

    if (this.wall == Direction.NORTH()) {
      int wallStart = zoneVolume.getMinZ();
      int wallEnd = zoneVolume.getMaxZ();
      int x = zoneVolume.getMinX();
      int wallLength = wallEnd - wallStart + 1;
      int wallCenterPos = wallStart + wallLength / 2;
      int y = zoneVolume.getCenterY();
      this.lobbyMiddleWallBlock = this.warzone.getWorld().getBlockAt(x, y, wallCenterPos).getLocation();
      corner1 = this.warzone.getWorld().getBlockAt(x, y - 1, wallCenterPos + this.lobbyHalfSide);
      corner2 = this.warzone.getWorld().getBlockAt(x - this.lobbyDepth, y + 1 + this.lobbyHeight, wallCenterPos - this.lobbyHalfSide);
    } else if (this.wall == Direction.EAST()) {
      int wallStart = zoneVolume.getMinX();
      int wallEnd = zoneVolume.getMaxX();
      int z = zoneVolume.getMinZ();
      int wallLength = wallEnd - wallStart + 1;
      int wallCenterPos = wallStart + wallLength / 2;
      int y = zoneVolume.getCenterY();
      this.lobbyMiddleWallBlock = this.warzone.getWorld().getBlockAt(wallCenterPos, y, z).getLocation();
      corner1 = this.warzone.getWorld().getBlockAt(wallCenterPos - this.lobbyHalfSide, y - 1, z);
      corner2 = this.warzone.getWorld().getBlockAt(wallCenterPos + this.lobbyHalfSide, y + 1 + this.lobbyHeight, z - this.lobbyDepth);
    } else if (this.wall == Direction.SOUTH()) {
      int wallStart = zoneVolume.getMinZ();
      int wallEnd = zoneVolume.getMaxZ();
      int x = zoneVolume.getMaxX();
      int wallLength = wallEnd - wallStart + 1;
      int wallCenterPos = wallStart + wallLength / 2;
      int y = zoneVolume.getCenterY();
      this.lobbyMiddleWallBlock = this.warzone.getWorld().getBlockAt(x, y, wallCenterPos).getLocation();
      corner1 = this.warzone.getWorld().getBlockAt(x, y - 1, wallCenterPos - this.lobbyHalfSide);
      corner2 = this.warzone.getWorld().getBlockAt(x + this.lobbyDepth, y + 1 + this.lobbyHeight, wallCenterPos + this.lobbyHalfSide);
    } else if (this.wall == Direction.WEST()) {
      int wallStart = zoneVolume.getMinX();
      int wallEnd = zoneVolume.getMaxX();
      int z = zoneVolume.getMaxZ();
      int wallLength = wallEnd - wallStart + 1;
      int wallCenterPos = wallStart + wallLength / 2;
      int y = zoneVolume.getCenterY();
      this.lobbyMiddleWallBlock = this.warzone.getWorld().getBlockAt(wallCenterPos, y, z).getLocation();
      corner1 = this.warzone.getWorld().getBlockAt(wallCenterPos + this.lobbyHalfSide, y - 1, z);
      corner2 = this.warzone.getWorld().getBlockAt(wallCenterPos - this.lobbyHalfSide, y + 1 + this.lobbyHeight, z + this.lobbyDepth);
    }

View Full Code Here

Examples of com.tommytony.war.volume.ZoneVolume

      String lobbyStr = warzoneConfig.getString("lobby");

      warzoneConfig.close();

      if (createNewVolume) {
        ZoneVolume zoneVolume = new ZoneVolume(warzone.getName(), world, warzone); // VolumeMapper.loadZoneVolume(warzone.getName(), warzone.getName(), war, warzone.getWorld(), warzone);
        warzone.setVolume(zoneVolume);
      }

      // monument blocks
      for (Monument monument : warzone.getMonuments()) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.