Merge pull request #13 from Mathe172/master

Support for elliptic and rectangular border shapes
This commit is contained in:
Brett Flannigan 2013-03-27 19:20:00 -07:00
commit 103d9941be
8 changed files with 184 additions and 95 deletions

View File

@ -13,7 +13,8 @@ public class BorderData
// the main data interacted with
private double x = 0;
private double z = 0;
private int radius = 0;
private int radiusX = 0;
private int radiusZ = 0;
private Boolean shapeRound = null;
// some extra data kept handy for faster border checks
@ -21,28 +22,33 @@ public class BorderData
private double minX;
private double maxZ;
private double minZ;
private double radiusSquared;
private double DefiniteSquare;
private double radiusXSquared;
private double radiusZSquared;
private double DefiniteRectangleX;
private double DefiniteRectangleZ;
private double radiusSquaredQuotient;
public BorderData(double x, double z, int radius)
public BorderData(double x, double z, int radiusX, int radiusZ)
{
setData(x, z, radius, null);
setData(x, z, radiusX, radiusZ , null);
}
public BorderData(double x, double z, int radius, Boolean shapeRound)
public BorderData(double x, double z, int radiusX, int radiusZ, Boolean shapeRound)
{
setData(x, z, radius, shapeRound);
setData(x, z, radiusX, radiusZ, shapeRound);
}
public final void setData(double x, double z, int radius, Boolean shapeRound)
public final void setData(double x, double z, int radiusX, int radiusZ, Boolean shapeRound)
{
this.x = x;
this.z = z;
this.shapeRound = shapeRound;
this.setRadius(radius);
this.setRadiusX(radiusX);
this.setRadiusZ(radiusZ);
}
public BorderData copy()
{
return new BorderData(x, z, radius, shapeRound);
return new BorderData(x, z, radiusX, radiusZ, shapeRound);
}
public double getX()
@ -52,8 +58,8 @@ public class BorderData
public void setX(double x)
{
this.x = x;
this.maxX = x + radius;
this.minX = x - radius;
this.maxX = x + radiusX;
this.minX = x - radiusX;
}
public double getZ()
{
@ -62,22 +68,34 @@ public class BorderData
public void setZ(double z)
{
this.z = z;
this.maxZ = z + radius;
this.minZ = z - radius;
this.maxZ = z + radiusZ;
this.minZ = z - radiusZ;
}
public int getRadius()
public int getRadiusX()
{
return radius;
return radiusX;
}
public void setRadius(int radius)
public int getRadiusZ()
{
this.radius = radius;
this.maxX = x + radius;
this.minX = x - radius;
this.maxZ = z + radius;
this.minZ = z - radius;
this.radiusSquared = (double)radius * (double)radius;
this.DefiniteSquare = Math.sqrt(.5 * this.radiusSquared);
return radiusZ;
}
public void setRadiusX(int radiusX)
{
this.radiusX = radiusX;
this.maxX = x + radiusX;
this.minX = x - radiusX;
this.radiusXSquared = (double)radiusX * (double)radiusX;
this.radiusSquaredQuotient = this.radiusXSquared / this.radiusZSquared;
this.DefiniteRectangleX = Math.sqrt(.5 * this.radiusXSquared);
}
public void setRadiusZ(int radiusZ)
{
this.radiusZ = radiusZ;
this.maxZ = z + radiusZ;
this.minZ = z - radiusZ;
this.radiusZSquared = (double)radiusZ * (double)radiusZ;
this.radiusSquaredQuotient = this.radiusXSquared / this.radiusZSquared;
this.DefiniteRectangleZ = Math.sqrt(.5 * this.radiusZSquared);
}
public Boolean getShape()
@ -92,7 +110,7 @@ public class BorderData
@Override
public String toString()
{
return "radius " + radius + " at X: " + Config.coord.format(x) + " Z: " + Config.coord.format(z) + (shapeRound != null ? (" (shape override: " + (shapeRound.booleanValue() ? "round" : "square") + ")") : "");
return "radius " + radiusX + "-" + radiusZ + " at X: " + Config.coord.format(x) + " Z: " + Config.coord.format(z) + (shapeRound != null ? (" (shape override: " + (shapeRound.booleanValue() ? "round" : "square") + ")") : "");
}
// This algorithm of course needs to be fast, since it will be run very frequently
@ -113,11 +131,11 @@ public class BorderData
double X = Math.abs(x - xLoc);
double Z = Math.abs(z - zLoc);
if (X < DefiniteSquare && Z < DefiniteSquare)
if (X < DefiniteRectangleX && Z < DefiniteRectangleZ)
return true; // Definitely inside
else if (X >= radius || Z >= radius)
else if (X >= radiusX || Z >= radiusZ) //I'm not sure about this one...the chance that a player is totally outside the rectangle around the ellipse is only given if he teleports, and that shouldn't be that frequently
return false; // Definitely outside
else if (X * X + Z * Z < radiusSquared)
else if (X * X + Z * Z * radiusSquaredQuotient < radiusXSquared)
return true; // After further calculation, inside
else
return false; // Apparently outside, then
@ -159,11 +177,22 @@ public class BorderData
else
{
// algorithm from: http://stackoverflow.com/questions/300871/best-way-to-find-a-point-on-a-circle-closest-to-a-given-point
double vX = xLoc - x;
double vZ = zLoc - z;
double magV = Math.sqrt(vX*vX + vZ*vZ);
xLoc = x + vX / magV * (radius - Config.KnockBack());
zLoc = z + vZ / magV * (radius - Config.KnockBack());
//double vX = xLoc - x;
//double vZ = zLoc - z;
//double magV = Math.sqrt(vX*vX / radiusXSquared + vZ*vZ / radiusZSquared);
//xLoc = x + vX / (radiusX * magV) * (radiusX - Config.KnockBack());
//zLoc = z + vZ / (radiusZ * magV) * (radiusZ - Config.KnockBack());
//Transform the ellipse to a circle with radius 1 (we need to transform the point the same way)
double dX = xLoc - x;
double dZ = zLoc - z;
double dU = Math.sqrt(dX *dX + dZ * dZ); //distance of the untransformed point from the center
double dT = Math.sqrt(dX *dX / radiusXSquared + dZ * dZ / radiusZSquared); //distance of the transformed point from the center
double f = (1 / dT - Config.KnockBack() / dU); //"correction" factor for the distances
xLoc = x + dX * f;
zLoc = z + dZ * f;
}
int ixLoc = Location.locToBlock(xLoc);
@ -244,12 +273,12 @@ public class BorderData
return false;
BorderData test = (BorderData)obj;
return test.x == this.x && test.z == this.z && test.radius == this.radius;
return test.x == this.x && test.z == this.z && test.radiusX == this.radiusX && test.radiusZ == this.radiusZ;
}
@Override
public int hashCode()
{
return (((int)(this.x * 10) << 4) + (int)this.z + (this.radius << 2));
return (((int)(this.x * 10) << 4) + (int)this.z + (this.radiusX << 2));
}
}

