Another potential fix for construction

This commit is contained in:
Ceikry
2021-07-07 22:38:15 +00:00
parent bcde41b7c9
commit cec3f4938d
2 changed files with 24 additions and 9 deletions
@@ -267,10 +267,16 @@ public final class HouseManager {
int diffX = player.getLocation().getX() - r.getBaseLocation().getX(); int diffX = player.getLocation().getX() - r.getBaseLocation().getX();
int diffY = player.getLocation().getY() - r.getBaseLocation().getY(); int diffY = player.getLocation().getY() - r.getBaseLocation().getY();
int diffZ = player.getLocation().getZ() - r.getBaseLocation().getZ(); int diffZ = player.getLocation().getZ() - r.getBaseLocation().getZ();
DynamicRegion dr = region;
DynamicRegion dd = dungeon;
RegionManager.getRegionCache().remove(dr);
RegionManager.getRegionCache().remove(dd);
region = null; region = null;
dungeon = null; dungeon = null;
enter(player, buildingMode, false); enter(player, buildingMode, false);
player.getProperties().setTeleportLocation((player.getViewport().getRegion() == dungeon ? dungeon : region).getBaseLocation().transform(diffX, diffY, diffZ)); player.getProperties().setTeleportLocation((player.getViewport().getRegion() == dungeon ? dungeon : region).getBaseLocation().transform(diffX, diffY, diffZ));
dr.flagInactive();
dd.flagInactive();
} }
/** /**
@@ -299,11 +299,19 @@ public class Region {
} }
} }
/**
* Unloads a region - compatibility method for older uses
*/
private static void unload(Region r){
unload(r, false);
}
/** /**
* Unloads a region. * Unloads a region.
* @param r The region. * @param r The region.
*/ */
private static void unload(Region r) { private static void unload(Region r, boolean force) {
if(!force){
if (r.isViewed()) { if (r.isViewed()) {
SystemLogger.logErr("Players viewing region!"); SystemLogger.logErr("Players viewing region!");
r.flagActive(); r.flagActive();
@@ -316,6 +324,7 @@ public class Region {
return; return;
} }
} }
}
for (RegionPlane p : r.planes) { for (RegionPlane p : r.planes) {
p.clear(); p.clear();
if (!(r instanceof DynamicRegion)) { if (!(r instanceof DynamicRegion)) {