diff --git a/PlotSquared/PlotSquared.iml b/PlotSquared/PlotSquared.iml
new file mode 100644
index 000000000..650814c5e
--- /dev/null
+++ b/PlotSquared/PlotSquared.iml
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotMain.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotMain.java
index 4f385b19a..3a99ddbc0 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotMain.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotMain.java
@@ -21,16 +21,23 @@
package com.intellectualcrafters.plot;
-import com.intellectualcrafters.plot.Logger.LogLevel;
import com.intellectualcrafters.plot.commands.Auto;
import com.intellectualcrafters.plot.commands.MainCommand;
+import com.intellectualcrafters.plot.config.C;
+import com.intellectualcrafters.plot.config.ConfigurationNode;
+import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.database.*;
import com.intellectualcrafters.plot.events.PlayerTeleportToPlotEvent;
import com.intellectualcrafters.plot.events.PlotDeleteEvent;
+import com.intellectualcrafters.plot.flag.AbstractFlag;
+import com.intellectualcrafters.plot.flag.FlagManager;
import com.intellectualcrafters.plot.generator.DefaultPlotManager;
import com.intellectualcrafters.plot.generator.DefaultPlotWorld;
import com.intellectualcrafters.plot.generator.WorldGenerator;
import com.intellectualcrafters.plot.listeners.*;
+import com.intellectualcrafters.plot.object.*;
+import com.intellectualcrafters.plot.util.*;
+import com.intellectualcrafters.plot.util.Logger.LogLevel;
import com.intellectualcrafters.plot.uuid.PlotUUIDSaver;
import com.intellectualcrafters.plot.uuid.UUIDSaver;
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
@@ -1285,15 +1292,15 @@ public class PlotMain extends JavaPlugin {
return plots;
}
+ public static void setAllPlotsRaw(final LinkedHashMap> plots) {
+ PlotMain.plots = plots;
+ }
+
public static void setAllPlotsRaw(final HashMap> plots) {
PlotMain.plots = new LinkedHashMap<>(plots);
// PlotMain.plots.putAll(plots);
}
- public static void setAllPlotsRaw(final LinkedHashMap> plots) {
- PlotMain.plots = plots;
- }
-
/**
* !!WorldGeneration!!
*/
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/api/PlotAPI.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/api/PlotAPI.java
index c85e5fca2..28018d8d5 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/api/PlotAPI.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/api/PlotAPI.java
@@ -21,9 +21,19 @@
package com.intellectualcrafters.plot.api;
-import com.intellectualcrafters.plot.*;
+import com.intellectualcrafters.plot.PlotMain;
import com.intellectualcrafters.plot.commands.MainCommand;
import com.intellectualcrafters.plot.commands.SubCommand;
+import com.intellectualcrafters.plot.config.C;
+import com.intellectualcrafters.plot.flag.AbstractFlag;
+import com.intellectualcrafters.plot.flag.FlagManager;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotId;
+import com.intellectualcrafters.plot.object.PlotManager;
+import com.intellectualcrafters.plot.object.PlotWorld;
+import com.intellectualcrafters.plot.util.PlayerFunctions;
+import com.intellectualcrafters.plot.util.PlotHelper;
+import com.intellectualcrafters.plot.util.SchematicHandler;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.World;
@@ -108,8 +118,8 @@ public class PlotAPI {
* @param plotWorld Plot World Object
* @param manager World Manager
* @see com.intellectualcrafters.plot.PlotMain#addPlotWorld(String,
- * com.intellectualcrafters.plot.PlotWorld,
- * com.intellectualcrafters.plot.PlotManager)
+ * com.intellectualcrafters.plot.object.PlotWorld,
+ * com.intellectualcrafters.plot.object.PlotManager)
*/
public void addPlotWorld(final String world, final PlotWorld plotWorld, final PlotManager manager) {
PlotMain.addPlotWorld(world, plotWorld, manager);
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Auto.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Auto.java
index 1076b0c0a..4e0ee4ee9 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Auto.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Auto.java
@@ -21,22 +21,57 @@
package com.intellectualcrafters.plot.commands;
-import com.intellectualcrafters.plot.*;
+import com.intellectualcrafters.plot.PlotMain;
+import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc;
-
+import com.intellectualcrafters.plot.flag.Flag;
+import com.intellectualcrafters.plot.flag.FlagManager;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotId;
+import com.intellectualcrafters.plot.object.PlotWorld;
+import com.intellectualcrafters.plot.util.PlayerFunctions;
+import com.intellectualcrafters.plot.util.PlotHelper;
import net.milkbowl.vault.economy.Economy;
-
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.entity.Player;
@SuppressWarnings("deprecation")
public class Auto extends SubCommand {
+ public static PlotId lastPlot = new PlotId(0, 0);
+
public Auto() {
super("auto", "plots.auto", "Claim the nearest plot", "auto", "a", CommandCategory.CLAIMING, true);
}
- public static PlotId lastPlot = new PlotId(0, 0);
+ public static PlotId getNextPlot(final PlotId id, final int step) {
+ final int absX = Math.abs(id.x);
+ final int absY = Math.abs(id.y);
+ if (absX > absY) {
+ if (id.x > 0) {
+ return new PlotId(id.x, id.y + 1);
+ } else {
+ return new PlotId(id.x, id.y - 1);
+ }
+ } else if (absY > absX) {
+ if (id.y > 0) {
+ return new PlotId(id.x - 1, id.y);
+ } else {
+ return new PlotId(id.x + 1, id.y);
+ }
+ } else {
+ if (id.x.equals(id.y) && (id.x > 0)) {
+ return new PlotId(id.x, id.y + step);
+ }
+ if (id.x == absX) {
+ return new PlotId(id.x, id.y + 1);
+ }
+ if (id.y == absY) {
+ return new PlotId(id.x, id.y - 1);
+ }
+ return new PlotId(id.x + 1, id.y);
+ }
+ }
// TODO auto claim a mega plot with schematic
@Override
@@ -131,10 +166,10 @@ public class Auto extends SubCommand {
Auto.lastPlot = getNextPlot(Auto.lastPlot, 1);
}
} else {
-
- // Why does this need fixing, it should work fine for auto claiming mega plots
-
-
+
+ // Why does this need fixing, it should work fine for auto claiming mega plots
+
+
while (!br) {
final PlotId start = getNextPlot(Auto.lastPlot, 1);
@@ -172,35 +207,6 @@ public class Auto extends SubCommand {
return true;
}
- public static PlotId getNextPlot(final PlotId id, final int step) {
- final int absX = Math.abs(id.x);
- final int absY = Math.abs(id.y);
- if (absX > absY) {
- if (id.x > 0) {
- return new PlotId(id.x, id.y + 1);
- } else {
- return new PlotId(id.x, id.y - 1);
- }
- } else if (absY > absX) {
- if (id.y > 0) {
- return new PlotId(id.x - 1, id.y);
- } else {
- return new PlotId(id.x + 1, id.y);
- }
- } else {
- if (id.x.equals(id.y) && (id.x > 0)) {
- return new PlotId(id.x, id.y + step);
- }
- if (id.x == absX) {
- return new PlotId(id.x, id.y + 1);
- }
- if (id.y == absY) {
- return new PlotId(id.x, id.y - 1);
- }
- return new PlotId(id.x + 1, id.y);
- }
- }
-
public boolean isUnowned(final World world, final PlotId pos1, final PlotId pos2) {
for (int x = pos1.x; x <= pos2.x; x++) {
for (int y = pos1.y; y <= pos2.y; y++) {
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Ban.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Ban.java
index e0ccecf8f..42dd0ce2d 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Ban.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Ban.java
@@ -1,8 +1,8 @@
package com.intellectualcrafters.plot.commands;
-import com.intellectualcrafters.plot.C;
-import com.intellectualcrafters.plot.PlayerFunctions;
-import com.intellectualcrafters.plot.Plot;
+import com.intellectualcrafters.plot.config.C;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.util.PlayerFunctions;
import org.bukkit.entity.Player;
/**
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Claim.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Claim.java
index efc12bf8e..dd9481924 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Claim.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Claim.java
@@ -21,13 +21,20 @@
package com.intellectualcrafters.plot.commands;
-import com.intellectualcrafters.plot.*;
+import com.intellectualcrafters.plot.PlotMain;
+import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.events.PlayerClaimPlotEvent;
+import com.intellectualcrafters.plot.flag.Flag;
+import com.intellectualcrafters.plot.flag.FlagManager;
import com.intellectualcrafters.plot.generator.DefaultPlotWorld;
-
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotWorld;
+import com.intellectualcrafters.plot.util.PlayerFunctions;
+import com.intellectualcrafters.plot.util.PlotHelper;
+import com.intellectualcrafters.plot.util.SchematicHandler;
+import com.intellectualcrafters.plot.util.SetBlockFast;
import net.milkbowl.vault.economy.Economy;
-
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
@@ -40,48 +47,6 @@ public class Claim extends SubCommand {
super(Command.CLAIM, "Claim the current plot you're standing on.", "claim", CommandCategory.CLAIMING, true);
}
- @Override
- public boolean execute(final Player plr, final String... args) {
- String schematic = "";
- if (args.length >= 1) {
- schematic = args[0];
- }
- if (!PlayerFunctions.isInPlot(plr)) {
- return sendMessage(plr, C.NOT_IN_PLOT);
- }
- if (PlayerFunctions.getPlayerPlotCount(plr.getWorld(), plr) >= PlayerFunctions.getAllowedPlots(plr)) {
- return sendMessage(plr, C.CANT_CLAIM_MORE_PLOTS);
- }
- final Plot plot = PlayerFunctions.getCurrentPlot(plr);
- if (plot.hasOwner()) {
- return sendMessage(plr, C.PLOT_IS_CLAIMED);
- }
- final PlotWorld world = PlotMain.getWorldSettings(plot.getWorld());
- if (PlotMain.useEconomy && world.USE_ECONOMY) {
- final double cost = world.PLOT_PRICE;
- if (cost > 0d) {
- final Economy economy = PlotMain.economy;
- if (economy.getBalance(plr) < cost) {
- return sendMessage(plr, C.CANNOT_AFFORD_PLOT, "" + cost);
- }
- economy.withdrawPlayer(plr, cost);
- sendMessage(plr, C.REMOVED_BALANCE, cost + "");
- }
- }
- if (!schematic.equals("")) {
- if (world.SCHEMATIC_CLAIM_SPECIFY) {
- if (!world.SCHEMATICS.contains(schematic.toLowerCase())) {
- return sendMessage(plr, C.SCHEMATIC_INVALID, "non-existent: " + schematic);
- }
- if (!PlotMain.hasPermission(plr, "plots.claim." + schematic) && !plr.hasPermission("plots.admin")) {
- return sendMessage(plr, C.NO_SCHEMATIC_PERMISSION, schematic);
- }
- }
- }
-
- return !claimPlot(plr, plot, false, schematic) || sendMessage(plr, C.PLOT_NOT_CLAIMED);
- }
-
public static boolean claimPlot(final Player player, final Plot plot, final boolean teleport) {
return claimPlot(player, plot, teleport, "");
}
@@ -129,4 +94,46 @@ public class Claim extends SubCommand {
}
return event.isCancelled();
}
+
+ @Override
+ public boolean execute(final Player plr, final String... args) {
+ String schematic = "";
+ if (args.length >= 1) {
+ schematic = args[0];
+ }
+ if (!PlayerFunctions.isInPlot(plr)) {
+ return sendMessage(plr, C.NOT_IN_PLOT);
+ }
+ if (PlayerFunctions.getPlayerPlotCount(plr.getWorld(), plr) >= PlayerFunctions.getAllowedPlots(plr)) {
+ return sendMessage(plr, C.CANT_CLAIM_MORE_PLOTS);
+ }
+ final Plot plot = PlayerFunctions.getCurrentPlot(plr);
+ if (plot.hasOwner()) {
+ return sendMessage(plr, C.PLOT_IS_CLAIMED);
+ }
+ final PlotWorld world = PlotMain.getWorldSettings(plot.getWorld());
+ if (PlotMain.useEconomy && world.USE_ECONOMY) {
+ final double cost = world.PLOT_PRICE;
+ if (cost > 0d) {
+ final Economy economy = PlotMain.economy;
+ if (economy.getBalance(plr) < cost) {
+ return sendMessage(plr, C.CANNOT_AFFORD_PLOT, "" + cost);
+ }
+ economy.withdrawPlayer(plr, cost);
+ sendMessage(plr, C.REMOVED_BALANCE, cost + "");
+ }
+ }
+ if (!schematic.equals("")) {
+ if (world.SCHEMATIC_CLAIM_SPECIFY) {
+ if (!world.SCHEMATICS.contains(schematic.toLowerCase())) {
+ return sendMessage(plr, C.SCHEMATIC_INVALID, "non-existent: " + schematic);
+ }
+ if (!PlotMain.hasPermission(plr, "plots.claim." + schematic) && !plr.hasPermission("plots.admin")) {
+ return sendMessage(plr, C.NO_SCHEMATIC_PERMISSION, schematic);
+ }
+ }
+ }
+
+ return !claimPlot(plr, plot, false, schematic) || sendMessage(plr, C.PLOT_NOT_CLAIMED);
+ }
}
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Clear.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Clear.java
index ac6696fb6..2a904e1c4 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Clear.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Clear.java
@@ -21,7 +21,12 @@
package com.intellectualcrafters.plot.commands;
-import com.intellectualcrafters.plot.*;
+import com.intellectualcrafters.plot.PlotMain;
+import com.intellectualcrafters.plot.config.C;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotId;
+import com.intellectualcrafters.plot.util.PlayerFunctions;
+import com.intellectualcrafters.plot.util.PlotHelper;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Clipboard.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Clipboard.java
index 35f6381be..060f632ed 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Clipboard.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Clipboard.java
@@ -21,13 +21,13 @@
package com.intellectualcrafters.plot.commands;
-import com.intellectualcrafters.plot.C;
-import com.intellectualcrafters.plot.PlayerFunctions;
-import com.intellectualcrafters.plot.PlotId;
-import com.intellectualcrafters.plot.PlotSelection;
+import com.intellectualcrafters.plot.config.C;
+import com.intellectualcrafters.plot.object.PlotId;
+import com.intellectualcrafters.plot.object.PlotSelection;
+import com.intellectualcrafters.plot.util.PlayerFunctions;
import org.bukkit.entity.Player;
-import static com.intellectualcrafters.plot.PlotSelection.currentSelection;
+import static com.intellectualcrafters.plot.object.PlotSelection.currentSelection;
public class Clipboard extends SubCommand {
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Comment.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Comment.java
index 830c7c3bb..9a5f53ccf 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Comment.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Comment.java
@@ -21,8 +21,12 @@
package com.intellectualcrafters.plot.commands;
-import com.intellectualcrafters.plot.*;
+import com.intellectualcrafters.plot.PlotMain;
+import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotComment;
+import com.intellectualcrafters.plot.util.PlayerFunctions;
import org.apache.commons.lang.StringUtils;
import org.bukkit.entity.Player;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Copy.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Copy.java
index 2bb55613d..7e011cbe0 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Copy.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Copy.java
@@ -21,7 +21,12 @@
package com.intellectualcrafters.plot.commands;
-import com.intellectualcrafters.plot.*;
+import com.intellectualcrafters.plot.PlotMain;
+import com.intellectualcrafters.plot.config.C;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotSelection;
+import com.intellectualcrafters.plot.util.PlayerFunctions;
+import com.intellectualcrafters.plot.util.PlotHelper;
import org.bukkit.entity.Player;
public class Copy extends SubCommand {
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DEOP.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DEOP.java
index b942d8ee5..4999358b6 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DEOP.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DEOP.java
@@ -1,8 +1,8 @@
package com.intellectualcrafters.plot.commands;
-import com.intellectualcrafters.plot.C;
-import com.intellectualcrafters.plot.PlayerFunctions;
-import com.intellectualcrafters.plot.Plot;
+import com.intellectualcrafters.plot.config.C;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.util.PlayerFunctions;
import org.bukkit.entity.Player;
/**
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Database.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Database.java
index 922f1efa5..8bd33bdbd 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Database.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Database.java
@@ -1,11 +1,11 @@
package com.intellectualcrafters.plot.commands;
-import com.intellectualcrafters.plot.PlayerFunctions;
-import com.intellectualcrafters.plot.Plot;
import com.intellectualcrafters.plot.PlotMain;
-import com.intellectualcrafters.plot.StringComparsion;
import com.intellectualcrafters.plot.database.MySQL;
import com.intellectualcrafters.plot.database.SQLManager;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.util.PlayerFunctions;
+import com.intellectualcrafters.plot.util.StringComparison;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
@@ -76,7 +76,7 @@ public class Database extends SubCommand {
if (args.length < 1) {
return sendMessage(plr, "/plot database [sqlite/mysql]");
}
- String type = new StringComparsion(args[0], new String[]{"mysql", "sqlite"}).getBestMatch().toLowerCase();
+ String type = new StringComparison(args[0], new String[]{"mysql", "sqlite"}).getBestMatch().toLowerCase();
switch (type) {
case "mysql":
if (args.length < 6) {
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Debug.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Debug.java
index 5c7c095c3..b8e582357 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Debug.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Debug.java
@@ -21,7 +21,12 @@
package com.intellectualcrafters.plot.commands;
-import com.intellectualcrafters.plot.*;
+import com.intellectualcrafters.plot.PlotMain;
+import com.intellectualcrafters.plot.config.C;
+import com.intellectualcrafters.plot.util.Lag;
+import com.intellectualcrafters.plot.util.PlayerFunctions;
+import com.intellectualcrafters.plot.util.PlotHelper;
+import com.intellectualcrafters.plot.util.RUtils;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.entity.Player;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugClaimTest.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugClaimTest.java
index 8c2b3ede1..da5351b05 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugClaimTest.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugClaimTest.java
@@ -22,9 +22,15 @@
package com.intellectualcrafters.plot.commands;
import com.google.common.collect.BiMap;
-import com.intellectualcrafters.plot.*;
+import com.intellectualcrafters.plot.PlotMain;
+import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.events.PlayerClaimPlotEvent;
+import com.intellectualcrafters.plot.flag.FlagManager;
+import com.intellectualcrafters.plot.object.*;
+import com.intellectualcrafters.plot.util.PlayerFunctions;
+import com.intellectualcrafters.plot.util.PlotHelper;
+import com.intellectualcrafters.plot.util.UUIDHandler;
import org.bukkit.Bukkit;
import org.bukkit.Chunk;
import org.bukkit.Location;
@@ -45,6 +51,26 @@ public class DebugClaimTest extends SubCommand {
super(Command.DEBUGCLAIMTEST, "If you accidentally delete your database, this command will attempt to restore all plots based on the data from the plot signs. Execution time may vary", "debugclaimtest", CommandCategory.DEBUG, false);
}
+ @SuppressWarnings("unused")
+ public static boolean claimPlot(final Player player, final Plot plot, final boolean teleport) {
+ return claimPlot(player, plot, teleport, "");
+ }
+
+ public static boolean claimPlot(final Player player, final Plot plot, final boolean teleport, @SuppressWarnings("unused") final String schematic) {
+ final PlayerClaimPlotEvent event = new PlayerClaimPlotEvent(player, plot);
+ Bukkit.getPluginManager().callEvent(event);
+ if (!event.isCancelled()) {
+ PlotHelper.createPlot(player, plot);
+ PlotHelper.setSign(player, plot);
+ PlayerFunctions.sendMessage(player, C.CLAIMED);
+ if (teleport) {
+ PlotMain.teleportPlayer(player, player.getLocation(), plot);
+ }
+ plot.settings.setFlags(FlagManager.parseFlags(PlotMain.getWorldSettings(player.getWorld()).DEFAULT_FLAGS));
+ }
+ return event.isCancelled();
+ }
+
@Override
public boolean execute(final Player plr, final String... args) {
if (plr == null) {
@@ -150,24 +176,4 @@ public class DebugClaimTest extends SubCommand {
}
return true;
}
-
- @SuppressWarnings("unused")
- public static boolean claimPlot(final Player player, final Plot plot, final boolean teleport) {
- return claimPlot(player, plot, teleport, "");
- }
-
- public static boolean claimPlot(final Player player, final Plot plot, final boolean teleport, @SuppressWarnings("unused") final String schematic) {
- final PlayerClaimPlotEvent event = new PlayerClaimPlotEvent(player, plot);
- Bukkit.getPluginManager().callEvent(event);
- if (!event.isCancelled()) {
- PlotHelper.createPlot(player, plot);
- PlotHelper.setSign(player, plot);
- PlayerFunctions.sendMessage(player, C.CLAIMED);
- if (teleport) {
- PlotMain.teleportPlayer(player, player.getLocation(), plot);
- }
- plot.settings.setFlags(FlagManager.parseFlags(PlotMain.getWorldSettings(player.getWorld()).DEFAULT_FLAGS));
- }
- return event.isCancelled();
- }
}
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugLoadTest.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugLoadTest.java
index fb0b0c659..66f81f8db 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugLoadTest.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugLoadTest.java
@@ -21,9 +21,9 @@
package com.intellectualcrafters.plot.commands;
-import com.intellectualcrafters.plot.PlayerFunctions;
import com.intellectualcrafters.plot.PlotMain;
import com.intellectualcrafters.plot.database.DBFunc;
+import com.intellectualcrafters.plot.util.PlayerFunctions;
import org.bukkit.entity.Player;
import java.lang.reflect.Field;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugSaveTest.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugSaveTest.java
index cf0e23068..c8af90319 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugSaveTest.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugSaveTest.java
@@ -21,10 +21,10 @@
package com.intellectualcrafters.plot.commands;
-import com.intellectualcrafters.plot.PlayerFunctions;
-import com.intellectualcrafters.plot.Plot;
import com.intellectualcrafters.plot.PlotMain;
import com.intellectualcrafters.plot.database.DBFunc;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.util.PlayerFunctions;
import org.bukkit.entity.Player;
import java.util.ArrayList;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Delete.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Delete.java
index 9b3e319ad..76e823199 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Delete.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Delete.java
@@ -21,8 +21,12 @@
package com.intellectualcrafters.plot.commands;
-import com.intellectualcrafters.plot.*;
+import com.intellectualcrafters.plot.PlotMain;
+import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotWorld;
+import com.intellectualcrafters.plot.util.PlayerFunctions;
import net.milkbowl.vault.economy.Economy;
import org.bukkit.entity.Player;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Denied.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Denied.java
index 078f81cdb..09740b4e7 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Denied.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Denied.java
@@ -21,12 +21,12 @@
package com.intellectualcrafters.plot.commands;
-import com.intellectualcrafters.plot.C;
-import com.intellectualcrafters.plot.PlayerFunctions;
-import com.intellectualcrafters.plot.Plot;
-import com.intellectualcrafters.plot.UUIDHandler;
+import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.events.PlayerPlotDeniedEvent;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.util.PlayerFunctions;
+import com.intellectualcrafters.plot.util.UUIDHandler;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Helpers.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Helpers.java
index 4b4e9404e..1705f75c3 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Helpers.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Helpers.java
@@ -21,12 +21,12 @@
package com.intellectualcrafters.plot.commands;
-import com.intellectualcrafters.plot.C;
-import com.intellectualcrafters.plot.PlayerFunctions;
-import com.intellectualcrafters.plot.Plot;
-import com.intellectualcrafters.plot.UUIDHandler;
+import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.events.PlayerPlotHelperEvent;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.util.PlayerFunctions;
+import com.intellectualcrafters.plot.util.UUIDHandler;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Home.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Home.java
index f7f465408..2dbf6db91 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Home.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Home.java
@@ -21,10 +21,10 @@
package com.intellectualcrafters.plot.commands;
-import com.intellectualcrafters.plot.C;
-import com.intellectualcrafters.plot.PlayerFunctions;
-import com.intellectualcrafters.plot.Plot;
import com.intellectualcrafters.plot.PlotMain;
+import com.intellectualcrafters.plot.config.C;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.util.PlayerFunctions;
import org.bukkit.entity.Player;
/**
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Inbox.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Inbox.java
index 0651ee3bd..9252c4efb 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Inbox.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Inbox.java
@@ -21,8 +21,12 @@
package com.intellectualcrafters.plot.commands;
-import com.intellectualcrafters.plot.*;
+import com.intellectualcrafters.plot.PlotMain;
+import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotComment;
+import com.intellectualcrafters.plot.util.PlayerFunctions;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Info.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Info.java
index 35435b38d..a35c5c460 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Info.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Info.java
@@ -21,8 +21,15 @@
package com.intellectualcrafters.plot.commands;
-import com.intellectualcrafters.plot.*;
+import com.intellectualcrafters.plot.PlotMain;
+import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotId;
+import com.intellectualcrafters.plot.object.PlotWorld;
+import com.intellectualcrafters.plot.util.PlayerFunctions;
+import com.intellectualcrafters.plot.util.PlotHelper;
+import com.intellectualcrafters.plot.util.UUIDHandler;
import org.apache.commons.lang.StringUtils;
import org.bukkit.Bukkit;
import org.bukkit.Location;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Kick.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Kick.java
index cad071f8e..3ffd96598 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Kick.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Kick.java
@@ -21,10 +21,10 @@
package com.intellectualcrafters.plot.commands;
-import com.intellectualcrafters.plot.C;
-import com.intellectualcrafters.plot.PlayerFunctions;
-import com.intellectualcrafters.plot.Plot;
import com.intellectualcrafters.plot.PlotMain;
+import com.intellectualcrafters.plot.config.C;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.util.PlayerFunctions;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/MainCommand.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/MainCommand.java
index eb5b62035..3d097b178 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/MainCommand.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/MainCommand.java
@@ -21,10 +21,10 @@
package com.intellectualcrafters.plot.commands;
-import com.intellectualcrafters.plot.C;
-import com.intellectualcrafters.plot.PlayerFunctions;
import com.intellectualcrafters.plot.PlotMain;
-import com.intellectualcrafters.plot.StringComparsion;
+import com.intellectualcrafters.plot.config.C;
+import com.intellectualcrafters.plot.util.PlayerFunctions;
+import com.intellectualcrafters.plot.util.StringComparison;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
@@ -225,7 +225,7 @@ public class MainCommand implements CommandExecutor, TabCompleter {
}
/* Let's try to get a proper usage string */
- String command = new StringComparsion(args[0], commands).getBestMatch();
+ String command = new StringComparison(args[0], commands).getBestMatch();
return PlayerFunctions.sendMessage(player, C.DID_YOU_MEAN, "/plot " + command);
//PlayerFunctions.sendMessage(player, C.DID_YOU_MEAN, new StringComparsion(args[0], commands).getBestMatch());
}
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Merge.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Merge.java
index f6f79a331..feacd68a9 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Merge.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Merge.java
@@ -21,8 +21,15 @@
package com.intellectualcrafters.plot.commands;
-import com.intellectualcrafters.plot.*;
+import com.intellectualcrafters.plot.PlotMain;
+import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.events.PlotMergeEvent;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotId;
+import com.intellectualcrafters.plot.object.PlotWorld;
+import com.intellectualcrafters.plot.util.PlayerFunctions;
+import com.intellectualcrafters.plot.util.PlotHelper;
+import com.intellectualcrafters.plot.util.SetBlockFast;
import net.milkbowl.vault.economy.Economy;
import org.apache.commons.lang.StringUtils;
import org.bukkit.Bukkit;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/MusicSubcommand.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/MusicSubcommand.java
index a1ae854f5..426dc02af 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/MusicSubcommand.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/MusicSubcommand.java
@@ -21,10 +21,10 @@
package com.intellectualcrafters.plot.commands;
-import com.intellectualcrafters.plot.C;
-import com.intellectualcrafters.plot.PlayerFunctions;
-import com.intellectualcrafters.plot.Plot;
+import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.listeners.PlotPlusListener;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.util.PlayerFunctions;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/OP.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/OP.java
index e3b2d6a21..aa054e9eb 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/OP.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/OP.java
@@ -1,8 +1,8 @@
package com.intellectualcrafters.plot.commands;
-import com.intellectualcrafters.plot.C;
-import com.intellectualcrafters.plot.PlayerFunctions;
-import com.intellectualcrafters.plot.Plot;
+import com.intellectualcrafters.plot.config.C;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.util.PlayerFunctions;
import org.bukkit.entity.Player;
/**
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Paste.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Paste.java
index b44ba780c..162d95d83 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Paste.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Paste.java
@@ -21,7 +21,12 @@
package com.intellectualcrafters.plot.commands;
-import com.intellectualcrafters.plot.*;
+import com.intellectualcrafters.plot.PlotMain;
+import com.intellectualcrafters.plot.config.C;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotSelection;
+import com.intellectualcrafters.plot.util.PlayerFunctions;
+import com.intellectualcrafters.plot.util.PlotHelper;
import org.bukkit.entity.Player;
public class Paste extends SubCommand {
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Purge.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Purge.java
index 9d1484cd0..ae5255346 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Purge.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Purge.java
@@ -21,11 +21,11 @@
package com.intellectualcrafters.plot.commands;
-import com.intellectualcrafters.plot.C;
-import com.intellectualcrafters.plot.PlayerFunctions;
-import com.intellectualcrafters.plot.PlotId;
import com.intellectualcrafters.plot.PlotMain;
+import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc;
+import com.intellectualcrafters.plot.object.PlotId;
+import com.intellectualcrafters.plot.util.PlayerFunctions;
import org.bukkit.entity.Player;
@SuppressWarnings({"unused", "deprecated", "javadoc"})
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Rate.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Rate.java
index 1df8e52f9..96ff4e805 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Rate.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Rate.java
@@ -21,10 +21,10 @@
package com.intellectualcrafters.plot.commands;
-import com.intellectualcrafters.plot.C;
-import com.intellectualcrafters.plot.PlayerFunctions;
-import com.intellectualcrafters.plot.Plot;
+import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.util.PlayerFunctions;
import org.bukkit.entity.Player;
@SuppressWarnings({"unused", "deprecated", "javadoc"})
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Reload.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Reload.java
index 2db4d7dd1..e5a43f8d8 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Reload.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Reload.java
@@ -21,10 +21,10 @@
package com.intellectualcrafters.plot.commands;
-import com.intellectualcrafters.plot.C;
-import com.intellectualcrafters.plot.PlayerFunctions;
import com.intellectualcrafters.plot.PlotMain;
-import com.intellectualcrafters.plot.PlotWorld;
+import com.intellectualcrafters.plot.config.C;
+import com.intellectualcrafters.plot.object.PlotWorld;
+import com.intellectualcrafters.plot.util.PlayerFunctions;
import org.bukkit.entity.Player;
public class Reload extends SubCommand {
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Schematic.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Schematic.java
index 4e8435c86..561d22729 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Schematic.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Schematic.java
@@ -22,9 +22,14 @@
package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.jnbt.CompoundTag;
-import com.intellectualcrafters.plot.*;
-import com.intellectualcrafters.plot.SchematicHandler.DataCollection;
-import com.intellectualcrafters.plot.SchematicHandler.Dimension;
+import com.intellectualcrafters.plot.PlotMain;
+import com.intellectualcrafters.plot.config.C;
+import com.intellectualcrafters.plot.config.Settings;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotId;
+import com.intellectualcrafters.plot.util.*;
+import com.intellectualcrafters.plot.util.SchematicHandler.DataCollection;
+import com.intellectualcrafters.plot.util.SchematicHandler.Dimension;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.World;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Set.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Set.java
index 51be1ab3c..cdc5f1626 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Set.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Set.java
@@ -21,11 +21,22 @@
package com.intellectualcrafters.plot.commands;
-import com.intellectualcrafters.plot.*;
+import com.intellectualcrafters.plot.PlotMain;
+import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.events.PlotFlagAddEvent;
import com.intellectualcrafters.plot.events.PlotFlagRemoveEvent;
+import com.intellectualcrafters.plot.flag.AbstractFlag;
+import com.intellectualcrafters.plot.flag.Flag;
+import com.intellectualcrafters.plot.flag.FlagManager;
import com.intellectualcrafters.plot.listeners.PlotListener;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotBlock;
+import com.intellectualcrafters.plot.object.PlotHomePosition;
+import com.intellectualcrafters.plot.object.PlotWorld;
+import com.intellectualcrafters.plot.util.PlayerFunctions;
+import com.intellectualcrafters.plot.util.PlotHelper;
+import com.intellectualcrafters.plot.util.StringComparison;
import org.apache.commons.lang.StringUtils;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@@ -225,7 +236,7 @@ public class Set extends SubCommand {
return true;
}
- final Biome biome = Biome.valueOf(new StringComparsion(args[1], Biome.values()).getBestMatch());
+ final Biome biome = Biome.valueOf(new StringComparison(args[1], Biome.values()).getBestMatch());
/*
* for (Biome b : Biome.values()) {
* if (b.toString().equalsIgnoreCase(args[1])) {
@@ -443,7 +454,7 @@ public class Set extends SubCommand {
}
private Material getMaterial(final String input, final List blocks) {
- return Material.valueOf(new StringComparsion(input, blocks.toArray()).getBestMatch());
+ return Material.valueOf(new StringComparison(input, blocks.toArray()).getBestMatch());
}
private String getBlockList(final List blocks) {
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/SetOwner.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/SetOwner.java
index 5a729559a..9b7cb8dd4 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/SetOwner.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/SetOwner.java
@@ -21,8 +21,12 @@
package com.intellectualcrafters.plot.commands;
-import com.intellectualcrafters.plot.*;
+import com.intellectualcrafters.plot.PlotMain;
+import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.util.PlayerFunctions;
+import com.intellectualcrafters.plot.util.UUIDHandler;
import org.bukkit.entity.Player;
import java.util.UUID;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Setup.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Setup.java
index 4737a7eba..c58b237a0 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Setup.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Setup.java
@@ -21,8 +21,13 @@
package com.intellectualcrafters.plot.commands;
-import com.intellectualcrafters.plot.*;
+import com.intellectualcrafters.plot.PlotMain;
+import com.intellectualcrafters.plot.config.C;
+import com.intellectualcrafters.plot.config.ConfigurationNode;
import com.intellectualcrafters.plot.generator.DefaultPlotWorld;
+import com.intellectualcrafters.plot.object.PlotGenerator;
+import com.intellectualcrafters.plot.object.PlotWorld;
+import com.intellectualcrafters.plot.util.PlayerFunctions;
import org.apache.commons.lang.StringUtils;
import org.bukkit.Bukkit;
import org.bukkit.World;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/SubCommand.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/SubCommand.java
index 73ad918b0..9658f4ba7 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/SubCommand.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/SubCommand.java
@@ -21,8 +21,8 @@
package com.intellectualcrafters.plot.commands;
-import com.intellectualcrafters.plot.C;
-import com.intellectualcrafters.plot.PlayerFunctions;
+import com.intellectualcrafters.plot.config.C;
+import com.intellectualcrafters.plot.util.PlayerFunctions;
import org.bukkit.entity.Player;
/**
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Swap.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Swap.java
index 6fef7b53a..21c1a6cfb 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Swap.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Swap.java
@@ -21,7 +21,14 @@
package com.intellectualcrafters.plot.commands;
-import com.intellectualcrafters.plot.*;
+import com.intellectualcrafters.plot.PlotMain;
+import com.intellectualcrafters.plot.config.C;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotId;
+import com.intellectualcrafters.plot.object.PlotSelection;
+import com.intellectualcrafters.plot.util.PlayerFunctions;
+import com.intellectualcrafters.plot.util.PlotHelper;
+import com.intellectualcrafters.plot.util.SetBlockFast;
import org.bukkit.World;
import org.bukkit.entity.Player;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/TP.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/TP.java
index 57dc2827a..9662bf089 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/TP.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/TP.java
@@ -21,7 +21,12 @@
package com.intellectualcrafters.plot.commands;
-import com.intellectualcrafters.plot.*;
+import com.intellectualcrafters.plot.PlotMain;
+import com.intellectualcrafters.plot.config.C;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotId;
+import com.intellectualcrafters.plot.util.PlayerFunctions;
+import com.intellectualcrafters.plot.util.PlotHelper;
import org.apache.commons.lang.StringUtils;
import org.bukkit.Bukkit;
import org.bukkit.World;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Trusted.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Trusted.java
index 08d5d023f..08685d823 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Trusted.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Trusted.java
@@ -21,12 +21,12 @@
package com.intellectualcrafters.plot.commands;
-import com.intellectualcrafters.plot.C;
-import com.intellectualcrafters.plot.PlayerFunctions;
-import com.intellectualcrafters.plot.Plot;
-import com.intellectualcrafters.plot.UUIDHandler;
+import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.events.PlayerPlotTrustedEvent;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.util.PlayerFunctions;
+import com.intellectualcrafters.plot.util.UUIDHandler;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Unban.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Unban.java
index 47ce4f4a2..9f50df2cf 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Unban.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Unban.java
@@ -1,8 +1,8 @@
package com.intellectualcrafters.plot.commands;
-import com.intellectualcrafters.plot.C;
-import com.intellectualcrafters.plot.PlayerFunctions;
-import com.intellectualcrafters.plot.Plot;
+import com.intellectualcrafters.plot.config.C;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.util.PlayerFunctions;
import org.bukkit.entity.Player;
/**
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Unlink.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Unlink.java
index e1ea63586..c293f5b05 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Unlink.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Unlink.java
@@ -21,9 +21,17 @@
package com.intellectualcrafters.plot.commands;
-import com.intellectualcrafters.plot.*;
+import com.intellectualcrafters.plot.PlotMain;
+import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.events.PlotUnlinkEvent;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotId;
+import com.intellectualcrafters.plot.object.PlotManager;
+import com.intellectualcrafters.plot.object.PlotWorld;
+import com.intellectualcrafters.plot.util.PlayerFunctions;
+import com.intellectualcrafters.plot.util.PlotHelper;
+import com.intellectualcrafters.plot.util.SetBlockFast;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.entity.Player;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Visit.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Visit.java
index 6dd49d522..462c4de26 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Visit.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Visit.java
@@ -21,10 +21,10 @@
package com.intellectualcrafters.plot.commands;
-import com.intellectualcrafters.plot.C;
-import com.intellectualcrafters.plot.Plot;
import com.intellectualcrafters.plot.PlotMain;
-import com.intellectualcrafters.plot.UUIDHandler;
+import com.intellectualcrafters.plot.config.C;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.util.UUIDHandler;
import org.bukkit.entity.Player;
import java.util.ArrayList;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/list.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/list.java
index 9f76f3fe9..33fb952ea 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/list.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/list.java
@@ -21,7 +21,13 @@
package com.intellectualcrafters.plot.commands;
-import com.intellectualcrafters.plot.*;
+import com.intellectualcrafters.plot.PlotMain;
+import com.intellectualcrafters.plot.config.C;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotId;
+import com.intellectualcrafters.plot.util.PlayerFunctions;
+import com.intellectualcrafters.plot.util.StringComparison;
+import com.intellectualcrafters.plot.util.UUIDHandler;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
@@ -146,7 +152,7 @@ public class list extends SubCommand {
return true;
} else {
// execute(plr);
- sendMessage(plr, C.DID_YOU_MEAN, new StringComparsion(args[0], new String[]{"mine", "shared", "world", "all"}).getBestMatch());
+ sendMessage(plr, C.DID_YOU_MEAN, new StringComparison(args[0], new String[]{"mine", "shared", "world", "all"}).getBestMatch());
return false;
}
}
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/plugin.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/plugin.java
index 5c48a185d..56220a09a 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/plugin.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/plugin.java
@@ -21,8 +21,8 @@
package com.intellectualcrafters.plot.commands;
-import com.intellectualcrafters.plot.PlayerFunctions;
import com.intellectualcrafters.plot.PlotMain;
+import com.intellectualcrafters.plot.util.PlayerFunctions;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/C.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/config/C.java
similarity index 99%
rename from PlotSquared/src/main/java/com/intellectualcrafters/plot/C.java
rename to PlotSquared/src/main/java/com/intellectualcrafters/plot/config/C.java
index 9e57d521b..224eb31ca 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/C.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/config/C.java
@@ -19,8 +19,9 @@
// You can contact us via: support@intellectualsites.com /
////////////////////////////////////////////////////////////////////////////////////////////////////
-package com.intellectualcrafters.plot;
+package com.intellectualcrafters.plot.config;
+import com.intellectualcrafters.plot.PlotMain;
import com.intellectualsites.translation.*;
import com.intellectualsites.translation.bukkit.BukkitTranslation;
import org.bukkit.ChatColor;
@@ -419,7 +420,7 @@ public enum C {
if (manager == null) {
manager = new TranslationManager();
}
-
+
// FIXME: generating a blank file
// FIXME: translations aren't customizable
// FIXME: Some messages still have the %arg stuff in them
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/Configuration.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/config/Configuration.java
similarity index 99%
rename from PlotSquared/src/main/java/com/intellectualcrafters/plot/Configuration.java
rename to PlotSquared/src/main/java/com/intellectualcrafters/plot/config/Configuration.java
index fc968ed9c..883598c3e 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/Configuration.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/config/Configuration.java
@@ -19,8 +19,9 @@
// You can contact us via: support@intellectualsites.com /
////////////////////////////////////////////////////////////////////////////////////////////////////
-package com.intellectualcrafters.plot;
+package com.intellectualcrafters.plot.config;
+import com.intellectualcrafters.plot.object.PlotBlock;
import org.bukkit.block.Biome;
import java.util.ArrayList;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/ConfigurationNode.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/config/ConfigurationNode.java
similarity index 96%
rename from PlotSquared/src/main/java/com/intellectualcrafters/plot/ConfigurationNode.java
rename to PlotSquared/src/main/java/com/intellectualcrafters/plot/config/ConfigurationNode.java
index a2fc1933e..a0b45f773 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/ConfigurationNode.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/config/ConfigurationNode.java
@@ -19,9 +19,9 @@
// You can contact us via: support@intellectualsites.com /
////////////////////////////////////////////////////////////////////////////////////////////////////
-package com.intellectualcrafters.plot;
+package com.intellectualcrafters.plot.config;
-import com.intellectualcrafters.plot.Configuration.SettingValue;
+import com.intellectualcrafters.plot.config.Configuration.SettingValue;
import org.apache.commons.lang.StringUtils;
import java.util.Arrays;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/Settings.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/config/Settings.java
similarity index 99%
rename from PlotSquared/src/main/java/com/intellectualcrafters/plot/Settings.java
rename to PlotSquared/src/main/java/com/intellectualcrafters/plot/config/Settings.java
index 64bee70bd..4544c7d48 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/Settings.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/config/Settings.java
@@ -19,7 +19,7 @@
// You can contact us via: support@intellectualsites.com /
////////////////////////////////////////////////////////////////////////////////////////////////////
-package com.intellectualcrafters.plot;
+package com.intellectualcrafters.plot.config;
/**
* Updater and DB settings
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/AbstractDB.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/AbstractDB.java
index 18f8a67cd..ae4302908 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/AbstractDB.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/AbstractDB.java
@@ -21,10 +21,10 @@
package com.intellectualcrafters.plot.database;
-import com.intellectualcrafters.plot.Flag;
-import com.intellectualcrafters.plot.Plot;
-import com.intellectualcrafters.plot.PlotComment;
-import com.intellectualcrafters.plot.PlotId;
+import com.intellectualcrafters.plot.flag.Flag;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotComment;
+import com.intellectualcrafters.plot.object.PlotId;
import org.bukkit.OfflinePlayer;
import java.sql.SQLException;
@@ -40,6 +40,11 @@ public abstract class AbstractDB {
// TODO MongoDB @Brandon
+ /**
+ *
+ */
+ public UUID everyone = UUID.fromString("1-1-3-3-7");
+
/**
* Set Plot owner
*
@@ -119,11 +124,6 @@ public abstract class AbstractDB {
*/
public abstract HashMap getSettings(final int id);
- /**
- *
- */
- public UUID everyone = UUID.fromString("1-1-3-3-7");
-
/**
* @param plot
* @param player
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/DBFunc.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/DBFunc.java
index 9e554343c..16df06c77 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/DBFunc.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/DBFunc.java
@@ -21,10 +21,10 @@
package com.intellectualcrafters.plot.database;
-import com.intellectualcrafters.plot.Flag;
-import com.intellectualcrafters.plot.Plot;
-import com.intellectualcrafters.plot.PlotComment;
-import com.intellectualcrafters.plot.PlotId;
+import com.intellectualcrafters.plot.flag.Flag;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotComment;
+import com.intellectualcrafters.plot.object.PlotId;
import org.bukkit.OfflinePlayer;
import java.util.ArrayList;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/PlotMeConverter.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/PlotMeConverter.java
index 8ed7767ad..166cbe818 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/PlotMeConverter.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/PlotMeConverter.java
@@ -22,10 +22,10 @@
package com.intellectualcrafters.plot.database;
import com.google.common.base.Charsets;
-import com.intellectualcrafters.plot.PlotHomePosition;
-import com.intellectualcrafters.plot.PlotId;
import com.intellectualcrafters.plot.PlotMain;
import com.intellectualcrafters.plot.generator.WorldGenerator;
+import com.intellectualcrafters.plot.object.PlotHomePosition;
+import com.intellectualcrafters.plot.object.PlotId;
import com.worldcretornica.plotme.PlayerList;
import com.worldcretornica.plotme.Plot;
import com.worldcretornica.plotme.PlotManager;
@@ -73,7 +73,7 @@ public class PlotMeConverter {
public void run() {
sendMessage("&7Conversion has started");
sendMessage("7Caching playerdata...");
- final ArrayList createdPlots =
+ final ArrayList createdPlots =
new ArrayList<>();
// Online Mode
final boolean online =
@@ -193,14 +193,14 @@ public class PlotMeConverter {
e.printStackTrace();
}
final PlotId id = new PlotId(Integer.parseInt(plot.id.split(";")[0]), Integer.parseInt(plot.id.split(";")[1]));
- com.intellectualcrafters.plot.Plot pl;
+ com.intellectualcrafters.plot.object.Plot pl;
if (online) {
- pl = new com.intellectualcrafters.plot.Plot(id, plot.getOwnerId(), plot.getBiome(), psAdded, psTrusted, psDenied,
+ pl = new com.intellectualcrafters.plot.object.Plot(id, plot.getOwnerId(), plot.getBiome(), psAdded, psTrusted, psDenied,
"", PlotHomePosition.DEFAULT, null, world.getName(), new boolean[]{false, false, false, false});
} else {
final String owner = plot.getOwner();
- pl = new com.intellectualcrafters.plot.Plot(id, UUID.nameUUIDFromBytes(("OfflinePlayer:" + owner).getBytes(Charsets.UTF_8)), plot.getBiome(), psAdded, psTrusted, psDenied,
+ pl = new com.intellectualcrafters.plot.object.Plot(id, UUID.nameUUIDFromBytes(("OfflinePlayer:" + owner).getBytes(Charsets.UTF_8)), plot.getBiome(), psAdded, psTrusted, psDenied,
"", PlotHomePosition.DEFAULT, null, world.getName(), new boolean[]{false, false, false, false});
}
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 e7b973371..57bca029e 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java
@@ -21,8 +21,15 @@
package com.intellectualcrafters.plot.database;
-import com.intellectualcrafters.plot.*;
-import com.intellectualcrafters.plot.Logger.LogLevel;
+import com.intellectualcrafters.plot.PlotMain;
+import com.intellectualcrafters.plot.flag.Flag;
+import com.intellectualcrafters.plot.flag.FlagManager;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotComment;
+import com.intellectualcrafters.plot.object.PlotHomePosition;
+import com.intellectualcrafters.plot.object.PlotId;
+import com.intellectualcrafters.plot.util.Logger;
+import com.intellectualcrafters.plot.util.Logger.LogLevel;
import org.apache.commons.lang.StringUtils;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
@@ -529,10 +536,6 @@ public class SQLManager extends AbstractDB {
}
}
}
- if (biome == null) {
- biome = Biome.FOREST;
- }
- plot.settings.setBiome(biome);
final String alias = r.getString("alias");
if (alias != null) {
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/sqlobjects/SQLTable.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/sqlobjects/SQLTable.java
index 7895169ed..725d06636 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/sqlobjects/SQLTable.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/sqlobjects/SQLTable.java
@@ -21,7 +21,7 @@
package com.intellectualcrafters.plot.database.sqlobjects;
-import com.intellectualcrafters.plot.Settings;
+import com.intellectualcrafters.plot.config.Settings;
/**
* Created by Citymonstret on 2014-10-28.
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlayerClaimPlotEvent.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlayerClaimPlotEvent.java
index 09124d277..8cca73343 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlayerClaimPlotEvent.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlayerClaimPlotEvent.java
@@ -21,7 +21,7 @@
package com.intellectualcrafters.plot.events;
-import com.intellectualcrafters.plot.Plot;
+import com.intellectualcrafters.plot.object.Plot;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
@@ -32,9 +32,8 @@ import org.bukkit.event.player.PlayerEvent;
*/
public class PlayerClaimPlotEvent extends PlayerEvent implements Cancellable {
private static HandlerList handlers = new HandlerList();
- private boolean cancelled;
-
private final Plot plot;
+ private boolean cancelled;
/**
* PlayerClaimPlotEvent: Called when a plot is claimed
@@ -47,6 +46,10 @@ public class PlayerClaimPlotEvent extends PlayerEvent implements Cancellable {
this.plot = plot;
}
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
/**
* Get the plot involved
*
@@ -56,10 +59,6 @@ public class PlayerClaimPlotEvent extends PlayerEvent implements Cancellable {
return this.plot;
}
- public static HandlerList getHandlerList() {
- return handlers;
- }
-
@Override
public HandlerList getHandlers() {
return handlers;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlayerEnterPlotEvent.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlayerEnterPlotEvent.java
index c7bf41a80..6b7256976 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlayerEnterPlotEvent.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlayerEnterPlotEvent.java
@@ -21,7 +21,7 @@
package com.intellectualcrafters.plot.events;
-import com.intellectualcrafters.plot.Plot;
+import com.intellectualcrafters.plot.object.Plot;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerEvent;
@@ -46,6 +46,10 @@ public class PlayerEnterPlotEvent extends PlayerEvent {
this.plot = plot;
}
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
/**
* Get the plot involved
*
@@ -55,10 +59,6 @@ public class PlayerEnterPlotEvent extends PlayerEvent {
return this.plot;
}
- public static HandlerList getHandlerList() {
- return handlers;
- }
-
@Override
public HandlerList getHandlers() {
return handlers;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlayerLeavePlotEvent.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlayerLeavePlotEvent.java
index 44498a7fa..3193f98d7 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlayerLeavePlotEvent.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlayerLeavePlotEvent.java
@@ -21,7 +21,7 @@
package com.intellectualcrafters.plot.events;
-import com.intellectualcrafters.plot.Plot;
+import com.intellectualcrafters.plot.object.Plot;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerEvent;
@@ -45,6 +45,10 @@ public class PlayerLeavePlotEvent extends PlayerEvent {
this.plot = plot;
}
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
/**
* Get the plot involved
*
@@ -54,10 +58,6 @@ public class PlayerLeavePlotEvent extends PlayerEvent {
return this.plot;
}
- public static HandlerList getHandlerList() {
- return handlers;
- }
-
@Override
public HandlerList getHandlers() {
return handlers;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlayerPlotDeniedEvent.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlayerPlotDeniedEvent.java
index 40c6615ca..b1f4598ee 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlayerPlotDeniedEvent.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlayerPlotDeniedEvent.java
@@ -21,7 +21,7 @@
package com.intellectualcrafters.plot.events;
-import com.intellectualcrafters.plot.Plot;
+import com.intellectualcrafters.plot.object.Plot;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
@@ -55,6 +55,10 @@ public class PlayerPlotDeniedEvent extends Event {
this.player = player;
}
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
/**
* If a user was added
*
@@ -91,10 +95,6 @@ public class PlayerPlotDeniedEvent extends Event {
return this.initiator;
}
- public static HandlerList getHandlerList() {
- return handlers;
- }
-
@Override
public HandlerList getHandlers() {
return handlers;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlayerPlotHelperEvent.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlayerPlotHelperEvent.java
index 2d87a935a..483fa0dba 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlayerPlotHelperEvent.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlayerPlotHelperEvent.java
@@ -21,7 +21,7 @@
package com.intellectualcrafters.plot.events;
-import com.intellectualcrafters.plot.Plot;
+import com.intellectualcrafters.plot.object.Plot;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
@@ -54,6 +54,10 @@ public class PlayerPlotHelperEvent extends Event {
this.player = player;
}
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
/**
* If a player was added
*
@@ -90,10 +94,6 @@ public class PlayerPlotHelperEvent extends Event {
return this.initiator;
}
- public static HandlerList getHandlerList() {
- return handlers;
- }
-
@Override
public HandlerList getHandlers() {
return handlers;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlayerPlotTrustedEvent.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlayerPlotTrustedEvent.java
index 4c3bc7094..74040ab50 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlayerPlotTrustedEvent.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlayerPlotTrustedEvent.java
@@ -21,7 +21,7 @@
package com.intellectualcrafters.plot.events;
-import com.intellectualcrafters.plot.Plot;
+import com.intellectualcrafters.plot.object.Plot;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
@@ -54,6 +54,10 @@ public class PlayerPlotTrustedEvent extends Event {
this.player = player;
}
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
/**
* If a player was added
*
@@ -90,10 +94,6 @@ public class PlayerPlotTrustedEvent extends Event {
return this.initiator;
}
- public static HandlerList getHandlerList() {
- return handlers;
- }
-
@Override
public HandlerList getHandlers() {
return handlers;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlayerTeleportToPlotEvent.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlayerTeleportToPlotEvent.java
index 9f94a10bf..14926ad5e 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlayerTeleportToPlotEvent.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlayerTeleportToPlotEvent.java
@@ -21,7 +21,7 @@
package com.intellectualcrafters.plot.events;
-import com.intellectualcrafters.plot.Plot;
+import com.intellectualcrafters.plot.object.Plot;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
@@ -52,6 +52,10 @@ public class PlayerTeleportToPlotEvent extends PlayerEvent implements Cancellabl
this.plot = plot;
}
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
@Override
public HandlerList getHandlers() {
return handlers;
@@ -75,10 +79,6 @@ public class PlayerTeleportToPlotEvent extends PlayerEvent implements Cancellabl
return this.plot;
}
- public static HandlerList getHandlerList() {
- return handlers;
- }
-
@Override
public boolean isCancelled() {
return this.cancelled;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlotClearEvent.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlotClearEvent.java
index 0529076e1..bf22e72a8 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlotClearEvent.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlotClearEvent.java
@@ -21,7 +21,7 @@
package com.intellectualcrafters.plot.events;
-import com.intellectualcrafters.plot.PlotId;
+import com.intellectualcrafters.plot.object.PlotId;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
@@ -31,10 +31,9 @@ import org.bukkit.event.HandlerList;
*/
public class PlotClearEvent extends Event implements Cancellable {
private static HandlerList handlers = new HandlerList();
- private boolean cancelled;
-
private final PlotId id;
private final String world;
+ private boolean cancelled;
/**
* PlotDeleteEvent: Called when a plot is cleared
@@ -47,6 +46,10 @@ public class PlotClearEvent extends Event implements Cancellable {
this.world = world;
}
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
/**
* Get the PlotId
*
@@ -65,10 +68,6 @@ public class PlotClearEvent extends Event implements Cancellable {
return this.world;
}
- public static HandlerList getHandlerList() {
- return handlers;
- }
-
@Override
public HandlerList getHandlers() {
return handlers;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlotDeleteEvent.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlotDeleteEvent.java
index e373df66a..5358c3469 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlotDeleteEvent.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlotDeleteEvent.java
@@ -21,7 +21,7 @@
package com.intellectualcrafters.plot.events;
-import com.intellectualcrafters.plot.PlotId;
+import com.intellectualcrafters.plot.object.PlotId;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
@@ -31,10 +31,9 @@ import org.bukkit.event.HandlerList;
*/
public class PlotDeleteEvent extends Event implements Cancellable {
private static HandlerList handlers = new HandlerList();
- private boolean cancelled;
-
private final PlotId id;
private final String world;
+ private boolean cancelled;
/**
* PlotDeleteEvent: Called when a plot is deleted
@@ -47,6 +46,10 @@ public class PlotDeleteEvent extends Event implements Cancellable {
this.world = world;
}
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
/**
* Get the PlotId
*
@@ -65,10 +68,6 @@ public class PlotDeleteEvent extends Event implements Cancellable {
return this.world;
}
- public static HandlerList getHandlerList() {
- return handlers;
- }
-
@Override
public HandlerList getHandlers() {
return handlers;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlotFlagAddEvent.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlotFlagAddEvent.java
index 7b0e3b8d3..82b63527f 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlotFlagAddEvent.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlotFlagAddEvent.java
@@ -21,8 +21,8 @@
package com.intellectualcrafters.plot.events;
-import com.intellectualcrafters.plot.Flag;
-import com.intellectualcrafters.plot.Plot;
+import com.intellectualcrafters.plot.flag.Flag;
+import com.intellectualcrafters.plot.object.Plot;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
@@ -32,10 +32,9 @@ import org.bukkit.event.HandlerList;
*/
public class PlotFlagAddEvent extends Event implements Cancellable {
private static HandlerList handlers = new HandlerList();
- private boolean cancelled;
-
private final Plot plot;
private final Flag flag;
+ private boolean cancelled;
/**
* PlotFlagAddEvent: Called when a Flag is added to a plot
@@ -48,6 +47,10 @@ public class PlotFlagAddEvent extends Event implements Cancellable {
this.flag = flag;
}
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
/**
* Get the plot involved
*
@@ -66,10 +69,6 @@ public class PlotFlagAddEvent extends Event implements Cancellable {
return this.flag;
}
- public static HandlerList getHandlerList() {
- return handlers;
- }
-
@Override
public HandlerList getHandlers() {
return handlers;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlotFlagRemoveEvent.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlotFlagRemoveEvent.java
index 9e74ffa53..84923d1fa 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlotFlagRemoveEvent.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlotFlagRemoveEvent.java
@@ -21,8 +21,8 @@
package com.intellectualcrafters.plot.events;
-import com.intellectualcrafters.plot.Flag;
-import com.intellectualcrafters.plot.Plot;
+import com.intellectualcrafters.plot.flag.Flag;
+import com.intellectualcrafters.plot.object.Plot;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
@@ -32,10 +32,9 @@ import org.bukkit.event.HandlerList;
*/
public class PlotFlagRemoveEvent extends Event implements Cancellable {
private static HandlerList handlers = new HandlerList();
- private boolean cancelled;
-
private final Plot plot;
private final Flag flag;
+ private boolean cancelled;
/**
* PlotFlagRemoveEvent: Called when a flag is removed from a plot
@@ -48,6 +47,10 @@ public class PlotFlagRemoveEvent extends Event implements Cancellable {
this.flag = flag;
}
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
/**
* Get the plot involved
*
@@ -66,10 +69,6 @@ public class PlotFlagRemoveEvent extends Event implements Cancellable {
return this.flag;
}
- public static HandlerList getHandlerList() {
- return handlers;
- }
-
@Override
public HandlerList getHandlers() {
return handlers;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlotMergeEvent.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlotMergeEvent.java
index abf5e6273..155557c75 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlotMergeEvent.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlotMergeEvent.java
@@ -21,8 +21,8 @@
package com.intellectualcrafters.plot.events;
-import com.intellectualcrafters.plot.Plot;
-import com.intellectualcrafters.plot.PlotId;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotId;
import org.bukkit.World;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
@@ -35,9 +35,8 @@ import java.util.ArrayList;
*/
public class PlotMergeEvent extends Event implements Cancellable {
private static HandlerList handlers = new HandlerList();
- private boolean cancelled;
-
private final ArrayList plots;
+ private boolean cancelled;
private Plot plot;
private World world;
@@ -51,6 +50,10 @@ public class PlotMergeEvent extends Event implements Cancellable {
this.plots = plots;
}
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
/**
* Get the plots being added;
*
@@ -73,10 +76,6 @@ public class PlotMergeEvent extends Event implements Cancellable {
return this.world;
}
- public static HandlerList getHandlerList() {
- return handlers;
- }
-
@Override
public HandlerList getHandlers() {
return handlers;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlotUnlinkEvent.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlotUnlinkEvent.java
index 1f9582101..40d70b3a1 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlotUnlinkEvent.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/PlotUnlinkEvent.java
@@ -21,7 +21,7 @@
package com.intellectualcrafters.plot.events;
-import com.intellectualcrafters.plot.PlotId;
+import com.intellectualcrafters.plot.object.PlotId;
import org.bukkit.World;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
@@ -34,10 +34,9 @@ import java.util.ArrayList;
*/
public class PlotUnlinkEvent extends Event implements Cancellable {
private static HandlerList handlers = new HandlerList();
- private boolean cancelled;
-
private final ArrayList plots;
private final World world;
+ private boolean cancelled;
/**
* Called when a mega-plot is unlinked.
@@ -50,6 +49,10 @@ public class PlotUnlinkEvent extends Event implements Cancellable {
this.world = world;
}
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
/**
* Get the plots involved
*
@@ -63,10 +66,6 @@ public class PlotUnlinkEvent extends Event implements Cancellable {
return this.world;
}
- public static HandlerList getHandlerList() {
- return handlers;
- }
-
@Override
public HandlerList getHandlers() {
return handlers;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/AbstractFlag.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/flag/AbstractFlag.java
similarity index 98%
rename from PlotSquared/src/main/java/com/intellectualcrafters/plot/AbstractFlag.java
rename to PlotSquared/src/main/java/com/intellectualcrafters/plot/flag/AbstractFlag.java
index d310ac892..afe978cce 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/AbstractFlag.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/flag/AbstractFlag.java
@@ -19,7 +19,7 @@
// You can contact us via: support@intellectualsites.com /
////////////////////////////////////////////////////////////////////////////////////////////////////
-package com.intellectualcrafters.plot;
+package com.intellectualcrafters.plot.flag;
import org.apache.commons.lang.StringUtils;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/Flag.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/flag/Flag.java
similarity index 99%
rename from PlotSquared/src/main/java/com/intellectualcrafters/plot/Flag.java
rename to PlotSquared/src/main/java/com/intellectualcrafters/plot/flag/Flag.java
index 56c673cbf..880bf1cc1 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/Flag.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/flag/Flag.java
@@ -19,7 +19,7 @@
// You can contact us via: support@intellectualsites.com /
////////////////////////////////////////////////////////////////////////////////////////////////////
-package com.intellectualcrafters.plot;
+package com.intellectualcrafters.plot.flag;
import org.apache.commons.lang.StringUtils;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/FlagManager.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/flag/FlagManager.java
similarity index 98%
rename from PlotSquared/src/main/java/com/intellectualcrafters/plot/FlagManager.java
rename to PlotSquared/src/main/java/com/intellectualcrafters/plot/flag/FlagManager.java
index af93135e3..ae8f384b4 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/FlagManager.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/flag/FlagManager.java
@@ -19,8 +19,9 @@
// You can contact us via: support@intellectualsites.com /
////////////////////////////////////////////////////////////////////////////////////////////////////
-package com.intellectualcrafters.plot;
+package com.intellectualcrafters.plot.flag;
+import com.intellectualcrafters.plot.object.Plot;
import org.bukkit.entity.Player;
import java.util.ArrayList;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/DefaultPlotManager.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/DefaultPlotManager.java
index 22a72e2bb..32eeb193c 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/DefaultPlotManager.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/DefaultPlotManager.java
@@ -21,7 +21,10 @@
package com.intellectualcrafters.plot.generator;
-import com.intellectualcrafters.plot.*;
+import com.intellectualcrafters.plot.PlotMain;
+import com.intellectualcrafters.plot.object.*;
+import com.intellectualcrafters.plot.util.PlayerFunctions;
+import com.intellectualcrafters.plot.util.PlotHelper;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.World;
@@ -487,7 +490,6 @@ public class DefaultPlotManager extends PlotManager {
}
}
- plot.settings.setBiome(biome);
PlotMain.updatePlot(plot);
PlotHelper.refreshPlotChunks(world, plot);
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/DefaultPlotWorld.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/DefaultPlotWorld.java
index 57c53c70e..188520753 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/DefaultPlotWorld.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/DefaultPlotWorld.java
@@ -21,7 +21,11 @@
package com.intellectualcrafters.plot.generator;
-import com.intellectualcrafters.plot.*;
+import com.intellectualcrafters.plot.PlotMain;
+import com.intellectualcrafters.plot.config.Configuration;
+import com.intellectualcrafters.plot.config.ConfigurationNode;
+import com.intellectualcrafters.plot.object.PlotBlock;
+import com.intellectualcrafters.plot.object.PlotWorld;
import org.apache.commons.lang.StringUtils;
import org.bukkit.configuration.ConfigurationSection;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/WorldGenerator.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/WorldGenerator.java
index 3556995f2..bc193fc19 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/WorldGenerator.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/WorldGenerator.java
@@ -21,22 +21,19 @@
package com.intellectualcrafters.plot.generator;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Random;
-
+import com.intellectualcrafters.plot.PlotMain;
+import com.intellectualcrafters.plot.object.PlotBlock;
+import com.intellectualcrafters.plot.object.PlotGenerator;
+import com.intellectualcrafters.plot.object.PlotManager;
+import com.intellectualcrafters.plot.object.PlotWorld;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.Biome;
-import org.bukkit.configuration.ConfigurationSection;
-import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.generator.BlockPopulator;
-import com.intellectualcrafters.plot.PlotBlock;
-import com.intellectualcrafters.plot.PlotGenerator;
-import com.intellectualcrafters.plot.PlotMain;
-import com.intellectualcrafters.plot.PlotManager;
-import com.intellectualcrafters.plot.PlotWorld;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Random;
/**
* @author Citymonstret The default generator is very messy, as we have decided
@@ -47,20 +44,10 @@ import com.intellectualcrafters.plot.PlotWorld;
* @auther Empire92
*/
public class WorldGenerator extends PlotGenerator {
- /**
- * result object is returned for each generated chunk, do stuff to it
- */
- short[][] result;
-
- /**
- * plotworld object
- */
- DefaultPlotWorld plotworld = null;
/**
* Set to static to re-use the same managet for all Default World Generators
*/
private static PlotManager manager = null;
-
/**
* Some generator specific variables (implementation dependent)
*/
@@ -77,6 +64,48 @@ public class WorldGenerator extends PlotGenerator {
final int plotheight;
final PlotBlock[] plotfloors;
final PlotBlock[] filling;
+ /**
+ * result object is returned for each generated chunk, do stuff to it
+ */
+ short[][] result;
+ /**
+ * plotworld object
+ */
+ DefaultPlotWorld plotworld = null;
+ /**
+ * Faster sudo-random number generator than java.util.random
+ */
+ private long state;
+
+ /**
+ * Initialize variables, and create plotworld object used in calculations
+ */
+ public WorldGenerator(final String world) {
+ super(world);
+
+ if (this.plotworld == null) {
+ this.plotworld = (DefaultPlotWorld) PlotMain.getWorldSettings(world);
+ }
+
+ this.plotsize = this.plotworld.PLOT_WIDTH;
+
+ this.pathsize = this.plotworld.ROAD_WIDTH;
+
+ this.floor1 = this.plotworld.ROAD_BLOCK;
+ this.floor2 = this.plotworld.ROAD_STRIPES;
+
+ this.wallfilling = this.plotworld.WALL_FILLING;
+ this.size = this.pathsize + this.plotsize;
+ this.wall = this.plotworld.WALL_BLOCK;
+
+ this.plotfloors = this.plotworld.TOP_BLOCK;
+ this.filling = this.plotworld.MAIN_BLOCK;
+ this.wallheight = this.plotworld.WALL_HEIGHT;
+ this.roadheight = this.plotworld.ROAD_HEIGHT;
+ this.plotheight = this.plotworld.PLOT_HEIGHT;
+
+ this.biome = this.plotworld.PLOT_BIOME;
+ }
/**
* Return the plot manager for this type of generator, or create one For
@@ -109,11 +138,6 @@ public class WorldGenerator extends PlotGenerator {
return this.plotworld;
}
- /**
- * Faster sudo-random number generator than java.util.random
- */
- private long state;
-
public final long nextLong() {
final long a = this.state;
this.state = xorShift64(a);
@@ -172,36 +196,6 @@ public class WorldGenerator extends PlotGenerator {
result[y >> 4][((y & 0xF) << 8) | (z << 4) | x] = blkid;
}
- /**
- * Initialize variables, and create plotworld object used in calculations
- */
- public WorldGenerator(final String world) {
- super(world);
-
- if (this.plotworld == null) {
- this.plotworld = (DefaultPlotWorld) PlotMain.getWorldSettings(world);
- }
-
- this.plotsize = this.plotworld.PLOT_WIDTH;
-
- this.pathsize = this.plotworld.ROAD_WIDTH;
-
- this.floor1 = this.plotworld.ROAD_BLOCK;
- this.floor2 = this.plotworld.ROAD_STRIPES;
-
- this.wallfilling = this.plotworld.WALL_FILLING;
- this.size = this.pathsize + this.plotsize;
- this.wall = this.plotworld.WALL_BLOCK;
-
- this.plotfloors = this.plotworld.TOP_BLOCK;
- this.filling = this.plotworld.MAIN_BLOCK;
- this.wallheight = this.plotworld.WALL_HEIGHT;
- this.roadheight = this.plotworld.ROAD_HEIGHT;
- this.plotheight = this.plotworld.PLOT_HEIGHT;
-
- this.biome = this.plotworld.PLOT_BIOME;
- }
-
/**
* Return the block populator
*/
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/XPopulator.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/XPopulator.java
index 7dd5efe82..d4fa33c1a 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/XPopulator.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/XPopulator.java
@@ -21,8 +21,8 @@
package com.intellectualcrafters.plot.generator;
-import com.intellectualcrafters.plot.PlotBlock;
-import com.intellectualcrafters.plot.PlotWorld;
+import com.intellectualcrafters.plot.object.PlotBlock;
+import com.intellectualcrafters.plot.object.PlotWorld;
import org.bukkit.Chunk;
import org.bukkit.World;
import org.bukkit.block.Biome;
@@ -41,9 +41,53 @@ public class XPopulator extends BlockPopulator {
* information about how a BlockPopulator works.
*/
+ private final DefaultPlotWorld plotworld;
+ int plotsize;
+ int pathsize;
+ PlotBlock wall;
+ PlotBlock wallfilling;
+ PlotBlock floor1;
+ PlotBlock floor2;
+ int size;
+ Biome biome;
+ int roadheight;
+ int wallheight;
+ int plotheight;
+ PlotBlock[] plotfloors;
+ PlotBlock[] filling;
private int X;
private int Z;
private long state;
+ private double pathWidthLower;
+
+ public XPopulator(final PlotWorld pw) {
+ this.plotworld = (DefaultPlotWorld) pw;
+
+ // save configuration
+
+ this.plotsize = this.plotworld.PLOT_WIDTH;
+ this.pathsize = this.plotworld.ROAD_WIDTH;
+
+ this.floor1 = this.plotworld.ROAD_BLOCK;
+ this.floor2 = this.plotworld.ROAD_STRIPES;
+
+ this.wallfilling = this.plotworld.WALL_FILLING;
+ this.size = this.pathsize + this.plotsize;
+ this.wall = this.plotworld.WALL_BLOCK;
+
+ this.plotfloors = this.plotworld.TOP_BLOCK;
+ this.filling = this.plotworld.MAIN_BLOCK;
+
+ this.wallheight = this.plotworld.WALL_HEIGHT;
+ this.roadheight = this.plotworld.ROAD_HEIGHT;
+ this.plotheight = this.plotworld.PLOT_HEIGHT;
+
+ if ((this.pathsize % 2) == 0) {
+ this.pathWidthLower = Math.floor(this.pathsize / 2) - 1;
+ } else {
+ this.pathWidthLower = Math.floor(this.pathsize / 2);
+ }
+ }
public final long nextLong() {
final long a = this.state;
@@ -102,52 +146,6 @@ public class XPopulator extends BlockPopulator {
return new short[]{Short.parseShort(block), 0};
}
- int plotsize;
- int pathsize;
- PlotBlock wall;
- PlotBlock wallfilling;
- PlotBlock floor1;
- PlotBlock floor2;
- int size;
- Biome biome;
- int roadheight;
- int wallheight;
- int plotheight;
- PlotBlock[] plotfloors;
- PlotBlock[] filling;
-
- private double pathWidthLower;
- private final DefaultPlotWorld plotworld;
-
- public XPopulator(final PlotWorld pw) {
- this.plotworld = (DefaultPlotWorld) pw;
-
- // save configuration
-
- this.plotsize = this.plotworld.PLOT_WIDTH;
- this.pathsize = this.plotworld.ROAD_WIDTH;
-
- this.floor1 = this.plotworld.ROAD_BLOCK;
- this.floor2 = this.plotworld.ROAD_STRIPES;
-
- this.wallfilling = this.plotworld.WALL_FILLING;
- this.size = this.pathsize + this.plotsize;
- this.wall = this.plotworld.WALL_BLOCK;
-
- this.plotfloors = this.plotworld.TOP_BLOCK;
- this.filling = this.plotworld.MAIN_BLOCK;
-
- this.wallheight = this.plotworld.WALL_HEIGHT;
- this.roadheight = this.plotworld.ROAD_HEIGHT;
- this.plotheight = this.plotworld.PLOT_HEIGHT;
-
- if ((this.pathsize % 2) == 0) {
- this.pathWidthLower = Math.floor(this.pathsize / 2) - 1;
- } else {
- this.pathWidthLower = Math.floor(this.pathsize / 2);
- }
- }
-
@Override
public void populate(final World w, final Random r, final Chunk c) {
int cx = c.getX(), cz = c.getZ();
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/EntityListener.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/EntityListener.java
index a80341a23..02687bd0e 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/EntityListener.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/EntityListener.java
@@ -1,17 +1,12 @@
package com.intellectualcrafters.plot.listeners;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map.Entry;
-import java.util.Set;
-
-import org.bukkit.Bukkit;
-import org.bukkit.Chunk;
-import org.bukkit.Location;
-import org.bukkit.Material;
-import org.bukkit.World;
-import org.bukkit.block.Block;
+import com.intellectualcrafters.plot.PlotMain;
+import com.intellectualcrafters.plot.config.C;
+import com.intellectualcrafters.plot.config.Settings;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.util.PlayerFunctions;
+import com.intellectualcrafters.plot.util.PlotHelper;
+import org.bukkit.*;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
@@ -21,71 +16,30 @@ import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.event.entity.EntityDeathEvent;
-import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.world.ChunkLoadEvent;
import org.bukkit.event.world.ChunkUnloadEvent;
import org.bukkit.scheduler.BukkitScheduler;
-import com.intellectualcrafters.plot.C;
-import com.intellectualcrafters.plot.PlayerFunctions;
-import com.intellectualcrafters.plot.Plot;
-import com.intellectualcrafters.plot.PlotHelper;
-import com.intellectualcrafters.plot.PlotMain;
-import com.intellectualcrafters.plot.Settings;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map.Entry;
+import java.util.Set;
public class EntityListener implements Listener {
-
+
public static HashMap>> entityMap = new HashMap>>();
-
- @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
- public static void onPlayerInteract(final PlayerInteractEvent e) {
- if (e.getAction() == Action.RIGHT_CLICK_BLOCK) {
- final Player p = e.getPlayer();
- World w = p.getWorld();
- String n = w.getName();
- if (e.getMaterial() == Material.MONSTER_EGG || e.getMaterial() == Material.MONSTER_EGGS) {
- if (entityMap.containsKey(n)) {
- Location l = e.getClickedBlock().getLocation();
- Plot plot = PlotHelper.getCurrentPlot(l);
- if (plot!=null && plot.hasRights(p)) {
- int mobs;
- if (entityMap.get(n).containsKey(plot)) {
- mobs = entityMap.get(n).get(plot).size();
- }
- else {
- mobs = 0;
- }
- if (!(PlotMain.hasPermissionRange(p, "plots.mobcap", Settings.MOB_CAP)>mobs)) {
- PlayerFunctions.sendMessage(p, C.NO_PLOTS, "plots.mobcap."+(mobs+1));
- }
- }
- }
- }
- }
- }
-
- @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
- public static void onCreatureSpawn(CreatureSpawnEvent e) {
- Location l = e.getLocation();
- String w = l.getWorld().getName();
- if (PlotMain.isPlotWorld(w)) {
- Plot plot = PlotHelper.getCurrentPlot(l);
- if (plot!=null && plot.hasOwner()) {
- addEntity(e.getEntity(), plot);
- }
- }
- }
-
+
public EntityListener() {
BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
scheduler.scheduleSyncRepeatingTask(PlotMain.getMain(), new Runnable() {
@Override
public void run() {
Iterator>>> worldIt = entityMap.entrySet().iterator();
-
+
Set plots = PlotMain.getPlots();
-
+
while (worldIt.hasNext()) {
Entry>> entry = worldIt.next();
String worldname = entry.getKey();
@@ -97,7 +51,7 @@ public class EntityListener implements Listener {
if (world == null || entry.getValue().size() == 0) {
worldIt.remove();
continue;
- }
+ }
Iterator>> it = entry.getValue().entrySet().iterator();
while (it.hasNext()) {
Entry> plotEntry = it.next();
@@ -106,9 +60,9 @@ public class EntityListener implements Listener {
it.remove();
continue;
}
-
+
boolean loaded = false;
-
+
final Location pos1 = PlotHelper.getPlotBottomLoc(world, plot.id).add(1, 0, 1);
final Location pos2 = PlotHelper.getPlotTopLoc(world, plot.id);
try {
@@ -122,8 +76,7 @@ public class EntityListener implements Listener {
}
}
}
- }
- catch (Exception e) {
+ } catch (Exception e) {
it.remove();
continue;
}
@@ -135,7 +88,45 @@ public class EntityListener implements Listener {
}
}, 24000L, 48000L);
}
-
+
+ @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
+ public static void onPlayerInteract(final PlayerInteractEvent e) {
+ if (e.getAction() == Action.RIGHT_CLICK_BLOCK) {
+ final Player p = e.getPlayer();
+ World w = p.getWorld();
+ String n = w.getName();
+ if (e.getMaterial() == Material.MONSTER_EGG || e.getMaterial() == Material.MONSTER_EGGS) {
+ if (entityMap.containsKey(n)) {
+ Location l = e.getClickedBlock().getLocation();
+ Plot plot = PlotHelper.getCurrentPlot(l);
+ if (plot != null && plot.hasRights(p)) {
+ int mobs;
+ if (entityMap.get(n).containsKey(plot)) {
+ mobs = entityMap.get(n).get(plot).size();
+ } else {
+ mobs = 0;
+ }
+ if (!(PlotMain.hasPermissionRange(p, "plots.mobcap", Settings.MOB_CAP) > mobs)) {
+ PlayerFunctions.sendMessage(p, C.NO_PLOTS, "plots.mobcap." + (mobs + 1));
+ }
+ }
+ }
+ }
+ }
+ }
+
+ @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
+ public static void onCreatureSpawn(CreatureSpawnEvent e) {
+ Location l = e.getLocation();
+ String w = l.getWorld().getName();
+ if (PlotMain.isPlotWorld(w)) {
+ Plot plot = PlotHelper.getCurrentPlot(l);
+ if (plot != null && plot.hasOwner()) {
+ addEntity(e.getEntity(), plot);
+ }
+ }
+ }
+
@EventHandler
public static void onChunkLoad(final ChunkLoadEvent e) {
if (PlotMain.isPlotWorld(e.getWorld())) {
@@ -143,7 +134,7 @@ public class EntityListener implements Listener {
if (entity instanceof LivingEntity) {
if (!(entity instanceof Player)) {
Plot plot = PlotHelper.getCurrentPlot(entity.getLocation());
- if (plot!=null) {
+ if (plot != null) {
if (plot.hasOwner()) {
addEntity(entity, plot);
}
@@ -153,7 +144,7 @@ public class EntityListener implements Listener {
}
}
}
-
+
public static void addEntity(Entity entity, Plot plot) {
if (!entityMap.containsKey(plot.world)) {
entityMap.put(plot.world, new HashMap>());
@@ -164,7 +155,7 @@ public class EntityListener implements Listener {
}
section.get(plot).add(entity.getEntityId());
}
-
+
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public static void onEntityDeath(EntityDeathEvent e) {
Entity entity = e.getEntity();
@@ -173,12 +164,11 @@ public class EntityListener implements Listener {
if (entityMap.containsKey(w)) {
int id = entity.getEntityId();
Plot plot = PlotHelper.getCurrentPlot(entity.getLocation());
- if (plot!=null) {
+ if (plot != null) {
if (entityMap.get(w).containsKey(plot)) {
entityMap.get(w).get(plot).remove(id);
}
- }
- else {
+ } else {
Iterator>> it = entityMap.get(w).entrySet().iterator();
while (it.hasNext()) {
Entry> n = it.next();
@@ -187,7 +177,7 @@ public class EntityListener implements Listener {
}
}
}
-
+
@EventHandler
public static void onChunkDespawn(final ChunkUnloadEvent e) {
String w = e.getWorld().getName();
@@ -196,13 +186,12 @@ public class EntityListener implements Listener {
if (entity instanceof LivingEntity) {
if (!(entity instanceof Player)) {
Plot plot = PlotHelper.getCurrentPlot(entity.getLocation());
- if (plot!=null) {
+ if (plot != null) {
if (plot.hasOwner()) {
if (entityMap.get(w).containsKey(plot)) {
- if (entityMap.get(w).get(plot).size()==1) {
+ if (entityMap.get(w).get(plot).size() == 1) {
entityMap.get(w).remove(plot);
- }
- else {
+ } else {
entityMap.get(w).get(plot).remove(entity.getEntityId());
}
}
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/ForceFieldListener.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/ForceFieldListener.java
index 2b4340d6f..44e4ec46f 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/ForceFieldListener.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/ForceFieldListener.java
@@ -21,8 +21,8 @@
package com.intellectualcrafters.plot.listeners;
-import com.intellectualcrafters.plot.PlayerFunctions;
-import com.intellectualcrafters.plot.Plot;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.util.PlayerFunctions;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
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 6e683e9d2..4c0443042 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents.java
@@ -21,9 +21,13 @@
package com.intellectualcrafters.plot.listeners;
-import com.intellectualcrafters.plot.*;
+import com.intellectualcrafters.plot.PlotMain;
import com.intellectualcrafters.plot.commands.Setup;
+import com.intellectualcrafters.plot.config.C;
+import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.database.DBFunc;
+import com.intellectualcrafters.plot.object.*;
+import com.intellectualcrafters.plot.util.PlayerFunctions;
import org.bukkit.*;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
@@ -79,7 +83,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(), 64, t.getZ());
-
+
if ((f.getBlockX() != q.getBlockX()) || (f.getBlockZ() != q.getBlockZ())) {
if (!isPlotWorld(player.getWorld())) {
return;
@@ -421,20 +425,17 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public static void onBlockIgnite(final BlockIgniteEvent e) {
final World world;
-
+
if (e.getBlock() != null) {
world = e.getBlock().getWorld();
- }
- else if (e.getIgnitingEntity() != null) {
+ } else if (e.getIgnitingEntity() != null) {
world = e.getIgnitingEntity().getWorld();
- }
- else if (e.getPlayer() != null) {
+ } else if (e.getPlayer() != null) {
world = e.getPlayer().getWorld();
- }
- else {
+ } else {
return;
}
-
+
if (!isPlotWorld(world)) {
return;
}
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlotListener.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlotListener.java
index 7ba1e8f42..fc1dccec7 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlotListener.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlotListener.java
@@ -21,9 +21,15 @@
package com.intellectualcrafters.plot.listeners;
-import com.intellectualcrafters.plot.*;
+import com.intellectualcrafters.plot.PlotMain;
+import com.intellectualcrafters.plot.config.C;
+import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.events.PlayerEnterPlotEvent;
import com.intellectualcrafters.plot.events.PlayerLeavePlotEvent;
+import com.intellectualcrafters.plot.flag.FlagManager;
+import com.intellectualcrafters.plot.object.*;
+import com.intellectualcrafters.plot.util.PlayerFunctions;
+import com.intellectualcrafters.plot.util.UUIDHandler;
import org.bukkit.*;
import org.bukkit.block.Biome;
import org.bukkit.block.Block;
@@ -211,7 +217,6 @@ public class PlotListener {
final PlayerEnterPlotEvent callEvent = new PlayerEnterPlotEvent(player, plot);
Bukkit.getPluginManager().callEvent(callEvent);
}
- PlayerFunctions.sendMessage(player, plot.settings.getJoinMessage());
}
}
@@ -232,7 +237,6 @@ public class PlotListener {
if (plot.settings.getFlag("weather") != null) {
player.resetPlayerWeather();
}
- PlayerFunctions.sendMessage(player, plot.settings.getLeaveMessage());
}
public static boolean getFlagValue(final String value) {
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlotPlusListener.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlotPlusListener.java
index 608550148..aee3b0b71 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlotPlusListener.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlotPlusListener.java
@@ -21,11 +21,11 @@
package com.intellectualcrafters.plot.listeners;
-import com.intellectualcrafters.plot.C;
-import com.intellectualcrafters.plot.PlayerFunctions;
-import com.intellectualcrafters.plot.Plot;
+import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.events.PlayerEnterPlotEvent;
import com.intellectualcrafters.plot.events.PlayerLeavePlotEvent;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.util.PlayerFunctions;
import org.bukkit.*;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/WorldEditListener.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/WorldEditListener.java
index aa5b32b63..df6d20135 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/WorldEditListener.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/WorldEditListener.java
@@ -21,9 +21,14 @@
package com.intellectualcrafters.plot.listeners;
-import com.intellectualcrafters.plot.*;
+import com.intellectualcrafters.plot.PlotMain;
import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.events.PlotDeleteEvent;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotId;
+import com.intellectualcrafters.plot.util.PWE;
+import com.intellectualcrafters.plot.util.PlayerFunctions;
+import com.intellectualcrafters.plot.util.PlotHelper;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/WorldGuardListener.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/WorldGuardListener.java
index 71716fbc6..abbcbf36a 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/WorldGuardListener.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/WorldGuardListener.java
@@ -21,11 +21,15 @@
package com.intellectualcrafters.plot.listeners;
-import com.intellectualcrafters.plot.*;
+import com.intellectualcrafters.plot.PlotMain;
import com.intellectualcrafters.plot.events.PlayerClaimPlotEvent;
import com.intellectualcrafters.plot.events.PlotDeleteEvent;
import com.intellectualcrafters.plot.events.PlotMergeEvent;
import com.intellectualcrafters.plot.events.PlotUnlinkEvent;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotId;
+import com.intellectualcrafters.plot.util.PlotHelper;
+import com.intellectualcrafters.plot.util.UUIDHandler;
import com.sk89q.worldedit.BlockVector;
import com.sk89q.worldguard.domains.DefaultDomain;
import com.sk89q.worldguard.protection.flags.DefaultFlag;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/BlockWrapper.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/BlockWrapper.java
similarity index 98%
rename from PlotSquared/src/main/java/com/intellectualcrafters/plot/BlockWrapper.java
rename to PlotSquared/src/main/java/com/intellectualcrafters/plot/object/BlockWrapper.java
index fed5e594d..4b44bbc84 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/BlockWrapper.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/BlockWrapper.java
@@ -19,7 +19,7 @@
// You can contact us via: support@intellectualsites.com /
////////////////////////////////////////////////////////////////////////////////////////////////////
-package com.intellectualcrafters.plot;
+package com.intellectualcrafters.plot.object;
/**
* Wrapper class for blocks, using
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/Plot.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/Plot.java
similarity index 98%
rename from PlotSquared/src/main/java/com/intellectualcrafters/plot/Plot.java
rename to PlotSquared/src/main/java/com/intellectualcrafters/plot/object/Plot.java
index 88b3b04c5..dbc7a0785 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/Plot.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/Plot.java
@@ -19,9 +19,12 @@
// You can contact us via: support@intellectualsites.com /
////////////////////////////////////////////////////////////////////////////////////////////////////
-package com.intellectualcrafters.plot;
+package com.intellectualcrafters.plot.object;
+import com.intellectualcrafters.plot.PlotMain;
import com.intellectualcrafters.plot.database.DBFunc;
+import com.intellectualcrafters.plot.flag.Flag;
+import com.intellectualcrafters.plot.util.PlotHelper;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.block.Biome;
@@ -92,7 +95,6 @@ public class Plot implements Cloneable {
public Plot(final PlotId id, final UUID owner, final Biome plotBiome, final ArrayList helpers, final ArrayList denied, final String world) {
this.id = id;
this.settings = new PlotSettings(this);
- this.settings.setBiome(plotBiome);
this.owner = owner;
this.deny_entry = this.owner == null;
this.helpers = helpers;
@@ -118,7 +120,6 @@ public class Plot implements Cloneable {
public Plot(final PlotId id, final UUID owner, final Biome plotBiome, final ArrayList helpers, final ArrayList trusted, final ArrayList denied, final String alias, final PlotHomePosition position, final Flag[] flags, final String world, final boolean[] merged) {
this.id = id;
this.settings = new PlotSettings(this);
- this.settings.setBiome(plotBiome);
this.owner = owner;
this.deny_entry = this.owner != null;
this.trusted = trusted;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotBlock.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotBlock.java
similarity index 97%
rename from PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotBlock.java
rename to PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotBlock.java
index 95c473d08..6e0a3904e 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotBlock.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotBlock.java
@@ -19,7 +19,7 @@
// You can contact us via: support@intellectualsites.com /
////////////////////////////////////////////////////////////////////////////////////////////////////
-package com.intellectualcrafters.plot;
+package com.intellectualcrafters.plot.object;
public class PlotBlock {
public short id;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotComment.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotComment.java
similarity index 98%
rename from PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotComment.java
rename to PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotComment.java
index 905dbb0f7..2de692e78 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotComment.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotComment.java
@@ -19,7 +19,7 @@
// You can contact us via: support@intellectualsites.com /
////////////////////////////////////////////////////////////////////////////////////////////////////
-package com.intellectualcrafters.plot;
+package com.intellectualcrafters.plot.object;
public class PlotComment {
public final String comment;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotGenerator.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotGenerator.java
similarity index 96%
rename from PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotGenerator.java
rename to PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotGenerator.java
index b06ba6a18..0d319045e 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotGenerator.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotGenerator.java
@@ -19,8 +19,9 @@
// You can contact us via: support@intellectualsites.com /
////////////////////////////////////////////////////////////////////////////////////////////////////
-package com.intellectualcrafters.plot;
+package com.intellectualcrafters.plot.object;
+import com.intellectualcrafters.plot.PlotMain;
import org.bukkit.generator.ChunkGenerator;
public abstract class PlotGenerator extends ChunkGenerator {
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotHomePosition.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotHomePosition.java
similarity index 98%
rename from PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotHomePosition.java
rename to PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotHomePosition.java
index 9b8d1c695..e600aed7a 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotHomePosition.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotHomePosition.java
@@ -19,7 +19,7 @@
// You can contact us via: support@intellectualsites.com /
////////////////////////////////////////////////////////////////////////////////////////////////////
-package com.intellectualcrafters.plot;
+package com.intellectualcrafters.plot.object;
/**
* Created by Citymonstret on 2014-08-05.
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotId.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotId.java
similarity index 98%
rename from PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotId.java
rename to PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotId.java
index a1ecbee54..67df7654a 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotId.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotId.java
@@ -19,30 +19,10 @@
// You can contact us via: support@intellectualsites.com /
////////////////////////////////////////////////////////////////////////////////////////////////////
-package com.intellectualcrafters.plot;
+package com.intellectualcrafters.plot.object;
public class PlotId {
- /**
- * Get a Plot Id based on a string
- *
- * @param string to create id from
- * @return null if the string is invalid
- */
- public static PlotId fromString(final String string) {
- int x, y;
- String[] parts = string.split(";");
- if (parts.length < 2)
- return null;
- try {
- x = Integer.parseInt(parts[0]);
- y = Integer.parseInt(parts[1]);
- } catch (Exception e) {
- return null;
- }
- return new PlotId(x, y);
- }
-
/**
* x value
*/
@@ -63,6 +43,26 @@ public class PlotId {
this.y = y;
}
+ /**
+ * Get a Plot Id based on a string
+ *
+ * @param string to create id from
+ * @return null if the string is invalid
+ */
+ public static PlotId fromString(final String string) {
+ int x, y;
+ String[] parts = string.split(";");
+ if (parts.length < 2)
+ return null;
+ try {
+ x = Integer.parseInt(parts[0]);
+ y = Integer.parseInt(parts[1]);
+ } catch (Exception e) {
+ return null;
+ }
+ return new PlotId(x, y);
+ }
+
@Override
public boolean equals(final Object obj) {
if (this == obj) {
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotManager.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotManager.java
similarity index 98%
rename from PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotManager.java
rename to PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotManager.java
index 9ff1dc217..3896bec0b 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotManager.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotManager.java
@@ -19,7 +19,7 @@
// You can contact us via: support@intellectualsites.com /
////////////////////////////////////////////////////////////////////////////////////////////////////
-package com.intellectualcrafters.plot;
+package com.intellectualcrafters.plot.object;
import org.bukkit.Location;
import org.bukkit.World;
@@ -27,6 +27,7 @@ import org.bukkit.block.Biome;
import java.util.ArrayList;
+@SuppressWarnings("unused")
public abstract class PlotManager {
/*
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotSelection.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotSelection.java
similarity index 97%
rename from PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotSelection.java
rename to PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotSelection.java
index f556c52dd..0fcc7a9d2 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotSelection.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotSelection.java
@@ -19,8 +19,10 @@
// You can contact us via: support@intellectualsites.com /
////////////////////////////////////////////////////////////////////////////////////////////////////
-package com.intellectualcrafters.plot;
+package com.intellectualcrafters.plot.object;
+import com.intellectualcrafters.plot.util.PlotHelper;
+import com.intellectualcrafters.plot.util.SetBlockFast;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.Biome;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotSettings.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotSettings.java
similarity index 85%
rename from PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotSettings.java
rename to PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotSettings.java
index 1522900cc..d0a207cd3 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotSettings.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotSettings.java
@@ -19,8 +19,10 @@
// You can contact us via: support@intellectualsites.com /
////////////////////////////////////////////////////////////////////////////////////////////////////
-package com.intellectualcrafters.plot;
+package com.intellectualcrafters.plot.object;
+import com.intellectualcrafters.plot.flag.Flag;
+import com.intellectualcrafters.plot.util.PlotHelper;
import org.bukkit.block.Biome;
import java.util.ArrayList;
@@ -32,6 +34,7 @@ import java.util.Set;
* plot settings
*
* @author Citymonstret
+ * @author Empire92
*/
public class PlotSettings {
/**
@@ -43,23 +46,26 @@ public class PlotSettings {
*/
private String alias;
/**
- * plot biome
+ * Comments
*/
- private Biome biome;
-
private ArrayList comments = null;
/**
- *
+ * Flags
*/
private Set flags;
-
+ /**
+ * Home Position
+ */
private PlotHomePosition position;
-
+ /**
+ * Plot
+ */
private Plot plot;
+
/**
* Constructor
*
- * @param plot
+ * @param plot object
*/
public PlotSettings(final Plot plot) {
this.alias = "";
@@ -73,8 +79,8 @@ public class PlotSettings {
* 2 = South
* 3 = West
*
- * @param direction
- * @return boolean
+ * @param direction Direction to check
+ * @return boolean merged
*/
public boolean getMerged(final int direction) {
return this.merged[direction];
@@ -107,14 +113,7 @@ public class PlotSettings {
}
/**
- * @param b
- */
- public void setBiome(final Biome b) {
- this.biome = b;
- }
-
- /**
- * @param flag
+ * @param flag to add
*/
public void addFlag(final Flag flag) {
final Flag hasFlag = getFlag(flag.getKey());
@@ -125,7 +124,9 @@ public class PlotSettings {
}
/**
- * @return
+ * Get all flags applied for the plot
+ *
+ * @return flags
*/
public Set getFlags() {
return this.flags;
@@ -164,22 +165,37 @@ public class PlotSettings {
}
/**
- * @param alias
+ * Set the plot alias
+ *
+ * @param alias alias to be used
*/
public void setAlias(final String alias) {
this.alias = alias;
}
public String getJoinMessage() {
+ Flag greeting = getFlag("greeting");
+ if (greeting != null) {
+ return greeting.getValue();
+ }
return "";
}
+ /**
+ * Get the "farewell" flag value
+ *
+ * @return Farewell flag
+ */
public String getLeaveMessage() {
+ Flag farewell = getFlag("farewell");
+ if (farewell != null) {
+ return farewell.getValue();
+ }
return "";
}
public ArrayList getComments(final int tier) {
- final ArrayList c = new ArrayList();
+ final ArrayList c = new ArrayList<>();
for (final PlotComment comment : this.comments) {
if (comment.tier == tier) {
c.add(comment);
@@ -206,7 +222,7 @@ public class PlotSettings {
public void addComment(final PlotComment comment) {
if (this.comments == null) {
- this.comments = new ArrayList();
+ this.comments = new ArrayList<>();
}
this.comments.add(comment);
}
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotWorld.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotWorld.java
similarity index 80%
rename from PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotWorld.java
rename to PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotWorld.java
index f4d7623e9..14631518a 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotWorld.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotWorld.java
@@ -19,8 +19,10 @@
// You can contact us via: support@intellectualsites.com /
////////////////////////////////////////////////////////////////////////////////////////////////////
-package com.intellectualcrafters.plot;
+package com.intellectualcrafters.plot.object;
+import com.intellectualcrafters.plot.config.Configuration;
+import com.intellectualcrafters.plot.config.ConfigurationNode;
import org.bukkit.Material;
import org.bukkit.block.Biome;
import org.bukkit.configuration.ConfigurationSection;
@@ -172,7 +174,47 @@ public abstract class PlotWorld {
}
}
- public String worldname;
+ /**
+ * Saving core plotworld settings
+ *
+ * @param config
+ */
+ public void saveConfiguration(final ConfigurationSection config) {
+ final HashMap options = new HashMap();
+
+ options.put("natural_mob_spawning", PlotWorld.MOB_SPAWNING_DEFAULT);
+ options.put("plot.auto_merge", PlotWorld.AUTO_MERGE_DEFAULT);
+ options.put("plot.biome", PlotWorld.PLOT_BIOME_DEFAULT.toString());
+ options.put("schematic.on_claim", PlotWorld.SCHEMATIC_ON_CLAIM_DEFAULT);
+ options.put("schematic.file", PlotWorld.SCHEMATIC_FILE_DEFAULT);
+ options.put("schematic.specify_on_claim", PlotWorld.SCHEMATIC_CLAIM_SPECIFY_DEFAULT);
+ options.put("schematic.schematics", PlotWorld.SCHEMATICS_DEFAULT);
+ options.put("economy.use", PlotWorld.USE_ECONOMY_DEFAULT);
+ options.put("economy.prices.claim", PlotWorld.PLOT_PRICE_DEFAULT);
+ options.put("economy.prices.merge", PlotWorld.MERGE_PRICE_DEFAULT);
+ options.put("economy.prices.sell", PlotWorld.SELL_PRICE_DEFAULT);
+ options.put("chat.enabled", PlotWorld.PLOT_CHAT_DEFAULT);
+ options.put("flags.default", PlotWorld.DEFAULT_FLAGS_DEFAULT);
+ options.put("event.pvp", PlotWorld.PVP_DEFAULT);
+ options.put("event.pve", PlotWorld.PVE_DEFAULT);
+ options.put("event.spawn.egg", PlotWorld.SPAWN_EGGS_DEFAULT);
+ options.put("event.spawn.custom", PlotWorld.SPAWN_CUSTOM_DEFAULT);
+ options.put("event.spawn.breeding", PlotWorld.SPAWN_BREEDING_DEFAULT);
+ final ConfigurationNode[] settings = getSettingNodes();
+
+ /*
+ * Saving generator specific settings
+ */
+ for (final ConfigurationNode setting : settings) {
+ options.put(setting.getConstant(), setting.getType().parseObject(setting.getValue()));
+ }
+
+ for (final String option : options.keySet()) {
+ if (!config.contains(option)) {
+ config.set(option, options.get(option));
+ }
+ }
+ } public String worldname;
/**
* Used for the /plot setup command Return null if you do not want to
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/StringWrapper.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/StringWrapper.java
similarity index 98%
rename from PlotSquared/src/main/java/com/intellectualcrafters/plot/StringWrapper.java
rename to PlotSquared/src/main/java/com/intellectualcrafters/plot/object/StringWrapper.java
index c94561ed0..8393433cf 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/StringWrapper.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/StringWrapper.java
@@ -19,7 +19,7 @@
// You can contact us via: support@intellectualsites.com /
////////////////////////////////////////////////////////////////////////////////////////////////////
-package com.intellectualcrafters.plot;
+package com.intellectualcrafters.plot.object;
/**
* @author Empire92
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/Title.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/Title.java
similarity index 99%
rename from PlotSquared/src/main/java/com/intellectualcrafters/plot/Title.java
rename to PlotSquared/src/main/java/com/intellectualcrafters/plot/object/Title.java
index 225b38754..14011de67 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/Title.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/Title.java
@@ -19,7 +19,7 @@
// You can contact us via: support@intellectualsites.com /
////////////////////////////////////////////////////////////////////////////////////////////////////
-package com.intellectualcrafters.plot;
+package com.intellectualcrafters.plot.object;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@@ -38,6 +38,11 @@ import java.util.Map;
*/
@SuppressWarnings("unused")
public class Title {
+ private static final Map, Class>> CORRESPONDING_TYPES;
+
+ static {
+ CORRESPONDING_TYPES = new HashMap<>();
+ }
/* Title packet */
private Class> packetTitle;
/* Title packet actions ENUM */
@@ -56,12 +61,6 @@ public class Title {
private int fadeOutTime = -1;
private boolean ticks = false;
- private static final Map, Class>> CORRESPONDING_TYPES;
-
- static {
- CORRESPONDING_TYPES = new HashMap<>();
- }
-
/**
* Create a new 1.8 title
*
@@ -102,6 +101,18 @@ public class Title {
loadClasses();
}
+ private static boolean equalsTypeArray(final Class>[] a, final Class>[] o) {
+ if (a.length != o.length) {
+ return false;
+ }
+ for (int i = 0; i < a.length; i++) {
+ if (!a[i].equals(o[i]) && !a[i].isAssignableFrom(o[i])) {
+ return false;
+ }
+ }
+ return true;
+ }
+
/**
* Load spigot and NMS classes
*/
@@ -325,18 +336,6 @@ public class Title {
return types;
}
- private static boolean equalsTypeArray(final Class>[] a, final Class>[] o) {
- if (a.length != o.length) {
- return false;
- }
- for (int i = 0; i < a.length; i++) {
- if (!a[i].equals(o[i]) && !a[i].isAssignableFrom(o[i])) {
- return false;
- }
- }
- return true;
- }
-
private Object getHandle(final Object obj) {
try {
return getMethod("getHandle", obj.getClass()).invoke(obj);
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/ConsoleColors.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ConsoleColors.java
similarity index 99%
rename from PlotSquared/src/main/java/com/intellectualcrafters/plot/ConsoleColors.java
rename to PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ConsoleColors.java
index d70d62106..53dcd40d1 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/ConsoleColors.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ConsoleColors.java
@@ -19,7 +19,7 @@
// You can contact us via: support@intellectualsites.com /
////////////////////////////////////////////////////////////////////////////////////////////////////
-package com.intellectualcrafters.plot;
+package com.intellectualcrafters.plot.util;
import org.bukkit.ChatColor;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/LSetCube.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/LSetCube.java
similarity index 99%
rename from PlotSquared/src/main/java/com/intellectualcrafters/plot/LSetCube.java
rename to PlotSquared/src/main/java/com/intellectualcrafters/plot/util/LSetCube.java
index 0a57246bb..78f861bea 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/LSetCube.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/LSetCube.java
@@ -19,7 +19,7 @@
// You can contact us via: support@intellectualsites.com /
////////////////////////////////////////////////////////////////////////////////////////////////////
-package com.intellectualcrafters.plot;
+package com.intellectualcrafters.plot.util;
import org.bukkit.Location;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/Lag.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/Lag.java
similarity index 98%
rename from PlotSquared/src/main/java/com/intellectualcrafters/plot/Lag.java
rename to PlotSquared/src/main/java/com/intellectualcrafters/plot/util/Lag.java
index 8046ac0dd..9a2391727 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/Lag.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/Lag.java
@@ -19,7 +19,7 @@
// You can contact us via: support@intellectualsites.com /
////////////////////////////////////////////////////////////////////////////////////////////////////
-package com.intellectualcrafters.plot;
+package com.intellectualcrafters.plot.util;
/**
* TPS and Lag Checker.
@@ -78,12 +78,6 @@ public class Lag implements Runnable {
return System.currentTimeMillis() - t;
}
- @Override
- public void run() {
- T[TC % T.length] = System.currentTimeMillis();
- TC++;
- }
-
/**
* Get lag percentage
*
@@ -101,4 +95,10 @@ public class Lag implements Runnable {
public static double getFullPercentage() {
return getTPS() * 5.0D;
}
+
+ @Override
+ public void run() {
+ T[TC % T.length] = System.currentTimeMillis();
+ TC++;
+ }
}
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/Logger.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/Logger.java
similarity index 96%
rename from PlotSquared/src/main/java/com/intellectualcrafters/plot/Logger.java
rename to PlotSquared/src/main/java/com/intellectualcrafters/plot/util/Logger.java
index 49fde0d84..df2d8ea2d 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/Logger.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/Logger.java
@@ -19,7 +19,10 @@
// You can contact us via: support@intellectualsites.com /
////////////////////////////////////////////////////////////////////////////////////////////////////
-package com.intellectualcrafters.plot;
+package com.intellectualcrafters.plot.util;
+
+import com.intellectualcrafters.plot.PlotMain;
+import com.intellectualcrafters.plot.config.C;
import java.io.*;
import java.util.ArrayList;
@@ -50,22 +53,6 @@ public class Logger {
}
}
- public enum LogLevel {
- GENERAL("General"),
- WARNING("Warning"),
- DANGER("Danger");
- private final String name;
-
- LogLevel(final String name) {
- this.name = name;
- }
-
- @Override
- public String toString() {
- return this.name;
- }
- }
-
public static void write() throws IOException {
final FileWriter writer = new FileWriter(log);
for (final String string : entries) {
@@ -81,4 +68,20 @@ public class Logger {
private static void append(final String string) {
entries.add("[" + new Date().toString() + "]" + string);
}
+
+ public enum LogLevel {
+ GENERAL("General"),
+ WARNING("Warning"),
+ DANGER("Danger");
+ private final String name;
+
+ LogLevel(final String name) {
+ this.name = name;
+ }
+
+ @Override
+ public String toString() {
+ return this.name;
+ }
+ }
}
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/Metrics.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/Metrics.java
similarity index 99%
rename from PlotSquared/src/main/java/com/intellectualcrafters/plot/Metrics.java
rename to PlotSquared/src/main/java/com/intellectualcrafters/plot/util/Metrics.java
index 087f782c1..68031c3db 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/Metrics.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/Metrics.java
@@ -19,7 +19,7 @@
// You can contact us via: support@intellectualsites.com /
////////////////////////////////////////////////////////////////////////////////////////////////////
-package com.intellectualcrafters.plot;
+package com.intellectualcrafters.plot.util;
import org.bukkit.Bukkit;
import org.bukkit.configuration.InvalidConfigurationException;
@@ -111,6 +111,114 @@ public class Metrics {
this.debug = this.configuration.getBoolean("debug", false);
}
+ /**
+ * GZip compress a string of bytes
+ *
+ * @param input
+ * @return
+ */
+ public static byte[] gzip(final String input) {
+ final ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ GZIPOutputStream gzos = null;
+ try {
+ gzos = new GZIPOutputStream(baos);
+ gzos.write(input.getBytes("UTF-8"));
+ } catch (final IOException e) {
+ e.printStackTrace();
+ } finally {
+ if (gzos != null) {
+ try {
+ gzos.close();
+ } catch (final IOException ignore) {
+ }
+ }
+ }
+ return baos.toByteArray();
+ }
+
+ /**
+ * Appends a json encoded key/value pair to the given string builder.
+ *
+ * @param json
+ * @param key
+ * @param value
+ * @throws UnsupportedEncodingException
+ */
+ private static void appendJSONPair(final StringBuilder json, final String key, final String value) throws UnsupportedEncodingException {
+ boolean isValueNumeric = false;
+ try {
+ if (value.equals("0") || !value.endsWith("0")) {
+ Double.parseDouble(value);
+ isValueNumeric = true;
+ }
+ } catch (final NumberFormatException e) {
+ isValueNumeric = false;
+ }
+ if (json.charAt(json.length() - 1) != '{') {
+ json.append(',');
+ }
+ json.append(escapeJSON(key));
+ json.append(':');
+ if (isValueNumeric) {
+ json.append(value);
+ } else {
+ json.append(escapeJSON(value));
+ }
+ }
+
+ /**
+ * Escape a string to create a valid JSON string
+ *
+ * @param text
+ * @return
+ */
+ private static String escapeJSON(final String text) {
+ final StringBuilder builder = new StringBuilder();
+ builder.append('"');
+ for (int index = 0; index < text.length(); index++) {
+ final char chr = text.charAt(index);
+ switch (chr) {
+ case '"':
+ case '\\':
+ builder.append('\\');
+ builder.append(chr);
+ break;
+ case '\b':
+ builder.append("\\b");
+ break;
+ case '\t':
+ builder.append("\\t");
+ break;
+ case '\n':
+ builder.append("\\n");
+ break;
+ case '\r':
+ builder.append("\\r");
+ break;
+ default:
+ if (chr < ' ') {
+ final String t = "000" + Integer.toHexString(chr);
+ builder.append("\\u" + t.substring(t.length() - 4));
+ } else {
+ builder.append(chr);
+ }
+ break;
+ }
+ }
+ builder.append('"');
+ return builder.toString();
+ }
+
+ /**
+ * Encode text as UTF-8
+ *
+ * @param text the text to encode
+ * @return the encoded text, as UTF-8
+ */
+ private static String urlEncode(final String text) throws UnsupportedEncodingException {
+ return URLEncoder.encode(text, "UTF-8");
+ }
+
/**
* Construct and create a Graph that can be used to separate specific
* plotters to their own graphs on the metrics website. Plotters can be
@@ -445,31 +553,6 @@ public class Metrics {
}
}
- /**
- * GZip compress a string of bytes
- *
- * @param input
- * @return
- */
- public static byte[] gzip(final String input) {
- final ByteArrayOutputStream baos = new ByteArrayOutputStream();
- GZIPOutputStream gzos = null;
- try {
- gzos = new GZIPOutputStream(baos);
- gzos.write(input.getBytes("UTF-8"));
- } catch (final IOException e) {
- e.printStackTrace();
- } finally {
- if (gzos != null) {
- try {
- gzos.close();
- } catch (final IOException ignore) {
- }
- }
- }
- return baos.toByteArray();
- }
-
/**
* Check if mineshafter is present. If it is, we need to bypass it to send
* POST requests
@@ -485,89 +568,6 @@ public class Metrics {
}
}
- /**
- * Appends a json encoded key/value pair to the given string builder.
- *
- * @param json
- * @param key
- * @param value
- * @throws UnsupportedEncodingException
- */
- private static void appendJSONPair(final StringBuilder json, final String key, final String value) throws UnsupportedEncodingException {
- boolean isValueNumeric = false;
- try {
- if (value.equals("0") || !value.endsWith("0")) {
- Double.parseDouble(value);
- isValueNumeric = true;
- }
- } catch (final NumberFormatException e) {
- isValueNumeric = false;
- }
- if (json.charAt(json.length() - 1) != '{') {
- json.append(',');
- }
- json.append(escapeJSON(key));
- json.append(':');
- if (isValueNumeric) {
- json.append(value);
- } else {
- json.append(escapeJSON(value));
- }
- }
-
- /**
- * Escape a string to create a valid JSON string
- *
- * @param text
- * @return
- */
- private static String escapeJSON(final String text) {
- final StringBuilder builder = new StringBuilder();
- builder.append('"');
- for (int index = 0; index < text.length(); index++) {
- final char chr = text.charAt(index);
- switch (chr) {
- case '"':
- case '\\':
- builder.append('\\');
- builder.append(chr);
- break;
- case '\b':
- builder.append("\\b");
- break;
- case '\t':
- builder.append("\\t");
- break;
- case '\n':
- builder.append("\\n");
- break;
- case '\r':
- builder.append("\\r");
- break;
- default:
- if (chr < ' ') {
- final String t = "000" + Integer.toHexString(chr);
- builder.append("\\u" + t.substring(t.length() - 4));
- } else {
- builder.append(chr);
- }
- break;
- }
- }
- builder.append('"');
- return builder.toString();
- }
-
- /**
- * Encode text as UTF-8
- *
- * @param text the text to encode
- * @return the encoded text, as UTF-8
- */
- private static String urlEncode(final String text) throws UnsupportedEncodingException {
- return URLEncoder.encode(text, "UTF-8");
- }
-
/**
* Represents a custom graph on the website
*/
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PWE.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/PWE.java
similarity index 97%
rename from PlotSquared/src/main/java/com/intellectualcrafters/plot/PWE.java
rename to PlotSquared/src/main/java/com/intellectualcrafters/plot/util/PWE.java
index 2f2e1439f..6bdac9b9a 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PWE.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/PWE.java
@@ -19,9 +19,12 @@
// You can contact us via: support@intellectualsites.com /
////////////////////////////////////////////////////////////////////////////////////////////////////
-package com.intellectualcrafters.plot;
+package com.intellectualcrafters.plot.util;
+import com.intellectualcrafters.plot.PlotMain;
import com.intellectualcrafters.plot.database.DBFunc;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotId;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.LocalWorld;
import com.sk89q.worldedit.Vector;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlayerFunctions.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/PlayerFunctions.java
similarity index 96%
rename from PlotSquared/src/main/java/com/intellectualcrafters/plot/PlayerFunctions.java
rename to PlotSquared/src/main/java/com/intellectualcrafters/plot/util/PlayerFunctions.java
index d69608228..fb1e4d57a 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlayerFunctions.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/PlayerFunctions.java
@@ -19,8 +19,15 @@
// You can contact us via: support@intellectualsites.com /
////////////////////////////////////////////////////////////////////////////////////////////////////
-package com.intellectualcrafters.plot;
+package com.intellectualcrafters.plot.util;
+import com.intellectualcrafters.plot.PlotMain;
+import com.intellectualcrafters.plot.config.C;
+import com.intellectualcrafters.plot.config.Settings;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotId;
+import com.intellectualcrafters.plot.object.PlotManager;
+import com.intellectualcrafters.plot.object.PlotWorld;
import org.bukkit.*;
import org.bukkit.block.Biome;
import org.bukkit.entity.Player;
@@ -292,7 +299,7 @@ public class PlayerFunctions {
*
* @param plr Player to recieve message
* @param c Caption to send
- * @return
+ * @return
*/
public static boolean sendMessage(final Player plr, final C c, final String... args) {
if (c.s().length() > 1) {
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotHelper.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/PlotHelper.java
similarity index 99%
rename from PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotHelper.java
rename to PlotSquared/src/main/java/com/intellectualcrafters/plot/util/PlotHelper.java
index 2b0ea2c5d..94229e43a 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotHelper.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/PlotHelper.java
@@ -19,10 +19,13 @@
// You can contact us via: support@intellectualsites.com /
////////////////////////////////////////////////////////////////////////////////////////////////////
-package com.intellectualcrafters.plot;
+package com.intellectualcrafters.plot.util;
+import com.intellectualcrafters.plot.PlotMain;
+import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.listeners.PlotListener;
+import com.intellectualcrafters.plot.object.*;
import net.milkbowl.vault.economy.Economy;
import org.bukkit.*;
import org.bukkit.block.Biome;
@@ -44,6 +47,8 @@ import java.util.UUID;
*/
public class PlotHelper {
public static boolean canSetFast = false;
+ public static ArrayList runners_p = new ArrayList();
+ public static HashMap runners = new HashMap();
static long state = 1;
/**
@@ -209,6 +214,10 @@ public class PlotHelper {
return a;
}
+ /*
+ * End of random number gen section
+ */
+
public static final long xorShift64(long a) {
a ^= (a << 21);
a ^= (a >>> 35);
@@ -224,10 +233,6 @@ public class PlotHelper {
return (int) r;
}
- /*
- * End of random number gen section
- */
-
public static void removeSign(final World world, final Plot p) {
final PlotManager manager = PlotMain.getPlotManager(world);
final PlotWorld plotworld = PlotMain.getWorldSettings(world);
@@ -429,22 +434,6 @@ public class PlotHelper {
return world.getEntities().size();
}
- public static int getTileEntities(final World world) {
- PlotMain.getWorldSettings(world);
- int x = 0;
- for (final Chunk chunk : world.getLoadedChunks()) {
- x += chunk.getTileEntities().length;
- }
- return x;
- }
-
- public static double getWorldFolderSize(final World world) {
- // long size = FileUtil.sizeOfDirectory(world.getWorldFolder());
- final File folder = world.getWorldFolder();
- final long size = folder.length();
- return (((size) / 1024) / 1024);
- }
-
// public static void adjustLinkedPlots(String id) {
// World world = Bukkit.getWorld(Settings.PLOT_WORLD);
// int x = getIdX(id);
@@ -601,13 +590,26 @@ public class PlotHelper {
// }
// }
+ public static int getTileEntities(final World world) {
+ PlotMain.getWorldSettings(world);
+ int x = 0;
+ for (final Chunk chunk : world.getLoadedChunks()) {
+ x += chunk.getTileEntities().length;
+ }
+ return x;
+ }
+
+ public static double getWorldFolderSize(final World world) {
+ // long size = FileUtil.sizeOfDirectory(world.getWorldFolder());
+ final File folder = world.getWorldFolder();
+ final long size = folder.length();
+ return (((size) / 1024) / 1024);
+ }
+
public static String createId(final int x, final int z) {
return x + ";" + z;
}
- public static ArrayList runners_p = new ArrayList();
- public static HashMap runners = new HashMap();
-
public static void adjustWallFilling(final Player requester, final Plot plot, final PlotBlock block) {
if (runners.containsKey(plot)) {
PlayerFunctions.sendMessage(requester, C.WAIT_FOR_TIMER);
@@ -809,7 +811,6 @@ public class PlotHelper {
}
}
- plot.settings.setBiome(b);
PlotMain.updatePlot(plot);
refreshPlotChunks(world, plot);
}
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotSquaredException.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/PlotSquaredException.java
similarity index 96%
rename from PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotSquaredException.java
rename to PlotSquared/src/main/java/com/intellectualcrafters/plot/util/PlotSquaredException.java
index edfea17df..e88888c04 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotSquaredException.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/PlotSquaredException.java
@@ -19,7 +19,9 @@
// You can contact us via: support@intellectualsites.com /
////////////////////////////////////////////////////////////////////////////////////////////////////
-package com.intellectualcrafters.plot;
+package com.intellectualcrafters.plot.util;
+
+import com.intellectualcrafters.plot.PlotMain;
/**
* Created by Citymonstret on 2014-09-29.
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/RUtils.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/RUtils.java
similarity index 86%
rename from PlotSquared/src/main/java/com/intellectualcrafters/plot/RUtils.java
rename to PlotSquared/src/main/java/com/intellectualcrafters/plot/util/RUtils.java
index daad036f5..778517c74 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/RUtils.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/RUtils.java
@@ -19,8 +19,10 @@
// You can contact us via: support@intellectualsites.com /
////////////////////////////////////////////////////////////////////////////////////////////////////
-package com.intellectualcrafters.plot;
+package com.intellectualcrafters.plot.util;
+import com.intellectualcrafters.plot.config.C;
+import com.intellectualcrafters.plot.config.Settings;
import org.bukkit.Location;
import org.bukkit.entity.Player;
@@ -29,20 +31,39 @@ import org.bukkit.entity.Player;
*
* @author Citymonstret
*/
+@SuppressWarnings("unused")
public class RUtils {
+ /**
+ * Get the total allocated ram
+ *
+ * @return total ram
+ */
public static long getTotalRam() {
- return (Runtime.getRuntime().maxMemory() / 1024) / 1024;
+ return (Runtime.getRuntime().totalMemory() / 1024) / 1024;
}
+ /**
+ * Get the total free ram
+ * @return free ram
+ */
public static long getFreeRam() {
return (Runtime.getRuntime().freeMemory() / 1024) / 1024;
}
+ /**
+ * Percentage of used ram
+ * @return percentage
+ */
public static long getRamPercentage() {
return (getFreeRam() / getTotalRam()) * 100;
}
+ /**
+ * Get formatted time
+ * @param sec seconds
+ * @return formatted time
+ */
public static String formatTime(final double sec) {
final double h = sec / 3600;
final double m = (sec % 3600) / 60;
@@ -55,22 +76,11 @@ public class RUtils {
return string.replaceAll("%sec%", s_s).replaceAll("%min%", s_m).replaceAll("%hours%", s_h);
}
- enum Direction {
- SOUTH(0),
- EAST(1),
- NORTH(2),
- WEST(3);
- private final int i;
-
- Direction(final int i) {
- this.i = i;
- }
-
- public int getInt() {
- return this.i;
- }
- }
-
+ /**
+ * Force textures on the client
+ *
+ * @param p texture to force
+ */
public void forceTexture(final Player p) {
p.setResourcePack(Settings.PLOT_SPECIFIC_RESOURCE_PACK);
}
@@ -97,4 +107,20 @@ public class RUtils {
return getDirection(l1) == getDirection(l2);
}
+ enum Direction {
+ SOUTH(0),
+ EAST(1),
+ NORTH(2),
+ WEST(3);
+ private final int i;
+
+ Direction(final int i) {
+ this.i = i;
+ }
+
+ public int getInt() {
+ return this.i;
+ }
+ }
+
}
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/ReflectionUtils.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ReflectionUtils.java
similarity index 99%
rename from PlotSquared/src/main/java/com/intellectualcrafters/plot/ReflectionUtils.java
rename to PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ReflectionUtils.java
index bc8d7e195..600fc1425 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/ReflectionUtils.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ReflectionUtils.java
@@ -19,7 +19,7 @@
// You can contact us via: support@intellectualsites.com /
////////////////////////////////////////////////////////////////////////////////////////////////////
-package com.intellectualcrafters.plot;
+package com.intellectualcrafters.plot.util;
import org.bukkit.Bukkit;
import org.bukkit.Server;
@@ -120,6 +120,10 @@ public class ReflectionUtils {
public static class RefClass {
private final Class> clazz;
+ private RefClass(final Class> clazz) {
+ this.clazz = clazz;
+ }
+
/**
* get passed class
*
@@ -129,10 +133,6 @@ public class ReflectionUtils {
return this.clazz;
}
- private RefClass(final Class> clazz) {
- this.clazz = clazz;
- }
-
/**
* see {@link Class#isInstance(Object)}
*
@@ -374,6 +374,11 @@ public class ReflectionUtils {
public static class RefMethod {
private final Method method;
+ private RefMethod(final Method method) {
+ this.method = method;
+ method.setAccessible(true);
+ }
+
/**
* @return passed method
*/
@@ -395,11 +400,6 @@ public class ReflectionUtils {
return new RefClass(this.method.getReturnType());
}
- private RefMethod(final Method method) {
- this.method = method;
- method.setAccessible(true);
- }
-
/**
* apply method to object
*
@@ -454,6 +454,11 @@ public class ReflectionUtils {
public static class RefConstructor {
private final Constructor constructor;
+ private RefConstructor(final Constructor constructor) {
+ this.constructor = constructor;
+ constructor.setAccessible(true);
+ }
+
/**
* @return passed constructor
*/
@@ -468,11 +473,6 @@ public class ReflectionUtils {
return new RefClass(this.constructor.getDeclaringClass());
}
- private RefConstructor(final Constructor constructor) {
- this.constructor = constructor;
- constructor.setAccessible(true);
- }
-
/**
* create new instance with constructor
*
@@ -492,6 +492,11 @@ public class ReflectionUtils {
public static class RefField {
private final Field field;
+ private RefField(final Field field) {
+ this.field = field;
+ field.setAccessible(true);
+ }
+
/**
* @return passed field
*/
@@ -513,11 +518,6 @@ public class ReflectionUtils {
return new RefClass(this.field.getType());
}
- private RefField(final Field field) {
- this.field = field;
- field.setAccessible(true);
- }
-
/**
* apply fiend for object
*
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/SchematicHandler.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/SchematicHandler.java
similarity index 98%
rename from PlotSquared/src/main/java/com/intellectualcrafters/plot/SchematicHandler.java
rename to PlotSquared/src/main/java/com/intellectualcrafters/plot/util/SchematicHandler.java
index 32308d6c8..6e2c5c1c0 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/SchematicHandler.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/SchematicHandler.java
@@ -19,9 +19,13 @@
// You can contact us via: support@intellectualsites.com /
////////////////////////////////////////////////////////////////////////////////////////////////////
-package com.intellectualcrafters.plot;
+package com.intellectualcrafters.plot.util;
import com.intellectualcrafters.jnbt.*;
+import com.intellectualcrafters.plot.PlotMain;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotBlock;
+import com.intellectualcrafters.plot.object.PlotId;
import org.bukkit.Chunk;
import org.bukkit.Location;
import org.bukkit.World;
@@ -214,64 +218,6 @@ public class SchematicHandler {
return schematic;
}
- /**
- * Schematic Class
- *
- * @author Citymonstret
- */
- public static class Schematic {
- private final DataCollection[] blockCollection;
- private final Dimension schematicDimension;
- private final File file;
-
- public Schematic(final DataCollection[] blockCollection, final Dimension schematicDimension, final File file) {
- this.blockCollection = blockCollection;
- this.schematicDimension = schematicDimension;
- this.file = file;
- }
-
- public File getFile() {
- return this.file;
- }
-
- public Dimension getSchematicDimension() {
- return this.schematicDimension;
- }
-
- public DataCollection[] getBlockCollection() {
- return this.blockCollection;
- }
- }
-
- /**
- * Schematic Dimensions
- *
- * @author Citymonstret
- */
- public static class Dimension {
- private final int x;
- private final int y;
- private final int z;
-
- public Dimension(final int x, final int y, final int z) {
- this.x = x;
- this.y = y;
- this.z = z;
- }
-
- public int getX() {
- return this.x;
- }
-
- public int getY() {
- return this.y;
- }
-
- public int getZ() {
- return this.z;
- }
- }
-
/**
* Saves a schematic to a file path
*
@@ -392,31 +338,6 @@ public class SchematicHandler {
return new CompoundTag("Schematic", schematic);
}
- /**
- * Schematic Data Collection
- *
- * @author Citymonstret
- */
- public static class DataCollection {
- private final short block;
- private final byte data;
-
- // public CompoundTag tag;
-
- public DataCollection(final short block, final byte data) {
- this.block = block;
- this.data = data;
- }
-
- public short getBlock() {
- return this.block;
- }
-
- public byte getData() {
- return this.data;
- }
- }
-
public static boolean pastePart(final World world, final DataCollection[] blocks, final Location l1, final int x_offset, final int z_offset, final int i1, final int i2, final int WIDTH, final int LENGTH) {
boolean result = false;
for (int i = i1; i <= i2; i++) {
@@ -448,4 +369,87 @@ public class SchematicHandler {
}
return result;
}
+
+ /**
+ * Schematic Class
+ *
+ * @author Citymonstret
+ */
+ public static class Schematic {
+ private final DataCollection[] blockCollection;
+ private final Dimension schematicDimension;
+ private final File file;
+
+ public Schematic(final DataCollection[] blockCollection, final Dimension schematicDimension, final File file) {
+ this.blockCollection = blockCollection;
+ this.schematicDimension = schematicDimension;
+ this.file = file;
+ }
+
+ public File getFile() {
+ return this.file;
+ }
+
+ public Dimension getSchematicDimension() {
+ return this.schematicDimension;
+ }
+
+ public DataCollection[] getBlockCollection() {
+ return this.blockCollection;
+ }
+ }
+
+ /**
+ * Schematic Dimensions
+ *
+ * @author Citymonstret
+ */
+ public static class Dimension {
+ private final int x;
+ private final int y;
+ private final int z;
+
+ public Dimension(final int x, final int y, final int z) {
+ this.x = x;
+ this.y = y;
+ this.z = z;
+ }
+
+ public int getX() {
+ return this.x;
+ }
+
+ public int getY() {
+ return this.y;
+ }
+
+ public int getZ() {
+ return this.z;
+ }
+ }
+
+ /**
+ * Schematic Data Collection
+ *
+ * @author Citymonstret
+ */
+ public static class DataCollection {
+ private final short block;
+ private final byte data;
+
+ // public CompoundTag tag;
+
+ public DataCollection(final short block, final byte data) {
+ this.block = block;
+ this.data = data;
+ }
+
+ public short getBlock() {
+ return this.block;
+ }
+
+ public byte getData() {
+ return this.data;
+ }
+ }
}
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/SetBlockFast.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/SetBlockFast.java
similarity index 93%
rename from PlotSquared/src/main/java/com/intellectualcrafters/plot/SetBlockFast.java
rename to PlotSquared/src/main/java/com/intellectualcrafters/plot/util/SetBlockFast.java
index 14d6a45ac..6d080f717 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/SetBlockFast.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/SetBlockFast.java
@@ -19,13 +19,13 @@
// You can contact us via: support@intellectualsites.com /
////////////////////////////////////////////////////////////////////////////////////////////////////
-package com.intellectualcrafters.plot;
+package com.intellectualcrafters.plot.util;
-import com.intellectualcrafters.plot.ReflectionUtils.RefClass;
-import com.intellectualcrafters.plot.ReflectionUtils.RefMethod;
+import com.intellectualcrafters.plot.util.ReflectionUtils.RefClass;
+import com.intellectualcrafters.plot.util.ReflectionUtils.RefMethod;
import org.bukkit.Bukkit;
-import static com.intellectualcrafters.plot.ReflectionUtils.getRefClass;
+import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
/**
* SetBlockFast class
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/StringComparsion.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/StringComparison.java
similarity index 77%
rename from PlotSquared/src/main/java/com/intellectualcrafters/plot/StringComparsion.java
rename to PlotSquared/src/main/java/com/intellectualcrafters/plot/util/StringComparison.java
index 3c81680a3..58f011d70 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/StringComparsion.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/StringComparison.java
@@ -19,24 +19,42 @@
// You can contact us via: support@intellectualsites.com /
////////////////////////////////////////////////////////////////////////////////////////////////////
-package com.intellectualcrafters.plot;
+package com.intellectualcrafters.plot.util;
import java.util.ArrayList;
import java.util.Collections;
/**
- * String comparsion library
+ * String comparison library
*
* @author Citymonstret
*/
-public class StringComparsion {
+@SuppressWarnings("unused")
+public class StringComparison {
+ /**
+ * Best Match
+ */
private String bestMatch;
+ /**
+ * Match Value
+ *
+ * Can be checked for low match (< .25 or something)
+ */
private double match = 0;
+ /**
+ * The actual object
+ */
private Object bestMatchObject;
- public StringComparsion(final String input, final Object[] objects) {
- double c = 0;
+ /**
+ * Constructor
+ *
+ * @param input Input Base Value
+ * @param objects Objects to compare
+ */
+ public StringComparison(final String input, final Object[] objects) {
+ double c;
this.bestMatch = objects[0].toString();
this.bestMatchObject = objects[0];
for (final Object o : objects) {
@@ -48,18 +66,13 @@ public class StringComparsion {
}
}
- public Object getMatchObject() {
- return this.bestMatchObject;
- }
-
- public String getBestMatch() {
- return this.bestMatch;
- }
-
- public Object[] getBestMatchAdvanced() {
- return new Object[]{this.match, this.bestMatch};
- }
-
+ /**
+ * Compare two strings
+ *
+ * @param s1 String Base
+ * @param s2 Object
+ * @return match
+ */
public static double compare(final String s1, final String s2) {
final ArrayList p1 = wLetterPair(s1.toUpperCase()), p2 = wLetterPair(s2.toUpperCase());
int intersection = 0;
@@ -76,6 +89,12 @@ public class StringComparsion {
return (2.0 * intersection) / union;
}
+ /**
+ * Create an ArrayList containing pairs of letters
+ *
+ * @param s string to split
+ * @return ArrayList
+ */
public static ArrayList wLetterPair(final String s) {
final ArrayList aPairs = new ArrayList<>();
final String[] wo = s.split("\\s");
@@ -86,6 +105,12 @@ public class StringComparsion {
return aPairs;
}
+ /**
+ * Get an array containing letter pairs
+ *
+ * @param s string to split
+ * @return Array
+ */
public static String[] sLetterPair(final String s) {
final int numPair = s.length() - 1;
final String[] p = new String[numPair];
@@ -95,4 +120,31 @@ public class StringComparsion {
return p;
}
+ /**
+ * Get the object
+ *
+ * @return match object
+ */
+ public Object getMatchObject() {
+ return this.bestMatchObject;
+ }
+
+ /**
+ * Get the best match value
+ *
+ * @return match value
+ */
+ public String getBestMatch() {
+ return this.bestMatch;
+ }
+
+ /**
+ * Will return both the match number, and the actual match string
+ *
+ * @return object[] containing: double, String
+ */
+ public Object[] getBestMatchAdvanced() {
+ return new Object[]{this.match, this.bestMatch};
+ }
+
}
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/UUIDHandler.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/UUIDHandler.java
similarity index 98%
rename from PlotSquared/src/main/java/com/intellectualcrafters/plot/UUIDHandler.java
rename to PlotSquared/src/main/java/com/intellectualcrafters/plot/util/UUIDHandler.java
index 4ce241d6c..cd3b23a8c 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/UUIDHandler.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/UUIDHandler.java
@@ -19,11 +19,14 @@
// You can contact us via: support@intellectualsites.com /
////////////////////////////////////////////////////////////////////////////////////////////////////
-package com.intellectualcrafters.plot;
+package com.intellectualcrafters.plot.util;
import com.google.common.base.Charsets;
import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;
+import com.intellectualcrafters.plot.PlotMain;
+import com.intellectualcrafters.plot.config.Settings;
+import com.intellectualcrafters.plot.object.StringWrapper;
import com.intellectualcrafters.plot.uuid.NameFetcher;
import com.intellectualcrafters.plot.uuid.UUIDFetcher;
import com.intellectualcrafters.plot.uuid.UUIDSaver;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/uuid/PlotUUIDSaver.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/uuid/PlotUUIDSaver.java
index 9e89f9f96..826a2a52d 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/uuid/PlotUUIDSaver.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/uuid/PlotUUIDSaver.java
@@ -25,9 +25,9 @@ import com.google.common.collect.BiMap;
import com.intellectualcrafters.json.JSONObject;
import com.intellectualcrafters.json.JSONTokener;
import com.intellectualcrafters.plot.PlotMain;
-import com.intellectualcrafters.plot.Settings;
-import com.intellectualcrafters.plot.StringWrapper;
-import com.intellectualcrafters.plot.UUIDHandler;
+import com.intellectualcrafters.plot.config.Settings;
+import com.intellectualcrafters.plot.object.StringWrapper;
+import com.intellectualcrafters.plot.util.UUIDHandler;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.plugin.java.JavaPlugin;
diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/uuid/UUIDSaver.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/uuid/UUIDSaver.java
index 005496357..5acfe91d6 100644
--- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/uuid/UUIDSaver.java
+++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/uuid/UUIDSaver.java
@@ -22,7 +22,7 @@
package com.intellectualcrafters.plot.uuid;
import com.google.common.collect.BiMap;
-import com.intellectualcrafters.plot.StringWrapper;
+import com.intellectualcrafters.plot.object.StringWrapper;
import java.util.UUID;
diff --git a/PlotSquared/src/test/java/Test1.java b/PlotSquared/src/test/java/Test1.java
index 83baa39a5..161f8cfbc 100644
--- a/PlotSquared/src/test/java/Test1.java
+++ b/PlotSquared/src/test/java/Test1.java
@@ -1,41 +1,30 @@
+import com.intellectualcrafters.plot.PlotMain;
+import com.intellectualcrafters.plot.config.Settings;
+import com.intellectualcrafters.plot.database.AbstractDB;
+import com.intellectualcrafters.plot.database.DBFunc;
+import com.intellectualcrafters.plot.flag.Flag;
+import com.intellectualcrafters.plot.generator.DefaultPlotManager;
+import com.intellectualcrafters.plot.generator.DefaultPlotWorld;
+import com.intellectualcrafters.plot.object.*;
+import com.intellectualcrafters.plot.util.PlotHelper;
+import com.intellectualcrafters.plot.util.SetBlockFast;
+import org.bukkit.OfflinePlayer;
+import org.bukkit.block.Biome;
+import org.junit.Assert;
+import org.junit.Test;
+
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.UUID;
-import org.bukkit.Bukkit;
-import org.bukkit.OfflinePlayer;
-import org.bukkit.block.Biome;
-import org.bukkit.plugin.java.JavaPlugin;
-import org.junit.Assert;
-import org.junit.Test;
-
-import com.intellectualcrafters.plot.Flag;
-import com.intellectualcrafters.plot.Plot;
-import com.intellectualcrafters.plot.PlotComment;
-import com.intellectualcrafters.plot.PlotHelper;
-import com.intellectualcrafters.plot.PlotHomePosition;
-import com.intellectualcrafters.plot.PlotId;
-import com.intellectualcrafters.plot.PlotMain;
-import com.intellectualcrafters.plot.PlotManager;
-import com.intellectualcrafters.plot.PlotWorld;
-import com.intellectualcrafters.plot.SchematicHandler;
-import com.intellectualcrafters.plot.SetBlockFast;
-import com.intellectualcrafters.plot.Settings;
-import com.intellectualcrafters.plot.commands.Schematic;
-import com.intellectualcrafters.plot.database.AbstractDB;
-import com.intellectualcrafters.plot.database.DBFunc;
-import com.intellectualcrafters.plot.generator.DefaultPlotManager;
-import com.intellectualcrafters.plot.generator.DefaultPlotWorld;
-import com.sk89q.worldguard.bukkit.BukkitBlacklist;
-
public class Test1 {
static Integer count = 0;
-
+
// I have no idea what I should actually test :p
-
-
+
+
public boolean nextTest() {
Test1.count++;
switch (Test1.count) {
@@ -60,196 +49,250 @@ public class Test1 {
}
return false;
}
-
- @Test public void t1() {Assert.assertTrue(nextTest());}
- @Test public void t2() {Assert.assertTrue(nextTest());}
- @Test public void t3() {Assert.assertTrue(nextTest());}
- @Test public void t4() {Assert.assertTrue(nextTest());}
- @Test public void t5() {Assert.assertTrue(nextTest());}
- @Test public void t6() {Assert.assertTrue(nextTest());}
- @Test public void t7() {Assert.assertTrue(nextTest());}
- @Test public void t8() {Assert.assertTrue(nextTest());}
- @Test public void t9() {Assert.assertTrue(nextTest());}
+
+ @Test
+ public void t1() {
+ Assert.assertTrue(nextTest());
+ }
+
+ @Test
+ public void t2() {
+ Assert.assertTrue(nextTest());
+ }
+
+ @Test
+ public void t3() {
+ Assert.assertTrue(nextTest());
+ }
+
+ @Test
+ public void t4() {
+ Assert.assertTrue(nextTest());
+ }
+
+ @Test
+ public void t5() {
+ Assert.assertTrue(nextTest());
+ }
+
+ @Test
+ public void t6() {
+ Assert.assertTrue(nextTest());
+ }
+
+ @Test
+ public void t7() {
+ Assert.assertTrue(nextTest());
+ }
+
+ @Test
+ public void t8() {
+ Assert.assertTrue(nextTest());
+ }
+
+ @Test
+ public void t9() {
+ Assert.assertTrue(nextTest());
+ }
public boolean test1_Square() {
return PlotHelper.square(5) == 25;
}
-
+
public boolean test2_InitMain() {
boolean passed = false;
try {
PlotMain plugin = PlotMain.getMain();
passed = plugin != null;
- }
- catch (Throwable e) {
-
+ } catch (Throwable e) {
+
}
return passed;
}
-
+
public boolean test3_InitPlotId() {
boolean passed = false;
try {
- Object id = new PlotId(0,0);
+ Object id = new PlotId(0, 0);
passed = id != null;
- }
- catch (Throwable e) {
-
+ } catch (Throwable e) {
+
}
return passed;
}
-
+
public boolean test4_InitPlot() {
boolean passed = false;
try {
- Object plot = new Plot(new PlotId(0,0), DBFunc.everyone, Biome.FOREST, new ArrayList(), new ArrayList(), new ArrayList(), null, PlotHomePosition.DEFAULT, null, "testworld", new boolean[] {false, false, false, false} );
+ Object plot = new Plot(new PlotId(0, 0), DBFunc.everyone, Biome.FOREST, new ArrayList(), new ArrayList(), new ArrayList(), null, PlotHomePosition.DEFAULT, null, "testworld", new boolean[]{false, false, false, false});
passed = plot != null;
- }
- catch (Throwable e) {
-
+ } catch (Throwable e) {
+
}
return passed;
}
-
+
public boolean test5_InitDBFunc() {
-
+
Settings.DB.USE_MONGO = true;
Settings.DB.USE_MYSQL = false;
Settings.DB.USE_SQLITE = false;
-
+
boolean passed = false;
try {
DBFunc.dbManager = new AbstractDB() {
-
+
@Override
public void setTrusted(String world, Plot plot, OfflinePlayer player) {
}
+
@Override
public void setPosition(String world, Plot plot, String position) {
}
+
@Override
public void setOwner(Plot plot, UUID uuid) {
}
+
@Override
public void setMerged(String world, Plot plot, boolean[] merged) {
}
+
@Override
public void setHelper(String world, Plot plot, OfflinePlayer player) {
}
+
@Override
public void setFlags(String world, Plot plot, Flag[] flags) {
}
+
@Override
public void setDenied(String world, Plot plot, OfflinePlayer player) {
}
+
@Override
public void setComment(String world, Plot plot, PlotComment comment) {
}
+
@Override
public void setAlias(String world, Plot plot, String alias) {
}
+
@Override
public void removeTrusted(String world, Plot plot, OfflinePlayer player) {
}
+
@Override
public void removeHelper(String world, Plot plot, OfflinePlayer player) {
}
+
@Override
public void removeDenied(String world, Plot plot, OfflinePlayer player) {
}
+
@Override
public void removeComment(String world, Plot plot, PlotComment comment) {
}
+
@Override
public void purge(String world) {
}
+
@Override
public void purge(String world, PlotId id) {
}
+
@Override
public HashMap getSettings(int id) {
return null;
}
+
@Override
public double getRatings(Plot plot) {
return 0;
}
+
@Override
public LinkedHashMap> getPlots() {
LinkedHashMap> plots = new LinkedHashMap>();
-
+
plots.put("testworld", new HashMap());
-
- PlotId id = new PlotId(0,0);
-
- plots.get("testworld").put(id,
- new Plot(id,
- DBFunc.everyone,
- Biome.FOREST,
- new ArrayList(),
- new ArrayList(),
- new ArrayList(),
- null,
- PlotHomePosition.DEFAULT,
- null,
- "testworld",
- new boolean[] {false, false, false, false}));
-
+
+ PlotId id = new PlotId(0, 0);
+
+ plots.get("testworld").put(id,
+ new Plot(id,
+ DBFunc.everyone,
+ Biome.FOREST,
+ new ArrayList(),
+ new ArrayList(),
+ new ArrayList(),
+ null,
+ PlotHomePosition.DEFAULT,
+ null,
+ "testworld",
+ new boolean[]{false, false, false, false}));
+
return plots;
}
-
+
@Override
public int getId(String world, PlotId id2) {
return 0;
}
+
@Override
public ArrayList getComments(String world, Plot plot, int tier) {
return null;
}
+
@Override
public void delete(String world, Plot plot) {
}
+
@Override
public void createTables(String database, boolean add_constraint) throws Exception {
}
+
@Override
public void createPlots(ArrayList plots) {
}
+
@Override
public void createPlotSettings(int id, Plot plot) {
}
+
@Override
public void createPlot(Plot plot) {
}
+
@Override
public void createAllSettingsAndHelpers(ArrayList plots) {
}
};
passed = true;
- }
- catch (Throwable e) {
-
+ } catch (Throwable e) {
+
}
return passed;
}
-
+
public boolean test6_Plots() {
return PlotMain.getAllPlotsRaw() != null;
}
-
+
public boolean test7_OnEnable() {
boolean passed = false;
try {
PlotMain.getMain().onEnable();
passed = true;
- }
- catch (Throwable e) {
-
+ } catch (Throwable e) {
+
}
return passed;
}
-
+
public boolean test8_AddPlotWorld() {
boolean passed = false;
try {
@@ -257,25 +300,23 @@ public class Test1 {
final PlotManager manager = new DefaultPlotManager();
PlotMain.addPlotWorld("poop", plotworld, manager);
passed = (PlotMain.getPlotManager("poop") != null) && (PlotMain.getWorldSettings("poop") != null);
- }
- catch (final Throwable e) {
+ } catch (final Throwable e) {
}
return passed;
}
-
+
public boolean test9_CanSetFast() {
boolean passed = false;
try {
new SetBlockFast();
passed = true;
- }
- catch (Throwable e) {
-
+ } catch (Throwable e) {
+
}
return passed;
}
-
+
}