Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
46 changes: 45 additions & 1 deletion src/main/java/com/wimbli/WorldBorder/BorderData.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import org.bukkit.Chunk;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;


Expand Down Expand Up @@ -275,9 +276,52 @@ else if (zLoc >= maxZ)
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());
}
Expand Down
16 changes: 16 additions & 0 deletions src/main/java/com/wimbli/WorldBorder/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -283,6 +285,16 @@ public static boolean getDenyEnderpearl()
return denyEnderpearl;
}

public static boolean getFixTpTarget()
{
return fixTpTarget;
}

public static int getSearchArea()
{
return searchArea;
}

public static void setDenyEnderpearl(boolean enable)
{
denyEnderpearl = enable;
Expand Down Expand Up @@ -580,6 +592,8 @@ public static void load(WorldBorder master, boolean logIt)
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();

Expand Down Expand Up @@ -687,6 +701,8 @@ public static void save(boolean logIt, boolean storeFillTask)
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())
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down