mirror of
https://github.com/PryPurity/WorldBorder.git
synced 2024-11-21 11:25:42 +01:00
Cleaned it up a bit more, went back to 3x3 instead of 4 x 4
This commit is contained in:
parent
b53629e7cf
commit
c288b18afc
2
pom.xml
2
pom.xml
@ -3,7 +3,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.wimbli.WorldBorder</groupId>
|
||||
<artifactId>WorldBorder</artifactId>
|
||||
<version>2.0.6</version>
|
||||
<version>2.0.7</version>
|
||||
<name>WorldBorder</name>
|
||||
<url>https://github.com/PryPurity/WorldBorder</url>
|
||||
<issueManagement>
|
||||
|
@ -109,7 +109,7 @@ public class BorderData {
|
||||
safeOpenBlocks.add(Material.OAK_WALL_SIGN);
|
||||
safeOpenBlocks.add(Material.SPRUCE_SIGN);
|
||||
safeOpenBlocks.add(Material.SPRUCE_WALL_SIGN);
|
||||
} catch (NoSuchFieldError ex) {
|
||||
} catch (NoSuchFieldError ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
@ -390,10 +390,10 @@ public class BorderData {
|
||||
return safe;
|
||||
|
||||
Material below = world.getBlockAt(X, Y - 1, Z).getType();
|
||||
return (safe
|
||||
&& (!safeOpenBlocks.contains(below) || below == Material.WATER) // below target block not open/breathable (so presumably solid), or is water
|
||||
&& !painfulBlocks.contains(below) // below target block not painful
|
||||
);
|
||||
// below target block not open/breathable (so presumably solid), or is water
|
||||
// below target block not painful
|
||||
// below target block not painful
|
||||
return (!safeOpenBlocks.contains(below) || below == Material.WATER) && !painfulBlocks.contains(below);
|
||||
}
|
||||
|
||||
// find closest safe Y position from the starting position
|
||||
|
@ -96,8 +96,8 @@ public class Config {
|
||||
public static void setBorderCorners(String world, double x1, double z1, double x2, double z2, Boolean shapeRound, boolean wrap) {
|
||||
double radiusX = Math.abs(x1 - x2) / 2;
|
||||
double radiusZ = Math.abs(z1 - z2) / 2;
|
||||
double x = ((x1 < x2) ? x1 : x2) + radiusX;
|
||||
double z = ((z1 < z2) ? z1 : z2) + radiusZ;
|
||||
double x = (Math.min(x1, x2)) + radiusX;
|
||||
double z = (Math.min(z1, z2)) + radiusZ;
|
||||
setBorder(world, new BorderData(x, z, (int) Math.round(radiusX), (int) Math.round(radiusZ), shapeRound, wrap), true);
|
||||
}
|
||||
|
||||
@ -221,6 +221,7 @@ public class Config {
|
||||
return;
|
||||
|
||||
World world = loc.getWorld();
|
||||
assert world != null;
|
||||
world.playEffect(loc, Effect.ENDER_SIGNAL, 0);
|
||||
world.playEffect(loc, Effect.ENDER_SIGNAL, 0);
|
||||
world.playEffect(loc, Effect.SMOKE, 4);
|
||||
|
@ -3,13 +3,8 @@ package com.wimbli.WorldBorder;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import java.awt.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
import java.io.FileFilter;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
// image output stuff, for debugging method at bottom of this file
|
||||
@ -157,7 +152,6 @@ public class WorldFileData {
|
||||
}
|
||||
|
||||
regionChunkExistence.put(region, data);
|
||||
testImage(region, data);
|
||||
return data;
|
||||
}
|
||||
|
||||
@ -168,33 +162,6 @@ public class WorldFileData {
|
||||
notifyPlayer.sendMessage("[WorldData] " + text);
|
||||
}
|
||||
|
||||
// crude chunk map PNG image output, for debugging
|
||||
private void testImage(CoordXZ region, List<Boolean> data) {
|
||||
int width = 32;
|
||||
int height = 32;
|
||||
BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
|
||||
Graphics2D g2 = bi.createGraphics();
|
||||
int current = 0;
|
||||
g2.setColor(Color.BLACK);
|
||||
|
||||
for (int x = 0; x < 32; ++x) {
|
||||
for (int z = 0; z < 32; ++z) {
|
||||
if (data.get(current))
|
||||
g2.fillRect(x, z, x + 1, z + 1);
|
||||
current++;
|
||||
}
|
||||
}
|
||||
|
||||
File f = new File("region_" + region.x + "_" + region.z + "_.png");
|
||||
Config.log(f.getAbsolutePath());
|
||||
try {
|
||||
// png is an image format (like gif or jpg)
|
||||
ImageIO.write(bi, "png", f);
|
||||
} catch (IOException ex) {
|
||||
Config.log("[SEVERE]" + ex.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// file filter used for region files
|
||||
private static class ExtFileFilter implements FileFilter {
|
||||
String ext;
|
||||
|
@ -209,7 +209,7 @@ public class WorldFillTask implements Runnable {
|
||||
if (chunksProcessedLastTick > 0 || pendingChunks.size() > 0) {
|
||||
// Note we generally queue 3 chunks, so real numbers are 1/3 of chunksProcessedLastTick and pendingchunks.size
|
||||
// Trying 4 chunks
|
||||
int chunksExpectedToGetProcessed = (chunksProcessedLastTick - pendingChunks.size()) / 4 + 4;
|
||||
int chunksExpectedToGetProcessed = (chunksProcessedLastTick - pendingChunks.size()) / 3 + 3;
|
||||
if (chunksExpectedToGetProcessed < chunksToProcess)
|
||||
chunksToProcess = chunksExpectedToGetProcessed;
|
||||
}
|
||||
@ -542,8 +542,6 @@ public class WorldFillTask implements Runnable {
|
||||
// toggle "force loaded" flag on for chunk to prevent it from being unloaded while we need it
|
||||
world.setChunkForceLoaded(x, z, true);
|
||||
|
||||
// alternatively for 1.14.4+
|
||||
//world.addPluginChunkTicket(x, z, pluginInstance);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
name: WorldBorder
|
||||
authors: [Brettflan, PryPurity]
|
||||
description: Efficient, feature-rich plugin for limiting the size of your worlds.
|
||||
version: 2.0.6
|
||||
version: 2.0.7
|
||||
api-version: 1.13
|
||||
main: com.wimbli.WorldBorder.WorldBorder
|
||||
softdepend:
|
||||
|
Loading…
Reference in New Issue
Block a user