Starting work on sponge

This commit is contained in:
boy0001 2015-02-19 14:24:05 +11:00
parent 6ed681ae3d
commit 4a314144c6
22 changed files with 748 additions and 2 deletions

5
.gitignore vendored
View File

@ -1,3 +1,4 @@
PlotSquared/.project
# Created by https://www.gitignore.io # Created by https://www.gitignore.io
### Intellij ### ### Intellij ###
@ -48,6 +49,8 @@ com_crashlytics_export_strings.xml
### Eclipse ### ### Eclipse ###
.classpath
.project
*.pydevproject *.pydevproject
.metadata .metadata
.gradle .gradle
@ -93,8 +96,6 @@ local.properties
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid* hs_err_pid*
.classpath
.project
/target /target
/plotsquared/target /plotsquared/target
*.MF *.MF

View File

@ -0,0 +1,8 @@
package com.intellectualcrafters.plot;
import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;
public class BukkitMain extends JavaPlugin implements Listener {
}

View File

@ -53,6 +53,7 @@ import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
import me.confuser.barapi.BarAPI; import me.confuser.barapi.BarAPI;
import net.milkbowl.vault.economy.Economy; import net.milkbowl.vault.economy.Economy;
<<<<<<< Updated upstream
import org.bukkit.*; import org.bukkit.*;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.command.PluginCommand; import org.bukkit.command.PluginCommand;
@ -68,6 +69,8 @@ import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.RegisteredServiceProvider; import org.bukkit.plugin.RegisteredServiceProvider;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
=======
>>>>>>> Stashed changes
import java.io.File; import java.io.File;
import java.io.FileWriter; import java.io.FileWriter;
import java.io.IOException; import java.io.IOException;
@ -84,7 +87,11 @@ import java.util.Map.Entry;
* @author Citymonstret * @author Citymonstret
* @author Empire92 * @author Empire92
*/ */
<<<<<<< Updated upstream
public class PlotMain extends JavaPlugin implements Listener { public class PlotMain extends JavaPlugin implements Listener {
=======
public class PlotMain {
>>>>>>> Stashed changes
/** /**
* Permission that allows for "everything" * Permission that allows for "everything"
*/ */
@ -928,9 +935,13 @@ public class PlotMain extends JavaPlugin implements Listener {
} }
public static void loadWorld(final String world, final ChunkGenerator generator) { public static void loadWorld(final String world, final ChunkGenerator generator) {
<<<<<<< Updated upstream
System.out.print(2); System.out.print(2);
if (getWorldSettings(world) != null) { if (getWorldSettings(world) != null) {
System.out.print(3); System.out.print(3);
=======
if (getWorldSettings(world) != null) {
>>>>>>> Stashed changes
return; return;
} }
@ -942,7 +953,10 @@ public class PlotMain extends JavaPlugin implements Listener {
final String path = "worlds." + world; final String path = "worlds." + world;
if (!LOADING_WORLD && (generator != null) && (generator instanceof PlotGenerator)) { if (!LOADING_WORLD && (generator != null) && (generator instanceof PlotGenerator)) {
<<<<<<< Updated upstream
System.out.print(4); System.out.print(4);
=======
>>>>>>> Stashed changes
plotGenerator = (PlotGenerator) generator; plotGenerator = (PlotGenerator) generator;
plotWorld = plotGenerator.getNewPlotWorld(world); plotWorld = plotGenerator.getNewPlotWorld(world);
plotManager = plotGenerator.getPlotManager(); plotManager = plotGenerator.getPlotManager();
@ -966,9 +980,13 @@ public class PlotMain extends JavaPlugin implements Listener {
addPlotWorld(world, plotWorld, plotManager); addPlotWorld(world, plotWorld, plotManager);
PlotHelper.setupBorder(world); PlotHelper.setupBorder(world);
} else { } else {
<<<<<<< Updated upstream
System.out.print(5 + " | " + (generator instanceof PlotGenerator)); System.out.print(5 + " | " + (generator instanceof PlotGenerator));
if (!worlds.contains(world)) { if (!worlds.contains(world)) {
System.out.print(6); System.out.print(6);
=======
if (!worlds.contains(world)) {
>>>>>>> Stashed changes
return; return;
} }
if (!LOADING_WORLD) { if (!LOADING_WORLD) {
@ -1598,18 +1616,32 @@ public class PlotMain extends JavaPlugin implements Listener {
{ {
if (checkVersion(1, 8, 0)) { if (checkVersion(1, 8, 0)) {
try { try {
<<<<<<< Updated upstream
AbstractSetBlock.setBlockManager = new SetBlockSlow(); AbstractSetBlock.setBlockManager = new SetBlockSlow();
} }
catch (Throwable e) { catch (Throwable e) {
e.printStackTrace(); e.printStackTrace();
AbstractSetBlock.setBlockManager = new SetBlockSlow(); AbstractSetBlock.setBlockManager = new SetBlockSlow();
=======
SetBlockManager.setBlockManager = new SetBlockSlow();
}
catch (Throwable e) {
e.printStackTrace();
SetBlockManager.setBlockManager = new SetBlockSlow();
>>>>>>> Stashed changes
} }
} }
else { else {
try { try {
<<<<<<< Updated upstream
AbstractSetBlock.setBlockManager = new SetBlockFast(); AbstractSetBlock.setBlockManager = new SetBlockFast();
} catch (Throwable e) { } catch (Throwable e) {
AbstractSetBlock.setBlockManager = new SetBlockSlow(); AbstractSetBlock.setBlockManager = new SetBlockSlow();
=======
SetBlockManager.setBlockManager = new SetBlockFast();
} catch (Throwable e) {
SetBlockManager.setBlockManager = new SetBlockSlow();
>>>>>>> Stashed changes
} }
} }
try { try {

View File

@ -30,7 +30,11 @@ import com.intellectualcrafters.plot.PlotMain;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.generator.HybridPlotManager; import com.intellectualcrafters.plot.generator.HybridPlotManager;
import com.intellectualcrafters.plot.generator.HybridPlotWorld; import com.intellectualcrafters.plot.generator.HybridPlotWorld;
<<<<<<< Updated upstream
import com.intellectualcrafters.plot.util.AbstractSetBlock; import com.intellectualcrafters.plot.util.AbstractSetBlock;
=======
import com.intellectualcrafters.plot.util.SetBlockManager;
>>>>>>> Stashed changes
import com.intellectualcrafters.plot.util.PlayerFunctions; import com.intellectualcrafters.plot.util.PlayerFunctions;
public class DebugRoadRegen extends SubCommand { public class DebugRoadRegen extends SubCommand {
@ -49,7 +53,11 @@ public class DebugRoadRegen extends SubCommand {
Chunk chunk = player.getLocation().getChunk(); Chunk chunk = player.getLocation().getChunk();
boolean result = manager.regenerateRoad(chunk); boolean result = manager.regenerateRoad(chunk);
if (result) { if (result) {
<<<<<<< Updated upstream
AbstractSetBlock.setBlockManager.update(Arrays.asList(new Chunk[] {chunk})); 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")); PlayerFunctions.sendMessage(player, "&6Regenerating chunk: "+chunk.getX() + "," + chunk.getZ() + "\n&6 - Result: " + (result == true ? "&aSuccess" : "&cFailed"));
return true; return true;

View File

@ -21,6 +21,7 @@
package com.intellectualcrafters.plot.commands; package com.intellectualcrafters.plot.commands;
<<<<<<< Updated upstream
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
@ -32,12 +33,53 @@ public class Template extends SubCommand {
super("template", "plots.admin", "Create or use a world template", "template", "", CommandCategory.DEBUG, true); 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;
import java.util.zip.GZIPOutputStream;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.entity.Player;
import com.intellectualcrafters.plot.PlotMain;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.PlotWorld;
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);
}
>>>>>>> Stashed changes
@Override @Override
public boolean execute(final Player plr, final String... args) { public boolean execute(final Player plr, final String... args) {
if (args.length != 2) { if (args.length != 2) {
PlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot template <import|export> <world>"); PlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot template <import|export> <world>");
return false; return false;
} }
<<<<<<< Updated upstream
=======
World world = Bukkit.getWorld(args[1]);
PlotWorld plotworld = PlotMain.getWorldSettings(args[1]);
if (world == null || plotworld == null) {
PlayerFunctions.sendMessage(plr, C.NOT_VALID_PLOT_WORLD);
return false;
}
switch (args[0].toLowerCase()) {
case "import": {
// TODO import template
PlayerFunctions.sendMessage(plr, "TODO");
return true;
}
case "export": {
PlayerFunctions.sendMessage(plr, "TODO");
}
}
>>>>>>> Stashed changes
// TODO allow world settings (including schematics to be packed into a single file) // TODO allow world settings (including schematics to be packed into a single file)
@ -45,4 +87,24 @@ public class Template extends SubCommand {
return true; return true;
} }
<<<<<<< Updated upstream
=======
public void gzipIt(String output, String input) {
byte[] buffer = new byte[1024];
try {
GZIPOutputStream gzos = new GZIPOutputStream(new FileOutputStream(output));
FileInputStream in = new FileInputStream(input);
int len;
while ((len = in.read(buffer)) > 0) {
gzos.write(buffer, 0, len);
}
in.close();
gzos.finish();
gzos.close();
} catch (IOException ex) {
ex.printStackTrace();
}
}
>>>>>>> Stashed changes
} }

View File

@ -161,6 +161,10 @@ public class SQLManager implements AbstractDB {
} }
stored.get(world).put(new PlotId(idx, idz), id); stored.get(world).put(new PlotId(idx, idz), id);
} }
<<<<<<< Updated upstream
=======
result.close();
>>>>>>> Stashed changes
stmt.close(); stmt.close();
} catch (final SQLException e) { } catch (final SQLException e) {
e.printStackTrace(); e.printStackTrace();
@ -482,6 +486,10 @@ public class SQLManager implements AbstractDB {
while (r.next()) { while (r.next()) {
id = r.getInt("id"); id = r.getInt("id");
} }
<<<<<<< Updated upstream
=======
r.close();
>>>>>>> Stashed changes
stmt.close(); stmt.close();
return id; return id;
} catch (final SQLException e) { } catch (final SQLException e) {
@ -515,6 +523,10 @@ public class SQLManager implements AbstractDB {
final Statement statement = this.connection.createStatement(); final Statement statement = this.connection.createStatement();
statement.addBatch("ALTER TABLE `" + this.prefix + "plot_settings` ADD `merged` int(11) DEFAULT NULL"); statement.addBatch("ALTER TABLE `" + this.prefix + "plot_settings` ADD `merged` int(11) DEFAULT NULL");
statement.executeBatch(); statement.executeBatch();
<<<<<<< Updated upstream
=======
rs.close();
>>>>>>> Stashed changes
statement.close(); statement.close();
} }
} catch (final Exception e) { } catch (final Exception e) {
@ -706,6 +718,10 @@ public class SQLManager implements AbstractDB {
} }
} }
stmt.close(); stmt.close();
<<<<<<< Updated upstream
=======
r.close();
>>>>>>> Stashed changes
for (final Plot plot : plots.values()) { for (final Plot plot : plots.values()) {
final String world = plot.world; final String world = plot.world;
if (!newplots.containsKey(world)) { if (!newplots.containsKey(world)) {
@ -951,6 +967,11 @@ public class SQLManager implements AbstractDB {
} }
} }
purgeIds(world, ids); purgeIds(world, ids);
<<<<<<< Updated upstream
=======
stmt.close();
r.close();
>>>>>>> Stashed changes
} catch (SQLException e) { } catch (SQLException e) {
e.printStackTrace(); e.printStackTrace();
PlotMain.sendConsoleSenderMessage("&c[ERROR] "+"FAILED TO PURGE WORLD '" + world + "'!"); PlotMain.sendConsoleSenderMessage("&c[ERROR] "+"FAILED TO PURGE WORLD '" + world + "'!");
@ -1026,6 +1047,10 @@ public class SQLManager implements AbstractDB {
h.put(var, val); h.put(var, val);
} }
stmt.close(); stmt.close();
<<<<<<< Updated upstream
=======
r.close();
>>>>>>> Stashed changes
} catch (final SQLException e) { } catch (final SQLException e) {
PlotMain.sendConsoleSenderMessage("&7[WARN] "+"Failed to load settings for plot: " + id); PlotMain.sendConsoleSenderMessage("&7[WARN] "+"Failed to load settings for plot: " + id);
e.printStackTrace(); e.printStackTrace();
@ -1087,6 +1112,10 @@ public class SQLManager implements AbstractDB {
comments.add(comment); comments.add(comment);
} }
statement.close(); statement.close();
<<<<<<< Updated upstream
=======
set.close();
>>>>>>> Stashed changes
} catch (final SQLException e) { } catch (final SQLException e) {
PlotMain.sendConsoleSenderMessage("&7[WARN] "+"Failed to fetch comment"); PlotMain.sendConsoleSenderMessage("&7[WARN] "+"Failed to fetch comment");
e.printStackTrace(); e.printStackTrace();
@ -1283,6 +1312,10 @@ public class SQLManager implements AbstractDB {
rating = set.getDouble("rating"); rating = set.getDouble("rating");
} }
statement.close(); statement.close();
<<<<<<< Updated upstream
=======
set.close();
>>>>>>> Stashed changes
return rating; return rating;
} catch (final SQLException e) { } catch (final SQLException e) {
PlotMain.sendConsoleSenderMessage("&7[WARN] "+"Failed to fetch rating for plot " + plot.getId().toString()); PlotMain.sendConsoleSenderMessage("&7[WARN] "+"Failed to fetch rating for plot " + plot.getId().toString());
@ -1338,6 +1371,10 @@ public class SQLManager implements AbstractDB {
c_id = r.getInt("id"); c_id = r.getInt("id");
} }
stmt.close(); stmt.close();
<<<<<<< Updated upstream
=======
r.close();
>>>>>>> Stashed changes
return c_id; return c_id;
} catch (final SQLException e) { } catch (final SQLException e) {
e.printStackTrace(); e.printStackTrace();
@ -1516,6 +1553,10 @@ public class SQLManager implements AbstractDB {
} }
} }
stmt.close(); stmt.close();
<<<<<<< Updated upstream
=======
r.close();
>>>>>>> Stashed changes
for (final PlotCluster c : clusters.values()) { for (final PlotCluster c : clusters.values()) {
final String world = c.world; final String world = c.world;
if (!newClusters.containsKey(world)) { if (!newClusters.containsKey(world)) {
@ -1745,6 +1786,10 @@ public class SQLManager implements AbstractDB {
h.put(var, val); h.put(var, val);
} }
stmt.close(); stmt.close();
<<<<<<< Updated upstream
=======
r.close();
>>>>>>> Stashed changes
} catch (final SQLException e) { } catch (final SQLException e) {
PlotMain.sendConsoleSenderMessage("&7[WARN] "+"Failed to load settings for cluster: " + id); PlotMain.sendConsoleSenderMessage("&7[WARN] "+"Failed to load settings for cluster: " + id);
e.printStackTrace(); e.printStackTrace();

View File

@ -5,19 +5,30 @@ import java.util.Random;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Chunk; import org.bukkit.Chunk;
<<<<<<< Updated upstream
import org.bukkit.Location; import org.bukkit.Location;
=======
>>>>>>> Stashed changes
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.generator.BlockPopulator; import org.bukkit.generator.BlockPopulator;
import com.intellectualcrafters.plot.PlotMain; import com.intellectualcrafters.plot.PlotMain;
import com.intellectualcrafters.plot.object.BlockWrapper; 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.PlotCluster;
import com.intellectualcrafters.plot.object.PlotGenerator; import com.intellectualcrafters.plot.object.PlotGenerator;
import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.object.PlotId;
import com.intellectualcrafters.plot.object.PlotManager; import com.intellectualcrafters.plot.object.PlotManager;
import com.intellectualcrafters.plot.object.PlotWorld; import com.intellectualcrafters.plot.object.PlotWorld;
import com.intellectualcrafters.plot.object.RegionWrapper; import com.intellectualcrafters.plot.object.RegionWrapper;
<<<<<<< Updated upstream
import com.intellectualcrafters.plot.util.AbstractSetBlock; 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.ChunkManager;
import com.intellectualcrafters.plot.util.PlotHelper; import com.intellectualcrafters.plot.util.PlotHelper;
import com.intellectualcrafters.plot.util.TaskManager; import com.intellectualcrafters.plot.util.TaskManager;
@ -38,7 +49,11 @@ public class AugmentedPopulator extends BlockPopulator {
private final int tx; private final int tx;
private final int tz; private final int tz;
<<<<<<< Updated upstream
public BlockWrapper getBlock(int X, int Z, int i, int j, short[][] r, boolean c) { 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 y = (i << 4) + (j >> 8);
int a = (j - ((y & 0xF) << 8)); int a = (j - ((y & 0xF) << 8));
int z = (a >> 4); int z = (a >> 4);
@ -66,11 +81,19 @@ public class AugmentedPopulator extends BlockPopulator {
Location bl = manager.getPlotBottomLocAbs(plotworld, cluster.getP1()); Location bl = manager.getPlotBottomLocAbs(plotworld, cluster.getP1());
Location tl = manager.getPlotTopLocAbs(plotworld, cluster.getP2()).add(1,0,1); Location tl = manager.getPlotTopLocAbs(plotworld, cluster.getP2()).add(1,0,1);
<<<<<<< Updated upstream
this.bx = bl.getBlockX(); this.bx = bl.getBlockX();
this.bz = bl.getBlockZ(); this.bz = bl.getBlockZ();
this.tx = tl.getBlockX(); this.tx = tl.getBlockX();
this.tz = tl.getBlockZ(); this.tz = tl.getBlockZ();
=======
this.bx = bl.getX();
this.bz = bl.getZ();
this.tx = tl.getX();
this.tz = tl.getZ();
>>>>>>> Stashed changes
} }
else { else {
this.bx = Integer.MIN_VALUE; this.bx = Integer.MIN_VALUE;
@ -118,8 +141,13 @@ public class AugmentedPopulator extends BlockPopulator {
check = false; check = false;
} }
if (plotworld.TERRAIN == 2) { if (plotworld.TERRAIN == 2) {
<<<<<<< Updated upstream
PlotId plot1 = manager.getPlotIdAbs(plotworld, new Location(world, x, 0, z)); PlotId plot1 = manager.getPlotIdAbs(plotworld, new Location(world, x, 0, z));
PlotId plot2 = manager.getPlotIdAbs(plotworld, new Location(world, x2, 0, z2)); 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)) { if (plot1 != null && plot2 != null && plot1.equals(plot2)) {
return; return;
} }
@ -132,7 +160,11 @@ public class AugmentedPopulator extends BlockPopulator {
public void run() { public void run() {
populateBiome(world, x, z); populateBiome(world, x, z);
chunk.unload(true, true); chunk.unload(true, true);
<<<<<<< Updated upstream
AbstractSetBlock.setBlockManager.update(Arrays.asList( new Chunk[] {chunk})); AbstractSetBlock.setBlockManager.update(Arrays.asList( new Chunk[] {chunk}));
=======
SetBlockManager.setBlockManager.update(Arrays.asList( new Chunk[] {chunk}));
>>>>>>> Stashed changes
} }
}, 20); }, 20);
} }
@ -149,7 +181,11 @@ public class AugmentedPopulator extends BlockPopulator {
chunk.load(true); chunk.load(true);
populateBlocks(world, rand, X, Z, x, z, check); populateBlocks(world, rand, X, Z, x, z, check);
chunk.unload(true, true); chunk.unload(true, true);
<<<<<<< Updated upstream
AbstractSetBlock.setBlockManager.update(Arrays.asList( new Chunk[] {chunk})); AbstractSetBlock.setBlockManager.update(Arrays.asList( new Chunk[] {chunk}));
=======
SetBlockManager.setBlockManager.update(Arrays.asList( new Chunk[] {chunk}));
>>>>>>> Stashed changes
} }
}, 40 + rand.nextInt(40)); }, 40 + rand.nextInt(40));
} }
@ -170,7 +206,11 @@ public class AugmentedPopulator extends BlockPopulator {
int length = result[0].length; int length = result[0].length;
for(int i = 0; i < result.length; i++) { for(int i = 0; i < result.length; i++) {
for(int j = 0; j < length; j++) { for(int j = 0; j < length; j++) {
<<<<<<< Updated upstream
BlockWrapper blockInfo = getBlock(x, z, i, j, result, check); BlockWrapper blockInfo = getBlock(x, z, i, j, result, check);
=======
BlockWrapper blockInfo = get(x, z, i, j, result, check);
>>>>>>> Stashed changes
if (blockInfo == null) { if (blockInfo == null) {
continue; continue;
} }
@ -182,7 +222,11 @@ public class AugmentedPopulator extends BlockPopulator {
continue; continue;
} }
} }
<<<<<<< Updated upstream
else if (manager.getPlotIdAbs(plotworld, new Location(world, xx, 0, zz)) != null) { else if (manager.getPlotIdAbs(plotworld, new Location(world, xx, 0, zz)) != null) {
=======
else if (manager.getPlotIdAbs(plotworld, xx, 0, zz) != null) {
>>>>>>> Stashed changes
continue; continue;
} }
} }

View File

@ -48,7 +48,11 @@ public abstract class ClassicPlotManager extends SquarePlotManager {
public boolean setFloor(final World world, final PlotWorld plotworld, final PlotId plotid, final PlotBlock[] blocks) { public boolean setFloor(final World world, final PlotWorld plotworld, final PlotId plotid, final PlotBlock[] blocks) {
final ClassicPlotWorld dpw = (ClassicPlotWorld) plotworld; final ClassicPlotWorld dpw = (ClassicPlotWorld) plotworld;
<<<<<<< Updated upstream
final Location pos1 = PlotHelper.getPlotBottomLoc(world, plotid).add(1, 0, 1); 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); 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); 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; return true;
@ -59,7 +63,11 @@ public abstract class ClassicPlotManager extends SquarePlotManager {
if (dpw.ROAD_WIDTH == 0) { if (dpw.ROAD_WIDTH == 0) {
return false; return false;
} }
<<<<<<< Updated upstream
final Location bottom = PlotHelper.getPlotBottomLoc(w, plotid); final Location bottom = PlotHelper.getPlotBottomLoc(w, plotid);
=======
final Location bottom = PlotHelper.getPlotBottomLoc(plotworld.worldname, plotid);
>>>>>>> Stashed changes
final Location top = PlotHelper.getPlotTopLoc(w, plotid); final Location top = PlotHelper.getPlotTopLoc(w, plotid);
int x, z; int x, z;
@ -97,7 +105,11 @@ public abstract class ClassicPlotManager extends SquarePlotManager {
if (dpw.ROAD_WIDTH == 0) { if (dpw.ROAD_WIDTH == 0) {
return false; return false;
} }
<<<<<<< Updated upstream
final Location bottom = PlotHelper.getPlotBottomLoc(w, plotid); final Location bottom = PlotHelper.getPlotBottomLoc(w, plotid);
=======
final Location bottom = PlotHelper.getPlotBottomLoc(plotworld.worldname, plotid);
>>>>>>> Stashed changes
final Location top = PlotHelper.getPlotTopLoc(w, plotid); final Location top = PlotHelper.getPlotTopLoc(w, plotid);
int x, z; int x, z;
@ -318,7 +330,11 @@ public abstract class ClassicPlotManager extends SquarePlotManager {
} }
@Override @Override
<<<<<<< Updated upstream
public String[] getPlotComponents(World world, PlotWorld plotworld, PlotId plotid) { public String[] getPlotComponents(World world, PlotWorld plotworld, PlotId plotid) {
=======
public String[] getPlotComponents(PlotWorld plotworld, PlotId plotid) {
>>>>>>> Stashed changes
return new String[] { return new String[] {
"floor", "floor",
"wall", "wall",
@ -330,8 +346,15 @@ public abstract class ClassicPlotManager extends SquarePlotManager {
* Remove sign for a plot * Remove sign for a plot
*/ */
@Override @Override
<<<<<<< Updated upstream
public Location getSignLoc(final World world, final PlotWorld plotworld, final Plot plot) { public Location getSignLoc(final World world, final PlotWorld plotworld, final Plot plot) {
final ClassicPlotWorld dpw = (ClassicPlotWorld) plotworld; 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); 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
} }
} }

View File

@ -41,7 +41,11 @@ import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotBlock; import com.intellectualcrafters.plot.object.PlotBlock;
import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.object.PlotId;
import com.intellectualcrafters.plot.object.PlotWorld; import com.intellectualcrafters.plot.object.PlotWorld;
<<<<<<< Updated upstream
import com.intellectualcrafters.plot.util.AbstractSetBlock; 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.ChunkManager;
import com.intellectualcrafters.plot.util.PlayerFunctions; import com.intellectualcrafters.plot.util.PlayerFunctions;
import com.intellectualcrafters.plot.util.PlotHelper; import com.intellectualcrafters.plot.util.PlotHelper;
@ -196,7 +200,11 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
regenerateRoad(chunk); regenerateRoad(chunk);
} }
} }
<<<<<<< Updated upstream
AbstractSetBlock.setBlockManager.update(chunks2); AbstractSetBlock.setBlockManager.update(chunks2);
=======
SetBlockManager.setBlockManager.update(chunks2);
>>>>>>> Stashed changes
} }
public boolean scheduleRoadUpdate(final World world) { public boolean scheduleRoadUpdate(final World world) {

View File

@ -160,8 +160,14 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
final Location f = event.getFrom(); final Location f = event.getFrom();
final Location t = event.getTo(); final Location t = event.getTo();
final Location q = new Location(t.getWorld(), t.getBlockX(), 0, t.getZ()); 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())) {
=======
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) { if (Settings.TELEPORT_DELAY != 0 && TaskManager.TELEPORT_QUEUE.size() > 0) {
String name = player.getName(); String name = player.getName();
if (TaskManager.TELEPORT_QUEUE.contains(name)) { if (TaskManager.TELEPORT_QUEUE.contains(name)) {
@ -192,6 +198,10 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
passed = true; passed = true;
} }
if (passed) { if (passed) {
<<<<<<< Updated upstream
=======
q.setY(t.getBlockY());
>>>>>>> Stashed changes
event.setTo(q); event.setTo(q);
PlayerFunctions.sendMessage(player, C.BORDER); PlayerFunctions.sendMessage(player, C.BORDER);
return; return;
@ -199,6 +209,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
} }
Plot plot = getCurrentPlot(q); Plot plot = getCurrentPlot(q);
if (plot != null) { if (plot != null) {
<<<<<<< Updated upstream
if (!plot.equals(getCurrentPlot(f))) { if (!plot.equals(getCurrentPlot(f))) {
if (plot.deny_entry(player)) { if (plot.deny_entry(player)) {
if (!PlotMain.hasPermission(player, "plots.admin.entry.denied")) { if (!PlotMain.hasPermission(player, "plots.admin.entry.denied")) {
@ -207,6 +218,20 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
return; 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); plotEntry(player, plot);
} }
} else if (leftPlot(f, event.getTo())) { } else if (leftPlot(f, event.getTo())) {

View File

@ -11,13 +11,21 @@ import java.lang.reflect.Method;
*/ */
public class Location implements Cloneable, Comparable<Location> { public class Location implements Cloneable, Comparable<Location> {
<<<<<<< Updated upstream
private double x, y, z; private double x, y, z;
=======
private int x, y, z;
>>>>>>> Stashed changes
private float yaw, pitch; private float yaw, pitch;
private String world; private String world;
private boolean built; private boolean built;
private Object o; 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 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.world = world;
this.x = x; this.x = x;
this.y = y; this.y = y;
@ -29,6 +37,7 @@ public class Location implements Cloneable, Comparable<Location> {
} }
public Location() { public Location() {
<<<<<<< Updated upstream
this("", 0d, 0d, 0d, 0f, 0f); this("", 0d, 0d, 0d, 0f, 0f);
} }
@ -41,24 +50,54 @@ public class Location implements Cloneable, Comparable<Location> {
} }
public void setX(final double x) { public void setX(final double x) {
=======
this("", 0, 0, 0, 0, 0);
}
public Location(final String world, final int x, final int y, final int z) {
this(world, x, y, z, 0f, 0f);
}
public int getX() {
return this.x;
}
public void setX(final int x) {
>>>>>>> Stashed changes
this.x = x; this.x = x;
this.built = false; this.built = false;
} }
<<<<<<< Updated upstream
public double getY() { public double getY() {
return this.y; return this.y;
} }
public void setY(final double 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.y = y;
this.built = false; this.built = false;
} }
<<<<<<< Updated upstream
public double getZ() { public double getZ() {
return this.z; return this.z;
} }
public void setZ(final double 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.z = z;
this.built = false; this.built = false;
} }
@ -90,11 +129,19 @@ public class Location implements Cloneable, Comparable<Location> {
this.built = false; this.built = false;
} }
<<<<<<< Updated upstream
public void add(double x, double y, double z) { public void add(double x, double y, double z) {
=======
public Location add(int x, int y, int z) {
>>>>>>> Stashed changes
this.x += x; this.x += x;
this.y += y; this.y += y;
this.z += z; this.z += z;
this.built = false; this.built = false;
<<<<<<< Updated upstream
=======
return this;
>>>>>>> Stashed changes
} }
public double getEuclideanDistanceSquared(final Location l2) { public double getEuclideanDistanceSquared(final Location l2) {
@ -128,7 +175,11 @@ public class Location implements Cloneable, Comparable<Location> {
y <= max.getY() && z >= min.getX() && z < max.getZ(); y <= max.getY() && z >= min.getX() && z < max.getZ();
} }
<<<<<<< Updated upstream
public void lookTowards(double x, double y) { public void lookTowards(double x, double y) {
=======
public void lookTowards(int x, int y) {
>>>>>>> Stashed changes
double l = this.x - x; double l = this.x - x;
double w = this.z - z; double w = this.z - z;
double c = Math.sqrt(l * l + w * w); double c = Math.sqrt(l * l + w * w);
@ -140,17 +191,34 @@ public class Location implements Cloneable, Comparable<Location> {
this.built = false; this.built = false;
} }
<<<<<<< Updated upstream
public void subtract(double x, double y, double z) { public void subtract(double x, double y, double z) {
=======
public Location subtract(int x, int y, int z) {
>>>>>>> Stashed changes
this.x -= x; this.x -= x;
this.y -= y; this.y -= y;
this.z -= z; this.z -= z;
this.built = false; this.built = false;
<<<<<<< Updated upstream
=======
return this;
>>>>>>> Stashed changes
} }
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
<<<<<<< Updated upstream
if (!(o instanceof Location)) if (!(o instanceof Location))
return false; return false;
=======
if (o == null) {
return false;
}
if (!(o instanceof Location)) {
return false;
}
>>>>>>> Stashed changes
Location l = (Location) o; Location l = (Location) o;
return x == l.getX() && y == l.getY() && return x == l.getX() && y == l.getY() &&
z == l.getZ() && world.equals(l.getWorld()) && z == l.getZ() && world.equals(l.getWorld()) &&
@ -183,6 +251,12 @@ public class Location implements Cloneable, Comparable<Location> {
} }
} }
<<<<<<< Updated upstream
=======
/**
* Please use utility class as this is not efficient
*/
>>>>>>> Stashed changes
public Object toBukkitLocation() { public Object toBukkitLocation() {
if (built) { if (built) {
return o; return o;
@ -196,6 +270,12 @@ public class Location implements Cloneable, Comparable<Location> {
} }
} }
<<<<<<< Updated upstream
=======
/**
* Please use utility class as this is not efficient
*/
>>>>>>> Stashed changes
public void teleport(final Object o) throws Exception { public void teleport(final Object o) throws Exception {
if (o.getClass().getName().contains("org.bukkit.entity")) { if (o.getClass().getName().contains("org.bukkit.entity")) {
Method m = o.getClass().getMethod("teleport", Class.forName("org.bukkit.Location")); Method m = o.getClass().getMethod("teleport", Class.forName("org.bukkit.Location"));

View File

@ -23,7 +23,10 @@ package com.intellectualcrafters.plot.object;
import java.util.ArrayList; import java.util.ArrayList;
<<<<<<< Updated upstream
import org.bukkit.Location; import org.bukkit.Location;
=======
>>>>>>> Stashed changes
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.block.Biome; import org.bukkit.block.Biome;
@ -34,9 +37,15 @@ public abstract class PlotManager {
* plots) * plots)
*/ */
<<<<<<< Updated upstream
public abstract PlotId getPlotIdAbs(final PlotWorld plotworld, final Location loc); public abstract PlotId getPlotIdAbs(final PlotWorld plotworld, final Location loc);
public abstract PlotId getPlotId(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 // 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); public abstract Location getPlotBottomLocAbs(final PlotWorld plotworld, final PlotId plotid);
@ -46,6 +55,7 @@ public abstract class PlotManager {
/* /*
* Plot clearing (return false if you do not support some method) * 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 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 claimPlot(final World world, final PlotWorld plotworld, final Plot plot);
@ -53,17 +63,34 @@ public abstract class PlotManager {
public abstract boolean unclaimPlot(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 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);
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 * Plot set functions (return false if you do not support the specific set
* method) * method)
*/ */
<<<<<<< Updated upstream
public abstract String[] getPlotComponents(final World world, final PlotWorld plotworld, final PlotId plotid); 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 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 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 * PLOT MERGING (return false if your generator does not support plot
@ -81,6 +108,7 @@ public abstract class PlotManager {
public abstract boolean removeRoadSouthEast(final PlotWorld plotworld, final Plot plot); public abstract boolean removeRoadSouthEast(final PlotWorld plotworld, final Plot plot);
<<<<<<< Updated upstream
public abstract boolean startPlotMerge(final World world, final PlotWorld plotworld, final ArrayList<PlotId> plotIds); public abstract boolean startPlotMerge(final World world, final PlotWorld plotworld, final ArrayList<PlotId> plotIds);
public abstract boolean startPlotUnlink(final World world, final PlotWorld plotworld, final ArrayList<PlotId> plotIds); public abstract boolean startPlotUnlink(final World world, final PlotWorld plotworld, final ArrayList<PlotId> plotIds);
@ -88,5 +116,14 @@ public abstract class PlotManager {
public abstract boolean finishPlotMerge(final World world, final PlotWorld plotworld, final ArrayList<PlotId> plotIds); public abstract boolean finishPlotMerge(final World world, final PlotWorld plotworld, final ArrayList<PlotId> plotIds);
public abstract boolean finishPlotUnlink(final World world, final PlotWorld plotworld, final ArrayList<PlotId> plotIds); public abstract boolean finishPlotUnlink(final World world, final PlotWorld plotworld, final ArrayList<PlotId> plotIds);
=======
public abstract boolean startPlotMerge(final PlotWorld plotworld, final ArrayList<PlotId> plotIds);
public abstract boolean startPlotUnlink(final PlotWorld plotworld, final ArrayList<PlotId> plotIds);
public abstract boolean finishPlotMerge(final PlotWorld plotworld, final ArrayList<PlotId> plotIds);
public abstract boolean finishPlotUnlink(final PlotWorld plotworld, final ArrayList<PlotId> plotIds);
>>>>>>> Stashed changes
} }

View File

@ -0,0 +1,64 @@
package com.intellectualcrafters.plot.util;
import org.bukkit.World;
import com.intellectualcrafters.plot.object.PlotBlock;
public abstract class BlockManager {
private static BlockManager manager = new BukkitUtil();
private static long state = 1;
public static long nextLong() {
final long a = state;
state = xorShift64(a);
return a;
}
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 abstract void functionSetBlock(String worldname, int[] x, int[] y, int[] z, int[] id, byte[] data);
public abstract void setSign(String worldname, int x, int y, int z);
public static void setBlocks(String worldname, int[] x, int y[], int z[], PlotBlock[][] blocks) {
int[] id = new int[blocks.length];
byte[] data = new byte[blocks.length];
for (int i = 0; i < blocks.length; i++) {
PlotBlock[] current = blocks[i];
int n = random(current.length);
id[i] = current[n].id;
data[i] = current[n].data;
}
setBlocks(worldname, x, y, z, id, data);
}
public static void setBlocks(String worldname, int[] x, int y[], int z[], PlotBlock[] blocks) {
int[] id = new int[blocks.length];
byte[] data = new byte[blocks.length];
for (int i = 0; i < blocks.length; i++) {
PlotBlock current = blocks[i];
id[i] = current.id;
data[i] = current.data;
}
setBlocks(worldname, x, y, z, id, data);
}
public static void setBlocks(String worldname, int[] x, int[] y, int[] z, int[] id, byte[] data) {
}
}

View File

@ -0,0 +1,65 @@
package com.intellectualcrafters.plot.util;
import java.util.ArrayList;
import java.util.HashMap;
import org.bukkit.Bukkit;
import org.bukkit.Chunk;
import org.bukkit.World;
import com.intellectualcrafters.plot.object.PlotBlock;
public class BukkitUtil extends BlockManager {
private static HashMap<String, World> worlds = new HashMap<>();
private static String lastString = null;
private static World lastWorld = null;
public static World getWorld(String string) {
if (lastString == string) {
return lastWorld;
}
World world = worlds.get(string);
if (world == null) {
world = Bukkit.getWorld(string);
worlds.put(string, world);
}
return world;
}
public static Chunk getChunkAt(String worldname, int x, int z) {
World world = getWorld(worldname);
return world.getChunkAt(x, z);
}
public static void update(String world, int x, int z) {
ArrayList<Chunk> 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 = getChunkAt(world, (x >> 4) + cx, (z >> 4) + cz);
chunks.add(chunk);
}
}
SetBlockManager.setBlockManager.update(chunks);
}
public static void setBlock(World world, int x, int y, int z, int id, byte data) {
try {
SetBlockManager.setBlockManager.set(world, x, y, z, id, data);
}
catch (Throwable e) {
SetBlockManager.setBlockManager = new SetBlockSlow();
SetBlockManager.setBlockManager.set(world, x, y, z, id, data);
}
}
@Override
public void functionSetBlock(String worldname, int[] x, int[] y, int[] z, int[] id, byte[] data) {
World world = getWorld(worldname);
for (int i = 0; i < x.length; i++) {
BukkitUtil.setBlock(world, x[i], y[i], z[i], id[i], data[i]);
}
}
}

View File

@ -229,13 +229,21 @@ public class ChunkManager {
Block block = world.getBlockAt(x, y, z); Block block = world.getBlockAt(x, y, z);
int id = block.getTypeId(); int id = block.getTypeId();
byte data = block.getData(); byte data = block.getData();
<<<<<<< Updated upstream
AbstractSetBlock.setBlockManager.set(world, x + relX, y, z + relZ, id, data); 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(); mx.increment();
if (x == ex) { // done! if (x == ex) { // done!
restoreBlocks(world, relX, relZ); restoreBlocks(world, relX, relZ);
<<<<<<< Updated upstream
AbstractSetBlock.setBlockManager.update(chunks); AbstractSetBlock.setBlockManager.update(chunks);
=======
SetBlockManager.setBlockManager.update(chunks);
>>>>>>> Stashed changes
for (Chunk chunk : chunks) { for (Chunk chunk : chunks) {
chunk.unload(true, true); chunk.unload(true, true);
} }
@ -351,7 +359,11 @@ public class ChunkManager {
restoreEntities(world, 0, 0); restoreEntities(world, 0, 0);
} }
chunk.unload(true, true); chunk.unload(true, true);
<<<<<<< Updated upstream
AbstractSetBlock.setBlockManager.update(Arrays.asList( new Chunk[] {chunk})); AbstractSetBlock.setBlockManager.update(Arrays.asList( new Chunk[] {chunk}));
=======
SetBlockManager.setBlockManager.update(Arrays.asList( new Chunk[] {chunk}));
>>>>>>> Stashed changes
} }
CURRENT_PLOT_CLEAR = null; CURRENT_PLOT_CLEAR = null;
} }

View File

@ -288,7 +288,11 @@ public class ClusterManager {
@Override @Override
public void run() { public void run() {
if (populator == null || plotworld.TYPE == 0) { if (populator == null || plotworld.TYPE == 0) {
<<<<<<< Updated upstream
AbstractSetBlock.setBlockManager.update(Arrays.asList( new Chunk[] {chunk})); AbstractSetBlock.setBlockManager.update(Arrays.asList( new Chunk[] {chunk}));
=======
SetBlockManager.setBlockManager.update(Arrays.asList( new Chunk[] {chunk}));
>>>>>>> Stashed changes
world.regenerateChunk(chunk.getX(), chunk.getZ()); world.regenerateChunk(chunk.getX(), chunk.getZ());
chunk.unload(true, true); chunk.unload(true, true);
} }

View File

@ -65,7 +65,11 @@ import java.util.UUID;
return myplots; return myplots;
} }
<<<<<<< Updated upstream
public static ArrayList<PlotId> getMaxPlotSelectionIds(final World world, PlotId pos1, PlotId pos2) { public static ArrayList<PlotId> getMaxPlotSelectionIds(final World world, PlotId pos1, PlotId pos2) {
=======
public static ArrayList<PlotId> getMaxPlotSelectionIds(final String world, PlotId pos1, PlotId pos2) {
>>>>>>> Stashed changes
final Plot plot1 = PlotMain.getPlots(world).get(pos1); final Plot plot1 = PlotMain.getPlots(world).get(pos1);
final Plot plot2 = PlotMain.getPlots(world).get(pos2); final Plot plot2 = PlotMain.getPlots(world).get(pos2);
@ -87,7 +91,11 @@ import java.util.UUID;
return myplots; return myplots;
} }
<<<<<<< Updated upstream
public static Plot getBottomPlot(final World world, final Plot plot) { 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)) { if (plot.settings.getMerged(0)) {
final Plot p = PlotMain.getPlots(world).get(new PlotId(plot.id.x, plot.id.y - 1)); final Plot p = PlotMain.getPlots(world).get(new PlotId(plot.id.x, plot.id.y - 1));
if (p == null) { if (p == null) {
@ -105,7 +113,11 @@ import java.util.UUID;
return plot; return plot;
} }
<<<<<<< Updated upstream
public static Plot getTopPlot(final World world, final Plot plot) { 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)) { if (plot.settings.getMerged(2)) {
return getTopPlot(world, PlotMain.getPlots(world).get(new PlotId(plot.id.x, plot.id.y + 1))); return getTopPlot(world, PlotMain.getPlots(world).get(new PlotId(plot.id.x, plot.id.y + 1)));
} }
@ -129,7 +141,11 @@ import java.util.UUID;
return null; return null;
} }
final PlotWorld plotworld = PlotMain.getWorldSettings(world); final PlotWorld plotworld = PlotMain.getWorldSettings(world);
<<<<<<< Updated upstream
return manager.getPlotIdAbs(plotworld, loc); return manager.getPlotIdAbs(plotworld, loc);
=======
return manager.getPlotIdAbs(plotworld, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
>>>>>>> Stashed changes
} }
/** /**
@ -146,7 +162,11 @@ import java.util.UUID;
return null; return null;
} }
final PlotWorld plotworld = PlotMain.getWorldSettings(world); final PlotWorld plotworld = PlotMain.getWorldSettings(world);
<<<<<<< Updated upstream
PlotId id = manager.getPlotId(plotworld, loc); 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 (id!=null && plotworld.TYPE == 2) {
if (ClusterManager.getCluster(world, id) == null) { if (ClusterManager.getCluster(world, id) == null) {
return null; return null;

View File

@ -31,7 +31,10 @@ import net.milkbowl.vault.economy.Economy;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Chunk; import org.bukkit.Chunk;
<<<<<<< Updated upstream
import org.bukkit.Location; import org.bukkit.Location;
=======
>>>>>>> Stashed changes
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.OfflinePlayer; import org.bukkit.OfflinePlayer;
import org.bukkit.World; import org.bukkit.World;
@ -47,6 +50,10 @@ import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.listeners.PlotListener; import com.intellectualcrafters.plot.listeners.PlotListener;
import com.intellectualcrafters.plot.object.BlockLoc; 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.Plot;
import com.intellectualcrafters.plot.object.PlotBlock; import com.intellectualcrafters.plot.object.PlotBlock;
import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.object.PlotId;
@ -133,7 +140,11 @@ import com.intellectualcrafters.plot.object.PlotWorld;
* *
* @return * @return
*/ */
<<<<<<< Updated upstream
public static boolean mergePlots(final Player plr, final World world, final ArrayList<PlotId> plotIds) { public static boolean mergePlots(final Player plr, final World world, final ArrayList<PlotId> plotIds) {
=======
public static boolean mergePlots(final Player plr, final String world, final ArrayList<PlotId> plotIds) {
>>>>>>> Stashed changes
final PlotWorld plotworld = PlotMain.getWorldSettings(world); final PlotWorld plotworld = PlotMain.getWorldSettings(world);
if (PlotMain.useEconomy && plotworld.USE_ECONOMY) { if (PlotMain.useEconomy && plotworld.USE_ECONOMY) {
final double cost = plotIds.size() * plotworld.MERGE_PRICE; final double cost = plotIds.size() * plotworld.MERGE_PRICE;
@ -161,7 +172,11 @@ import com.intellectualcrafters.plot.object.PlotWorld;
* *
* @return boolean (success) * @return boolean (success)
*/ */
<<<<<<< Updated upstream
public static boolean mergePlots(final World world, final ArrayList<PlotId> plotIds, boolean removeRoads) { public static boolean mergePlots(final World world, final ArrayList<PlotId> plotIds, boolean removeRoads) {
=======
public static boolean mergePlots(final String world, final ArrayList<PlotId> plotIds, boolean removeRoads) {
>>>>>>> Stashed changes
if (plotIds.size() < 2) { if (plotIds.size() < 2) {
return false; return false;
} }
@ -171,7 +186,11 @@ import com.intellectualcrafters.plot.object.PlotWorld;
final PlotManager manager = PlotMain.getPlotManager(world); final PlotManager manager = PlotMain.getPlotManager(world);
final PlotWorld plotworld = PlotMain.getWorldSettings(world); final PlotWorld plotworld = PlotMain.getWorldSettings(world);
<<<<<<< Updated upstream
manager.startPlotMerge(world, plotworld, plotIds); manager.startPlotMerge(world, plotworld, plotIds);
=======
manager.startPlotMerge(plotworld, plotIds);
>>>>>>> Stashed changes
boolean result = false; boolean result = false;
@ -190,7 +209,11 @@ import com.intellectualcrafters.plot.object.PlotWorld;
Plot plot2 = null; Plot plot2 = null;
if (removeRoads) { if (removeRoads) {
<<<<<<< Updated upstream
removeSign(world, plot); removeSign(world, plot);
=======
removeSign(plot);
>>>>>>> Stashed changes
} }
if (lx) { if (lx) {
if (ly) { if (ly) {
@ -225,12 +248,20 @@ import com.intellectualcrafters.plot.object.PlotWorld;
for (int y = pos1.y; y <= pos2.y; y++) { for (int y = pos1.y; y <= pos2.y; y++) {
final PlotId id = new PlotId(x, y); final PlotId id = new PlotId(x, y);
final Plot plot = PlotMain.getPlots(world).get(id); final Plot plot = PlotMain.getPlots(world).get(id);
<<<<<<< Updated upstream
DBFunc.setMerged(world.getName(), plot, plot.settings.getMerged()); 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(world, plotworld, plotIds);
=======
manager.finishPlotMerge(plotworld, plotIds);
>>>>>>> Stashed changes
return result; return result;
} }
@ -243,7 +274,11 @@ import com.intellectualcrafters.plot.object.PlotWorld;
* @param lesserPlot * @param lesserPlot
* @param greaterPlot * @param greaterPlot
*/ */
<<<<<<< Updated upstream
public static void mergePlot(final World world, final Plot lesserPlot, final Plot greaterPlot, boolean removeRoads) { 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 PlotManager manager = PlotMain.getPlotManager(world);
final PlotWorld plotworld = PlotMain.getWorldSettings(world); final PlotWorld plotworld = PlotMain.getWorldSettings(world);
@ -265,6 +300,7 @@ import com.intellectualcrafters.plot.object.PlotWorld;
} }
} }
} }
<<<<<<< Updated upstream
/* /*
* Random number gen section * Random number gen section
@ -310,12 +346,30 @@ import com.intellectualcrafters.plot.object.PlotWorld;
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public static void setSign(final World world, String name, final Plot p) { public static void setSign(final World world, String name, final Plot p) {
=======
public static void removeSign(final Plot p) {
String world = p.world;
final PlotManager manager = PlotMain.getPlotManager(world);
final PlotWorld plotworld = PlotMain.getWorldSettings(world);
final Location loc = manager.getSignLoc(plotworld, p);
BlockManager.setBlocks(world, new int[] { loc.getX()}, new int[] { loc.getY()}, new int[] { loc.getZ()}, new int[] { 0 }, new byte[] { 0 });
}
public static void setSign(String name, final Plot p) {
>>>>>>> Stashed changes
if (name == null) { if (name == null) {
name = "unknown"; name = "unknown";
} }
final PlotManager manager = PlotMain.getPlotManager(world); final PlotManager manager = PlotMain.getPlotManager(world);
final PlotWorld plotworld = PlotMain.getWorldSettings(world); final PlotWorld plotworld = PlotMain.getWorldSettings(world);
<<<<<<< Updated upstream
final Location loc = manager.getSignLoc(world, plotworld, p); final Location loc = manager.getSignLoc(world, plotworld, p);
=======
final Location loc = manager.getSignLoc(plotworld, p);
>>>>>>> Stashed changes
final Block bs = loc.getBlock(); final Block bs = loc.getBlock();
bs.setType(Material.AIR); bs.setType(Material.AIR);
bs.setTypeIdAndData(Material.WALL_SIGN.getId(), (byte) 2, false); bs.setTypeIdAndData(Material.WALL_SIGN.getId(), (byte) 2, false);
@ -346,6 +400,7 @@ import com.intellectualcrafters.plot.object.PlotWorld;
return string; return string;
} }
<<<<<<< Updated upstream
public static boolean setBlock(World world, int x, int y, int z, int id, byte data) { public static boolean setBlock(World world, int x, int y, int z, int id, byte data) {
try { try {
return AbstractSetBlock.setBlockManager.set(world, x, y, z, id, data); return AbstractSetBlock.setBlockManager.set(world, x, y, z, id, data);
@ -381,6 +436,9 @@ import com.intellectualcrafters.plot.object.PlotWorld;
} }
public static void autoMerge(final World world, final Plot plot, final Player player) { 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) { if (plot == null) {
return; return;
} }
@ -438,7 +496,11 @@ import com.intellectualcrafters.plot.object.PlotWorld;
update(player.getLocation()); update(player.getLocation());
} }
<<<<<<< Updated upstream
private static boolean ownsPlots(final World world, final ArrayList<PlotId> plots, final Player player, final int dir) { private static boolean ownsPlots(final World world, final ArrayList<PlotId> plots, final Player player, final int dir) {
=======
private static boolean ownsPlots(final String world, final ArrayList<PlotId> plots, final Player player, final int dir) {
>>>>>>> Stashed changes
final PlotId id_min = plots.get(0); final PlotId id_min = plots.get(0);
final PlotId id_max = plots.get(plots.size() - 1); final PlotId id_max = plots.get(plots.size() - 1);
for (final PlotId myid : plots) { for (final PlotId myid : plots) {
@ -504,16 +566,28 @@ import com.intellectualcrafters.plot.object.PlotWorld;
return p; return p;
} }
<<<<<<< Updated upstream
public static int getLoadedChunks(final World world) { public static int getLoadedChunks(final World world) {
return world.getLoadedChunks().length; return world.getLoadedChunks().length;
} }
public static int getEntities(final World world) { 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(); return world.getEntities().size();
} }
<<<<<<< Updated upstream
public static int getTileEntities(final World world) { public static int getTileEntities(final World world) {
=======
public static int getTileEntities(final String world) {
>>>>>>> Stashed changes
PlotMain.getWorldSettings(world); PlotMain.getWorldSettings(world);
int x = 0; int x = 0;
for (final Chunk chunk : world.getLoadedChunks()) { for (final Chunk chunk : world.getLoadedChunks()) {
@ -522,7 +596,11 @@ import com.intellectualcrafters.plot.object.PlotWorld;
return x; return x;
} }
<<<<<<< Updated upstream
public static double getWorldFolderSize(final World world) { public static double getWorldFolderSize(final World world) {
=======
public static double getWorldFolderSize(final String world) {
>>>>>>> Stashed changes
// long size = FileUtil.sizeOfDirectory(world.getWorldFolder()); // long size = FileUtil.sizeOfDirectory(world.getWorldFolder());
final File folder = world.getWorldFolder(); final File folder = world.getWorldFolder();
final long size = folder.length(); final long size = folder.length();
@ -545,7 +623,11 @@ import com.intellectualcrafters.plot.object.PlotWorld;
return new short[]{Short.parseShort(block), 0}; 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 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<Entity> entities = world.getEntities(); final List<Entity> entities = world.getEntities();
for (final Entity entity : entities) { for (final Entity entity : entities) {
@ -569,7 +651,11 @@ import com.intellectualcrafters.plot.object.PlotWorld;
* @param plot * @param plot
* @param isDelete * @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 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)) { if (runners.containsKey(plot)) {
PlayerFunctions.sendMessage(null, C.WAIT_FOR_TIMER); PlayerFunctions.sendMessage(null, C.WAIT_FOR_TIMER);
return; return;
@ -635,7 +721,11 @@ import com.intellectualcrafters.plot.object.PlotWorld;
PlayerFunctions.sendMessage(requester, C.CLEARING_PLOT); PlayerFunctions.sendMessage(requester, C.CLEARING_PLOT);
<<<<<<< Updated upstream
final World world; final World world;
=======
final String world;
>>>>>>> Stashed changes
world = requester.getWorld(); world = requester.getWorld();
clearAllEntities(world, plot, false); clearAllEntities(world, plot, false);
@ -643,7 +733,11 @@ import com.intellectualcrafters.plot.object.PlotWorld;
removeSign(world, plot); 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 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 y = pos1.getBlockY(); y < pos2.getBlockY(); y++) {
for (int x = pos1.getBlockX(); x < pos2.getBlockX(); x++) { for (int x = pos1.getBlockX(); x < pos2.getBlockX(); x++) {
for (int z = pos1.getBlockZ(); z < pos2.getBlockZ(); z++) { for (int z = pos1.getBlockZ(); z < pos2.getBlockZ(); z++) {
@ -656,7 +750,11 @@ 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 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) { if (blocks.length == 1) {
setCuboid(world, pos1, pos2, blocks[0]); setCuboid(world, pos1, pos2, blocks[0]);
return; return;
@ -675,7 +773,11 @@ 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 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 y = pos1.getBlockY(); y < pos2.getBlockY(); y++) {
for (int x = pos1.getBlockX(); x < pos2.getBlockX(); x++) { for (int x = pos1.getBlockX(); x < pos2.getBlockX(); x++) {
for (int z = pos1.getBlockZ(); z < pos2.getBlockZ(); z++) { for (int z = pos1.getBlockZ(); z < pos2.getBlockZ(); z++) {
@ -688,7 +790,11 @@ 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 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 bottomX = getPlotBottomLoc(world, plot.id).getBlockX();
final int topX = getPlotTopLoc(world, plot.id).getBlockX() + 1; final int topX = getPlotTopLoc(world, plot.id).getBlockX() + 1;
final int bottomZ = getPlotBottomLoc(world, plot.id).getBlockZ(); final int bottomZ = getPlotBottomLoc(world, plot.id).getBlockZ();
@ -714,7 +820,11 @@ 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 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; boolean safe = false;
int id; int id;
for (int i = 1; i < world.getMaxHeight(); i++) { for (int i = 1; i < world.getMaxHeight(); i++) {
@ -788,7 +898,11 @@ import com.intellectualcrafters.plot.object.PlotWorld;
* @param world World in which the plot is located * @param world World in which the plot is located
* @param plot Plot Object * @param plot Plot Object
*/ */
<<<<<<< Updated upstream
public static void refreshPlotChunks(final World world, final Plot plot) { 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 bottomX = getPlotBottomLoc(world, plot.id).getBlockX();
final int topX = getPlotTopLoc(world, plot.id).getBlockX(); final int topX = getPlotTopLoc(world, plot.id).getBlockX();
final int bottomZ = getPlotBottomLoc(world, plot.id).getBlockZ(); final int bottomZ = getPlotBottomLoc(world, plot.id).getBlockZ();
@ -832,7 +946,11 @@ import com.intellectualcrafters.plot.object.PlotWorld;
* *
* @return * @return
*/ */
<<<<<<< Updated upstream
public static Location getPlotTopLocAbs(final World world, final PlotId id) { 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 PlotWorld plotworld = PlotMain.getWorldSettings(world);
final PlotManager manager = PlotMain.getPlotManager(world); final PlotManager manager = PlotMain.getPlotManager(world);
return manager.getPlotTopLocAbs(plotworld, id); return manager.getPlotTopLocAbs(plotworld, id);
@ -847,7 +965,11 @@ import com.intellectualcrafters.plot.object.PlotWorld;
* *
* @return * @return
*/ */
<<<<<<< Updated upstream
public static Location getPlotBottomLocAbs(final World world, final PlotId id) { 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 PlotWorld plotworld = PlotMain.getWorldSettings(world);
final PlotManager manager = PlotMain.getPlotManager(world); final PlotManager manager = PlotMain.getPlotManager(world);
return manager.getPlotBottomLocAbs(plotworld, id); return manager.getPlotBottomLocAbs(plotworld, id);
@ -861,7 +983,11 @@ import com.intellectualcrafters.plot.object.PlotWorld;
* *
* @return * @return
*/ */
<<<<<<< Updated upstream
public static int getPlotWidth(final World world, final PlotId id) { 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(); return getPlotTopLoc(world, id).getBlockX() - getPlotBottomLoc(world, id).getBlockX();
} }
@ -874,7 +1000,11 @@ import com.intellectualcrafters.plot.object.PlotWorld;
* *
* @return * @return
*/ */
<<<<<<< Updated upstream
public static Location getPlotTopLoc(final World world, PlotId id) { 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); final Plot plot = PlotMain.getPlots(world).get(id);
if (plot != null) { if (plot != null) {
id = PlayerFunctions.getTopPlot(world, plot).id; id = PlayerFunctions.getTopPlot(world, plot).id;
@ -893,7 +1023,11 @@ import com.intellectualcrafters.plot.object.PlotWorld;
* *
* @return * @return
*/ */
<<<<<<< Updated upstream
public static Location getPlotBottomLoc(final World world, PlotId id) { 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); final Plot plot = PlotMain.getPlots(world).get(id);
if (plot != null) { if (plot != null) {
id = PlayerFunctions.getBottomPlot(world, plot).id; id = PlayerFunctions.getBottomPlot(world, plot).id;
@ -903,7 +1037,11 @@ import com.intellectualcrafters.plot.object.PlotWorld;
return manager.getPlotBottomLocAbs(plotworld, id); 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 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 x = pos1.x; x <= pos2.x; x++) {
for (int y = pos1.y; y <= pos2.y; y++) { for (int y = pos1.y; y <= pos2.y; y++) {
final PlotId id = new PlotId(x, y); final PlotId id = new PlotId(x, y);
@ -917,6 +1055,7 @@ import com.intellectualcrafters.plot.object.PlotWorld;
return true; return true;
} }
<<<<<<< Updated upstream
public static boolean move(final World world, final PlotId current, PlotId newPlot, final Runnable whenDone) { public static boolean move(final World world, final PlotId current, PlotId newPlot, final Runnable whenDone) {
final Location bot1 = PlotHelper.getPlotBottomLoc(world, current); final Location bot1 = PlotHelper.getPlotBottomLoc(world, current);
Location bot2 = PlotHelper.getPlotBottomLoc(world, newPlot); Location bot2 = PlotHelper.getPlotBottomLoc(world, newPlot);
@ -927,6 +1066,19 @@ import com.intellectualcrafters.plot.object.PlotWorld;
} }
Plot pos1 = PlayerFunctions.getBottomPlot(world, currentPlot); Plot pos1 = PlayerFunctions.getBottomPlot(world, currentPlot);
Plot pos2 = PlayerFunctions.getTopPlot(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);
com.intellectualcrafters.plot.object.Location bot2 = PlotHelper.getPlotBottomLoc(worldname, newPlot);
final Location top = PlotHelper.getPlotTopLoc(worldname, current);
final Plot currentPlot = PlotHelper.getPlot(worldname, current);
if (currentPlot.owner == null) {
return false;
}
Plot pos1 = PlayerFunctions.getBottomPlot(worldname, currentPlot);
Plot pos2 = PlayerFunctions.getTopPlot(worldname, currentPlot);
>>>>>>> Stashed changes
PlotId size = PlotHelper.getSize(world, currentPlot); PlotId size = PlotHelper.getSize(world, currentPlot);
if (!PlotHelper.isUnowned(world, newPlot, new PlotId(newPlot.x + size.x - 1, newPlot.y + size.y - 1))) { if (!PlotHelper.isUnowned(world, newPlot, new PlotId(newPlot.x + size.x - 1, newPlot.y + size.y - 1))) {
return false; return false;
@ -955,7 +1107,11 @@ import com.intellectualcrafters.plot.object.PlotWorld;
return true; return true;
} }
<<<<<<< Updated upstream
public static PlotId getSize(World world, Plot plot) { public static PlotId getSize(World world, Plot plot) {
=======
public static PlotId getSize(String world, Plot plot) {
>>>>>>> Stashed changes
PlotSettings settings = plot.settings; PlotSettings settings = plot.settings;
if (!settings.isMerged()) { if (!settings.isMerged()) {
return new PlotId(1,1); return new PlotId(1,1);
@ -973,7 +1129,11 @@ import com.intellectualcrafters.plot.object.PlotWorld;
* *
* @return * @return
*/ */
<<<<<<< Updated upstream
public static Plot getPlot(final World world, final PlotId id) { 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) { if (id == null) {
return null; return null;
} }

View File

@ -36,7 +36,11 @@ import com.intellectualcrafters.plot.util.ReflectionUtils.RefMethod;
* *
* @author Empire92 * @author Empire92
*/ */
<<<<<<< Updated upstream
public class SetBlockFast extends AbstractSetBlock { public class SetBlockFast extends AbstractSetBlock {
=======
public class SetBlockFast extends SetBlockManager {
>>>>>>> Stashed changes
private static final RefClass classBlock = getRefClass("{nms}.Block"); private static final RefClass classBlock = getRefClass("{nms}.Block");
private static final RefClass classChunk = getRefClass("{nms}.Chunk"); private static final RefClass classChunk = getRefClass("{nms}.Chunk");
@ -73,13 +77,20 @@ public class SetBlockFast extends AbstractSetBlock {
* @return true * @return true
*/ */
@Override @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 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 w = methodGetHandle.of(world).call();
final Object chunk = methodGetChunkAt.of(w).call(x >> 4, z >> 4); final Object chunk = methodGetChunkAt.of(w).call(x >> 4, z >> 4);
final Object block = methodGetById.of(null).call(blockId); final Object block = methodGetById.of(null).call(blockId);
methodA.of(chunk).call(x & 0x0f, y, z & 0x0f, block, data); methodA.of(chunk).call(x & 0x0f, y, z & 0x0f, block, data);
<<<<<<< Updated upstream
return true; return true;
=======
>>>>>>> Stashed changes
} }
/** /**

View File

@ -37,7 +37,11 @@ import com.intellectualcrafters.plot.util.ReflectionUtils.RefMethod;
* *
* @author Empire92 * @author Empire92
*/ */
<<<<<<< Updated upstream
public class SetBlockFast_1_8 extends AbstractSetBlock { 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 classBlock = getRefClass("{nms}.Block");
private static final RefClass classBlockPosition = getRefClass("{nms}.BlockPosition"); private static final RefClass classBlockPosition = getRefClass("{nms}.BlockPosition");
@ -85,13 +89,20 @@ public class SetBlockFast_1_8 extends AbstractSetBlock {
* @return true * @return true
*/ */
@Override @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 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 w = methodGetHandle.of(world).call();
final Object chunk = methodGetChunkAt.of(w).call(x >> 4, z >> 4); 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 pos = constructorBlockPosition.create((int) (x & 0x0f), y, (int) (z & 0x0f));
final Object id = methodGetByCombinedId.of(null).call(blockId + (data << 12)); final Object id = methodGetByCombinedId.of(null).call(blockId + (data << 12));
methodA.of(chunk).call(pos, id); methodA.of(chunk).call(pos, id);
<<<<<<< Updated upstream
return true; return true;
=======
>>>>>>> Stashed changes
} }
/** /**

View File

@ -0,0 +1,16 @@
package com.intellectualcrafters.plot.util;
import java.util.List;
import org.bukkit.Chunk;
import org.bukkit.World;
import com.intellectualcrafters.plot.object.PlotBlock;
public abstract class SetBlockManager {
public static SetBlockManager setBlockManager = null;
public abstract void set(final org.bukkit.World world, final int x, final int y, final int z, final int blockId, final byte data);
public abstract void update(List<Chunk> list);
}

View File

@ -6,10 +6,17 @@ import org.bukkit.Chunk;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.block.Block; import org.bukkit.block.Block;
<<<<<<< Updated upstream
public class SetBlockSlow extends AbstractSetBlock { public class SetBlockSlow extends AbstractSetBlock {
@Override @Override
public boolean set(World world, int x, int y, int z, int id, byte data) { 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); Block block = world.getBlockAt(x, y, z);
if (block.getData() == data) { if (block.getData() == data) {
if (block.getTypeId() != id) { if (block.getTypeId() != id) {
@ -22,7 +29,10 @@ public class SetBlockSlow extends AbstractSetBlock {
block.setTypeIdAndData(id, data, false); block.setTypeIdAndData(id, data, false);
} }
} }
<<<<<<< Updated upstream
return false; return false;
=======
>>>>>>> Stashed changes
} }
@Override @Override