View File

@ -56,15 +56,16 @@ public class Config
save(true);
DynMapFeatures.showBorder(world, border);
}
public static void setBorder(String world, int radius, double x, double z, Boolean shapeRound)
public static void setBorder(String world, int radiusX, int radiusZ, double x, double z, Boolean shapeRound)
{
setBorder(world, new BorderData(x, z, radius, shapeRound));
setBorder(world, new BorderData(x, z, radiusX, radiusZ, shapeRound));
}
public static void setBorder(String world, int radius, double x, double z)
public static void setBorder(String world, int radiusX, int radiusZ, double x, double z)
{
BorderData old = Border(world);
Boolean oldShape = (old == null) ? null : old.getShape();
setBorder(world, new BorderData(x, z, radius, oldShape));
setBorder(world, new BorderData(x, z, radiusX, radiusZ, oldShape));
}
public static void removeBorder(String world)
@ -130,7 +131,7 @@ public class Config
public static void setShape(boolean round)
{
shapeRound = round;
Log("Set default border shape to " + (round ? "round" : "square") + ".");
Log("Set default border shape to " + (round ? "elliptic" : "rectangular") + ".");
save(true);
DynMapFeatures.showAllBorders();
}
@ -361,7 +362,7 @@ public class Config
timerTicks = cfg.getInt("timer-delay-ticks", 5);
dynmapEnable = cfg.getBoolean("dynmap-border-enabled", true);
dynmapMessage = cfg.getString("dynmap-border-message", "The border of the world.");
LogConfig("Using " + (shapeRound ? "round" : "square") + " border, knockback of " + knockBack + " blocks, and timer delay of " + timerTicks + ".");
LogConfig("Using " + (shapeRound ? "elliptic" : "rectangular") + " border, knockback of " + knockBack + " blocks, and timer delay of " + timerTicks + ".");
StartBorderTimer();
@ -389,7 +390,7 @@ public class Config
worldName = worldName.replace("<", ".");
Boolean overrideShape = (Boolean) bord.get("shape-round");
BorderData border = new BorderData(bord.getDouble("x", 0), bord.getDouble("z", 0), bord.getInt("radius", 0), overrideShape);
BorderData border = new BorderData(bord.getDouble("x", 0), bord.getDouble("z", 0), bord.getInt("radiusX", 0), bord.getInt("radiusZ", 0), overrideShape);
borders.put(worldName, border);
LogConfig(BorderDescription(worldName));
}
@ -446,7 +447,8 @@ public class Config
cfg.set("worlds." + name + ".x", bord.getX());
cfg.set("worlds." + name + ".z", bord.getZ());
cfg.set("worlds." + name + ".radius", bord.getRadius());
cfg.set("worlds." + name + ".radiusX", bord.getRadiusX());
cfg.set("worlds." + name + ".radiusZ", bord.getRadiusZ());
if (bord.getShape() != null)
cfg.set("worlds." + name + ".shape-round", bord.getShape());

