This commit is contained in:
spaceFountain 2015-02-26 14:47:41 +00:00
commit 79be87fb5b
4 changed files with 63 additions and 3 deletions

View File

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.wimbli.WorldBorder</groupId>
<artifactId>WorldBorder</artifactId>
<version>1.8.2_dev</version>
<version>1.8.4_dev</version>
<name>WorldBorder</name>
<url>https://github.com/Brettflan/WorldBorder</url>
<issueManagement>

View File

@ -5,6 +5,7 @@ import java.util.LinkedHashSet;
import org.bukkit.Chunk;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
@ -275,9 +276,52 @@ public class BorderData
if (!tChunk.isLoaded())
tChunk.load();
double originalY = yLoc;
yLoc = getSafeY(loc.getWorld(), ixLoc, Location.locToBlock(yLoc), izLoc, flying);
if (yLoc == -1)
return null;
{
int searchArea = Config.getSearchArea();
for (int cX = ixLoc - searchArea; cX <= ixLoc + searchArea; ++cX) {
for (int cZ = izLoc - searchArea; cZ <= izLoc + searchArea; ++cZ) {
if (cX == ixLoc && cZ == izLoc)
continue; // Skips the block that was already checked
if (insideBorder(new CoordXZ(cX, cZ)))
continue;
ixLoc = cX;
izLoc = cZ;
// Make sure the chunk we're checking in is actually loaded
tChunk = loc.getWorld().getChunkAt(CoordXZ.blockToChunk(ixLoc), CoordXZ.blockToChunk(izLoc));
if (!tChunk.isLoaded())
tChunk.load();
yLoc = getSafeY(loc.getWorld(), ixLoc, Location.locToBlock(yLoc), izLoc, flying);
if (yLoc != -1) {
xLoc = cX;
zLoc = cZ;
ixLoc = Location.locToBlock(xLoc);
izLoc = Location.locToBlock(zLoc);
break;
}
}
}
if (yLoc == -1)
{
if (Config.getFixTpTarget()) {
loc.getWorld().getBlockAt(ixLoc, Location.locToBlock(originalY) - 1, izLoc).setType(Material.STONE);
loc.getWorld().getBlockAt(ixLoc, Location.locToBlock(originalY), izLoc).setType(Material.AIR);
loc.getWorld().getBlockAt(ixLoc, Location.locToBlock(originalY) + 1, izLoc).setType(Material.AIR);
return new Location(loc.getWorld(), Math.floor(xLoc) + 0.5, originalY, Math.floor(zLoc) + 0.5, loc.getYaw(), loc.getPitch());
}
return null;
}
return new Location(loc.getWorld(), Math.floor(xLoc) + 0.5, yLoc, Math.floor(zLoc) + 0.5, loc.getYaw(), loc.getPitch());
}
return new Location(loc.getWorld(), Math.floor(xLoc) + 0.5, yLoc, Math.floor(zLoc) + 0.5, loc.getYaw(), loc.getPitch());
}

View File

@ -55,6 +55,8 @@ public class Config
private static int fillAutosaveFrequency = 30;
private static int fillMemoryTolerance = 500;
private static boolean preventBlockPlace = false;
private static int searchArea = 0;
private static boolean fixTpTarget = false;
// for monitoring plugin efficiency
// public static long timeUsed = 0;
@ -283,6 +285,16 @@ public class Config
return denyEnderpearl;
}
public static boolean getFixTpTarget()
{
return fixTpTarget;
}
public static int getSearchArea()
{
return searchArea;
}
public static void setDenyEnderpearl(boolean enable)
{
denyEnderpearl = enable;
@ -580,6 +592,8 @@ public class Config
importBypassStringList(cfg.getStringList("bypass-list-uuids"));
fillMemoryTolerance = cfg.getInt("fill-memory-tolerance", 500);
preventBlockPlace = cfg.getBoolean("prevent-block-place");
searchArea = cfg.getInt("search-area", 0);
fixTpTarget = cfg.getBoolean("fix-tp-target");
StartBorderTimer();
@ -687,6 +701,8 @@ public class Config
cfg.set("bypass-list-uuids", exportBypassStringList());
cfg.set("fill-memory-tolerance", fillMemoryTolerance);
cfg.set("prevent-block-place", preventBlockPlace);
cfg.set("search-area", searchArea);
cfg.set("fix-tp-target", fixTpTarget);
cfg.set("worlds", null);
for(Entry<String, BorderData> stringBorderDataEntry : borders.entrySet())

View File

@ -1,7 +1,7 @@
name: WorldBorder
author: Brettflan
description: Efficient, feature-rich plugin for limiting the size of your worlds.
version: 1.8.1
version: 1.8.4
main: com.wimbli.WorldBorder.WorldBorder
softdepend:
- dynmap