mirror of
				https://github.com/IntellectualSites/PlotSquared.git
				synced 2025-11-04 03:03:43 +01:00 
			
		
		
		
	WE unregistration + home/visit sorting + format
- WorldEdit listener unregistration for external masking/extent/async worldedit management. (wink) - Use the same listing for home and visit as previous behavior was confusing.
This commit is contained in:
		@@ -879,7 +879,7 @@ public class PS
 | 
			
		||||
                            return -1;
 | 
			
		||||
                        }
 | 
			
		||||
                        else if (b.getTimestamp() > a.getTimestamp()) {
 | 
			
		||||
                        return 1;
 | 
			
		||||
                            return 1;
 | 
			
		||||
                        }
 | 
			
		||||
                        return 0;
 | 
			
		||||
                    }
 | 
			
		||||
@@ -970,7 +970,7 @@ public class PS
 | 
			
		||||
                            return -1;
 | 
			
		||||
                        }
 | 
			
		||||
                        else if (b.getTimestamp() > a.getTimestamp()) {
 | 
			
		||||
                        return 1;
 | 
			
		||||
                            return 1;
 | 
			
		||||
                        }
 | 
			
		||||
                        return 0;
 | 
			
		||||
                    }
 | 
			
		||||
@@ -1003,7 +1003,7 @@ public class PS
 | 
			
		||||
                        return -1;
 | 
			
		||||
                    }
 | 
			
		||||
                    else if (b.getTimestamp() > a.getTimestamp()) {
 | 
			
		||||
                    return 1;
 | 
			
		||||
                        return 1;
 | 
			
		||||
                    }
 | 
			
		||||
                    return 0;
 | 
			
		||||
                }
 | 
			
		||||
@@ -1150,7 +1150,7 @@ public class PS
 | 
			
		||||
            public int compare(final String a, final String b)
 | 
			
		||||
            {
 | 
			
		||||
                if ((priorityWorld != null) && StringMan.isEqual(a, priorityWorld)) {
 | 
			
		||||
                return -1;
 | 
			
		||||
                    return -1;
 | 
			
		||||
                }
 | 
			
		||||
                return a.hashCode() - b.hashCode();
 | 
			
		||||
            }
 | 
			
		||||
 
 | 
			
		||||
@@ -89,9 +89,9 @@ public class PlotAPI
 | 
			
		||||
     * @see com.intellectualcrafters.plot.PS
 | 
			
		||||
     *
 | 
			
		||||
     * @deprecated Use this class if you just want to do a few simple things.<br>
 | 
			
		||||
     *  - It will remain stable for future versions of the plugin
 | 
			
		||||
     *  - The PlotPlayer and Plot class should be considered relatively safe
 | 
			
		||||
     *  - For more advanced/intensive tasks you should consider using other classes 
 | 
			
		||||
     *  - It will remain stable for future versions of the plugin
 | 
			
		||||
     *  - The PlotPlayer and Plot class should be considered relatively safe
 | 
			
		||||
     *  - For more advanced/intensive tasks you should consider using other classes
 | 
			
		||||
     *
 | 
			
		||||
     *
 | 
			
		||||
     */
 | 
			
		||||
 
 | 
			
		||||
@@ -21,6 +21,8 @@
 | 
			
		||||
package com.intellectualcrafters.plot.commands;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.Iterator;
 | 
			
		||||
import java.util.Set;
 | 
			
		||||
 | 
			
		||||
import com.intellectualcrafters.plot.PS;
 | 
			
		||||
import com.intellectualcrafters.plot.config.C;
 | 
			
		||||