View File

@ -178,7 +178,7 @@ public class DynMapFeatures
CircleMarker marker = roundBorders.get(worldName);
if (marker == null)
{
marker = markSet.createCircleMarker("worldborder_"+worldName, Config.DynmapMessage(), false, worldName, border.getX(), 64.0, border.getZ(), border.getRadius(), border.getRadius(), true);
marker = markSet.createCircleMarker("worldborder_"+worldName, Config.DynmapMessage(), false, worldName, border.getX(), 64.0, border.getZ(), border.getRadiusX(), border.getRadiusZ(), true);
marker.setLineStyle(lineWeight, lineOpacity, lineColor);
marker.setFillStyle(0.0, 0x000000);
roundBorders.put(worldName, marker);
@ -186,7 +186,7 @@ public class DynMapFeatures
else
{
marker.setCenter(worldName, border.getX(), 64.0, border.getZ());
marker.setRadius(border.getRadius(), border.getRadius());
marker.setRadius(border.getRadiusX(), border.getRadiusZ());
}
}
@ -196,8 +196,8 @@ public class DynMapFeatures
removeBorder(worldName);
// corners of the square border
double[] xVals = {border.getX() - border.getRadius(), border.getX() + border.getRadius()};
double[] zVals = {border.getZ() - border.getRadius(), border.getZ() + border.getRadius()};
double[] xVals = {border.getX() - border.getRadiusX(), border.getX() + border.getRadiusX()};
double[] zVals = {border.getZ() - border.getRadiusZ(), border.getZ() + border.getRadiusZ()};
AreaMarker marker = squareBorders.get(worldName);
if (marker == null)

View File

