Fixes / Additions / Tweaks

Fixed #867
Fixes some issues with partial plot areas
Added /plot area regen
This commit is contained in:
Jesse Boyd 2016-02-13 22:01:22 +11:00
parent 03aec43f5d
commit e2ba9fb8e9
9 changed files with 207 additions and 143 deletions

View File

@ -1,5 +1,33 @@
package com.intellectualcrafters.plot; package com.intellectualcrafters.plot;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
import java.nio.file.Files;
import java.sql.Connection;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Objects;
import java.util.Set;
import java.util.UUID;
import java.util.regex.Pattern;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import com.intellectualcrafters.configuration.ConfigurationSection; import com.intellectualcrafters.configuration.ConfigurationSection;
import com.intellectualcrafters.configuration.MemorySection; import com.intellectualcrafters.configuration.MemorySection;
import com.intellectualcrafters.configuration.file.YamlConfiguration; import com.intellectualcrafters.configuration.file.YamlConfiguration;
@ -56,34 +84,6 @@ import com.intellectualcrafters.plot.util.area.QuadMap;
import com.plotsquared.listener.WESubscriber; import com.plotsquared.listener.WESubscriber;
import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEdit;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
import java.nio.file.Files;
import java.sql.Connection;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Objects;
import java.util.Set;
import java.util.UUID;
import java.util.regex.Pattern;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
/** /**
* An implementation of the core, * An implementation of the core,
* with a static getter for easy access * with a static getter for easy access
@ -434,21 +434,17 @@ public class PS {
case 7: case 7:
case 8: case 8:
String world = loc.getWorld(); String world = loc.getWorld();
PlotArea last = null;
int count = 0;
int x = loc.getX(); int x = loc.getX();
int y = loc.getY(); int y = loc.getY();
int hash = world.hashCode(); int hash = world.hashCode();
for (PlotArea area : plotareas) { for (PlotArea area : plotareas) {
if (hash == area.worldhash && world.equals(area.worldname)) { if (hash == area.worldhash) {
if (area.contains(loc)) { if (area.contains(loc.getX(), loc.getZ()) && world.equals(area.worldname)) {
return area; return area;
} }
count++;
last = area;
} }
} }
return count == 1 ? last : null; return null;
default: default:
PlotArea[] areas = plotareamap.get(loc.getWorld()); PlotArea[] areas = plotareamap.get(loc.getWorld());
if (areas == null) { if (areas == null) {
@ -498,6 +494,19 @@ public class PS {
} }
} }
public PlotArea getPlotAreaAbs(String world, String id) {
PlotArea[] areas = plotareamap.get(world);
if (areas == null) {
return null;
}
for (PlotArea area : areas) {
if (StringMan.isEqual(id, area.id)) {
return area;
}
}
return null;
}
public PlotArea getPlotAreaByString(String search) { public PlotArea getPlotAreaByString(String search) {
String[] split = search.split(";|,"); String[] split = search.split(";|,");
PlotArea[] areas = plotareamap.get(split[0]); PlotArea[] areas = plotareamap.get(split[0]);
@ -556,8 +565,8 @@ public class PS {
int y = loc.getY(); int y = loc.getY();
int hash = world.hashCode(); int hash = world.hashCode();
for (PlotArea area : plotareas) { for (PlotArea area : plotareas) {
if (hash == area.worldhash && world.equals(area.worldname)) { if (hash == area.worldhash) {
if (area.contains(loc)) { if (area.contains(loc.getX(), loc.getZ()) && world.equals(area.worldname)) {
return area; return area;
} }
} }
@ -571,7 +580,7 @@ public class PS {
switch (areas.length) { switch (areas.length) {
case 0: case 0:
PlotArea a = areas[0]; PlotArea a = areas[0];
return a.contains(loc) ? a : null; return a.contains(loc.getX(), loc.getZ()) ? a : null;
case 2: case 2:
case 3: case 3:
case 4: case 4:
@ -1583,7 +1592,7 @@ public class PS {
if (pos1 == null || pos2 == null || name.length() == 0) { if (pos1 == null || pos2 == null || name.length() == 0) {
throw new IllegalArgumentException("Invalid Area identifier: " + areaId + ". Expected form `<name>-<x1;z1>-<x2;z2>`"); throw new IllegalArgumentException("Invalid Area identifier: " + areaId + ". Expected form `<name>-<x1;z1>-<x2;z2>`");
} }
if (getPlotArea(world, name) != null) { if (getPlotAreaAbs(world, name) != null) {
continue; continue;
} }
ConfigurationSection section = areasSection.getConfigurationSection(areaId); ConfigurationSection section = areasSection.getConfigurationSection(areaId);

View File

@ -2,6 +2,7 @@ package com.intellectualcrafters.plot.commands;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Objects;
import java.util.Set; import java.util.Set;
import com.intellectualcrafters.configuration.ConfigurationSection; import com.intellectualcrafters.configuration.ConfigurationSection;
@ -38,7 +39,7 @@ category = CommandCategory.ADMINISTRATION,
requiredType = RequiredType.NONE, requiredType = RequiredType.NONE,
description = "Create a new PlotArea", description = "Create a new PlotArea",
aliases = { "world" }, aliases = { "world" },
usage = "/plot area <create|info|list|tp>") usage = "/plot area <create|info|list|tp|regen>")
//plot createarea partial //plot createarea partial
public class Area extends SubCommand { public class Area extends SubCommand {
@ -108,8 +109,8 @@ public class Area extends SubCommand {
object.id = area.id; object.id = area.id;
object.terrain = area.TERRAIN; object.terrain = area.TERRAIN;
object.type = area.TYPE; object.type = area.TYPE;
object.min = new PlotId(0, 0); object.min = new PlotId(1, 1);
object.max = new PlotId(numx - 1, numz - 1); object.max = new PlotId(numx, numz);
object.plotManager = "PlotSquared"; object.plotManager = "PlotSquared";
object.setupGenerator = "PlotSquared"; object.setupGenerator = "PlotSquared";
object.step = area.getSettingNodes(); object.step = area.getSettingNodes();
@ -156,8 +157,9 @@ public class Area extends SubCommand {
} }
object.world = split[0]; object.world = split[0];
final HybridPlotWorld pa = new HybridPlotWorld(object.world, id, new HybridGen(), null, null); final HybridPlotWorld pa = new HybridPlotWorld(object.world, id, new HybridGen(), null, null);
if (PS.get().getPlotArea(pa.worldname, id) != null) { PlotArea other = PS.get().getPlotArea(pa.worldname, id);
C.SETUP_WORLD_TAKEN.send(plr, pa.worldname); if (other != null && Objects.equals(pa.id, other.id)) {
C.SETUP_WORLD_TAKEN.send(plr, pa.toString());
return false; return false;
} }
Set<PlotArea> areas = PS.get().getPlotAreas(pa.worldname); Set<PlotArea> areas = PS.get().getPlotAreas(pa.worldname);
@ -322,7 +324,7 @@ public class Area extends SubCommand {
region = area.getRegion().toString(); region = area.getRegion().toString();
} else { } else {
name = area.worldname; name = area.worldname;
percent = claimed == 0 ? 0 : Short.MAX_VALUE * Short.MAX_VALUE / (double) claimed; percent = claimed == 0 ? 0 : (100d * claimed) / (Integer.MAX_VALUE);
region = "N/A"; region = "N/A";
} }
String value = "&r$1NAME: " + name String value = "&r$1NAME: " + name
@ -396,6 +398,29 @@ public class Area extends SubCommand {
}, "/plot area list", C.AREA_LIST_HEADER_PAGED.s()); }, "/plot area list", C.AREA_LIST_HEADER_PAGED.s());
return true; return true;
} }
case "regen":
case "regenerate": {
if (!Permissions.hasPermission(plr, "plots.area.regen")) {
C.NO_PERMISSION.send(plr, "plots.area.regen");
return false;
}
final PlotArea area = plr.getApplicablePlotArea();
if (area == null) {
C.NOT_IN_PLOT_WORLD.send(plr);
return false;
}
if (area.TYPE != 2) {
MainUtil.sendMessage(plr, "$4Stop the server and delete: " + area.worldname + "/region");
return false;
}
ChunkManager.largeRegionTask(area.worldname, area.getRegion(), new RunnableVal<ChunkLoc>() {
@Override
public void run(ChunkLoc value) {
AugmentedUtils.generate(area.worldname, value.x, value.z);
}
}, null);
return true;
}
case "goto": case "goto":
case "v": case "v":
case "teleport": case "teleport":
@ -414,8 +439,19 @@ public class Area extends SubCommand {
C.NOT_VALID_PLOT_WORLD.send(plr, args[1]); C.NOT_VALID_PLOT_WORLD.send(plr, args[1]);
return false; return false;
} }
Location spawn = WorldUtil.IMP.getSpawn(area.worldname); RegionWrapper region = area.getRegion();
plr.teleport(spawn); Location center = new Location(area.worldname, region.minX + (region.maxX - region.minX) / 2, 0, region.minZ + (region.maxZ - region.minZ) / 2);
center.setY(WorldUtil.IMP.getHeighestBlock(area.worldname, center.getX(), center.getZ()));
plr.teleport(center);
return true;
}
case "delete":
case "remove": {
MainUtil.sendMessage(plr, "$1World creation settings may be stored in multiple locations:"
+ "\n$3 - $2Bukkit bukkit.yml"
+ "\n$3 - $2PlotSquared settings.yml"
+ "\n$3 - $2Multiverse worlds.yml (or any world management plugin)"
+ "\n$1Stop the server and delete it from these locations.");
return true; return true;
} }
} }

View File

@ -80,12 +80,12 @@ public class Visit extends SubCommand {
page = Integer.parseInt(args[1]); page = Integer.parseInt(args[1]);
} }
case 1: { case 1: {
if (page == Integer.MIN_VALUE && MathMan.isInteger(args[0])) { final UUID user = UUIDHandler.getCachedUUID(args[0], null);
if (page == Integer.MIN_VALUE && user == null && MathMan.isInteger(args[0])) {
page = Integer.parseInt(args[0]); page = Integer.parseInt(args[0]);
unsorted = PS.get().getPlots(player); unsorted = PS.get().getPlots(player);
break; break;
} }
final UUID user = UUIDHandler.getCachedUUID(args[0], null);
if (user != null) { if (user != null) {
unsorted = PS.get().getPlots(user); unsorted = PS.get().getPlots(user);
} else if (PS.get().getPlotAreaByString(args[0]) != null) { } else if (PS.get().getPlotAreaByString(args[0]) != null) {

View File

@ -28,7 +28,7 @@ public class AugmentedUtils {
} }
final int bx = cx << 4; final int bx = cx << 4;
final int bz = cz << 4; final int bz = cz << 4;
RegionWrapper region = new RegionWrapper(bx, bx + 16, bz, bz + 16); RegionWrapper region = new RegionWrapper(bx, bx + 15, bz, bz + 15);
Set<PlotArea> areas = PS.get().getPlotAreas(world, region); Set<PlotArea> areas = PS.get().getPlotAreas(world, region);
if (areas.size() == 0) { if (areas.size() == 0) {
return; return;
@ -56,8 +56,8 @@ public class AugmentedUtils {
// coords // coords
int bxx = Math.max(0, area.getRegion().minX - bx); int bxx = Math.max(0, area.getRegion().minX - bx);
int bzz = Math.max(0, area.getRegion().minZ - bz); int bzz = Math.max(0, area.getRegion().minZ - bz);
int txx = Math.min(16, area.getRegion().maxX - bx); int txx = Math.min(15, area.getRegion().maxX - bx);
int tzz = Math.min(16, area.getRegion().maxZ - bz); int tzz = Math.min(15, area.getRegion().maxZ - bz);
// gen // gen
if (area.TYPE == 2) { if (area.TYPE == 2) {
primaryMask = new PlotChunk<Object>(wrap) { primaryMask = new PlotChunk<Object>(wrap) {
@ -99,8 +99,8 @@ public class AugmentedUtils {
PlotManager manager = area.getPlotManager(); PlotManager manager = area.getPlotManager();
final boolean[][] canPlace = new boolean[16][16]; final boolean[][] canPlace = new boolean[16][16];
boolean has = false; boolean has = false;
for (int x = bxx; x < txx; x++) { for (int x = bxx; x <= txx; x++) {
for (int z = bzz; z < tzz; z++) { for (int z = bzz; z <= tzz; z++) {
int rx = x + bx; int rx = x + bx;
int rz = z + bz; int rz = z + bz;
boolean can = manager.getPlotIdAbs(area, rx, 0, rz) == null; boolean can = manager.getPlotIdAbs(area, rx, 0, rz) == null;
@ -144,8 +144,8 @@ public class AugmentedUtils {
}; };
} else { } else {
secondaryMask = primaryMask; secondaryMask = primaryMask;
for (int x = bxx; x < txx; x++) { for (int x = bxx; x <= txx; x++) {
for (int z = bzz; z < tzz; z++) { for (int z = bzz; z <= tzz; z++) {
for (int y = 1; y < 128; y++) { for (int y = 1; y < 128; y++) {
result.setBlock(x, y, z, air); result.setBlock(x, y, z, air);
} }
@ -156,6 +156,7 @@ public class AugmentedUtils {
} }
if (cache_chunk != null) { if (cache_chunk != null) {
cache_chunk.addToQueue(); cache_chunk.addToQueue();
cache_chunk.flush(false);
} }
} }
} }

View File

@ -20,6 +20,18 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.object; package com.intellectualcrafters.plot.object;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import com.intellectualcrafters.configuration.ConfigurationSection; import com.intellectualcrafters.configuration.ConfigurationSection;
import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
@ -38,18 +50,6 @@ import com.intellectualcrafters.plot.util.StringMan;
import com.intellectualcrafters.plot.util.WorldUtil; import com.intellectualcrafters.plot.util.WorldUtil;
import com.intellectualcrafters.plot.util.area.QuadMap; import com.intellectualcrafters.plot.util.area.QuadMap;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
/** /**
* @author Jesse Boyd * @author Jesse Boyd
*/ */
@ -133,18 +133,24 @@ public abstract class PlotArea {
* @return * @return
*/ */
public RegionWrapper getRegion() { public RegionWrapper getRegion() {
region = getRegionAbs();
if (region == null) {
return new RegionWrapper(Integer.MIN_VALUE, Integer.MAX_VALUE, Integer.MIN_VALUE, Integer.MAX_VALUE);
}
return region;
}
public RegionWrapper getRegionAbs() {
if (region == null) { if (region == null) {
if (min != null) { if (min != null) {
Location bot = getPlotManager().getPlotBottomLocAbs(this, min); Location bot = getPlotManager().getPlotBottomLocAbs(this, min);
Location top = getPlotManager().getPlotTopLocAbs(this, max); Location top = getPlotManager().getPlotTopLocAbs(this, max);
this.region = new RegionWrapper(bot.getX() - 1, top.getX() + 1, bot.getZ() - 1, top.getZ() + 1); this.region = new RegionWrapper(bot.getX() - 1, top.getX() + 1, bot.getZ() - 1, top.getZ() + 1);
} else {
return new RegionWrapper(Integer.MIN_VALUE, Integer.MAX_VALUE, Integer.MIN_VALUE, Integer.MAX_VALUE);
} }
} }
return region; return region;
} }
/** /**
* Returns the min PlotId * Returns the min PlotId
* @return * @return
@ -427,8 +433,12 @@ public abstract class PlotArea {
return plot == null ? null : plot.getBasePlot(false); return plot == null ? null : plot.getBasePlot(false);
} }
public boolean contains(int x, int z) {
return TYPE != 2 || getRegionAbs().isIn(x, z);
}
public boolean contains(Location loc) { public boolean contains(Location loc) {
return StringMan.isEqual(loc.getWorld(), worldname) && (region == null || region.isIn(loc.getX(), loc.getZ())); return StringMan.isEqual(loc.getWorld(), worldname) && (getRegionAbs() == null || region.isIn(loc.getX(), loc.getZ()));
} }
public Set<Plot> getPlotsAbs(UUID uuid) { public Set<Plot> getPlotsAbs(UUID uuid) {
@ -479,10 +489,6 @@ public abstract class PlotArea {
return player != null ? getPlotCount(player.getUUID()) : 0; return player != null ? getPlotCount(player.getUUID()) : 0;
} }
public boolean contains(int x, int z) {
return region == null || region.isIn(x, z);
}
public Plot getPlotAbs(PlotId id) { public Plot getPlotAbs(PlotId id) {
Plot plot = getOwnedPlotAbs(id); Plot plot = getOwnedPlotAbs(id);
if (plot == null) { if (plot == null) {

View File

@ -76,11 +76,11 @@ public abstract class ChunkManager {
int tx = bx + 511; int tx = bx + 511;
int tz = bz + 511; int tz = bz + 511;
if (bx <= region.maxX && tx >= region.minX && bz <= region.maxZ && tz >= region.minZ) { if (bx <= region.maxX && tx >= region.minX && bz <= region.maxZ && tz >= region.minZ) {
for (int x = (bx >> 4); x <= (tx << 4); x++) { for (int x = (bx >> 4); x <= (tx >> 4); x++) {
int cbx = x << 4; int cbx = x << 4;
int ctx = cbx + 15; int ctx = cbx + 15;
if (cbx <= region.maxX && ctx >= region.minX) { if (cbx <= region.maxX && ctx >= region.minX) {
for (int z = (bz >> 4); z <= (tz << 4); z++) { for (int z = (bz >> 4); z <= (tz >> 4); z++) {
int cbz = z << 4; int cbz = z << 4;
int ctz = cbz + 15; int ctz = cbz + 15;
if (cbz <= region.maxZ && ctz >= region.minZ) { if (cbz <= region.maxZ && ctz >= region.minZ) {
@ -91,7 +91,15 @@ public abstract class ChunkManager {
} }
} }
} }
TaskManager.objectTask(chunks, task, whenDone); TaskManager.objectTask(chunks, new RunnableVal<ChunkLoc>() {
@Override
public void run(ChunkLoc value) {
if (manager.loadChunk(world, value, false)) {
task.run(value);
}
}
}, whenDone);
} }
}); });
} }

View File

@ -1,33 +1,16 @@
package com.plotsquared.bukkit.listeners; package com.plotsquared.bukkit.listeners;
import com.intellectualcrafters.plot.PS; import java.util.ArrayList;
import com.intellectualcrafters.plot.config.C; import java.util.Arrays;
import com.intellectualcrafters.plot.config.Settings; import java.util.HashSet;
import com.intellectualcrafters.plot.flag.Flag; import java.util.Iterator;
import com.intellectualcrafters.plot.flag.FlagManager; import java.util.List;
import com.intellectualcrafters.plot.object.Location; import java.util.Map.Entry;
import com.intellectualcrafters.plot.object.Plot; import java.util.Objects;
import com.intellectualcrafters.plot.object.PlotArea; import java.util.Set;
import com.intellectualcrafters.plot.object.PlotBlock; import java.util.UUID;
import com.intellectualcrafters.plot.object.PlotHandler; import java.util.regex.Pattern;
import com.intellectualcrafters.plot.object.PlotId;
import com.intellectualcrafters.plot.object.PlotInventory;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.StringWrapper;
import com.intellectualcrafters.plot.util.EventUtil;
import com.intellectualcrafters.plot.util.ExpireManager;
import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.MathMan;
import com.intellectualcrafters.plot.util.Permissions;
import com.intellectualcrafters.plot.util.RegExUtil;
import com.intellectualcrafters.plot.util.StringMan;
import com.intellectualcrafters.plot.util.TaskManager;
import com.intellectualcrafters.plot.util.UUIDHandler;
import com.plotsquared.bukkit.BukkitMain;
import com.plotsquared.bukkit.object.BukkitLazyBlock;
import com.plotsquared.bukkit.object.BukkitPlayer;
import com.plotsquared.bukkit.util.BukkitUtil;
import com.plotsquared.listener.PlayerBlockEventType;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
@ -106,16 +89,34 @@ import org.bukkit.projectiles.BlockProjectileSource;
import org.bukkit.projectiles.ProjectileSource; import org.bukkit.projectiles.ProjectileSource;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import java.util.ArrayList; import com.intellectualcrafters.plot.PS;
import java.util.Arrays; import com.intellectualcrafters.plot.config.C;
import java.util.HashSet; import com.intellectualcrafters.plot.config.Settings;
import java.util.Iterator; import com.intellectualcrafters.plot.flag.Flag;
import java.util.List; import com.intellectualcrafters.plot.flag.FlagManager;
import java.util.Map.Entry; import com.intellectualcrafters.plot.object.Location;
import java.util.Objects; import com.intellectualcrafters.plot.object.Plot;
import java.util.Set; import com.intellectualcrafters.plot.object.PlotArea;
import java.util.UUID; import com.intellectualcrafters.plot.object.PlotBlock;
import java.util.regex.Pattern; import com.intellectualcrafters.plot.object.PlotHandler;
import com.intellectualcrafters.plot.object.PlotId;
import com.intellectualcrafters.plot.object.PlotInventory;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.StringWrapper;
import com.intellectualcrafters.plot.util.EventUtil;
import com.intellectualcrafters.plot.util.ExpireManager;
import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.MathMan;
import com.intellectualcrafters.plot.util.Permissions;
import com.intellectualcrafters.plot.util.RegExUtil;
import com.intellectualcrafters.plot.util.StringMan;
import com.intellectualcrafters.plot.util.TaskManager;
import com.intellectualcrafters.plot.util.UUIDHandler;
import com.plotsquared.bukkit.BukkitMain;
import com.plotsquared.bukkit.object.BukkitLazyBlock;
import com.plotsquared.bukkit.object.BukkitPlayer;
import com.plotsquared.bukkit.util.BukkitUtil;
import com.plotsquared.listener.PlayerBlockEventType;
/** /**
* Player Events involving plots * Player Events involving plots
@ -308,7 +309,7 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
return; return;
} }
final Location sLoc = BukkitUtil.getLocation(((BlockProjectileSource) shooter).getBlock().getLocation()); final Location sLoc = BukkitUtil.getLocation(((BlockProjectileSource) shooter).getBlock().getLocation());
if (!area.contains(sLoc)) { if (!area.contains(sLoc.getX(), sLoc.getZ())) {
entity.remove(); entity.remove();
return; return;
} }
@ -479,6 +480,7 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
pp.setMeta("location", loc); pp.setMeta("location", loc);
PlotArea area = loc.getPlotArea(); PlotArea area = loc.getPlotArea();
if (area == null) { if (area == null) {
pp.deleteMeta("lastplot");
return; return;
} }
Plot now = area.getPlotAbs(loc); Plot now = area.getPlotAbs(loc);
@ -536,6 +538,7 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
PlotArea area = loc.getPlotArea(); PlotArea area = loc.getPlotArea();
if (area == null) { if (area == null) {
pp.deleteMeta("lastplot");
return; return;
} }
Plot now = area.getPlotAbs(loc); Plot now = area.getPlotAbs(loc);
@ -703,7 +706,7 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
while (iter.hasNext()) { while (iter.hasNext()) {
final Block b = iter.next(); final Block b = iter.next();
loc = BukkitUtil.getLocation(b.getLocation()); loc = BukkitUtil.getLocation(b.getLocation());
if (!area.contains(loc) || !origin.equals(area.getOwnedPlot(loc))) { if (!area.contains(loc.getX(), loc.getZ()) || !origin.equals(area.getOwnedPlot(loc))) {
iter.remove(); iter.remove();
} }
} }
@ -892,7 +895,7 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
final List<Block> blocks = event.getBlocks(); final List<Block> blocks = event.getBlocks();
for (final Block b : blocks) { for (final Block b : blocks) {
final Location bloc = BukkitUtil.getLocation(b.getLocation().add(relative)); final Location bloc = BukkitUtil.getLocation(b.getLocation().add(relative));
if (!area.contains(bloc)) { if (!area.contains(bloc.getX(), bloc.getZ())) {
event.setCancelled(true); event.setCancelled(true);
return; return;
} }
@ -940,7 +943,7 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
try { try {
for (final Block pulled : event.getBlocks()) { for (final Block pulled : event.getBlocks()) {
loc = BukkitUtil.getLocation(pulled.getLocation()); loc = BukkitUtil.getLocation(pulled.getLocation());
if (!area.contains(loc)) { if (!area.contains(loc.getX(), loc.getZ())) {
event.setCancelled(true); event.setCancelled(true);
return; return;
} }
@ -1006,7 +1009,7 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
} }
for (int i = blocks.size() - 1; i >= 0; i--) { for (int i = blocks.size() - 1; i >= 0; i--) {
loc = BukkitUtil.getLocation(blocks.get(i).getLocation()); loc = BukkitUtil.getLocation(blocks.get(i).getLocation());
if (!area.contains(loc)) { if (!area.contains(loc.getX(), loc.getZ())) {
blocks.remove(i); blocks.remove(i);
continue; continue;
} }
@ -2029,7 +2032,7 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
final Location dloc = BukkitUtil.getLocation(damager); final Location dloc = BukkitUtil.getLocation(damager);
final Location vloc = BukkitUtil.getLocation(victim); final Location vloc = BukkitUtil.getLocation(victim);
PlotArea dArea = dloc.getPlotArea(); PlotArea dArea = dloc.getPlotArea();
PlotArea vArea = (dArea != null && dArea.contains(vloc)) ? dArea : vloc.getPlotArea(); PlotArea vArea = (dArea != null && dArea.contains(vloc.getX(), vloc.getZ())) ? dArea : vloc.getPlotArea();
if (dArea == null && vArea == null) { if (dArea == null && vArea == null) {
return true; return true;
} }

View File

@ -2,6 +2,22 @@ package com.plotsquared.bukkit.util.block;
import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass; import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;
import java.util.Set;
import org.bukkit.Chunk;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.World.Environment;
import org.bukkit.block.Biome;
import com.intellectualcrafters.plot.object.ChunkLoc; import com.intellectualcrafters.plot.object.ChunkLoc;
import com.intellectualcrafters.plot.object.PseudoRandom; import com.intellectualcrafters.plot.object.PseudoRandom;
import com.intellectualcrafters.plot.util.ChunkManager; import com.intellectualcrafters.plot.util.ChunkManager;
@ -17,21 +33,6 @@ import com.intellectualcrafters.plot.util.SetQueue.ChunkWrapper;
import com.intellectualcrafters.plot.util.TaskManager; import com.intellectualcrafters.plot.util.TaskManager;
import com.plotsquared.bukkit.util.BukkitUtil; import com.plotsquared.bukkit.util.BukkitUtil;
import com.plotsquared.bukkit.util.SendChunk; import com.plotsquared.bukkit.util.SendChunk;
import org.bukkit.Chunk;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.World.Environment;
import org.bukkit.block.Biome;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;
import java.util.Set;
public class FastQueue_1_8_3 extends SlowQueue { public class FastQueue_1_8_3 extends SlowQueue {
@ -285,7 +286,7 @@ public class FastQueue_1_8_3 extends SlowQueue {
// Initialize lighting // Initialize lighting
final Object c = methodGetHandleChunk.of(chunk).call(); final Object c = methodGetHandleChunk.of(chunk).call();
if (!(boolean) methodAreNeighborsLoaded.of(c).call(1)) { if (fixAll && !(boolean) methodAreNeighborsLoaded.of(c).call(1)) {
World world = chunk.getWorld(); World world = chunk.getWorld();
ChunkWrapper wrapper = bc.getChunkWrapper(); ChunkWrapper wrapper = bc.getChunkWrapper();
String worldname = wrapper.world; String worldname = wrapper.world;

View File

@ -20,6 +20,10 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.plotsquared.listener; package com.plotsquared.listener;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings; import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.flag.Flag; import com.intellectualcrafters.plot.flag.Flag;
@ -41,10 +45,6 @@ import com.intellectualcrafters.plot.util.StringMan;
import com.intellectualcrafters.plot.util.TaskManager; import com.intellectualcrafters.plot.util.TaskManager;
import com.intellectualcrafters.plot.util.UUIDHandler; import com.intellectualcrafters.plot.util.UUIDHandler;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
/** /**