-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from Realizedd/dev
Release v1.2.0 - New Reset Mode & Bug FIxes
- Loading branch information
Showing
33 changed files
with
977 additions
and
591 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
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
38 changes: 38 additions & 0 deletions
38
arenaregen/src/main/java/me/realized/de/arenaregen/util/BlockUtil.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,38 @@ | ||
package me.realized.de.arenaregen.util; | ||
|
||
import java.util.function.Consumer; | ||
|
||
import org.bukkit.Location; | ||
import org.bukkit.block.Block; | ||
import org.bukkit.block.BlockFace; | ||
|
||
public final class BlockUtil { | ||
|
||
public static boolean isSurrounded(final Block block) { | ||
final Block east = block.getRelative(BlockFace.EAST); | ||
final Block west = block.getRelative(BlockFace.WEST); | ||
final Block south = block.getRelative(BlockFace.SOUTH); | ||
final Block north = block.getRelative(BlockFace.NORTH); | ||
final Block up = block.getRelative(BlockFace.UP); | ||
final Block down = block.getRelative(BlockFace.DOWN); | ||
return !east.getType().isTransparent() | ||
&& !west.getType().isTransparent() | ||
&& !up.getType().isTransparent() | ||
&& !down.getType().isTransparent() | ||
&& !south.getType().isTransparent() | ||
&& !north.getType().isTransparent(); | ||
} | ||
|
||
public static void runForCuboid(final Location min, final Location max, final Consumer<Block> consumer) { | ||
for (int x = min.getBlockX(); x <= max.getBlockX(); x++) { | ||
for (int y = min.getBlockY(); y <= max.getBlockY(); y++) { | ||
for (int z = min.getBlockZ(); z <= max.getBlockZ(); z++) { | ||
consumer.accept(min.getWorld().getBlockAt(x, y, z)); | ||
} | ||
} | ||
} | ||
} | ||
|
||
private BlockUtil() {} | ||
|
||
} |
40 changes: 40 additions & 0 deletions
40
arenaregen/src/main/java/me/realized/de/arenaregen/util/ChunkLoc.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,40 @@ | ||
package me.realized.de.arenaregen.util; | ||
|
||
import java.util.Objects; | ||
|
||
import org.bukkit.Chunk; | ||
|
||
import lombok.Getter; | ||
|
||
public class ChunkLoc { | ||
|
||
@Getter | ||
private final int x, z; | ||
|
||
public ChunkLoc(final int x, final int z) { | ||
this.x = x; | ||
this.z = z; | ||
} | ||
|
||
public ChunkLoc(final Chunk chunk) { | ||
this(chunk.getX(), chunk.getZ()); | ||
} | ||
|
||
@Override | ||
public boolean equals(final Object o) { | ||
if (this == o) { return true; } | ||
if (o == null || getClass() != o.getClass()) { return false; } | ||
final ChunkLoc chunkLoc = (ChunkLoc) o; | ||
return x == chunkLoc.x && z == chunkLoc.z; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(x, z); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "{" + x + "," + z + "}"; | ||
} | ||
} |
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
Oops, something went wrong.