@ -71,7 +71,7 @@ public class WBCommand implements CommandExecutor
}
// "set" command from player or console, world specified
if (split.length == 5 && split[1].equalsIgnoreCase("set"))
if (split.length == 6 && split[1].equalsIgnoreCase("set"))
{
if (!Config.HasPermission(player, "set")) return true;
@ -84,7 +84,7 @@ public class WBCommand implements CommandExecutor
}
// "set" command from player, using current world, X and Z specified
else if (split.length == 4 && split[0].equalsIgnoreCase("set") && player != null)
else if (split.length == 5 && split[0].equalsIgnoreCase("set") && player != null)
{
if (!Config.HasPermission(player, "set")) return true;
@ -95,7 +95,7 @@ public class WBCommand implements CommandExecutor
}
// "set" command from player, using current world, X and Z NOT specified
else if (split.length == 2 && split[0].equalsIgnoreCase("set") && player != null)
else if (split.length == 3 && split[0].equalsIgnoreCase("set") && player != null)
{
if (!Config.HasPermission(player, "set")) return true;
@ -103,23 +103,25 @@ public class WBCommand implements CommandExecutor
double x = player.getLocation().getX();
double z = player.getLocation().getZ();
int radius;
int radiusX;
int radiusZ;
try
{
radius = Integer.parseInt(split[1]);
radiusX = Integer.parseInt(split[1]);
radiusZ = Integer.parseInt(split[2]);
}
catch(NumberFormatException ex)
{
sender.sendMessage(clrErr + "The radius value must be an integer.");
sender.sendMessage(clrErr + "The radius values must be integers.");
return true;
}
Config.setBorder(world, radius, x, z);
Config.setBorder(world, radiusX, radiusZ, x, z);
sender.sendMessage("Border has been set. " + Config.BorderDescription(world));
}
// "radius" command from player or console, world specified
else if (split.length == 3 && split[1].equalsIgnoreCase("radius"))
else if (split.length == 4 && split[1].equalsIgnoreCase("radius"))
{
if (!Config.HasPermission(player, "radius")) return true;
@ -134,25 +136,27 @@ public class WBCommand implements CommandExecutor
double x = border.getX();
double z = border.getZ();
int radius;
int radiusX;
int radiusZ;
try
{
radius = Integer.parseInt(split[2]);
radiusX = Integer.parseInt(split[2]);
radiusZ = Integer.parseInt(split[3]);
}
catch(NumberFormatException ex)
{
sender.sendMessage(clrErr + "The radius value must be an integer.");
sender.sendMessage(clrErr + "The radius values must be integers.");
return true;
}
Config.setBorder(world, radius, x, z);
Config.setBorder(world, radiusX, radiusZ, x, z);
if (player != null)
sender.sendMessage("Radius has been set. " + Config.BorderDescription(world));
}
// "radius" command from player, using current world
else if (split.length == 2 && split[0].equalsIgnoreCase("radius") && player != null)
else if (split.length == 3 && split[0].equalsIgnoreCase("radius") && player != null)
{
if (!Config.HasPermission(player, "radius")) return true;
@ -167,18 +171,20 @@ public class WBCommand implements CommandExecutor
double x = border.getX();
double z = border.getZ();
int radius;
int radiusX;
int radiusZ;
try
{
radius = Integer.parseInt(split[1]);
radiusX = Integer.parseInt(split[2]);
radiusZ = Integer.parseInt(split[3]);
}
catch(NumberFormatException ex)
{
sender.sendMessage(clrErr + "The radius value must be an integer.");
sender.sendMessage(clrErr + "The radius values must be integers.");
return true;
}
Config.setBorder(world, radius, x, z);
Config.setBorder(world, radiusX, radiusZ, x, z);
sender.sendMessage("Radius has been set. " + Config.BorderDescription(world));
}
@ -234,7 +240,7 @@ public class WBCommand implements CommandExecutor
{
if (!Config.HasPermission(player, "list")) return true;
sender.sendMessage("Default border shape for all worlds is \"" + (Config.ShapeRound() ? "round" : "square") + "\".");
sender.sendMessage("Default border shape for all worlds is \"" + (Config.ShapeRound() ? "elliptic" : "rectangular") + "\".");
Set<String> list = Config.BorderDescriptions();
@ -256,18 +262,18 @@ public class WBCommand implements CommandExecutor
{
if (!Config.HasPermission(player, "shape")) return true;
if (split[1].equalsIgnoreCase("square"))
if (split[1].equalsIgnoreCase("rectangular"))
Config.setShape(false);
else if (split[1].equalsIgnoreCase("round"))
else if (split[1].equalsIgnoreCase("elliptic"))
Config.setShape(true);
else
{
sender.sendMessage("You must specify a shape of \"round\" or \"square\".");
sender.sendMessage("You must specify a shape of \"elliptic\" or \"rectangular\".");
return true;
}
if (player != null)
sender.sendMessage("Default border shape for all worlds is now set to \"" + (Config.ShapeRound() ? "round" : "square") + "\".");
sender.sendMessage("Default border shape for all worlds is now set to \"" + (Config.ShapeRound() ? "elliptic" : "rectangular") + "\".");
}
// "getmsg" command from player or console
@ -412,16 +418,16 @@ public class WBCommand implements CommandExecutor
}
Boolean shape = null;
if (split[2].equalsIgnoreCase("square"))
if (split[2].equalsIgnoreCase("rectangular"))
shape = false;
else if (split[2].equalsIgnoreCase("round"))
else if (split[2].equalsIgnoreCase("elliptic"))
shape = true;
border.setShape(shape);
Config.setBorder(world, border);
if (player != null)
sender.sendMessage("Border shape for world \"" + world + "\" is now set to \"" + (shape == null ? "default" : (shape.booleanValue() ? "round" : "square")) + "\".");
sender.sendMessage("Border shape for world \"" + world + "\" is now set to \"" + (shape == null ? "default" : (shape.booleanValue() ? "elliptic" : "rectangular")) + "\".");
}
// "wshape" command from player, using current world
@ -438,15 +444,15 @@ public class WBCommand implements CommandExecutor
}
Boolean shape = null;
if (split[1].equalsIgnoreCase("square"))
if (split[1].equalsIgnoreCase("rectangular"))
shape = false;
else if (split[1].equalsIgnoreCase("round"))
else if (split[1].equalsIgnoreCase("elliptic"))
shape = true;
border.setShape(shape);
Config.setBorder(world, border);
sender.sendMessage("Border shape for world \"" + world + "\" is now set to \"" + (shape == null ? "default" : (shape.booleanValue() ? "round" : "square")) + "\".");
sender.sendMessage("Border shape for world \"" + world + "\" is now set to \"" + (shape == null ? "default" : (shape.booleanValue() ? "elliptic" : "rectangular")) + "\".");
}
// "fill" command from player or console, world specified
@ -652,13 +658,13 @@ public class WBCommand implements CommandExecutor
if (page == 0 || page == 1)
{
if (player != null)
sender.sendMessage(cmd+" set " + clrReq + "<radius>" + clrDesc + " - set world border, centered on you.");
sender.sendMessage(cmdW+" set " + clrReq + "<radius> <x> <z>" + clrDesc + " - set world border.");
sender.sendMessage(cmdW+" radius " + clrReq + "<radius>" + clrDesc + " - change a border radius.");
sender.sendMessage(cmd+" set " + clrReq + "<radiusX> <radiusZ>" + clrDesc + " - set world border, centered on you.");
sender.sendMessage(cmdW+" set " + clrReq + "<radiusX> <radiusZ> <x> <z>" + clrDesc + " - set world border.");
sender.sendMessage(cmdW+" radius " + clrReq + "<radiusX> <radiusZ>" + clrDesc + " - change a border radius.");
sender.sendMessage(cmdW+" clear" + clrDesc + " - remove border for this world.");
sender.sendMessage(cmd+" clear all" + clrDesc + " - remove border for all worlds.");
sender.sendMessage(cmd+" list" + clrDesc + " - show border information for all worlds.");
sender.sendMessage(cmd+" shape " + clrReq + "<round|square>" + clrDesc + " - set the default border shape.");
sender.sendMessage(cmd+" shape " + clrReq + "<elliptic|rectangular>" + clrDesc + " - set the default border shape.");
sender.sendMessage(cmd+" knockback " + clrReq + "<distance>" + clrDesc + " - how far to move the player back.");
if (page == 1)
sender.sendMessage(cmd+" 2" + clrDesc + " - view second page of commands.");
@ -668,7 +674,7 @@ public class WBCommand implements CommandExecutor
sender.sendMessage(cmdW+" fill " + clrOpt + "[freq] [pad]" + clrDesc + " - generate world out to border.");
sender.sendMessage(cmdW+" trim " + clrOpt + "[freq] [pad]" + clrDesc + " - trim world outside of border.");
sender.sendMessage(cmd+" bypass " + ((player == null) ? clrReq + "<player>" : clrOpt + "[player]") + clrOpt + " [on/off]" + clrDesc + " - let player go beyond border.");
sender.sendMessage(cmd+" wshape " + ((player == null) ? clrReq + "<world>" : clrOpt + "[world]") + clrReq + " <round|square|default>" + clrDesc + " - shape override.");
sender.sendMessage(cmd+" wshape " + ((player == null) ? clrReq + "<world>" : clrOpt + "[world]") + clrReq + " <elliptic|rectangular|default>" + clrDesc + " - shape override.");
sender.sendMessage(cmd+" getmsg" + clrDesc + " - display border message.");
sender.sendMessage(cmd+" setmsg " + clrReq + "<text>" + clrDesc + " - set border message.");
sender.sendMessage(cmd+" whoosh " + clrReq + "<on|off>" + clrDesc + " - turn knockback effect on or off.");
@ -708,21 +714,22 @@ public class WBCommand implements CommandExecutor
private boolean cmdSet(CommandSender sender, String world, String[] data, int offset)
{
int radius;
int radiusX, radiusZ;
double x, z;
try
{
radius = Integer.parseInt(data[offset]);
x = Double.parseDouble(data[offset+1]);
z = Double.parseDouble(data[offset+2]);
radiusX = Integer.parseInt(data[offset]);
radiusZ = Integer.parseInt(data[offset+1]);
x = Double.parseDouble(data[offset+2]);
z = Double.parseDouble(data[offset+3]);
}
catch(NumberFormatException ex)
{
sender.sendMessage(clrErr + "The radius value must be an integer and the x and z values must be numerical.");
sender.sendMessage(clrErr + "The radius values must be integers and the x and z values must be numerical.");
return false;
}
Config.setBorder(world, radius, x, z);
Config.setBorder(world, radiusX, radiusZ, x, z);
return true;
}

View File

@ -89,13 +89,21 @@ public class WorldFillTask implements Runnable
return;
}
this.border.setRadius(border.getRadius() + fillDistance);
this.border.setRadiusX(border.getRadiusX() + fillDistance);
this.border.setRadiusZ(border.getRadiusZ() + fillDistance);
this.x = CoordXZ.blockToChunk((int)border.getX());
this.z = CoordXZ.blockToChunk((int)border.getZ());
int chunkWidth = (int) Math.ceil((double)((border.getRadius() + 16) * 2) / 16);
this.reportTarget = (chunkWidth * chunkWidth) + chunkWidth + 1;
int chunkWidthX = (int) Math.ceil((double)((border.getRadiusX() + 16) * 2) / 16);
int chunkWidthZ = (int) Math.ceil((double)((border.getRadiusZ() + 16) * 2) / 16);
int biggerWidth = (chunkWidthX > chunkWidthZ) ? chunkWidthX : chunkWidthZ; //We need to calculate the reportTarget with the bigger with, since the spiral will only stop if it has a size of biggerWidth x biggerWidth
this.reportTarget = (biggerWidth * biggerWidth) + biggerWidth + 1;
//This would be another way to calculate reportTarget, it assumes that we don't need time to check if the chunk is outside and then skip it (it calculates the area of the rectangle/ellipse)
//this.reportTarget = (this.border.getShape()) ? ((int) Math.ceil(chunkWidthX * chunkWidthZ / 4 * Math.PI + 2 * chunkWidthX)) : (chunkWidthX * chunkWidthZ);
// Area of the ellipse just to be safe area of the rectangle
// keep track of the chunks which are already loaded when the task starts, to not unload them
Chunk[] originals = world.getLoadedChunks();
for (Chunk original : originals)

