From f154754e1b657dc5777baedf409bba1ae532ee7b Mon Sep 17 00:00:00 2001 From: boy0001 Date: Thu, 19 Feb 2015 14:38:49 +1100 Subject: [PATCH] yay, conflicts --- .../intellectualcrafters/plot/PlotMain.java | 52 ---- .../plot/commands/DebugRoadRegen.java | 8 - .../plot/commands/Template.java | 20 -- .../plot/database/SQLManager.java | 33 --- .../plot/generator/AugmentedPopulator.java | 44 --- .../plot/generator/ClassicPlotManager.java | 22 -- .../plot/generator/HybridPlotManager.java | 8 - .../plot/listeners/PlayerEvents.java | 25 -- .../plot/object/Location.java | 74 ----- .../plot/object/PlotManager.java | 38 --- .../plot/util/ChunkManager.java | 15 +- .../plot/util/ClusterManager.java | 5 +- .../plot/util/PlayerFunctions.java | 25 +- .../plot/util/PlotHelper.java | 260 +++--------------- .../plot/util/SetBlockFast.java | 14 +- .../plot/util/SetBlockFast_1_8.java | 15 +- .../plot/util/SetBlockSlow.java | 13 +- 17 files changed, 46 insertions(+), 625 deletions(-) diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotMain.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotMain.java index 2edef2195..5327239f9 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotMain.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotMain.java @@ -53,24 +53,6 @@ import com.sk89q.worldguard.bukkit.WorldGuardPlugin; import me.confuser.barapi.BarAPI; import net.milkbowl.vault.economy.Economy; -<<<<<<< Updated upstream -import org.bukkit.*; -import org.bukkit.Location; -import org.bukkit.command.PluginCommand; -import org.bukkit.configuration.file.YamlConfiguration; -import org.bukkit.entity.Entity; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.player.PlayerCommandPreprocessEvent; -import org.bukkit.event.world.WorldLoadEvent; -import org.bukkit.generator.ChunkGenerator; -import org.bukkit.plugin.Plugin; -import org.bukkit.plugin.RegisteredServiceProvider; -import org.bukkit.plugin.java.JavaPlugin; - -======= ->>>>>>> Stashed changes import java.io.File; import java.io.FileWriter; import java.io.IOException; @@ -87,11 +69,7 @@ import java.util.Map.Entry; * @author Citymonstret * @author Empire92 */ -<<<<<<< Updated upstream -public class PlotMain extends JavaPlugin implements Listener { -======= public class PlotMain { ->>>>>>> Stashed changes /** * Permission that allows for "everything" */ @@ -935,13 +913,7 @@ public class PlotMain { } public static void loadWorld(final String world, final ChunkGenerator generator) { -<<<<<<< Updated upstream - System.out.print(2); if (getWorldSettings(world) != null) { - System.out.print(3); -======= - if (getWorldSettings(world) != null) { ->>>>>>> Stashed changes return; } @@ -953,10 +925,6 @@ public class PlotMain { final String path = "worlds." + world; if (!LOADING_WORLD && (generator != null) && (generator instanceof PlotGenerator)) { -<<<<<<< Updated upstream - System.out.print(4); -======= ->>>>>>> Stashed changes plotGenerator = (PlotGenerator) generator; plotWorld = plotGenerator.getNewPlotWorld(world); plotManager = plotGenerator.getPlotManager(); @@ -980,13 +948,7 @@ public class PlotMain { addPlotWorld(world, plotWorld, plotManager); PlotHelper.setupBorder(world); } else { -<<<<<<< Updated upstream - System.out.print(5 + " | " + (generator instanceof PlotGenerator)); if (!worlds.contains(world)) { - System.out.print(6); -======= - if (!worlds.contains(world)) { ->>>>>>> Stashed changes return; } if (!LOADING_WORLD) { @@ -1616,32 +1578,18 @@ public class PlotMain { { if (checkVersion(1, 8, 0)) { try { -<<<<<<< Updated upstream - AbstractSetBlock.setBlockManager = new SetBlockSlow(); - } - catch (Throwable e) { - e.printStackTrace(); - AbstractSetBlock.setBlockManager = new SetBlockSlow(); -======= SetBlockManager.setBlockManager = new SetBlockSlow(); } catch (Throwable e) { e.printStackTrace(); SetBlockManager.setBlockManager = new SetBlockSlow(); ->>>>>>> Stashed changes } } else { try { -<<<<<<< Updated upstream - AbstractSetBlock.setBlockManager = new SetBlockFast(); - } catch (Throwable e) { - AbstractSetBlock.setBlockManager = new SetBlockSlow(); -======= SetBlockManager.setBlockManager = new SetBlockFast(); } catch (Throwable e) { SetBlockManager.setBlockManager = new SetBlockSlow(); ->>>>>>> Stashed changes } } try { diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugRoadRegen.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugRoadRegen.java index 099327e0a..5cb30cdcb 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugRoadRegen.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugRoadRegen.java @@ -30,11 +30,7 @@ import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.generator.HybridPlotManager; import com.intellectualcrafters.plot.generator.HybridPlotWorld; -<<<<<<< Updated upstream -import com.intellectualcrafters.plot.util.AbstractSetBlock; -======= import com.intellectualcrafters.plot.util.SetBlockManager; ->>>>>>> Stashed changes import com.intellectualcrafters.plot.util.PlayerFunctions; public class DebugRoadRegen extends SubCommand { @@ -53,11 +49,7 @@ public class DebugRoadRegen extends SubCommand { Chunk chunk = player.getLocation().getChunk(); boolean result = manager.regenerateRoad(chunk); if (result) { -<<<<<<< Updated upstream - AbstractSetBlock.setBlockManager.update(Arrays.asList(new Chunk[] {chunk})); -======= SetBlockManager.setBlockManager.update(Arrays.asList(new Chunk[] {chunk})); ->>>>>>> Stashed changes } PlayerFunctions.sendMessage(player, "&6Regenerating chunk: "+chunk.getX() + "," + chunk.getZ() + "\n&6 - Result: " + (result == true ? "&aSuccess" : "&cFailed")); return true; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Template.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Template.java index 7e4888cc5..7357addb8 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Template.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Template.java @@ -21,19 +21,6 @@ package com.intellectualcrafters.plot.commands; -<<<<<<< Updated upstream -import org.bukkit.entity.Player; - -import com.intellectualcrafters.plot.config.C; -import com.intellectualcrafters.plot.util.PlayerFunctions; - -public class Template extends SubCommand { - - public Template() { - super("template", "plots.admin", "Create or use a world template", "template", "", CommandCategory.DEBUG, true); - } - -======= import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; @@ -54,15 +41,12 @@ public class Template extends SubCommand { super("template", "plots.admin", "Create or use a world template", "template", "", CommandCategory.DEBUG, true); } ->>>>>>> Stashed changes @Override public boolean execute(final Player plr, final String... args) { if (args.length != 2) { PlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot template "); return false; } -<<<<<<< Updated upstream -======= World world = Bukkit.getWorld(args[1]); PlotWorld plotworld = PlotMain.getWorldSettings(args[1]); if (world == null || plotworld == null) { @@ -79,7 +63,6 @@ public class Template extends SubCommand { PlayerFunctions.sendMessage(plr, "TODO"); } } ->>>>>>> Stashed changes // TODO allow world settings (including schematics to be packed into a single file) @@ -87,8 +70,6 @@ public class Template extends SubCommand { return true; } -<<<<<<< Updated upstream -======= public void gzipIt(String output, String input) { byte[] buffer = new byte[1024]; @@ -106,5 +87,4 @@ public class Template extends SubCommand { ex.printStackTrace(); } } ->>>>>>> Stashed changes } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java index b196c60a4..1db8dc90c 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java @@ -161,10 +161,7 @@ public class SQLManager implements AbstractDB { } stored.get(world).put(new PlotId(idx, idz), id); } -<<<<<<< Updated upstream -======= result.close(); ->>>>>>> Stashed changes stmt.close(); } catch (final SQLException e) { e.printStackTrace(); @@ -486,10 +483,7 @@ public class SQLManager implements AbstractDB { while (r.next()) { id = r.getInt("id"); } -<<<<<<< Updated upstream -======= r.close(); ->>>>>>> Stashed changes stmt.close(); return id; } catch (final SQLException e) { @@ -523,10 +517,7 @@ public class SQLManager implements AbstractDB { final Statement statement = this.connection.createStatement(); statement.addBatch("ALTER TABLE `" + this.prefix + "plot_settings` ADD `merged` int(11) DEFAULT NULL"); statement.executeBatch(); -<<<<<<< Updated upstream -======= rs.close(); ->>>>>>> Stashed changes statement.close(); } } catch (final Exception e) { @@ -718,10 +709,7 @@ public class SQLManager implements AbstractDB { } } stmt.close(); -<<<<<<< Updated upstream -======= r.close(); ->>>>>>> Stashed changes for (final Plot plot : plots.values()) { final String world = plot.world; if (!newplots.containsKey(world)) { @@ -967,11 +955,8 @@ public class SQLManager implements AbstractDB { } } purgeIds(world, ids); -<<<<<<< Updated upstream -======= stmt.close(); r.close(); ->>>>>>> Stashed changes } catch (SQLException e) { e.printStackTrace(); PlotMain.sendConsoleSenderMessage("&c[ERROR] "+"FAILED TO PURGE WORLD '" + world + "'!"); @@ -1047,10 +1032,7 @@ public class SQLManager implements AbstractDB { h.put(var, val); } stmt.close(); -<<<<<<< Updated upstream -======= r.close(); ->>>>>>> Stashed changes } catch (final SQLException e) { PlotMain.sendConsoleSenderMessage("&7[WARN] "+"Failed to load settings for plot: " + id); e.printStackTrace(); @@ -1112,10 +1094,7 @@ public class SQLManager implements AbstractDB { comments.add(comment); } statement.close(); -<<<<<<< Updated upstream -======= set.close(); ->>>>>>> Stashed changes } catch (final SQLException e) { PlotMain.sendConsoleSenderMessage("&7[WARN] "+"Failed to fetch comment"); e.printStackTrace(); @@ -1312,10 +1291,7 @@ public class SQLManager implements AbstractDB { rating = set.getDouble("rating"); } statement.close(); -<<<<<<< Updated upstream -======= set.close(); ->>>>>>> Stashed changes return rating; } catch (final SQLException e) { PlotMain.sendConsoleSenderMessage("&7[WARN] "+"Failed to fetch rating for plot " + plot.getId().toString()); @@ -1371,10 +1347,7 @@ public class SQLManager implements AbstractDB { c_id = r.getInt("id"); } stmt.close(); -<<<<<<< Updated upstream -======= r.close(); ->>>>>>> Stashed changes return c_id; } catch (final SQLException e) { e.printStackTrace(); @@ -1553,10 +1526,7 @@ public class SQLManager implements AbstractDB { } } stmt.close(); -<<<<<<< Updated upstream -======= r.close(); ->>>>>>> Stashed changes for (final PlotCluster c : clusters.values()) { final String world = c.world; if (!newClusters.containsKey(world)) { @@ -1786,10 +1756,7 @@ public class SQLManager implements AbstractDB { h.put(var, val); } stmt.close(); -<<<<<<< Updated upstream -======= r.close(); ->>>>>>> Stashed changes } catch (final SQLException e) { PlotMain.sendConsoleSenderMessage("&7[WARN] "+"Failed to load settings for cluster: " + id); e.printStackTrace(); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/AugmentedPopulator.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/AugmentedPopulator.java index 5e67198ca..0e0bee151 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/AugmentedPopulator.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/AugmentedPopulator.java @@ -5,30 +5,19 @@ import java.util.Random; import org.bukkit.Bukkit; import org.bukkit.Chunk; -<<<<<<< Updated upstream -import org.bukkit.Location; -======= ->>>>>>> Stashed changes import org.bukkit.World; import org.bukkit.generator.BlockPopulator; import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.object.BlockWrapper; -<<<<<<< Updated upstream -======= import com.intellectualcrafters.plot.object.Location; ->>>>>>> Stashed changes import com.intellectualcrafters.plot.object.PlotCluster; import com.intellectualcrafters.plot.object.PlotGenerator; import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.object.PlotManager; import com.intellectualcrafters.plot.object.PlotWorld; import com.intellectualcrafters.plot.object.RegionWrapper; -<<<<<<< Updated upstream -import com.intellectualcrafters.plot.util.AbstractSetBlock; -======= import com.intellectualcrafters.plot.util.SetBlockManager; ->>>>>>> Stashed changes import com.intellectualcrafters.plot.util.ChunkManager; import com.intellectualcrafters.plot.util.PlotHelper; import com.intellectualcrafters.plot.util.TaskManager; @@ -49,11 +38,7 @@ public class AugmentedPopulator extends BlockPopulator { private final int tx; private final int tz; -<<<<<<< Updated upstream - public BlockWrapper getBlock(int X, int Z, int i, int j, short[][] r, boolean c) { -======= public BlockWrapper get(int X, int Z, int i, int j, short[][] r, boolean c) { ->>>>>>> Stashed changes int y = (i << 4) + (j >> 8); int a = (j - ((y & 0xF) << 8)); int z = (a >> 4); @@ -81,19 +66,11 @@ public class AugmentedPopulator extends BlockPopulator { Location bl = manager.getPlotBottomLocAbs(plotworld, cluster.getP1()); Location tl = manager.getPlotTopLocAbs(plotworld, cluster.getP2()).add(1,0,1); -<<<<<<< Updated upstream - this.bx = bl.getBlockX(); - this.bz = bl.getBlockZ(); - - this.tx = tl.getBlockX(); - this.tz = tl.getBlockZ(); -======= this.bx = bl.getX(); this.bz = bl.getZ(); this.tx = tl.getX(); this.tz = tl.getZ(); ->>>>>>> Stashed changes } else { this.bx = Integer.MIN_VALUE; @@ -141,13 +118,8 @@ public class AugmentedPopulator extends BlockPopulator { check = false; } if (plotworld.TERRAIN == 2) { -<<<<<<< Updated upstream - PlotId plot1 = manager.getPlotIdAbs(plotworld, new Location(world, x, 0, z)); - PlotId plot2 = manager.getPlotIdAbs(plotworld, new Location(world, x2, 0, z2)); -======= PlotId plot1 = manager.getPlotIdAbs(plotworld, x, 0, z); PlotId plot2 = manager.getPlotIdAbs(plotworld, x2, 0, z2); ->>>>>>> Stashed changes if (plot1 != null && plot2 != null && plot1.equals(plot2)) { return; } @@ -160,11 +132,7 @@ public class AugmentedPopulator extends BlockPopulator { public void run() { populateBiome(world, x, z); chunk.unload(true, true); -<<<<<<< Updated upstream - AbstractSetBlock.setBlockManager.update(Arrays.asList( new Chunk[] {chunk})); -======= SetBlockManager.setBlockManager.update(Arrays.asList( new Chunk[] {chunk})); ->>>>>>> Stashed changes } }, 20); } @@ -181,11 +149,7 @@ public class AugmentedPopulator extends BlockPopulator { chunk.load(true); populateBlocks(world, rand, X, Z, x, z, check); chunk.unload(true, true); -<<<<<<< Updated upstream - AbstractSetBlock.setBlockManager.update(Arrays.asList( new Chunk[] {chunk})); -======= SetBlockManager.setBlockManager.update(Arrays.asList( new Chunk[] {chunk})); ->>>>>>> Stashed changes } }, 40 + rand.nextInt(40)); } @@ -206,11 +170,7 @@ public class AugmentedPopulator extends BlockPopulator { int length = result[0].length; for(int i = 0; i < result.length; i++) { for(int j = 0; j < length; j++) { -<<<<<<< Updated upstream - BlockWrapper blockInfo = getBlock(x, z, i, j, result, check); -======= BlockWrapper blockInfo = get(x, z, i, j, result, check); ->>>>>>> Stashed changes if (blockInfo == null) { continue; } @@ -222,11 +182,7 @@ public class AugmentedPopulator extends BlockPopulator { continue; } } -<<<<<<< Updated upstream - else if (manager.getPlotIdAbs(plotworld, new Location(world, xx, 0, zz)) != null) { -======= else if (manager.getPlotIdAbs(plotworld, xx, 0, zz) != null) { ->>>>>>> Stashed changes continue; } } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/ClassicPlotManager.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/ClassicPlotManager.java index 7f966791a..b47eb342c 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/ClassicPlotManager.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/ClassicPlotManager.java @@ -48,11 +48,7 @@ public abstract class ClassicPlotManager extends SquarePlotManager { public boolean setFloor(final World world, final PlotWorld plotworld, final PlotId plotid, final PlotBlock[] blocks) { final ClassicPlotWorld dpw = (ClassicPlotWorld) plotworld; -<<<<<<< Updated upstream - final Location pos1 = PlotHelper.getPlotBottomLoc(world, plotid).add(1, 0, 1); -======= final Location pos1 = PlotHelper.getPlotBottomLoc(plotworld.worldname, plotid).add(1, 0, 1); ->>>>>>> Stashed changes final Location pos2 = PlotHelper.getPlotTopLoc(world, plotid); PlotHelper.setCuboid(world, new Location(world, pos1.getX(), dpw.PLOT_HEIGHT, pos1.getZ()), new Location(world, pos2.getX() + 1, dpw.PLOT_HEIGHT + 1, pos2.getZ() + 1), blocks); return true; @@ -63,11 +59,7 @@ public abstract class ClassicPlotManager extends SquarePlotManager { if (dpw.ROAD_WIDTH == 0) { return false; } -<<<<<<< Updated upstream - final Location bottom = PlotHelper.getPlotBottomLoc(w, plotid); -======= final Location bottom = PlotHelper.getPlotBottomLoc(plotworld.worldname, plotid); ->>>>>>> Stashed changes final Location top = PlotHelper.getPlotTopLoc(w, plotid); int x, z; @@ -105,11 +97,7 @@ public abstract class ClassicPlotManager extends SquarePlotManager { if (dpw.ROAD_WIDTH == 0) { return false; } -<<<<<<< Updated upstream - final Location bottom = PlotHelper.getPlotBottomLoc(w, plotid); -======= final Location bottom = PlotHelper.getPlotBottomLoc(plotworld.worldname, plotid); ->>>>>>> Stashed changes final Location top = PlotHelper.getPlotTopLoc(w, plotid); int x, z; @@ -330,11 +318,7 @@ public abstract class ClassicPlotManager extends SquarePlotManager { } @Override -<<<<<<< Updated upstream - public String[] getPlotComponents(World world, PlotWorld plotworld, PlotId plotid) { -======= public String[] getPlotComponents(PlotWorld plotworld, PlotId plotid) { ->>>>>>> Stashed changes return new String[] { "floor", "wall", @@ -346,15 +330,9 @@ public abstract class ClassicPlotManager extends SquarePlotManager { * Remove sign for a plot */ @Override -<<<<<<< Updated upstream - public Location getSignLoc(final World world, final PlotWorld plotworld, final Plot plot) { - final ClassicPlotWorld dpw = (ClassicPlotWorld) plotworld; - return new Location(world, PlotHelper.getPlotBottomLoc(world, plot.id).getBlockX(), dpw.ROAD_HEIGHT + 1, PlotHelper.getPlotBottomLoc(world, plot.id).getBlockZ() - 1); -======= public com.intellectualcrafters.plot.object.Location getSignLoc(final PlotWorld plotworld, final Plot plot) { final ClassicPlotWorld dpw = (ClassicPlotWorld) plotworld; Location bot = PlotHelper.getPlotBottomLoc(plotworld.worldname, plot.id); return new com.intellectualcrafters.plot.object.Location(plotworld.worldname, bot.getBlockX(), dpw.ROAD_HEIGHT + 1, bot.getBlockZ() - 1); ->>>>>>> Stashed changes } } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/HybridPlotManager.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/HybridPlotManager.java index d81ada939..223d1e4af 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/HybridPlotManager.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/HybridPlotManager.java @@ -41,11 +41,7 @@ import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotBlock; import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.object.PlotWorld; -<<<<<<< Updated upstream -import com.intellectualcrafters.plot.util.AbstractSetBlock; -======= import com.intellectualcrafters.plot.util.SetBlockManager; ->>>>>>> Stashed changes import com.intellectualcrafters.plot.util.ChunkManager; import com.intellectualcrafters.plot.util.PlayerFunctions; import com.intellectualcrafters.plot.util.PlotHelper; @@ -200,11 +196,7 @@ import com.intellectualcrafters.plot.util.UUIDHandler; regenerateRoad(chunk); } } -<<<<<<< Updated upstream - AbstractSetBlock.setBlockManager.update(chunks2); -======= SetBlockManager.setBlockManager.update(chunks2); ->>>>>>> Stashed changes } public boolean scheduleRoadUpdate(final World world) { diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents.java index 0da53c8e9..356aa1eda 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents.java @@ -160,14 +160,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi final Location f = event.getFrom(); final Location t = event.getTo(); final Location q = new Location(t.getWorld(), t.getBlockX(), 0, t.getZ()); -<<<<<<< Updated upstream - if ((f.getBlockX() != q.getBlockX()) || (f.getBlockZ() != q.getBlockZ())) { -======= - if ((f.getBlockX() != q.getBlockX()) || (f.getBlockZ() != q.getBlockZ())) { - System.out.print("========================="); - System.out.print("4. " + f); ->>>>>>> Stashed changes if (Settings.TELEPORT_DELAY != 0 && TaskManager.TELEPORT_QUEUE.size() > 0) { String name = player.getName(); if (TaskManager.TELEPORT_QUEUE.contains(name)) { @@ -198,10 +191,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi passed = true; } if (passed) { -<<<<<<< Updated upstream -======= q.setY(t.getBlockY()); ->>>>>>> Stashed changes event.setTo(q); PlayerFunctions.sendMessage(player, C.BORDER); return; @@ -209,29 +199,14 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi } Plot plot = getCurrentPlot(q); if (plot != null) { -<<<<<<< Updated upstream - if (!plot.equals(getCurrentPlot(f))) { - if (plot.deny_entry(player)) { - if (!PlotMain.hasPermission(player, "plots.admin.entry.denied")) { - PlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.admin.entry.denied"); - event.setCancelled(true); - return; - } - } -======= if (plot.deny_entry(player)) { if (!PlotMain.hasPermission(player, "plots.admin.entry.denied")) { PlayerFunctions.sendMessage(player, C.NO_PERMISSION, "plots.admin.entry.denied"); - System.out.print("DENY ENTRY"); - System.out.print("5. " + f); event.setCancelled(true); return; } } - System.out.print("6. " + f); if (!plot.equals(getCurrentPlot(f))) { - System.out.print("7. " + f); ->>>>>>> Stashed changes plotEntry(player, plot); } } else if (leftPlot(f, event.getTo())) { diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/Location.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/Location.java index f61e5f042..1dd3dffd2 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/Location.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/Location.java @@ -11,21 +11,13 @@ import java.lang.reflect.Method; */ public class Location implements Cloneable, Comparable { -<<<<<<< Updated upstream - private double x, y, z; -======= private int x, y, z; ->>>>>>> Stashed changes private float yaw, pitch; private String world; private boolean built; private Object o; -<<<<<<< Updated upstream - public Location(final String world, final double x, final double y, final double z, final float yaw, final float pitch) { -======= public Location(final String world, final int x, final int y, final int z, final float yaw, final float pitch) { ->>>>>>> Stashed changes this.world = world; this.x = x; this.y = y; @@ -37,20 +29,6 @@ public class Location implements Cloneable, Comparable { } public Location() { -<<<<<<< Updated upstream - this("", 0d, 0d, 0d, 0f, 0f); - } - - public Location(final String world, final double x, final double y, final double z) { - this(world, x, y, z, 0f, 0f); - } - - public double getX() { - return this.x; - } - - public void setX(final double x) { -======= this("", 0, 0, 0, 0, 0); } @@ -63,41 +41,24 @@ public class Location implements Cloneable, Comparable { } public void setX(final int x) { ->>>>>>> Stashed changes this.x = x; this.built = false; } -<<<<<<< Updated upstream - public double getY() { - return this.y; - } - - public void setY(final double y) { -======= public int getY() { return this.y; } public void setY(final int y) { ->>>>>>> Stashed changes this.y = y; this.built = false; } -<<<<<<< Updated upstream - public double getZ() { - return this.z; - } - - public void setZ(final double z) { -======= public int getZ() { return this.z; } public void setZ(final int z) { ->>>>>>> Stashed changes this.z = z; this.built = false; } @@ -129,19 +90,11 @@ public class Location implements Cloneable, Comparable { this.built = false; } -<<<<<<< Updated upstream - public void add(double x, double y, double z) { -======= - public Location add(int x, int y, int z) { ->>>>>>> Stashed changes this.x += x; this.y += y; this.z += z; this.built = false; -<<<<<<< Updated upstream -======= return this; ->>>>>>> Stashed changes } public double getEuclideanDistanceSquared(final Location l2) { @@ -175,11 +128,6 @@ public class Location implements Cloneable, Comparable { y <= max.getY() && z >= min.getX() && z < max.getZ(); } -<<<<<<< Updated upstream - public void lookTowards(double x, double y) { -======= - public void lookTowards(int x, int y) { ->>>>>>> Stashed changes double l = this.x - x; double w = this.z - z; double c = Math.sqrt(l * l + w * w); @@ -191,34 +139,21 @@ public class Location implements Cloneable, Comparable { this.built = false; } -<<<<<<< Updated upstream - public void subtract(double x, double y, double z) { -======= - public Location subtract(int x, int y, int z) { ->>>>>>> Stashed changes this.x -= x; this.y -= y; this.z -= z; this.built = false; -<<<<<<< Updated upstream -======= return this; ->>>>>>> Stashed changes } @Override public boolean equals(Object o) { -<<<<<<< Updated upstream - if (!(o instanceof Location)) - return false; -======= if (o == null) { return false; } if (!(o instanceof Location)) { return false; } ->>>>>>> Stashed changes Location l = (Location) o; return x == l.getX() && y == l.getY() && z == l.getZ() && world.equals(l.getWorld()) && @@ -251,12 +186,6 @@ public class Location implements Cloneable, Comparable { } } -<<<<<<< Updated upstream -======= - /** - * Please use utility class as this is not efficient - */ ->>>>>>> Stashed changes public Object toBukkitLocation() { if (built) { return o; @@ -270,12 +199,9 @@ public class Location implements Cloneable, Comparable { } } -<<<<<<< Updated upstream -======= /** * Please use utility class as this is not efficient */ ->>>>>>> Stashed changes public void teleport(final Object o) throws Exception { if (o.getClass().getName().contains("org.bukkit.entity")) { Method m = o.getClass().getMethod("teleport", Class.forName("org.bukkit.Location")); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotManager.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotManager.java index 48907692b..80c6dc9c9 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotManager.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotManager.java @@ -23,10 +23,6 @@ package com.intellectualcrafters.plot.object; import java.util.ArrayList; -<<<<<<< Updated upstream -import org.bukkit.Location; -======= ->>>>>>> Stashed changes import org.bukkit.World; import org.bukkit.block.Biome; @@ -37,15 +33,9 @@ public abstract class PlotManager { * plots) */ -<<<<<<< Updated upstream - public abstract PlotId getPlotIdAbs(final PlotWorld plotworld, final Location loc); - - public abstract PlotId getPlotId(final PlotWorld plotworld, final Location loc); -======= public abstract PlotId getPlotIdAbs(final PlotWorld plotworld, final int x, final int y, final int z); public abstract PlotId getPlotId(final PlotWorld plotworld, final int x, final int y, final int z); ->>>>>>> Stashed changes // If you have a circular plot, just return the corner if it were a square public abstract Location getPlotBottomLocAbs(final PlotWorld plotworld, final PlotId plotid); @@ -55,15 +45,6 @@ public abstract class PlotManager { /* * Plot clearing (return false if you do not support some method) */ -<<<<<<< Updated upstream - public abstract boolean clearPlot(final World world, final PlotWorld plotworld, final Plot plot, boolean isDelete, Runnable whenDone); - - public abstract boolean claimPlot(final World world, final PlotWorld plotworld, final Plot plot); - - public abstract boolean unclaimPlot(final World world, final PlotWorld plotworld, final Plot plot); - - public abstract Location getSignLoc(final World world, final PlotWorld plotworld, final Plot plot); -======= public abstract boolean clearPlot(final PlotWorld plotworld, final Plot plot, boolean isDelete, Runnable whenDone); public abstract boolean claimPlot(final PlotWorld plotworld, final Plot plot); @@ -71,26 +52,17 @@ public abstract class PlotManager { public abstract boolean unclaimPlot(final PlotWorld plotworld, final Plot plot); public abstract Location getSignLoc(final PlotWorld plotworld, final Plot plot); ->>>>>>> Stashed changes /* * Plot set functions (return false if you do not support the specific set * method) */ -<<<<<<< Updated upstream - public abstract String[] getPlotComponents(final World world, final PlotWorld plotworld, final PlotId plotid); - - public abstract boolean setComponent(final World world, final PlotWorld plotworld, final PlotId plotid, final String component, final PlotBlock[] blocks); - - public abstract boolean setBiome(final World world, final Plot plot, final Biome biome); -======= public abstract String[] getPlotComponents(final PlotWorld plotworld, final PlotId plotid); public abstract boolean setComponent(final PlotWorld plotworld, final PlotId plotid, final String component, final PlotBlock[] blocks); public abstract boolean setBiome(final Plot plot, final Biome biome); ->>>>>>> Stashed changes /* * PLOT MERGING (return false if your generator does not support plot @@ -108,15 +80,6 @@ public abstract class PlotManager { public abstract boolean removeRoadSouthEast(final PlotWorld plotworld, final Plot plot); -<<<<<<< Updated upstream - public abstract boolean startPlotMerge(final World world, final PlotWorld plotworld, final ArrayList plotIds); - - public abstract boolean startPlotUnlink(final World world, final PlotWorld plotworld, final ArrayList plotIds); - - public abstract boolean finishPlotMerge(final World world, final PlotWorld plotworld, final ArrayList plotIds); - - public abstract boolean finishPlotUnlink(final World world, final PlotWorld plotworld, final ArrayList plotIds); -======= public abstract boolean startPlotMerge(final PlotWorld plotworld, final ArrayList plotIds); public abstract boolean startPlotUnlink(final PlotWorld plotworld, final ArrayList plotIds); @@ -124,6 +87,5 @@ public abstract class PlotManager { public abstract boolean finishPlotMerge(final PlotWorld plotworld, final ArrayList plotIds); public abstract boolean finishPlotUnlink(final PlotWorld plotworld, final ArrayList plotIds); ->>>>>>> Stashed changes } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ChunkManager.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ChunkManager.java index 453590190..6831d5014 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ChunkManager.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ChunkManager.java @@ -229,21 +229,15 @@ public class ChunkManager { Block block = world.getBlockAt(x, y, z); int id = block.getTypeId(); byte data = block.getData(); -<<<<<<< Updated upstream - AbstractSetBlock.setBlockManager.set(world, x + relX, y, z + relZ, id, data); -======= SetBlockManager.setBlockManager.set(world, x + relX, y, z + relZ, id, data); ->>>>>>> Stashed changes + } } mx.increment(); if (x == ex) { // done! restoreBlocks(world, relX, relZ); -<<<<<<< Updated upstream - AbstractSetBlock.setBlockManager.update(chunks); -======= SetBlockManager.setBlockManager.update(chunks); ->>>>>>> Stashed changes + for (Chunk chunk : chunks) { chunk.unload(true, true); } @@ -359,11 +353,8 @@ public class ChunkManager { restoreEntities(world, 0, 0); } chunk.unload(true, true); -<<<<<<< Updated upstream - AbstractSetBlock.setBlockManager.update(Arrays.asList( new Chunk[] {chunk})); -======= SetBlockManager.setBlockManager.update(Arrays.asList( new Chunk[] {chunk})); ->>>>>>> Stashed changes + } CURRENT_PLOT_CLEAR = null; } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ClusterManager.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ClusterManager.java index 0d5a5835f..3c26fcae9 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ClusterManager.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ClusterManager.java @@ -288,11 +288,8 @@ public class ClusterManager { @Override public void run() { if (populator == null || plotworld.TYPE == 0) { -<<<<<<< Updated upstream - AbstractSetBlock.setBlockManager.update(Arrays.asList( new Chunk[] {chunk})); -======= SetBlockManager.setBlockManager.update(Arrays.asList( new Chunk[] {chunk})); ->>>>>>> Stashed changes + world.regenerateChunk(chunk.getX(), chunk.getZ()); chunk.unload(true, true); } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/PlayerFunctions.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/PlayerFunctions.java index b8fc3d8da..e3083971e 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/PlayerFunctions.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/PlayerFunctions.java @@ -65,11 +65,8 @@ import java.util.UUID; return myplots; } -<<<<<<< Updated upstream - public static ArrayList getMaxPlotSelectionIds(final World world, PlotId pos1, PlotId pos2) { -======= public static ArrayList getMaxPlotSelectionIds(final String world, PlotId pos1, PlotId pos2) { ->>>>>>> Stashed changes + final Plot plot1 = PlotMain.getPlots(world).get(pos1); final Plot plot2 = PlotMain.getPlots(world).get(pos2); @@ -91,11 +88,8 @@ import java.util.UUID; return myplots; } -<<<<<<< Updated upstream - public static Plot getBottomPlot(final World world, final Plot plot) { -======= public static Plot getBottomPlot(final String world, final Plot plot) { ->>>>>>> Stashed changes + if (plot.settings.getMerged(0)) { final Plot p = PlotMain.getPlots(world).get(new PlotId(plot.id.x, plot.id.y - 1)); if (p == null) { @@ -113,11 +107,8 @@ import java.util.UUID; return plot; } -<<<<<<< Updated upstream - public static Plot getTopPlot(final World world, final Plot plot) { -======= public static Plot getTopPlot(final String world, final Plot plot) { ->>>>>>> Stashed changes + if (plot.settings.getMerged(2)) { return getTopPlot(world, PlotMain.getPlots(world).get(new PlotId(plot.id.x, plot.id.y + 1))); } @@ -141,11 +132,8 @@ import java.util.UUID; return null; } final PlotWorld plotworld = PlotMain.getWorldSettings(world); -<<<<<<< Updated upstream - return manager.getPlotIdAbs(plotworld, loc); -======= return manager.getPlotIdAbs(plotworld, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()); ->>>>>>> Stashed changes + } /** @@ -162,11 +150,8 @@ import java.util.UUID; return null; } final PlotWorld plotworld = PlotMain.getWorldSettings(world); -<<<<<<< Updated upstream - PlotId id = manager.getPlotId(plotworld, loc); -======= PlotId id = manager.getPlotId(plotworld, loc.getBlockX(),loc.getBlockY(), loc.getBlockZ()); ->>>>>>> Stashed changes + if (id!=null && plotworld.TYPE == 2) { if (ClusterManager.getCluster(world, id) == null) { return null; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/PlotHelper.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/PlotHelper.java index 596ab8030..1e00a51fe 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/PlotHelper.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/PlotHelper.java @@ -31,10 +31,7 @@ import net.milkbowl.vault.economy.Economy; import org.bukkit.Bukkit; import org.bukkit.Chunk; -<<<<<<< Updated upstream -import org.bukkit.Location; -======= ->>>>>>> Stashed changes + import org.bukkit.Material; import org.bukkit.OfflinePlayer; import org.bukkit.World; @@ -50,10 +47,8 @@ import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.listeners.PlotListener; import com.intellectualcrafters.plot.object.BlockLoc; -<<<<<<< Updated upstream -======= import com.intellectualcrafters.plot.object.Location; ->>>>>>> Stashed changes + import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotBlock; import com.intellectualcrafters.plot.object.PlotId; @@ -140,11 +135,8 @@ import com.intellectualcrafters.plot.object.PlotWorld; * * @return */ -<<<<<<< Updated upstream - public static boolean mergePlots(final Player plr, final World world, final ArrayList plotIds) { -======= public static boolean mergePlots(final Player plr, final String world, final ArrayList plotIds) { ->>>>>>> Stashed changes + final PlotWorld plotworld = PlotMain.getWorldSettings(world); if (PlotMain.useEconomy && plotworld.USE_ECONOMY) { final double cost = plotIds.size() * plotworld.MERGE_PRICE; @@ -172,11 +164,8 @@ import com.intellectualcrafters.plot.object.PlotWorld; * * @return boolean (success) */ -<<<<<<< Updated upstream - public static boolean mergePlots(final World world, final ArrayList plotIds, boolean removeRoads) { -======= public static boolean mergePlots(final String world, final ArrayList plotIds, boolean removeRoads) { ->>>>>>> Stashed changes + if (plotIds.size() < 2) { return false; } @@ -186,11 +175,8 @@ import com.intellectualcrafters.plot.object.PlotWorld; final PlotManager manager = PlotMain.getPlotManager(world); final PlotWorld plotworld = PlotMain.getWorldSettings(world); -<<<<<<< Updated upstream - manager.startPlotMerge(world, plotworld, plotIds); -======= manager.startPlotMerge(plotworld, plotIds); ->>>>>>> Stashed changes + boolean result = false; @@ -209,11 +195,8 @@ import com.intellectualcrafters.plot.object.PlotWorld; Plot plot2 = null; if (removeRoads) { -<<<<<<< Updated upstream - removeSign(world, plot); -======= removeSign(plot); ->>>>>>> Stashed changes + } if (lx) { if (ly) { @@ -248,20 +231,14 @@ import com.intellectualcrafters.plot.object.PlotWorld; for (int y = pos1.y; y <= pos2.y; y++) { final PlotId id = new PlotId(x, y); final Plot plot = PlotMain.getPlots(world).get(id); -<<<<<<< Updated upstream - DBFunc.setMerged(world.getName(), plot, plot.settings.getMerged()); -======= DBFunc.setMerged(world, plot, plot.settings.getMerged()); ->>>>>>> Stashed changes + } } -<<<<<<< Updated upstream - manager.finishPlotMerge(world, plotworld, plotIds); -======= manager.finishPlotMerge(plotworld, plotIds); ->>>>>>> Stashed changes + return result; } @@ -274,11 +251,8 @@ import com.intellectualcrafters.plot.object.PlotWorld; * @param lesserPlot * @param greaterPlot */ -<<<<<<< Updated upstream - public static void mergePlot(final World world, final Plot lesserPlot, final Plot greaterPlot, boolean removeRoads) { -======= public static void mergePlot(final String world, final Plot lesserPlot, final Plot greaterPlot, boolean removeRoads) { ->>>>>>> Stashed changes + final PlotManager manager = PlotMain.getPlotManager(world); final PlotWorld plotworld = PlotMain.getWorldSettings(world); @@ -300,53 +274,6 @@ import com.intellectualcrafters.plot.object.PlotWorld; } } } -<<<<<<< Updated upstream - - /* - * Random number gen section - */ - public static long nextLong() { - final long a = state; - state = xorShift64(a); - return a; - } - - /* - * End of random number gen section - */ - - public static long xorShift64(long a) { - a ^= (a << 21); - a ^= (a >>> 35); - a ^= (a << 4); - return a; - } - - public static int random(final int n) { - if (n == 1) { - return 0; - } - final long r = ((nextLong() >>> 32) * n) >> 32; - return (int) r; - } - - public static void removeSign(final World world, final Plot p) { - final PlotManager manager = PlotMain.getPlotManager(world); - final PlotWorld plotworld = PlotMain.getWorldSettings(world); - final Location loc = manager.getSignLoc(world, plotworld, p); - final Block bs = loc.getBlock(); - if (bs.getType() == Material.WALL_SIGN) { - bs.setType(Material.AIR); - } - } - - public static void setSign(final Player player, final Plot p) { - setSign(Bukkit.getWorld(p.world), player.getName(), p); - } - - @SuppressWarnings("deprecation") - public static void setSign(final World world, String name, final Plot p) { -======= @@ -359,17 +286,14 @@ import com.intellectualcrafters.plot.object.PlotWorld; } public static void setSign(String name, final Plot p) { ->>>>>>> Stashed changes + if (name == null) { name = "unknown"; } final PlotManager manager = PlotMain.getPlotManager(world); final PlotWorld plotworld = PlotMain.getWorldSettings(world); -<<<<<<< Updated upstream - final Location loc = manager.getSignLoc(world, plotworld, p); -======= final Location loc = manager.getSignLoc(plotworld, p); ->>>>>>> Stashed changes + final Block bs = loc.getBlock(); bs.setType(Material.AIR); bs.setTypeIdAndData(Material.WALL_SIGN.getId(), (byte) 2, false); @@ -400,45 +324,8 @@ import com.intellectualcrafters.plot.object.PlotWorld; return string; } -<<<<<<< Updated upstream - public static boolean setBlock(World world, int x, int y, int z, int id, byte data) { - try { - return AbstractSetBlock.setBlockManager.set(world, x, y, z, id, data); - } - catch (Throwable e) { - AbstractSetBlock.setBlockManager = new SetBlockSlow(); - return AbstractSetBlock.setBlockManager.set(world, x, y, z, id, data); - } - } - - public static boolean setBlock(World world, int x, int y, int z, PlotBlock[] blocks) { - final int i = random(blocks.length); - final PlotBlock newblock = blocks[i]; - try { - return AbstractSetBlock.setBlockManager.set(world, x, y, z, newblock.id, newblock.data); - } - catch (Throwable e) { - AbstractSetBlock.setBlockManager = new SetBlockSlow(); - return AbstractSetBlock.setBlockManager.set(world, x, y, z, newblock.id, newblock.data); - } - } - - public static void update(Location loc) { - ArrayList chunks = new ArrayList<>(); - final int distance = Bukkit.getViewDistance(); - for (int cx = -distance; cx < distance; cx++) { - for (int cz = -distance; cz < distance; cz++) { - final Chunk chunk = loc.getWorld().getChunkAt(loc.getChunk().getX() + cx, loc.getChunk().getZ() + cz); - chunks.add(chunk); - } - } - AbstractSetBlock.setBlockManager.update(chunks); - } - - public static void autoMerge(final World world, final Plot plot, final Player player) { -======= public static void autoMerge(final String world, final Plot plot, final Player player) { ->>>>>>> Stashed changes + if (plot == null) { return; } @@ -496,11 +383,8 @@ import com.intellectualcrafters.plot.object.PlotWorld; update(player.getLocation()); } -<<<<<<< Updated upstream - private static boolean ownsPlots(final World world, final ArrayList plots, final Player player, final int dir) { -======= private static boolean ownsPlots(final String world, final ArrayList plots, final Player player, final int dir) { ->>>>>>> Stashed changes + final PlotId id_min = plots.get(0); final PlotId id_max = plots.get(plots.size() - 1); for (final PlotId myid : plots) { @@ -566,28 +450,18 @@ import com.intellectualcrafters.plot.object.PlotWorld; return p; } -<<<<<<< Updated upstream - public static int getLoadedChunks(final World world) { - return world.getLoadedChunks().length; - } - - public static int getEntities(final World world) { -======= public static int getLoadedChunks(final String world) { return world.getLoadedChunks().length; } public static int getEntities(final String world) { ->>>>>>> Stashed changes + return world.getEntities().size(); } -<<<<<<< Updated upstream - public static int getTileEntities(final World world) { -======= public static int getTileEntities(final String world) { ->>>>>>> Stashed changes + PlotMain.getWorldSettings(world); int x = 0; for (final Chunk chunk : world.getLoadedChunks()) { @@ -596,11 +470,8 @@ import com.intellectualcrafters.plot.object.PlotWorld; return x; } -<<<<<<< Updated upstream - public static double getWorldFolderSize(final World world) { -======= public static double getWorldFolderSize(final String world) { ->>>>>>> Stashed changes + // long size = FileUtil.sizeOfDirectory(world.getWorldFolder()); final File folder = world.getWorldFolder(); final long size = folder.length(); @@ -623,11 +494,8 @@ import com.intellectualcrafters.plot.object.PlotWorld; return new short[]{Short.parseShort(block), 0}; } -<<<<<<< Updated upstream - public static void clearAllEntities(final World world, final Plot plot, final boolean tile) { -======= public static void clearAllEntities(final String world, final Plot plot, final boolean tile) { ->>>>>>> Stashed changes + final List entities = world.getEntities(); for (final Entity entity : entities) { @@ -651,11 +519,8 @@ import com.intellectualcrafters.plot.object.PlotWorld; * @param plot * @param isDelete */ -<<<<<<< Updated upstream - public static void clear(final Player player, final World world, final Plot plot, final boolean isDelete) { -======= public static void clear(final Player player, final String world, final Plot plot, final boolean isDelete) { ->>>>>>> Stashed changes + if (runners.containsKey(plot)) { PlayerFunctions.sendMessage(null, C.WAIT_FOR_TIMER); return; @@ -721,11 +586,6 @@ import com.intellectualcrafters.plot.object.PlotWorld; PlayerFunctions.sendMessage(requester, C.CLEARING_PLOT); -<<<<<<< Updated upstream - final World world; -======= - final String world; ->>>>>>> Stashed changes world = requester.getWorld(); clearAllEntities(world, plot, false); @@ -733,11 +593,6 @@ import com.intellectualcrafters.plot.object.PlotWorld; removeSign(world, plot); } -<<<<<<< Updated upstream - public static void setCuboid(final World world, final Location pos1, final Location pos2, final PlotBlock newblock) { -======= - public static void setCuboid(final String world, final Location pos1, final Location pos2, final PlotBlock newblock) { ->>>>>>> Stashed changes for (int y = pos1.getBlockY(); y < pos2.getBlockY(); y++) { for (int x = pos1.getBlockX(); x < pos2.getBlockX(); x++) { for (int z = pos1.getBlockZ(); z < pos2.getBlockZ(); z++) { @@ -750,11 +605,8 @@ import com.intellectualcrafters.plot.object.PlotWorld; } } -<<<<<<< Updated upstream - public static void setCuboid(final World world, final Location pos1, final Location pos2, final PlotBlock[] blocks) { -======= public static void setCuboid(final String world, final Location pos1, final Location pos2, final PlotBlock[] blocks) { ->>>>>>> Stashed changes + if (blocks.length == 1) { setCuboid(world, pos1, pos2, blocks[0]); return; @@ -773,11 +625,8 @@ import com.intellectualcrafters.plot.object.PlotWorld; } } -<<<<<<< Updated upstream - public static void setSimpleCuboid(final World world, final Location pos1, final Location pos2, final PlotBlock newblock) { -======= public static void setSimpleCuboid(final String world, final Location pos1, final Location pos2, final PlotBlock newblock) { ->>>>>>> Stashed changes + for (int y = pos1.getBlockY(); y < pos2.getBlockY(); y++) { for (int x = pos1.getBlockX(); x < pos2.getBlockX(); x++) { for (int z = pos1.getBlockZ(); z < pos2.getBlockZ(); z++) { @@ -790,11 +639,8 @@ import com.intellectualcrafters.plot.object.PlotWorld; } } -<<<<<<< Updated upstream - public static void setBiome(final World world, final Plot plot, final Biome b) { -======= public static void setBiome(final String world, final Plot plot, final Biome b) { ->>>>>>> Stashed changes + final int bottomX = getPlotBottomLoc(world, plot.id).getBlockX(); final int topX = getPlotTopLoc(world, plot.id).getBlockX() + 1; final int bottomZ = getPlotBottomLoc(world, plot.id).getBlockZ(); @@ -820,11 +666,8 @@ import com.intellectualcrafters.plot.object.PlotWorld; } } -<<<<<<< Updated upstream - public static int getHeighestBlock(final World world, final int x, final int z) { -======= public static int getHeighestBlock(final String world, final int x, final int z) { ->>>>>>> Stashed changes + boolean safe = false; int id; for (int i = 1; i < world.getMaxHeight(); i++) { @@ -898,11 +741,8 @@ import com.intellectualcrafters.plot.object.PlotWorld; * @param world World in which the plot is located * @param plot Plot Object */ -<<<<<<< Updated upstream - public static void refreshPlotChunks(final World world, final Plot plot) { -======= public static void refreshPlotChunks(final String world, final Plot plot) { ->>>>>>> Stashed changes + final int bottomX = getPlotBottomLoc(world, plot.id).getBlockX(); final int topX = getPlotTopLoc(world, plot.id).getBlockX(); final int bottomZ = getPlotBottomLoc(world, plot.id).getBlockZ(); @@ -946,11 +786,8 @@ import com.intellectualcrafters.plot.object.PlotWorld; * * @return */ -<<<<<<< Updated upstream - public static Location getPlotTopLocAbs(final World world, final PlotId id) { -======= public static Location getPlotTopLocAbs(final String world, final PlotId id) { ->>>>>>> Stashed changes + final PlotWorld plotworld = PlotMain.getWorldSettings(world); final PlotManager manager = PlotMain.getPlotManager(world); return manager.getPlotTopLocAbs(plotworld, id); @@ -965,11 +802,8 @@ import com.intellectualcrafters.plot.object.PlotWorld; * * @return */ -<<<<<<< Updated upstream - public static Location getPlotBottomLocAbs(final World world, final PlotId id) { -======= public static Location getPlotBottomLocAbs(final String world, final PlotId id) { ->>>>>>> Stashed changes + final PlotWorld plotworld = PlotMain.getWorldSettings(world); final PlotManager manager = PlotMain.getPlotManager(world); return manager.getPlotBottomLocAbs(plotworld, id); @@ -983,11 +817,8 @@ import com.intellectualcrafters.plot.object.PlotWorld; * * @return */ -<<<<<<< Updated upstream - public static int getPlotWidth(final World world, final PlotId id) { -======= public static int getPlotWidth(final String world, final PlotId id) { ->>>>>>> Stashed changes + return getPlotTopLoc(world, id).getBlockX() - getPlotBottomLoc(world, id).getBlockX(); } @@ -1000,11 +831,8 @@ import com.intellectualcrafters.plot.object.PlotWorld; * * @return */ -<<<<<<< Updated upstream - public static Location getPlotTopLoc(final World world, PlotId id) { -======= public static Location getPlotTopLoc(final String world, PlotId id) { ->>>>>>> Stashed changes + final Plot plot = PlotMain.getPlots(world).get(id); if (plot != null) { id = PlayerFunctions.getTopPlot(world, plot).id; @@ -1023,11 +851,8 @@ import com.intellectualcrafters.plot.object.PlotWorld; * * @return */ -<<<<<<< Updated upstream - public static Location getPlotBottomLoc(final World world, PlotId id) { -======= public static Location getPlotBottomLoc(final String world, PlotId id) { ->>>>>>> Stashed changes + final Plot plot = PlotMain.getPlots(world).get(id); if (plot != null) { id = PlayerFunctions.getBottomPlot(world, plot).id; @@ -1037,11 +862,8 @@ import com.intellectualcrafters.plot.object.PlotWorld; return manager.getPlotBottomLocAbs(plotworld, id); } -<<<<<<< Updated upstream - public static boolean isUnowned(final World world, final PlotId pos1, final PlotId pos2) { -======= public static boolean isUnowned(final String world, final PlotId pos1, final PlotId pos2) { ->>>>>>> Stashed changes + for (int x = pos1.x; x <= pos2.x; x++) { for (int y = pos1.y; y <= pos2.y; y++) { final PlotId id = new PlotId(x, y); @@ -1055,18 +877,6 @@ import com.intellectualcrafters.plot.object.PlotWorld; return true; } -<<<<<<< Updated upstream - public static boolean move(final World world, final PlotId current, PlotId newPlot, final Runnable whenDone) { - final Location bot1 = PlotHelper.getPlotBottomLoc(world, current); - Location bot2 = PlotHelper.getPlotBottomLoc(world, newPlot); - final Location top = PlotHelper.getPlotTopLoc(world, current); - final Plot currentPlot = PlotHelper.getPlot(world, current); - if (currentPlot.owner == null) { - return false; - } - Plot pos1 = PlayerFunctions.getBottomPlot(world, currentPlot); - Plot pos2 = PlayerFunctions.getTopPlot(world, currentPlot); -======= public static boolean move(final String world, final PlotId current, PlotId newPlot, final Runnable whenDone) { String worldname = world.getName(); final com.intellectualcrafters.plot.object.Location bot1 = PlotHelper.getPlotBottomLoc(worldname, current); @@ -1078,7 +888,7 @@ import com.intellectualcrafters.plot.object.PlotWorld; } Plot pos1 = PlayerFunctions.getBottomPlot(worldname, currentPlot); Plot pos2 = PlayerFunctions.getTopPlot(worldname, currentPlot); ->>>>>>> Stashed changes + PlotId size = PlotHelper.getSize(world, currentPlot); if (!PlotHelper.isUnowned(world, newPlot, new PlotId(newPlot.x + size.x - 1, newPlot.y + size.y - 1))) { return false; @@ -1107,11 +917,8 @@ import com.intellectualcrafters.plot.object.PlotWorld; return true; } -<<<<<<< Updated upstream - public static PlotId getSize(World world, Plot plot) { -======= public static PlotId getSize(String world, Plot plot) { ->>>>>>> Stashed changes + PlotSettings settings = plot.settings; if (!settings.isMerged()) { return new PlotId(1,1); @@ -1129,11 +936,8 @@ import com.intellectualcrafters.plot.object.PlotWorld; * * @return */ -<<<<<<< Updated upstream - public static Plot getPlot(final World world, final PlotId id) { -======= public static Plot getPlot(final String world, final PlotId id) { ->>>>>>> Stashed changes + if (id == null) { return null; } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/SetBlockFast.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/SetBlockFast.java index 93365241a..125021c6e 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/SetBlockFast.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/SetBlockFast.java @@ -36,11 +36,8 @@ import com.intellectualcrafters.plot.util.ReflectionUtils.RefMethod; * * @author Empire92 */ -<<<<<<< Updated upstream -public class SetBlockFast extends AbstractSetBlock { -======= public class SetBlockFast extends SetBlockManager { ->>>>>>> Stashed changes + private static final RefClass classBlock = getRefClass("{nms}.Block"); private static final RefClass classChunk = getRefClass("{nms}.Chunk"); @@ -77,20 +74,11 @@ public class SetBlockFast extends SetBlockManager { * @return true */ @Override -<<<<<<< Updated upstream - public boolean set(final org.bukkit.World world, final int x, final int y, final int z, final int blockId, final byte data) { - -======= public void set(final org.bukkit.World world, final int x, final int y, final int z, final int blockId, final byte data) { ->>>>>>> Stashed changes final Object w = methodGetHandle.of(world).call(); final Object chunk = methodGetChunkAt.of(w).call(x >> 4, z >> 4); final Object block = methodGetById.of(null).call(blockId); methodA.of(chunk).call(x & 0x0f, y, z & 0x0f, block, data); -<<<<<<< Updated upstream - return true; -======= ->>>>>>> Stashed changes } /** diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/SetBlockFast_1_8.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/SetBlockFast_1_8.java index ce5483eea..811eef19b 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/SetBlockFast_1_8.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/SetBlockFast_1_8.java @@ -37,11 +37,8 @@ import com.intellectualcrafters.plot.util.ReflectionUtils.RefMethod; * * @author Empire92 */ -<<<<<<< Updated upstream -public class SetBlockFast_1_8 extends AbstractSetBlock { -======= public class SetBlockFast_1_8 extends SetBlockManager { ->>>>>>> Stashed changes + private static final RefClass classBlock = getRefClass("{nms}.Block"); private static final RefClass classBlockPosition = getRefClass("{nms}.BlockPosition"); @@ -89,20 +86,14 @@ public class SetBlockFast_1_8 extends SetBlockManager { * @return true */ @Override -<<<<<<< Updated upstream - public boolean set(final World world, final int x, final int y, final int z, final int blockId, final byte data) { -======= public void set(final World world, final int x, final int y, final int z, final int blockId, final byte data) { ->>>>>>> Stashed changes + final Object w = methodGetHandle.of(world).call(); final Object chunk = methodGetChunkAt.of(w).call(x >> 4, z >> 4); final Object pos = constructorBlockPosition.create((int) (x & 0x0f), y, (int) (z & 0x0f)); final Object id = methodGetByCombinedId.of(null).call(blockId + (data << 12)); methodA.of(chunk).call(pos, id); -<<<<<<< Updated upstream - return true; -======= ->>>>>>> Stashed changes + } /** diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/SetBlockSlow.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/SetBlockSlow.java index 8a6863b76..fc9531063 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/SetBlockSlow.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/SetBlockSlow.java @@ -6,17 +6,11 @@ import org.bukkit.Chunk; import org.bukkit.World; import org.bukkit.block.Block; -<<<<<<< Updated upstream -public class SetBlockSlow extends AbstractSetBlock { - - @Override - public boolean set(World world, int x, int y, int z, int id, byte data) { -======= public class SetBlockSlow extends SetBlockManager { @Override public void set(World world, int x, int y, int z, int id, byte data) { ->>>>>>> Stashed changes + Block block = world.getBlockAt(x, y, z); if (block.getData() == data) { if (block.getTypeId() != id) { @@ -29,16 +23,11 @@ public class SetBlockSlow extends SetBlockManager { block.setTypeIdAndData(id, data, false); } } -<<<<<<< Updated upstream - return false; -======= ->>>>>>> Stashed changes } @Override public void update(List chunks) { // TODO Auto-generated method stub - } }