@@ -51,7 +53,16 @@ public class Home extends SubCommand
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean onCommand(final PlotPlayer plr, String[] args)
 | 
			
		||||
    {
 | 
			
		||||
        final ArrayList<Plot> plots = PS.get().sortPlotsByTemp(PS.get().getPlots(plr));//PS.get().sortPlots(PS.get().getPlots(plr), SortType.CREATION_DATE, null);
 | 
			
		||||
        final Set<Plot> all = PS.get().getPlots(plr);
 | 
			
		||||
        final Iterator<Plot> iter = all.iterator();
 | 
			
		||||
        while (iter.hasNext())
 | 
			
		||||
        {
 | 
			
		||||
            if (!iter.next().isBasePlot())
 | 
			
		||||
            {
 | 
			
		||||
                iter.remove();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        final ArrayList<Plot> plots = PS.get().sortPlotsByTemp(all);
 | 
			
		||||
        if (plots.size() == 1)
 | 
			
		||||
        {
 | 
			
		||||
            MainUtil.teleportPlayer(plr, plr.getLocation(), plots.get(0));
 | 
			
		||||
 
 | 
			
		||||
@@ -159,12 +159,12 @@ public class Info extends SubCommand
 | 
			
		||||
            final UUID uuid = player.getUUID();
 | 
			
		||||
            final String name = MainUtil.getName(plot.owner);
 | 
			
		||||
            inv.setItem(1, new PlotItemStack(388, (short) 0, 1, "&cPlot Info", new String[] {
 | 
			
		||||
            "&cID: &6" + plot.getId().toString(),
 | 
			
		||||
            "&cOwner: &6" + name,
 | 
			
		||||
            "&cAlias: &6" + plot.getSettings().getAlias(),
 | 
			
		||||
            "&cBiome: &6" + plot.getBiome().toString().replaceAll("_", "").toLowerCase(),
 | 
			
		||||
            "&cCan Build: &6" + plot.isAdded(uuid),
 | 
			
		||||
            "&cIs Denied: &6" + plot.isDenied(uuid) }));
 | 
			
		||||
                "&cID: &6" + plot.getId().toString(),
 | 
			
		||||
                "&cOwner: &6" + name,
 | 
			
		||||
                "&cAlias: &6" + plot.getSettings().getAlias(),
 | 
			
		||||
                "&cBiome: &6" + plot.getBiome().toString().replaceAll("_", "").toLowerCase(),
 | 
			
		||||
                "&cCan Build: &6" + plot.isAdded(uuid),
 | 
			
		||||
                "&cIs Denied: &6" + plot.isDenied(uuid) }));
 | 
			
		||||
            inv.setItem(1, new PlotItemStack(388, (short) 0, 1, "&cTrusted", new String[] { "&cAmount: &6" + plot.getTrusted().size(), "&8Click to view a list of the trusted users" }));
 | 
			
		||||
            inv.setItem(1, new PlotItemStack(388, (short) 0, 1, "&cMembers", new String[] { "&cAmount: &6" + plot.getMembers().size(), "&8Click to view a list of plot members" }));
 | 
			
		||||
            inv.setItem(1, new PlotItemStack(388, (short) 0, 1, "&cDenied", new String[] { "&cDenied", "&cAmount: &6" + plot.getDenied().size(), "&8Click to view a list of denied players" }));
 | 
			
		||||
 
 | 
			
		||||
@@ -61,7 +61,7 @@ public class MusicSubcommand extends SubCommand
 | 
			
		||||
            {
 | 
			
		||||
                final PlotItemStack item = getItem(index);
 | 
			
		||||
                if (item == null) {
 | 
			
		||||
                return true;
 | 
			
		||||
                    return true;
 | 
			
		||||
                }
 | 
			
		||||
                final int id = item.id == 7 ? 0 : item.id;
 | 
			
		||||
                if (id == 0)
 | 
			
		||||
 
 | 
			
		||||
@@ -21,6 +21,7 @@
 | 
			
		||||
package com.intellectualcrafters.plot.commands;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.Iterator;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.UUID;
 | 
			
		||||
 | 
			
		||||
@@ -114,6 +115,14 @@ public class Visit extends SubCommand
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        final Plot plot = plots.get(index);
 | 
			
		||||
        final Iterator<Plot> iter = plots.iterator();
 | 
			
		||||
        while (iter.hasNext())
 | 
			
		||||
        {
 | 
			
		||||
            if (!iter.next().isBasePlot())
 | 
			
		||||
            {
 | 
			
		||||
                iter.remove();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        if (!plot.hasOwner())
 | 
			
		||||
        {
 | 
			
		||||
            if (!Permissions.hasPermission(plr, "plots.visit.unowned"))
 | 
			
		||||
 
 | 
			
		||||
@@ -248,7 +248,7 @@ public class list extends SubCommand
 | 
			
		||||
                        if (MathMan.isInteger(va))
 | 
			
		||||
                        {
 | 
			
		||||
                            if (MathMan.isInteger(vb)) {
 | 
			
		||||
                            return Integer.parseInt(vb) - Integer.parseInt(va);
 | 
			
		||||
                                return Integer.parseInt(vb) - Integer.parseInt(va);
 | 
			
		||||
                            }
 | 
			
		||||
                            return -1;
 | 
			
		||||
                        }
 | 
			
		||||
@@ -296,7 +296,7 @@ public class list extends SubCommand
 | 
			
		||||
                            v2 += p2s;
 | 
			
		||||
                        }
 | 
			
		||||
                        if ((v2 == v1) && (v2 != 0)) {
 | 
			
		||||
                        return p2s - p1s;
 | 
			
		||||
                            return p2s - p1s;
 | 
			
		||||
                        }
 | 
			
		||||
                        return (int) Math.signum(v2 - v1);
 | 
			
		||||
                    }
 | 
			
		||||
 
 | 
			
		||||
@@ -148,7 +148,7 @@ public class Configuration
 | 
			
		||||
        @Override
 | 
			
		||||
        public String parseString(final String string)
 | 
			
		||||
        {
 | 
			
		||||
            if (validateValue(string)) {
 | 
			
		||||
            if (validateValue(string)) {
 | 
			
		||||
                return string.toUpperCase();
 | 
			
		||||
            }
 | 
			
		||||
            return "FOREST";
 | 
			
		||||
@@ -209,7 +209,7 @@ public class Configuration
 | 
			
		||||
                        block = split[1];
 | 
			
		||||
                    }
 | 
			
		||||
                    final StringComparison<PlotBlock>.ComparisonResult value = BlockManager.manager.getClosestBlock(block);
 | 
			
		||||
                    if ((value == null) || (value.match > 1)) {
 | 
			
		||||
                    if ((value == null) || (value.match > 1)) {
 | 
			
		||||
                        return false;
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
 
 | 
			
		||||
@@ -215,9 +215,9 @@ public class Settings
 | 
			
		||||
    public static class DB
 | 
			
		||||
    {
 | 
			
		||||
        /**
 | 
			
		||||
         * MongoDB enabled?
 | 
			
		||||
         */
 | 
			
		||||
        public static boolean USE_MONGO = false; /*
 | 
			
		||||
         * MongoDB enabled?
 | 
			
		||||
         */
 | 
			
		||||
        public static boolean USE_MONGO = false; /*
 | 
			
		||||
         * TODO: Implement Mongo
 | 
			
		||||
         * @Brandon
 | 
			
		||||
         */
 | 
			
		||||
 
 | 
			
		||||
@@ -2289,9 +2289,9 @@ public class SQLManager implements AbstractDB
 | 
			
		||||
            @Override
 | 
			
		||||
            public PreparedStatement get() throws SQLException
 | 
			
		||||
            {
 | 
			
		||||
                if (plot != null) {
 | 
			
		||||
                return connection.prepareStatement("DELETE FROM `"
 | 
			
		||||
                + prefix
 | 
			
		||||
                if (plot != null) {
 | 
			
		||||
                    return connection.prepareStatement("DELETE FROM `"
 | 
			
		||||
                    + prefix
 | 
			
		||||
                    + "plot_comments` WHERE `world` = ? AND `hashcode` = ? AND `comment` = ? AND `inbox` = ? AND `sender` = ?");
 | 
			
		||||
                }
 | 
			
		||||
                return connection.prepareStatement("DELETE FROM `" + prefix + "plot_comments` WHERE `comment` = ? AND `inbox` = ? AND `sender` = ?");
 | 
			
		||||
@@ -2322,7 +2322,7 @@ public class SQLManager implements AbstractDB
 | 
			
		||||
            @Override
 | 
			
		||||
            public PreparedStatement get() throws SQLException
 | 
			
		||||
            {
 | 
			
		||||
                if (plot != null) {
 | 
			
		||||
                if (plot != null) {
 | 
			
		||||
                    return connection.prepareStatement("DELETE FROM `" + prefix + "plot_comments` WHERE `world` = ? AND `hashcode` = ? AND `inbox` = ?");
 | 
			
		||||
                }
 | 
			
		||||
                return connection.prepareStatement("DELETE FROM `" + prefix + "plot_comments` `inbox` = ?");
 | 
			
		||||
@@ -2353,7 +2353,7 @@ public class SQLManager implements AbstractDB
 | 
			
		||||
            @Override
 | 
			
		||||
            public PreparedStatement get() throws SQLException
 | 
			
		||||
            {
 | 
			
		||||
                if (plot != null) {
 | 
			
		||||
                if (plot != null) {
 | 
			
		||||
                    return connection.prepareStatement("SELECT * FROM `" + prefix + "plot_comments` WHERE `world` = ? AND `hashcode` = ? AND `inbox` = ?");
 | 
			
		||||
                }
 | 
			
		||||
                return connection.prepareStatement("SELECT * FROM `" + prefix + "plot_comments` WHERE `inbox` = ?");
 | 
			
		||||
 
 | 
			
		||||
@@ -144,29 +144,31 @@ public class Plot
 | 
			
		||||
    {
 | 
			
		||||
        this.world = world;
 | 
			
		||||
        this.id = id;
 | 
			
		||||
        this.owner = owner;
 | 
			
		||||
        this.owner = owner;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
    /**
 | 
			
		||||
     * Return a new/cached plot object at a given world/plot id
 | 
			
		||||
     * 
 | 
			
		||||
     *
 | 
			
		||||
     * @see MainUtil#getPlotSelectionOwned(String world, PlotId bottom, PlotId top) return a list of owned plots between (inclusive) two plot ids.
 | 
			
		||||
     *
 | 
			
		||||
     * @param world
 | 
			
		||||
     * @param id
 | 
			
		||||
     * @return
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    public static Plot getPlot(final String world, final PlotId id)
 | 
			
		||||
    {
 | 
			
		||||
        return MainUtil.getPlot(world, id);
 | 
			
		||||
        return MainUtil.getPlot(world, id);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
    /**
 | 
			
		||||
     * Return a new/cached plot object at a given location
 | 
			
		||||
     * 
 | 
			
		||||
     *
 | 
			
		||||
     * @see PlotPlayer#getCurrentPlot() if a player is expected here.
 | 
			
		||||
     *
 | 
			
		||||
     * @param loc
 | 
			
		||||
     * @return
 | 
			
		||||
     * @return
 | 
			
		||||
     */
 | 
			
		||||
    public static Plot getPlot(final Location loc)
 | 
			
		||||
    {
 | 
			
		||||
        return MainUtil.getPlot(loc);
 | 
			
		||||
@@ -192,7 +194,7 @@ public class Plot
 | 
			
		||||
        this.temp = temp;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
    /**
 | 
			
		||||
     * Constructor for a saved plots (Used by the database manager when plots are fetched)
 | 
			
		||||
     *
 | 
			
		||||
     * @see MainUtil#getPlot(String, PlotId) for existing plots
 | 
			
		||||
@@ -793,7 +795,7 @@ public class Plot
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Register a plot and create it in the database<br>
 | 
			
		||||
     * Register a plot and create it in the database<br>
 | 
			
		||||
     *  - The plot will not be created if the owner is null<br>
 | 
			
		||||
     *  - Any setting from before plot creation will not be saved until the server is stopped properly. i.e. Set any values/options after plot creation.
 | 
			
		||||
     * @return true if plot was created successfully
 | 
			
		||||
 
 | 
			
		||||
@@ -120,11 +120,11 @@ public abstract class PlotPlayer implements CommandCaller
 | 
			
		||||
        return MainUtil.getAllowedPlots(this);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Get the number of plots the player owns  
 | 
			
		||||
    /**
 | 
			
		||||
     * Get the number of plots the player owns
 | 
			
		||||
     *
 | 
			
		||||
     * @see #getPlotCount(String);
 | 
			
		||||
     * @see #getPlots()
 | 
			
		||||
     * @see #getPlots()
 | 
			
		||||
     *
 | 
			
		||||
     * @return number of plots within the scope (globally, or in the player's current world as defined in the settings.yml)
 | 
			
		||||
     */
 | 
			
		||||
 
 | 
			
		||||
@@ -72,54 +72,54 @@ public class BO3Handler
 | 
			
		||||
        for (int x = pos1.getX(); x <= pos2.getX(); x++)
 | 
			
		||||
        {
 | 
			
		||||
            final int X = ((x + 7) - cx) >> 4;
 | 
			
		||||
            final int xx = (x - cx) % 16;
 | 
			
		||||
            for (int z = pos1.getZ(); z <= pos2.getZ(); z++)
 | 
			
		||||
        final int xx = (x - cx) % 16;
 | 
			
		||||
        for (int z = pos1.getZ(); z <= pos2.getZ(); z++)
 | 
			
		||||
        {
 | 
			
		||||
            final int Z = ((z + 7) - cz) >> 4;
 | 
			
		||||
        final int zz = (z - cz) % 16;
 | 
			
		||||
        final ChunkLoc loc = new ChunkLoc(X, Z);
 | 
			
		||||
        BO3 bo3 = map.get(loc);
 | 
			
		||||
        for (int y = 1; y < height; y++)
 | 
			
		||||
        {
 | 
			
		||||
            final PlotBlock block = BlockManager.manager.getBlock(new Location(plot.world, x, y, z));
 | 
			
		||||
            if ((block != null) && !contains(cpw.MAIN_BLOCK, block))
 | 
			
		||||
            {
 | 
			
		||||
                final int Z = ((z + 7) - cz) >> 4;
 | 
			
		||||
                final int zz = (z - cz) % 16;
 | 
			
		||||
                final ChunkLoc loc = new ChunkLoc(X, Z);
 | 
			
		||||
                BO3 bo3 = map.get(loc);
 | 
			
		||||
                for (int y = 1; y < height; y++)
 | 
			
		||||
                if (bo3 == null)
 | 
			
		||||
                {
 | 
			
		||||
                    final PlotBlock block = BlockManager.manager.getBlock(new Location(plot.world, x, y, z));
 | 
			
		||||
                    if ((block != null) && !contains(cpw.MAIN_BLOCK, block))
 | 
			
		||||
                    {
 | 
			
		||||
                        if (bo3 == null)
 | 
			
		||||
                        {
 | 
			
		||||
                            bo3 = new BO3(alias, loc);
 | 
			
		||||
                            map.put(loc, bo3);
 | 
			
		||||
                            content = true;
 | 
			
		||||
                        }
 | 
			
		||||
                        bo3.addBlock(xx, y - height - 1, zz, block);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
                final PlotBlock floor = BlockManager.manager.getBlock(new Location(plot.world, x, height, z));
 | 
			
		||||
                if ((floor != null) && !contains(cpw.TOP_BLOCK, floor))
 | 
			
		||||
                {
 | 
			
		||||
                    if (bo3 == null)
 | 
			
		||||
                    {
 | 
			
		||||
                        bo3 = new BO3(alias, loc);
 | 
			
		||||
                        map.put(loc, bo3);
 | 
			
		||||
                        content = true;
 | 
			
		||||
                    }
 | 
			
		||||
                    bo3.addBlock(xx, -1, zz, floor);
 | 
			
		||||
                }
 | 
			
		||||
                for (int y = height + 1; y < 256; y++)
 | 
			
		||||
                {
 | 
			
		||||
                    final PlotBlock block = BlockManager.manager.getBlock(new Location(plot.world, x, y, z));
 | 
			
		||||
                    if ((block != null) && (block.id != 0))
 | 
			
		||||
                    {
 | 
			
		||||
                        if (bo3 == null)
 | 
			
		||||
                        {
 | 
			
		||||
                            bo3 = new BO3(alias, loc);
 | 
			
		||||
                            map.put(loc, bo3);
 | 
			
		||||
                            content = true;
 | 
			
		||||
                        }
 | 
			
		||||
                        bo3.addBlock(xx, y - height - 1, zz, block);
 | 
			
		||||
                    }
 | 
			
		||||
                    bo3 = new BO3(alias, loc);
 | 
			
		||||
                    map.put(loc, bo3);
 | 
			
		||||
                    content = true;
 | 
			
		||||
                }
 | 
			
		||||
                bo3.addBlock(xx, y - height - 1, zz, block);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        final PlotBlock floor = BlockManager.manager.getBlock(new Location(plot.world, x, height, z));
 | 
			
		||||
        if ((floor != null) && !contains(cpw.TOP_BLOCK, floor))
 | 
			
		||||
        {
 | 
			
		||||
            if (bo3 == null)
 | 
			
		||||
            {
 | 
			
		||||
                bo3 = new BO3(alias, loc);
 | 
			
		||||
                map.put(loc, bo3);
 | 
			
		||||
                content = true;
 | 
			
		||||
            }
 | 
			
		||||
            bo3.addBlock(xx, -1, zz, floor);
 | 
			
		||||
        }
 | 
			
		||||
        for (int y = height + 1; y < 256; y++)
 | 
			
		||||
        {
 | 
			
		||||
            final PlotBlock block = BlockManager.manager.getBlock(new Location(plot.world, x, y, z));
 | 
			
		||||
            if ((block != null) && (block.id != 0))
 | 
			
		||||
            {
 | 
			
		||||
                if (bo3 == null)
 | 
			
		||||
                {
 | 
			
		||||
                    bo3 = new BO3(alias, loc);
 | 
			
		||||
                    map.put(loc, bo3);
 | 
			
		||||
                    content = true;
 | 
			
		||||
                }
 | 
			
		||||
                bo3.addBlock(xx, y - height - 1, zz, block);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (!content)
 | 
			
		||||
        {
 | 
			
		||||
 
 | 
			
		||||
@@ -66,6 +66,9 @@ public class MainUtil
 | 
			
		||||
    public static short[][] x_loc;
 | 
			
		||||
    public static short[][] y_loc;
 | 
			
		||||
    public static short[][] z_loc;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This cache is used for world generation and just saves a bit of calculation time when checking if something is in the plot area.
 | 
			
		||||
     */
 | 
			
		||||
    public static void initCache()
 | 
			
		||||
    {
 | 
			
		||||
@@ -602,7 +605,7 @@ public class MainUtil
 | 
			
		||||
                        return;
 | 
			
		||||
                    }
 | 
			
		||||
                    TaskManager.TELEPORT_QUEUE.remove(name);
 | 
			
		||||
                    if (!player.isOnline()) {
 | 
			
		||||
                    if (!player.isOnline()) {
 | 
			
		||||
                        return;
 | 
			
		||||
                    }
 | 
			
		||||
                    sendMessage(player, C.TELEPORTED_TO_PLOT);
 | 
			
		||||
@@ -655,21 +658,21 @@ public class MainUtil
 | 
			
		||||
        final Location bot = getPlotBottomLoc(plot.world, plot.id).add(1, 0, 1);
 | 
			
		||||
        final Location top = getPlotTopLoc(plot.world, plot.id);
 | 
			
		||||
 | 
			
		||||
        final int bx = bot.getX() >> 4;
 | 
			
		||||
        final int bx = bot.getX() >> 4;
 | 
			
		||||
            final int bz = bot.getZ() >> 4;
 | 
			
		||||
 | 
			
		||||
        final int tx = (top.getX() >> 4);
 | 
			
		||||
 | 
			
		||||
                    final int tx = (top.getX() >> 4);
 | 
			
		||||
                    final int tz = (top.getZ() >> 4);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                    final ArrayList<ChunkLoc> chunks = new ArrayList<>();
 | 
			
		||||
 | 
			
		||||
        for (int x = bx; x <= tx; x++)
 | 
			
		||||
        {
 | 
			
		||||
            for (int z = bz; z <= tz; z++)
 | 
			
		||||
            {
 | 
			
		||||
                chunks.add(new ChunkLoc(x, z));
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
                    for (int x = bx; x <= tx; x++)
 | 
			
		||||
                    {
 | 
			
		||||
                        for (int z = bz; z <= tz; z++)
 | 
			
		||||
                        {
 | 
			
		||||
                            chunks.add(new ChunkLoc(x, z));
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                    BlockUpdateUtil.setBlockManager.update(plot.world, chunks);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -381,7 +381,7 @@ public class NbtFactory
 | 
			
		||||
 | 
			
		||||
                LOAD_COMPOUND = READ_LIMITER_CLASS != null ?
 | 
			
		||||
                new LoadMethodSkinUpdate(STREAM_TOOLS, READ_LIMITER_CLASS) :
 | 
			
		||||
                new LoadMethodWorldUpdate(STREAM_TOOLS);
 | 
			
		||||
                    new LoadMethodWorldUpdate(STREAM_TOOLS);
 | 
			
		||||
                SAVE_COMPOUND = getMethod(Modifier.STATIC, 0, STREAM_TOOLS, null, BASE_CLASS, DataOutput.class);
 | 
			
		||||
 | 
			
		||||
            }
 | 
			
		||||
@@ -544,7 +544,7 @@ public class NbtFactory
 | 
			
		||||
            output = stream.getOutput();
 | 
			
		||||
            data = new DataOutputStream(
 | 
			
		||||
            option == StreamOptions.GZIP_COMPRESSION ? new GZIPOutputStream(output) : output
 | 
			
		||||
                   );
 | 
			
		||||
            );
 | 
			
		||||
 | 
			
		||||
            invokeMethod(get().SAVE_COMPOUND, null, source.getHandle(), data);
 | 
			
		||||
            suppress = false;
 | 
			
		||||
 
 | 
			
		||||
@@ -99,7 +99,7 @@ public class SetBlockQueue
 | 
			
		||||
                public void run()
 | 
			
		||||
                {
 | 
			
		||||
                    if (locked) {
 | 
			
		||||
                    return;
 | 
			
		||||
                        return;
 | 
			
		||||
                    }
 | 
			
		||||
                    if ((blocks == null) || (blocks.size() == 0))
 | 
			
		||||
                    {
 | 
			
		||||
@@ -125,7 +125,7 @@ public class SetBlockQueue
 | 
			
		||||
                    while ((blocks.size() > 0) && ((System.currentTimeMillis() - last) < (50 + allocate)))
 | 
			
		||||
                    {
 | 
			
		||||
                        if (locked) {
 | 
			
		||||
                        return;
 | 
			
		||||
                            return;
 | 
			
		||||
                        }
 | 
			
		||||
                        final Iterator<Entry<ChunkWrapper, PlotBlock[][]>> iter = blocks.entrySet().iterator();
 | 
			
		||||
                        if (!iter.hasNext())
 | 
			
		||||
@@ -232,29 +232,29 @@ public class SetBlockQueue
 | 
			
		||||
            init();
 | 
			
		||||
        }
 | 
			
		||||
        final int X = x >> 4;
 | 
			
		||||
        final int Z = z >> 4;
 | 
			
		||||
        x -= X << 4;
 | 
			
		||||
        z -= Z << 4;
 | 
			
		||||
                                final int Z = z >> 4;
 | 
			
		||||
                            x -= X << 4;
 | 
			
		||||
                            z -= Z << 4;
 | 
			
		||||
 | 
			
		||||
        final ChunkWrapper wrap = new ChunkWrapper(world, X, Z);
 | 
			
		||||
        PlotBlock[][] result;
 | 
			
		||||
        result = blocks.get(wrap);
 | 
			
		||||
        if (!blocks.containsKey(wrap))
 | 
			
		||||
        {
 | 
			
		||||
            result = new PlotBlock[16][];
 | 
			
		||||
            blocks.put(wrap, result);
 | 
			
		||||
        }
 | 
			
		||||
        if ((y > 255) || (y < 0))
 | 
			
		||||
        {
 | 
			
		||||
            locked = false;
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        if (result[y >> 4] == null)
 | 
			
		||||
        {
 | 
			
		||||
            result[y >> 4] = new PlotBlock[4096];
 | 
			
		||||
        }
 | 
			
		||||
        result[y >> 4][((y & 0xF) << 8) | (z << 4) | x] = block;
 | 
			
		||||
        locked = false;
 | 
			
		||||
                            final ChunkWrapper wrap = new ChunkWrapper(world, X, Z);
 | 
			
		||||
                            PlotBlock[][] result;
 | 
			
		||||
                            result = blocks.get(wrap);
 | 
			
		||||
                            if (!blocks.containsKey(wrap))
 | 
			
		||||
                            {
 | 
			
		||||
                                result = new PlotBlock[16][];
 | 
			
		||||
                                blocks.put(wrap, result);
 | 
			
		||||
                            }
 | 
			
		||||
                            if ((y > 255) || (y < 0))
 | 
			
		||||
                            {
 | 
			
		||||
                                locked = false;
 | 
			
		||||
                                return;
 | 
			
		||||
                            }
 | 
			
		||||
                            if (result[y >> 4] == null)
 | 
			
		||||
                            {
 | 
			
		||||
                                result[y >> 4] = new PlotBlock[4096];
 | 
			
		||||
                            }
 | 
			
		||||
                            result[y >> 4][((y & 0xF) << 8) | (z << 4) | x] = block;
 | 
			
		||||
                            locked = false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static void setData(final String world, int x, final int y, int z, final byte data)
 | 
			
		||||
@@ -265,32 +265,32 @@ public class SetBlockQueue
 | 
			
		||||
            init();
 | 
			
		||||
        }
 | 
			
		||||
        final int X = x >> 4;
 | 
			
		||||
        final int Z = z >> 4;
 | 
			
		||||
        x -= X << 4;
 | 
			
		||||
        z -= Z << 4;
 | 
			
		||||
        final ChunkWrapper wrap = new ChunkWrapper(world, X, Z);
 | 
			
		||||
        PlotBlock[][] result;
 | 
			
		||||
        result = blocks.get(wrap);
 | 
			
		||||
        if (result == null)
 | 
			
		||||
        {
 | 
			
		||||
            if (blocks == null)
 | 
			
		||||
            {
 | 
			
		||||
                init();
 | 
			
		||||
            }
 | 
			
		||||
            result = new PlotBlock[16][];
 | 
			
		||||
            blocks.put(wrap, result);
 | 
			
		||||
        }
 | 
			
		||||
        if ((y > 255) || (y < 0))
 | 
			
		||||
        {
 | 
			
		||||
            locked = false;
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        if (result[y >> 4] == null)
 | 
			
		||||
        {
 | 
			
		||||
            result[y >> 4] = new PlotBlock[4096];
 | 
			
		||||
        }
 | 
			
		||||
        result[y >> 4][((y & 0xF) << 8) | (z << 4) | x] = new PlotBlock((short) -1, data);
 | 
			
		||||
        locked = false;
 | 
			
		||||
                            final int Z = z >> 4;
 | 
			
		||||
                            x -= X << 4;
 | 
			
		||||
                            z -= Z << 4;
 | 
			
		||||
                            final ChunkWrapper wrap = new ChunkWrapper(world, X, Z);
 | 
			
		||||
                            PlotBlock[][] result;
 | 
			
		||||
                            result = blocks.get(wrap);
 | 
			
		||||
                            if (result == null)
 | 
			
		||||
                            {
 | 
			
		||||
                                if (blocks == null)
 | 
			
		||||
                                {
 | 
			
		||||
                                    init();
 | 
			
		||||
                                }
 | 
			
		||||
                                result = new PlotBlock[16][];
 | 
			
		||||
                                blocks.put(wrap, result);
 | 
			
		||||
                            }
 | 
			
		||||
                            if ((y > 255) || (y < 0))
 | 
			
		||||
                            {
 | 
			
		||||
                                locked = false;
 | 
			
		||||
                                return;
 | 
			
		||||
                            }
 | 
			
		||||
                            if (result[y >> 4] == null)
 | 
			
		||||
                            {
 | 
			
		||||
                                result[y >> 4] = new PlotBlock[4096];
 | 
			
		||||
                            }
 | 
			
		||||
                            result[y >> 4][((y & 0xF) << 8) | (z << 4) | x] = new PlotBlock((short) -1, data);
 | 
			
		||||
                            locked = false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static void setBlock(final String world, int x, final int y, int z, final int id)
 | 
			
		||||
@@ -301,41 +301,41 @@ public class SetBlockQueue
 | 
			
		||||
            init();
 | 
			
		||||
        }
 | 
			
		||||
        final int X = x >> 4;
 | 
			
		||||
        final int Z = z >> 4;
 | 
			
		||||
        x -= X << 4;
 | 
			
		||||
        z -= Z << 4;
 | 
			
		||||
        final ChunkWrapper wrap = new ChunkWrapper(world, X, Z);
 | 
			
		||||
        PlotBlock[][] result;
 | 
			
		||||
        result = blocks.get(wrap);
 | 
			
		||||
        if (result == null)
 | 
			
		||||
        {
 | 
			
		||||
            if (blocks == null)
 | 
			
		||||
            {
 | 
			
		||||
                init();
 | 
			
		||||
            }
 | 
			
		||||
            result = new PlotBlock[16][];
 | 
			
		||||
            blocks.put(wrap, result);
 | 
			
		||||
        }
 | 
			
		||||
        if ((y > 255) || (y < 0))
 | 
			
		||||
        {
 | 
			
		||||
            locked = false;
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        if (result[y >> 4] == null)
 | 
			
		||||
        {
 | 
			
		||||
            result[y >> 4] = new PlotBlock[4096];
 | 
			
		||||
        }
 | 
			
		||||
        if (id == lastInt)
 | 
			
		||||
        {
 | 
			
		||||
            result[y >> 4][((y & 0xF) << 8) | (z << 4) | x] = lastBlock;
 | 
			
		||||
        }
 | 
			
		||||
        else
 | 
			
		||||
        {
 | 
			
		||||
            lastInt = id;
 | 
			
		||||
            lastBlock = new PlotBlock((short) id, (byte) 0);
 | 
			
		||||
        }
 | 
			
		||||
        result[y >> 4][((y & 0xF) << 8) | (z << 4) | x] = lastBlock;
 | 
			
		||||
        locked = false;
 | 
			
		||||
                            final int Z = z >> 4;
 | 
			
		||||
                            x -= X << 4;
 | 
			
		||||
                            z -= Z << 4;
 | 
			
		||||
                            final ChunkWrapper wrap = new ChunkWrapper(world, X, Z);
 | 
			
		||||
                            PlotBlock[][] result;
 | 
			
		||||
                            result = blocks.get(wrap);
 | 
			
		||||
                            if (result == null)
 | 
			
		||||
                            {
 | 
			
		||||
                                if (blocks == null)
 | 
			
		||||
                                {
 | 
			
		||||
                                    init();
 | 
			
		||||
                                }
 | 
			
		||||
                                result = new PlotBlock[16][];
 | 
			
		||||
                                blocks.put(wrap, result);
 | 
			
		||||
                            }
 | 
			
		||||
                            if ((y > 255) || (y < 0))
 | 
			
		||||
                            {
 | 
			
		||||
                                locked = false;
 | 
			
		||||
                                return;
 | 
			
		||||
                            }
 | 
			
		||||
                            if (result[y >> 4] == null)
 | 
			
		||||
                            {
 | 
			
		||||
                                result[y >> 4] = new PlotBlock[4096];
 | 
			
		||||
                            }
 | 
			
		||||
                            if (id == lastInt)
 | 
			
		||||
                            {
 | 
			
		||||
                                result[y >> 4][((y & 0xF) << 8) | (z << 4) | x] = lastBlock;
 | 
			
		||||
                            }
 | 
			
		||||
                            else
 | 
			
		||||
                            {
 | 
			
		||||
                                lastInt = id;
 | 
			
		||||
                                lastBlock = new PlotBlock((short) id, (byte) 0);
 | 
			
		||||
                            }
 | 
			
		||||
                            result[y >> 4][((y & 0xF) << 8) | (z << 4) | x] = lastBlock;
 | 
			
		||||
                            locked = false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static class ChunkWrapper
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user