View File

@ -64,7 +64,8 @@ public class WorldTrimTask implements Runnable
return;
}
this.border.setRadius(border.getRadius() + trimDistance);
this.border.setRadiusX(border.getRadiusX() + trimDistance);
this.border.setRadiusZ(border.getRadiusZ() + trimDistance);
worldData = WorldFileData.create(world, notifyPlayer);
if (worldData == null)

View File

@ -11,19 +11,19 @@ commands:
aliases: [worldborder, wb]
usage: |
/<command> - list available commands (show help).
/<command> set <radius> - set world border, centered on you.
/<command> [world] set <radius> <x> <z> - set world border.
/<command> [world] radius <radius> - change world's border radius.
/<command> set <radiusX> <radiusY> - set world border, centered on you.
/<command> [world] set <radiusX> <radiusZ> <x> <z> - set world border.
/<command> [world] radius <radiusX> <radiusZ> - change world's border radius.
/<command> [world] clear - remove border for this world.
/<command> clear all - remove border for all worlds.
/<command> list - show border information for all worlds.
/<command> shape <round|square> - set the default border shape.
/<command> shape <elliptic|rectangular> - set the default border shape.
/<command> getmsg - display border message.
/<command> setmsg <text> - set border message.
/<command> knockback <distance> - how far to move the player back.
/<command> whoosh <on/off> - turn knockback effect on or off.
/<command> delay <amount> - time between border checks.
/<command> wshape [world] <round|square|default> - override shape.
/<command> wshape [world] <elliptic|rectangular|default> - override shape.
/<command> [world] fill [freq] [pad] - generate world out to border.
/<command> [world] trim [freq] [pad] - trim world outside of border.
/<command> bypass [player] [on/off] - let player go beyond border.

