forked from SteamWar/SteamWar
Format code
This commit is contained in:
@@ -39,33 +39,33 @@ public class FightWorld {
|
||||
|
||||
private static final World world = Bukkit.getWorlds().get(0);
|
||||
|
||||
private static double posToChunk(int pos){
|
||||
private static double posToChunk(int pos) {
|
||||
return pos / 16.0;
|
||||
}
|
||||
|
||||
private static int getMinChunkX(){
|
||||
private static int getMinChunkX() {
|
||||
return (int) Math.floor(posToChunk(Config.ArenaMinX));
|
||||
}
|
||||
|
||||
private static int getMaxChunkX(){
|
||||
private static int getMaxChunkX() {
|
||||
return (int) Math.ceil(posToChunk(Config.ArenaMaxX));
|
||||
}
|
||||
|
||||
private static int getMinChunkZ(){
|
||||
private static int getMinChunkZ() {
|
||||
return (int) Math.floor(posToChunk(Config.ArenaMinZ));
|
||||
}
|
||||
|
||||
private static int getMaxChunkZ(){
|
||||
private static int getMaxChunkZ() {
|
||||
return (int) Math.ceil(posToChunk(Config.ArenaMaxZ));
|
||||
}
|
||||
|
||||
private static void forEachChunk(ObjIntConsumer<Integer> executor) {
|
||||
for(int x = getMinChunkX(); x <= getMaxChunkX(); x++)
|
||||
for(int z = getMinChunkZ(); z <= getMaxChunkZ(); z++)
|
||||
for (int x = getMinChunkX(); x <= getMaxChunkX(); x++)
|
||||
for (int z = getMinChunkZ(); z <= getMaxChunkZ(); z++)
|
||||
executor.accept(x, z);
|
||||
}
|
||||
|
||||
public static void resetWorld(){
|
||||
public static void resetWorld() {
|
||||
world.getEntities().stream().filter(entity -> entity.getType() != EntityType.PLAYER).forEach(Entity::remove);
|
||||
|
||||
World backup = new WorldCreator(world.getName() + "/backup").createWorld();
|
||||
@@ -84,7 +84,7 @@ public class FightWorld {
|
||||
worldChunk.heightmaps.clear();
|
||||
worldChunk.heightmaps.putAll(backupChunk.heightmaps);
|
||||
|
||||
for(Player p : Bukkit.getOnlinePlayers()) {
|
||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||
CraftbukkitWrapper.sendChunk(p, x, z);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user