Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Refactored the regions api making it cleaner and more efficient. * Refactored naming scheme for skull api. * Updated version
- Loading branch information
Showing
31 changed files
with
601 additions
and
565 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
labyrinth-regions/src/main/java/com/github/sanctum/labyrinth/data/CuboidAxis.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package com.github.sanctum.labyrinth.data; | ||
|
||
public class CuboidAxis { | ||
|
||
private final int xMin; | ||
private final int xMax; | ||
private final int yMin; | ||
private final int yMax; | ||
private final int zMin; | ||
private final int zMax; | ||
private final int height; | ||
private final int zWidth; | ||
private final int xWidth; | ||
private final int totalSize; | ||
|
||
public CuboidAxis(int x1, int x2, int y1, int y2, int z1, int z2) { | ||
this.xMin = Math.min(x1, x2); | ||
this.xMax = Math.max(x1, x2); | ||
this.yMin = Math.min(y1, y2); | ||
this.yMax = Math.max(y1, y2); | ||
this.zMin = Math.min(z1, z2); | ||
this.zMax = Math.max(z1, z2); | ||
this.height = this.yMax - this.yMin + 1; | ||
this.xWidth = this.xMax - this.xMin + 1; | ||
this.zWidth = this.zMax - this.zMin + 1; | ||
this.totalSize = height * xWidth * zWidth; | ||
} | ||
|
||
public int getTotalSize() { | ||
return totalSize; | ||
} | ||
|
||
public int getHeight() { | ||
return height; | ||
} | ||
|
||
public int getxWidth() { | ||
return xWidth; | ||
} | ||
|
||
public int getzWidth() { | ||
return zWidth; | ||
} | ||
|
||
public int getxMax() { | ||
return xMax; | ||
} | ||
|
||
public int getxMin() { | ||
return xMin; | ||
} | ||
|
||
public int getyMax() { | ||
return yMax; | ||
} | ||
|
||
public int getyMin() { | ||
return yMin; | ||
} | ||
|
||
public int getzMax() { | ||
return zMax; | ||
} | ||
|
||
public int getzMin() { | ||
return zMin; | ||
} | ||
|
||
} |
34 changes: 34 additions & 0 deletions
34
labyrinth-regions/src/main/java/com/github/sanctum/labyrinth/data/CuboidLocation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.github.sanctum.labyrinth.data; | ||
|
||
import java.util.Random; | ||
import org.bukkit.Location; | ||
import org.bukkit.World; | ||
|
||
public class CuboidLocation { | ||
|
||
private final World world; | ||
private final CuboidAxis axis; | ||
private final Location center; | ||
|
||
public CuboidLocation(CuboidAxis axis, World world) { | ||
this.world = world; | ||
this.axis = axis; | ||
this.center = new Location(getWorld(), (double) (this.axis.getxMax() - this.axis.getxMin()) / 2 + this.axis.getxMin(), (double) (this.axis.getyMax() - this.axis.getyMin()) / 2 + this.axis.getyMin(), (double) (this.axis.getzMax() - this.axis.getzMin()) / 2 + this.axis.getzMin()); | ||
} | ||
|
||
public Location getCenter() { | ||
return center; | ||
} | ||
|
||
public Location getRandom() { | ||
Random r = new Random(); | ||
int x = r.nextInt(Math.abs(this.axis.getxMax() - this.axis.getxMin()) + 1) + this.axis.getxMin(); | ||
int y = r.nextInt(Math.abs(this.axis.getyMax() - this.axis.getyMin()) + 1) + this.axis.getyMin(); | ||
int z = r.nextInt(Math.abs(this.axis.getzMax() - this.axis.getzMin()) + 1) + this.axis.getzMin(); | ||
return new Location(getWorld(), x, y, z); | ||
} | ||
|
||
public World getWorld() { | ||
return world; | ||
} | ||
} |
Oops, something went wrong.