42
src/readme.txt Normal file
View File

@ -0,0 +1,42 @@
The things I changed (I hope I didn't forget anything)
plugin.yml:
changed the help (<radius> --> <radiusX> <radiusZ>)
BorderCheckTask.java:
nothing
BorderData.java:
added variable radiusZ and renamed radius to radiusX
changed the "handy data for borderChecks"
adapted constructors to accept to radius-values
added set-/getRadiusZ
adapted toString function (it outputs "radiusX-radiusZ", I'm sure there a clearer way)
changed the inside-border-check procedure for the ellipse (I added a comment, explaining why I think you could remove one check)
changed the procedure that calculates the point inside the border the player need to be teleported to
adapted the equals function
adapted the hashCode function (not sure about this one, maybe you could improve it)
Config.java
adapted the setBorder function to accept both radius-values
adapted config-messages (round --> elliptic...)
adapted the config-file-to-border function
adapted the save procedure
CoordXZ.java:
nothing
DynMapFeatures.java:
adapted the showSquareBorder/showRoundBorder
WBCommand.java:
changed all the commands to accept one parameter more (you always have to enter two values)
changed the names of the shapes to rectangular and elliptic
adapted the help (<radius> --> <radiusX> <radiusZ>)
adapted the error messages to speak of two radius-values
WBListener.java:
nothing
WorldBorder.java:
nothing
WorldFileData.java:
nothing
WorldFillTask.java:
adapted calculation of the toFillBorder
changed calculation of reportTarget
added proposal for different method to calculate reportTarget
WorldTrimTask.java:
adapted calculation of the toTrimBorder