mirror of
				https://github.com/IntellectualSites/PlotSquared.git
				synced 2025-11-03 18:53:43 +01:00 
			
		
		
		
	Fixes / Additions / Tweaks
Fixed #867 Fixes some issues with partial plot areas Added /plot area regen
This commit is contained in:
		@@ -1,5 +1,33 @@
 | 
			
		||||
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.MemorySection;
 | 
			
		||||
import com.intellectualcrafters.configuration.file.YamlConfiguration;
 | 
			
		||||
@@ -56,34 +84,6 @@ import com.intellectualcrafters.plot.util.area.QuadMap;
 | 
			
		||||
import com.plotsquared.listener.WESubscriber;
 | 
			
		||||
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,
 | 
			
		||||
 * with a static getter for easy access
 | 
			
		||||
@@ -434,21 +434,17 @@ public class PS {
 | 
			
		||||
            case 7:
 | 
			
		||||
            case 8:
 | 
			
		||||
                String world = loc.getWorld();
 | 
			
		||||
                PlotArea last = null;
 | 
			
		||||
                int count = 0;
 | 
			
		||||
                int x = loc.getX();
 | 
			
		||||
                int y = loc.getY();
 | 
			
		||||
                int hash = world.hashCode();
 | 
			
		||||
                for (PlotArea area : plotareas) {
 | 
			
		||||
                    if (hash == area.worldhash && world.equals(area.worldname)) {
 | 
			
		||||
                        if (area.contains(loc)) {
 | 
			
		||||
                    if (hash == area.worldhash) {
 | 
			
		||||
                        if (area.contains(loc.getX(), loc.getZ()) && world.equals(area.worldname)) {
 | 
			
		||||
                            return area;
 | 
			
		||||
                        }
 | 
			
		||||
                        count++;
 | 
			
		||||
                        last = area;
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
                return count == 1 ? last : null;
 | 
			
		||||
                return null;
 | 
			
		||||
            default:
 | 
			
		||||
                PlotArea[] areas = plotareamap.get(loc.getWorld());
 | 
			
		||||
                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) {
 | 
			
		||||
        String[] split = search.split(";|,");
 | 
			
		||||
        PlotArea[] areas = plotareamap.get(split[0]);
 | 
			
		||||
@@ -556,8 +565,8 @@ public class PS {
 | 
			
		||||
                int y = loc.getY();
 | 
			
		||||
                int hash = world.hashCode();
 | 
			
		||||
                for (PlotArea area : plotareas) {
 | 
			
		||||
                    if (hash == area.worldhash && world.equals(area.worldname)) {
 | 
			
		||||
                        if (area.contains(loc)) {
 | 
			
		||||
                    if (hash == area.worldhash) {
 | 
			
		||||
                        if (area.contains(loc.getX(), loc.getZ()) && world.equals(area.worldname)) {
 | 
			
		||||
                            return area;
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
@@ -571,7 +580,7 @@ public class PS {
 | 
			
		||||
                switch (areas.length) {
 | 
			
		||||
                    case 0:
 | 
			
		||||
                        PlotArea a = areas[0];
 | 
			
		||||
                        return a.contains(loc) ? a : null;
 | 
			
		||||
                        return a.contains(loc.getX(), loc.getZ()) ? a : null;
 | 
			
		||||
                    case 2:
 | 
			
		||||
                    case 3:
 | 
			
		||||
                    case 4:
 | 
			
		||||
@@ -1583,7 +1592,7 @@ public class PS {
 | 
			
		||||
                if (pos1 == null || pos2 == null || name.length() == 0) {
 | 
			
		||||
                    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;
 | 
			
		||||
                }
 | 
			
		||||
                ConfigurationSection section = areasSection.getConfigurationSection(areaId);
 | 
			
		||||
 
 | 
			
		||||
@@ -2,6 +2,7 @@ package com.intellectualcrafters.plot.commands;
 | 
			
		||||
 | 
			
		||||
import java.io.IOException;
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.Objects;
 | 
			
		||||
import java.util.Set;
 | 
			
		||||
 | 
			
		||||
import com.intellectualcrafters.configuration.ConfigurationSection;
 | 
			
		||||
@@ -38,7 +39,7 @@ category = CommandCategory.ADMINISTRATION,
 | 
			
		||||
requiredType = RequiredType.NONE,
 | 
			
		||||
description = "Create a new PlotArea",
 | 
			
		||||
aliases = { "world" },
 | 
			
		||||
usage = "/plot area <create|info|list|tp>")
 | 
			
		||||
usage = "/plot area <create|info|list|tp|regen>")
 | 
			
		||||
//plot createarea partial
 | 
			
		||||
public class Area extends SubCommand {
 | 
			
		||||
    
 | 
			
		||||
@@ -108,8 +109,8 @@ public class Area extends SubCommand {
 | 
			
		||||
                                object.id = area.id;
 | 
			
		||||
                                object.terrain = area.TERRAIN;
 | 
			
		||||
                                object.type = area.TYPE;
 | 
			
		||||
                                object.min = new PlotId(0, 0);
 | 
			
		||||
                                object.max = new PlotId(numx - 1, numz - 1);
 | 
			
		||||
                                object.min = new PlotId(1, 1);
 | 
			
		||||
                                object.max = new PlotId(numx, numz);
 | 
			
		||||
                                object.plotManager = "PlotSquared";
 | 
			
		||||
                                object.setupGenerator = "PlotSquared";
 | 
			
		||||
                                object.step = area.getSettingNodes();
 | 
			
		||||
@@ -156,8 +157,9 @@ public class Area extends SubCommand {
 | 
			
		||||
                        }
 | 
			
		||||
                        object.world = split[0];
 | 
			
		||||
                        final HybridPlotWorld pa = new HybridPlotWorld(object.world, id, new HybridGen(), null, null);
 | 
			
		||||
                        if (PS.get().getPlotArea(pa.worldname, id) != null) {
 | 
			
		||||
                            C.SETUP_WORLD_TAKEN.send(plr, pa.worldname);
 | 
			
		||||
                        PlotArea other = PS.get().getPlotArea(pa.worldname, id);
 | 
			
		||||
                        if (other != null && Objects.equals(pa.id, other.id)) {
 | 
			
		||||
                            C.SETUP_WORLD_TAKEN.send(plr, pa.toString());
 | 
			
		||||
                            return false;
 | 
			
		||||
                        }
 | 
			
		||||
                        Set<PlotArea> areas = PS.get().getPlotAreas(pa.worldname);
 | 
			
		||||
@@ -322,7 +324,7 @@ public class Area extends SubCommand {
 | 
			
		||||
                    region = area.getRegion().toString();
 | 
			
		||||
                } else {
 | 
			
		||||
                    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";
 | 
			
		||||
                }
 | 
			
		||||
                String value = "&r$1NAME: " + name
 | 
			
		||||
@@ -396,6 +398,29 @@ public class Area extends SubCommand {
 | 
			
		||||
                }, "/plot area list", C.AREA_LIST_HEADER_PAGED.s());
 | 
			
		||||
                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 "v":
 | 
			
		||||
            case "teleport":
 | 
			
		||||
@@ -414,8 +439,19 @@ public class Area extends SubCommand {
 | 
			
		||||
                    C.NOT_VALID_PLOT_WORLD.send(plr, args[1]);
 | 
			
		||||
                    return false;
 | 
			
		||||
                }
 | 
			
		||||
                Location spawn = WorldUtil.IMP.getSpawn(area.worldname);
 | 
			
		||||
                plr.teleport(spawn);
 | 
			
		||||
                RegionWrapper region = area.getRegion();
 | 
			
		||||
                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;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -80,12 +80,12 @@ public class Visit extends SubCommand {
 | 
			
		||||
                page = Integer.parseInt(args[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]);
 | 
			
		||||
                    unsorted = PS.get().getPlots(player);
 | 
			
		||||
                    break;
 | 
			
		||||
                }
 | 
			
		||||
                final UUID user = UUIDHandler.getCachedUUID(args[0], null);
 | 
			
		||||
                if (user != null) {
 | 
			
		||||
                    unsorted = PS.get().getPlots(user);
 | 
			
		||||
                } else if (PS.get().getPlotAreaByString(args[0]) != null) {
 | 
			
		||||
 
 | 
			
		||||
@@ -28,7 +28,7 @@ public class AugmentedUtils {
 | 
			
		||||
        }
 | 
			
		||||
        final int bx = cx << 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);
 | 
			
		||||
        if (areas.size() == 0) {
 | 
			
		||||
            return;
 | 
			
		||||
@@ -56,8 +56,8 @@ public class AugmentedUtils {
 | 
			
		||||
            // coords
 | 
			
		||||
            int bxx = Math.max(0, area.getRegion().minX - bx);
 | 
			
		||||
            int bzz = Math.max(0, area.getRegion().minZ - bz);
 | 
			
		||||
            int txx = Math.min(16, area.getRegion().maxX - bx);
 | 
			
		||||
            int tzz = Math.min(16, area.getRegion().maxZ - bz);
 | 
			
		||||
            int txx = Math.min(15, area.getRegion().maxX - bx);
 | 
			
		||||
            int tzz = Math.min(15, area.getRegion().maxZ - bz);
 | 
			
		||||
            // gen
 | 
			
		||||
            if (area.TYPE == 2) {
 | 
			
		||||
                primaryMask = new PlotChunk<Object>(wrap) {
 | 
			
		||||
@@ -99,8 +99,8 @@ public class AugmentedUtils {
 | 
			
		||||
                PlotManager manager = area.getPlotManager();
 | 
			
		||||
                final boolean[][] canPlace = new boolean[16][16];
 | 
			
		||||
                boolean has = false;
 | 
			
		||||
                for (int x = bxx; x < txx; x++) {
 | 
			
		||||
                    for (int z = bzz; z < tzz; z++) {
 | 
			
		||||
                for (int x = bxx; x <= txx; x++) {
 | 
			
		||||
                    for (int z = bzz; z <= tzz; z++) {
 | 
			
		||||
                        int rx = x + bx;
 | 
			
		||||
                        int rz = z + bz;
 | 
			
		||||
                        boolean can = manager.getPlotIdAbs(area, rx, 0, rz) == null;
 | 
			
		||||
@@ -144,8 +144,8 @@ public class AugmentedUtils {
 | 
			
		||||
                };
 | 
			
		||||
            } else {
 | 
			
		||||
                secondaryMask = primaryMask;
 | 
			
		||||
                for (int x = bxx; x < txx; x++) {
 | 
			
		||||
                    for (int z = bzz; z < tzz; z++) {
 | 
			
		||||
                for (int x = bxx; x <= txx; x++) {
 | 
			
		||||
                    for (int z = bzz; z <= tzz; z++) {
 | 
			
		||||
                        for (int y = 1; y < 128; y++) {
 | 
			
		||||
                            result.setBlock(x, y, z, air);
 | 
			
		||||
                        }
 | 
			
		||||
@@ -156,6 +156,7 @@ public class AugmentedUtils {
 | 
			
		||||
        }
 | 
			
		||||
        if (cache_chunk != null) {
 | 
			
		||||
            cache_chunk.addToQueue();
 | 
			
		||||
            cache_chunk.flush(false);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -20,6 +20,18 @@
 | 
			
		||||
////////////////////////////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
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.plot.PS;
 | 
			
		||||
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.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
 | 
			
		||||
 */
 | 
			
		||||
@@ -133,18 +133,24 @@ public abstract class PlotArea {
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    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 (min != null) {
 | 
			
		||||
                Location bot = getPlotManager().getPlotBottomLocAbs(this, min);
 | 
			
		||||
                Location top = getPlotManager().getPlotTopLocAbs(this, max);
 | 
			
		||||
                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;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Returns the min PlotId
 | 
			
		||||
     * @return
 | 
			
		||||
@@ -427,8 +433,12 @@ public abstract class PlotArea {
 | 
			
		||||
        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) {
 | 
			
		||||
        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) {
 | 
			
		||||
@@ -479,10 +489,6 @@ public abstract class PlotArea {
 | 
			
		||||
        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) {
 | 
			
		||||
        Plot plot = getOwnedPlotAbs(id);
 | 
			
		||||
        if (plot == null) {
 | 
			
		||||
 
 | 
			
		||||
@@ -76,11 +76,11 @@ public abstract class ChunkManager {
 | 
			
		||||
                    int tx = bx + 511;
 | 
			
		||||
                    int tz = bz + 511;
 | 
			
		||||
                    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 ctx = cbx + 15;
 | 
			
		||||
                            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 ctz = cbz + 15;
 | 
			
		||||
                                    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);
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -1,33 +1,16 @@
 | 
			
		||||
package com.plotsquared.bukkit.listeners;
 | 
			
		||||
 | 
			
		||||
import com.intellectualcrafters.plot.PS;
 | 
			
		||||
import com.intellectualcrafters.plot.config.C;
 | 
			
		||||
import com.intellectualcrafters.plot.config.Settings;
 | 
			
		||||
import com.intellectualcrafters.plot.flag.Flag;
 | 
			
		||||
import com.intellectualcrafters.plot.flag.FlagManager;
 | 
			
		||||
import com.intellectualcrafters.plot.object.Location;
 | 
			
		||||
import com.intellectualcrafters.plot.object.Plot;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotArea;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotBlock;
 | 
			
		||||
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;
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.Arrays;
 | 
			
		||||
import java.util.HashSet;
 | 
			
		||||
import java.util.Iterator;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Map.Entry;
 | 
			
		||||
import java.util.Objects;
 | 
			
		||||
import java.util.Set;
 | 
			
		||||
import java.util.UUID;
 | 
			
		||||
import java.util.regex.Pattern;
 | 
			
		||||
 | 
			
		||||
import org.bukkit.Bukkit;
 | 
			
		||||
import org.bukkit.ChatColor;
 | 
			
		||||
import org.bukkit.Material;
 | 
			
		||||
@@ -106,16 +89,34 @@ import org.bukkit.projectiles.BlockProjectileSource;
 | 
			
		||||
import org.bukkit.projectiles.ProjectileSource;
 | 
			
		||||
import org.bukkit.util.Vector;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.Arrays;
 | 
			
		||||
import java.util.HashSet;
 | 
			
		||||
import java.util.Iterator;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Map.Entry;
 | 
			
		||||
import java.util.Objects;
 | 
			
		||||
import java.util.Set;
 | 
			
		||||
import java.util.UUID;
 | 
			
		||||
import java.util.regex.Pattern;
 | 
			
		||||
import com.intellectualcrafters.plot.PS;
 | 
			
		||||
import com.intellectualcrafters.plot.config.C;
 | 
			
		||||
import com.intellectualcrafters.plot.config.Settings;
 | 
			
		||||
import com.intellectualcrafters.plot.flag.Flag;
 | 
			
		||||
import com.intellectualcrafters.plot.flag.FlagManager;
 | 
			
		||||
import com.intellectualcrafters.plot.object.Location;
 | 
			
		||||
import com.intellectualcrafters.plot.object.Plot;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotArea;
 | 
			
		||||
import com.intellectualcrafters.plot.object.PlotBlock;
 | 
			
		||||
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
 | 
			
		||||
@@ -308,7 +309,7 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
            final Location sLoc = BukkitUtil.getLocation(((BlockProjectileSource) shooter).getBlock().getLocation());
 | 
			
		||||
            if (!area.contains(sLoc)) {
 | 
			
		||||
            if (!area.contains(sLoc.getX(), sLoc.getZ())) {
 | 
			
		||||
                entity.remove();
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
@@ -479,6 +480,7 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
 | 
			
		||||
            pp.setMeta("location", loc);
 | 
			
		||||
            PlotArea area = loc.getPlotArea();
 | 
			
		||||
            if (area == null) {
 | 
			
		||||
                pp.deleteMeta("lastplot");
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
            Plot now = area.getPlotAbs(loc);
 | 
			
		||||
@@ -536,6 +538,7 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
 | 
			
		||||
            
 | 
			
		||||
            PlotArea area = loc.getPlotArea();
 | 
			
		||||
            if (area == null) {
 | 
			
		||||
                pp.deleteMeta("lastplot");
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
            Plot now = area.getPlotAbs(loc);
 | 
			
		||||
@@ -703,7 +706,7 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
 | 
			
		||||
                    while (iter.hasNext()) {
 | 
			
		||||
                        final Block b = iter.next();
 | 
			
		||||
                        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();
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
@@ -892,7 +895,7 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
 | 
			
		||||
        final List<Block> blocks = event.getBlocks();
 | 
			
		||||
        for (final Block b : blocks) {
 | 
			
		||||
            final Location bloc = BukkitUtil.getLocation(b.getLocation().add(relative));
 | 
			
		||||
            if (!area.contains(bloc)) {
 | 
			
		||||
            if (!area.contains(bloc.getX(), bloc.getZ())) {
 | 
			
		||||
                event.setCancelled(true);
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
@@ -940,7 +943,7 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
 | 
			
		||||
            try {
 | 
			
		||||
                for (final Block pulled : event.getBlocks()) {
 | 
			
		||||
                    loc = BukkitUtil.getLocation(pulled.getLocation());
 | 
			
		||||
                    if (!area.contains(loc)) {
 | 
			
		||||
                    if (!area.contains(loc.getX(), loc.getZ())) {
 | 
			
		||||
                        event.setCancelled(true);
 | 
			
		||||
                        return;
 | 
			
		||||
                    }
 | 
			
		||||
@@ -1006,7 +1009,7 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
 | 
			
		||||
            }
 | 
			
		||||
            for (int i = blocks.size() - 1; i >= 0; i--) {
 | 
			
		||||
                loc = BukkitUtil.getLocation(blocks.get(i).getLocation());
 | 
			
		||||
                if (!area.contains(loc)) {
 | 
			
		||||
                if (!area.contains(loc.getX(), loc.getZ())) {
 | 
			
		||||
                    blocks.remove(i);
 | 
			
		||||
                    continue;
 | 
			
		||||
                }
 | 
			
		||||
@@ -2029,7 +2032,7 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
 | 
			
		||||
        final Location dloc = BukkitUtil.getLocation(damager);
 | 
			
		||||
        final Location vloc = BukkitUtil.getLocation(victim);
 | 
			
		||||
        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) {
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -2,6 +2,22 @@ package com.plotsquared.bukkit.util.block;
 | 
			
		||||
 | 
			
		||||
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.PseudoRandom;
 | 
			
		||||
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.plotsquared.bukkit.util.BukkitUtil;
 | 
			
		||||
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 {
 | 
			
		||||
    
 | 
			
		||||
@@ -285,7 +286,7 @@ public class FastQueue_1_8_3 extends SlowQueue {
 | 
			
		||||
            // Initialize lighting
 | 
			
		||||
            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();
 | 
			
		||||
                ChunkWrapper wrapper = bc.getChunkWrapper();
 | 
			
		||||
                String worldname = wrapper.world;
 | 
			
		||||
 
 | 
			
		||||
@@ -20,6 +20,10 @@
 | 
			
		||||
////////////////////////////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
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.Settings;
 | 
			
		||||
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.UUIDHandler;
 | 
			
		||||
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
import java.util.UUID;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user