mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-26 07:06:44 +01:00
fixed a billion of broken references
This commit is contained in:
parent
0b75874c20
commit
4926cae53e
@ -92,7 +92,7 @@ public class Database extends SubCommand {
|
|||||||
}
|
}
|
||||||
Connection n;
|
Connection n;
|
||||||
try {
|
try {
|
||||||
n = new MySQL(PlotSquared.THIS, host, port, database, username, password).openConnection();
|
n = new MySQL(PlotSquared.getInstance(), host, port, database, username, password).openConnection();
|
||||||
// Connection
|
// Connection
|
||||||
if (n.isClosed()) {
|
if (n.isClosed()) {
|
||||||
return sendMessage(plr, "Failed to open connection");
|
return sendMessage(plr, "Failed to open connection");
|
||||||
|
@ -20,33 +20,21 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.intellectualcrafters.plot.commands;
|
package com.intellectualcrafters.plot.commands;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
|
||||||
import org.apache.commons.lang.mutable.MutableInt;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PlotSquared;
|
import com.intellectualcrafters.plot.PlotSquared;
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.config.Settings;
|
import com.intellectualcrafters.plot.config.Settings;
|
||||||
import com.intellectualcrafters.plot.database.DBFunc;
|
import com.intellectualcrafters.plot.database.DBFunc;
|
||||||
import com.intellectualcrafters.plot.flag.Flag;
|
import com.intellectualcrafters.plot.object.*;
|
||||||
import com.intellectualcrafters.plot.flag.FlagManager;
|
|
||||||
import com.intellectualcrafters.plot.listeners.PlotListener;
|
|
||||||
import com.intellectualcrafters.plot.object.Location;
|
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotBlock;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotInventory;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotItemStack;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
|
||||||
import com.intellectualcrafters.plot.util.BlockManager;
|
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
import com.intellectualcrafters.plot.util.TaskManager;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
import org.apache.commons.lang.mutable.MutableInt;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public class Rate extends SubCommand {
|
public class Rate extends SubCommand {
|
||||||
/*
|
/*
|
||||||
@ -61,7 +49,7 @@ public class Rate extends SubCommand {
|
|||||||
public boolean execute(final PlotPlayer player, final String... args) {
|
public boolean execute(final PlotPlayer player, final String... args) {
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
if (args[0].equalsIgnoreCase("next")) {
|
if (args[0].equalsIgnoreCase("next")) {
|
||||||
ArrayList<Plot> plots = new ArrayList<>(PlotSquared.getPlots());
|
ArrayList<Plot> plots = new ArrayList<>(PlotSquared.getInstance().getPlots());
|
||||||
Collections.sort(plots, new Comparator<Plot>() {
|
Collections.sort(plots, new Comparator<Plot>() {
|
||||||
@Override
|
@Override
|
||||||
public int compare(Plot p1, Plot p2) {
|
public int compare(Plot p1, Plot p2) {
|
||||||
|
@ -134,7 +134,7 @@ public class SchematicCmd extends SubCommand {
|
|||||||
SchematicHandler.manager.pasteStates(schematic, plot, 0, 0);
|
SchematicHandler.manager.pasteStates(schematic, plot, 0, 0);
|
||||||
sendMessage(plr, C.SCHEMATIC_PASTE_SUCCESS);
|
sendMessage(plr, C.SCHEMATIC_PASTE_SUCCESS);
|
||||||
SchematicCmd.this.running = false;
|
SchematicCmd.this.running = false;
|
||||||
PlotSquared.TASK.cancelTask(SchematicCmd.this.task);
|
PlotSquared.getInstance().TASK.cancelTask(SchematicCmd.this.task);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final int end = Math.min(start + 5000, blen);
|
final int end = Math.min(start + 5000, blen);
|
||||||
|
@ -34,7 +34,7 @@ public class WE_Anywhere extends SubCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(final PlotPlayer plr, final String... args) {
|
public boolean execute(final PlotPlayer plr, final String... args) {
|
||||||
if (PlotSquared.worldEdit == null) {
|
if (PlotSquared.getInstance().worldEdit == null) {
|
||||||
MainUtil.sendMessage(plr, "&cWorldEdit is not enabled on this server");
|
MainUtil.sendMessage(plr, "&cWorldEdit is not enabled on this server");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -20,17 +20,17 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.intellectualcrafters.plot.commands;
|
package com.intellectualcrafters.plot.commands;
|
||||||
|
|
||||||
|
import com.intellectualcrafters.plot.PlotSquared;
|
||||||
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
|
import com.intellectualcrafters.plot.util.TaskManager;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.net.URLConnection;
|
import java.net.URLConnection;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PlotSquared;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
|
||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
|
||||||
|
|
||||||
public class plugin extends SubCommand {
|
public class plugin extends SubCommand {
|
||||||
public static String downloads, version;
|
public static String downloads, version;
|
||||||
|
|
||||||
@ -93,7 +93,7 @@ public class plugin extends SubCommand {
|
|||||||
public void run() {
|
public void run() {
|
||||||
final ArrayList<String> strings = new ArrayList<String>() {
|
final ArrayList<String> strings = new ArrayList<String>() {
|
||||||
{
|
{
|
||||||
add(String.format("&c>> &6PlotSquared (Version: %s)", PlotSquared.IMP.getVersion()));
|
add(String.format("&c>> &6PlotSquared (Version: %s)", PlotSquared.getInstance().IMP.getVersion()));
|
||||||
add(String.format("&c>> &6Made by Citymonstret and Empire92"));
|
add(String.format("&c>> &6Made by Citymonstret and Empire92"));
|
||||||
add(String.format("&c>> &6Download at &lhttp://www.spigotmc.org/resources/1177"));
|
add(String.format("&c>> &6Download at &lhttp://www.spigotmc.org/resources/1177"));
|
||||||
add(String.format("&c>> &cNewest Version (Spigot): %s", version));
|
add(String.format("&c>> &cNewest Version (Spigot): %s", version));
|
||||||
|
@ -1,26 +1,5 @@
|
|||||||
package com.intellectualcrafters.plot.database.plotme;
|
package com.intellectualcrafters.plot.database.plotme;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.nio.charset.Charset;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
import java.nio.file.Files;
|
|
||||||
import java.nio.file.Path;
|
|
||||||
import java.nio.file.Paths;
|
|
||||||
import java.sql.Connection;
|
|
||||||
import java.sql.DriverManager;
|
|
||||||
import java.sql.PreparedStatement;
|
|
||||||
import java.sql.ResultSet;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PlotSquared;
|
import com.intellectualcrafters.plot.PlotSquared;
|
||||||
import com.intellectualcrafters.plot.database.DBFunc;
|
import com.intellectualcrafters.plot.database.DBFunc;
|
||||||
import com.intellectualcrafters.plot.database.SQLite;
|
import com.intellectualcrafters.plot.database.SQLite;
|
||||||
@ -30,10 +9,29 @@ import com.intellectualcrafters.plot.object.PlotId;
|
|||||||
import com.intellectualcrafters.plot.object.StringWrapper;
|
import com.intellectualcrafters.plot.object.StringWrapper;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.sql.*;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public class ClassicPlotMeConnector extends APlotMeConnector {
|
public class ClassicPlotMeConnector extends APlotMeConnector {
|
||||||
|
|
||||||
private String plugin;
|
private String plugin;
|
||||||
|
|
||||||
|
public static String getWorld(final String world) {
|
||||||
|
for (final World newworld : Bukkit.getWorlds()) {
|
||||||
|
if (newworld.getName().equalsIgnoreCase(world)) {
|
||||||
|
return newworld.getName();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return world;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Connection getPlotMeConnection(String plugin, FileConfiguration plotConfig, String dataFolder) {
|
public Connection getPlotMeConnection(String plugin, FileConfiguration plotConfig, String dataFolder) {
|
||||||
@ -46,13 +44,13 @@ public class ClassicPlotMeConnector extends APlotMeConnector {
|
|||||||
return DriverManager.getConnection(con, user, password);
|
return DriverManager.getConnection(con, user, password);
|
||||||
// return new MySQL(plotsquared, hostname, port, database, username, password)
|
// return new MySQL(plotsquared, hostname, port, database, username, password)
|
||||||
} else {
|
} else {
|
||||||
return new SQLite(PlotSquared.THIS, dataFolder + File.separator + "plots.db").openConnection();
|
return new SQLite(PlotSquared.getInstance(), dataFolder + File.separator + "plots.db").openConnection();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (SQLException | ClassNotFoundException e) {}
|
catch (SQLException | ClassNotFoundException e) {}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMerged(HashMap<String, HashMap<PlotId, boolean[]>> merges, String world, PlotId id, int direction) {
|
public void setMerged(HashMap<String, HashMap<PlotId, boolean[]>> merges, String world, PlotId id, int direction) {
|
||||||
HashMap<PlotId, boolean[]> plots = merges.get(world);
|
HashMap<PlotId, boolean[]> plots = merges.get(world);
|
||||||
PlotId id2;
|
PlotId id2;
|
||||||
@ -96,15 +94,6 @@ public class ClassicPlotMeConnector extends APlotMeConnector {
|
|||||||
plots.put(id, merge1);
|
plots.put(id, merge1);
|
||||||
plots.put(id2, merge1);
|
plots.put(id2, merge1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getWorld(final String world) {
|
|
||||||
for (final World newworld : Bukkit.getWorlds()) {
|
|
||||||
if (newworld.getName().equalsIgnoreCase(world)) {
|
|
||||||
return newworld.getName();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return world;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HashMap<String, HashMap<PlotId, Plot>> getPlotMePlots(Connection connection) throws SQLException {
|
public HashMap<String, HashMap<PlotId, Plot>> getPlotMePlots(Connection connection) throws SQLException {
|
||||||
@ -123,8 +112,8 @@ public class ClassicPlotMeConnector extends APlotMeConnector {
|
|||||||
final String name = r.getString("owner");
|
final String name = r.getString("owner");
|
||||||
final String world = LikePlotMeConverter.getWorld(r.getString("world"));
|
final String world = LikePlotMeConverter.getWorld(r.getString("world"));
|
||||||
if (!plots.containsKey(world)) {
|
if (!plots.containsKey(world)) {
|
||||||
int plot = PlotSquared.config.getInt("worlds." + world + ".plot.size");
|
int plot = PlotSquared.getInstance().config.getInt("worlds." + world + ".plot.size");
|
||||||
int path = PlotSquared.config.getInt("worlds." + world + ".road.width");
|
int path = PlotSquared.getInstance().config.getInt("worlds." + world + ".road.width");
|
||||||
if (plot == 0 && path == 0) {
|
if (plot == 0 && path == 0) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,14 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.intellectualcrafters.plot.generator;
|
package com.intellectualcrafters.plot.generator;
|
||||||
|
|
||||||
|
import com.intellectualcrafters.plot.PlotSquared;
|
||||||
|
import com.intellectualcrafters.plot.commands.Template;
|
||||||
|
import com.intellectualcrafters.plot.object.*;
|
||||||
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
|
import com.intellectualcrafters.plot.util.SetBlockQueue;
|
||||||
|
import com.intellectualcrafters.plot.util.TaskManager;
|
||||||
|
import com.intellectualcrafters.plot.util.bukkit.BukkitUtil;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
@ -27,26 +35,12 @@ import java.util.Arrays;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PlotSquared;
|
|
||||||
import com.intellectualcrafters.plot.commands.Template;
|
|
||||||
import com.intellectualcrafters.plot.object.FileBytes;
|
|
||||||
import com.intellectualcrafters.plot.object.Location;
|
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotBlock;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotId;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotLoc;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
|
||||||
import com.intellectualcrafters.plot.util.SetBlockQueue;
|
|
||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
|
||||||
import com.intellectualcrafters.plot.util.bukkit.BukkitUtil;
|
|
||||||
|
|
||||||
public class HybridPlotManager extends ClassicPlotManager {
|
public class HybridPlotManager extends ClassicPlotManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void exportTemplate(final PlotWorld plotworld) throws IOException {
|
public void exportTemplate(final PlotWorld plotworld) throws IOException {
|
||||||
final HashSet<FileBytes> files = new HashSet<>(Arrays.asList(new FileBytes("templates/" + "tmp-data.yml", Template.getBytes(plotworld))));
|
final HashSet<FileBytes> files = new HashSet<>(Arrays.asList(new FileBytes("templates/" + "tmp-data.yml", Template.getBytes(plotworld))));
|
||||||
final String psRoot = PlotSquared.IMP.getDirectory() + File.separator;
|
final String psRoot = PlotSquared.getInstance().IMP.getDirectory() + File.separator;
|
||||||
final String dir = "schematics" + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator + plotworld.worldname + File.separator;
|
final String dir = "schematics" + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator + plotworld.worldname + File.separator;
|
||||||
final String newDir = "schematics" + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator + "__TEMP_DIR__" + File.separator;
|
final String newDir = "schematics" + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator + "__TEMP_DIR__" + File.separator;
|
||||||
try {
|
try {
|
||||||
|
@ -122,7 +122,7 @@ public abstract class SquarePlotManager extends GridPlotManager {
|
|||||||
// This means you are in the intersection
|
// This means you are in the intersection
|
||||||
final Location loc = new Location(plotworld.worldname, x + dpw.ROAD_WIDTH, 0, z + dpw.ROAD_WIDTH);
|
final Location loc = new Location(plotworld.worldname, x + dpw.ROAD_WIDTH, 0, z + dpw.ROAD_WIDTH);
|
||||||
final PlotId id = MainUtil.getPlotAbs(loc);
|
final PlotId id = MainUtil.getPlotAbs(loc);
|
||||||
final Plot plot = PlotSquared.getPlots(plotworld.worldname).get(id);
|
final Plot plot = PlotSquared.getInstance().getPlots(plotworld.worldname).get(id);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -135,7 +135,7 @@ public abstract class SquarePlotManager extends GridPlotManager {
|
|||||||
// You are on a road running West to East (yeah, I named the var poorly)
|
// You are on a road running West to East (yeah, I named the var poorly)
|
||||||
final Location loc = new Location(plotworld.worldname, x, 0, z + dpw.ROAD_WIDTH);
|
final Location loc = new Location(plotworld.worldname, x, 0, z + dpw.ROAD_WIDTH);
|
||||||
final PlotId id = MainUtil.getPlotAbs(loc);
|
final PlotId id = MainUtil.getPlotAbs(loc);
|
||||||
final Plot plot = PlotSquared.getPlots(plotworld.worldname).get(id);
|
final Plot plot = PlotSquared.getInstance().getPlots(plotworld.worldname).get(id);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -148,7 +148,7 @@ public abstract class SquarePlotManager extends GridPlotManager {
|
|||||||
// This is the road separating an Eastern and Western plot
|
// This is the road separating an Eastern and Western plot
|
||||||
final Location loc = new Location(plotworld.worldname, x + dpw.ROAD_WIDTH, 0, z);
|
final Location loc = new Location(plotworld.worldname, x + dpw.ROAD_WIDTH, 0, z);
|
||||||
final PlotId id = MainUtil.getPlotAbs(loc);
|
final PlotId id = MainUtil.getPlotAbs(loc);
|
||||||
final Plot plot = PlotSquared.getPlots(plotworld.worldname).get(id);
|
final Plot plot = PlotSquared.getInstance().getPlots(plotworld.worldname).get(id);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -158,7 +158,7 @@ public abstract class SquarePlotManager extends GridPlotManager {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
final PlotId id = new PlotId(dx, dz);
|
final PlotId id = new PlotId(dx, dz);
|
||||||
final Plot plot = PlotSquared.getPlots(plotworld.worldname).get(id);
|
final Plot plot = PlotSquared.getInstance().getPlots(plotworld.worldname).get(id);
|
||||||
if (plot == null) {
|
if (plot == null) {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
package com.intellectualcrafters.plot.listeners.worldedit;
|
package com.intellectualcrafters.plot.listeners.worldedit;
|
||||||
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PlotSquared;
|
import com.intellectualcrafters.plot.PlotSquared;
|
||||||
import com.intellectualcrafters.plot.config.Settings;
|
import com.intellectualcrafters.plot.config.Settings;
|
||||||
import com.intellectualcrafters.plot.object.Location;
|
import com.intellectualcrafters.plot.object.Location;
|
||||||
@ -11,6 +8,9 @@ import com.intellectualcrafters.plot.object.PlotPlayer;
|
|||||||
import com.intellectualcrafters.plot.object.RegionWrapper;
|
import com.intellectualcrafters.plot.object.RegionWrapper;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public class WEManager {
|
public class WEManager {
|
||||||
public static HashSet<String> bypass = new HashSet<>();
|
public static HashSet<String> bypass = new HashSet<>();
|
||||||
|
|
||||||
@ -26,7 +26,7 @@ public class WEManager {
|
|||||||
public static HashSet<RegionWrapper> getMask(PlotPlayer player) {
|
public static HashSet<RegionWrapper> getMask(PlotPlayer player) {
|
||||||
HashSet<RegionWrapper> regions = new HashSet<>();
|
HashSet<RegionWrapper> regions = new HashSet<>();
|
||||||
UUID uuid = player.getUUID();
|
UUID uuid = player.getUUID();
|
||||||
for (Plot plot : PlotSquared.getPlots(player.getLocation().getWorld()).values()) {
|
for (Plot plot : PlotSquared.getInstance().getPlots(player.getLocation().getWorld()).values()) {
|
||||||
if (!plot.settings.getMerged(0) && !plot.settings.getMerged(3)) {
|
if (!plot.settings.getMerged(0) && !plot.settings.getMerged(3)) {
|
||||||
if (Settings.WE_ALLOW_HELPER ? plot.isAdded(uuid) : (plot.isOwner(uuid) || plot.trusted.contains(uuid))) {
|
if (Settings.WE_ALLOW_HELPER ? plot.isAdded(uuid) : (plot.isOwner(uuid) || plot.trusted.contains(uuid))) {
|
||||||
Location pos1 = MainUtil.getPlotBottomLoc(plot.world, plot.id).add(1, 0, 1);
|
Location pos1 = MainUtil.getPlotBottomLoc(plot.world, plot.id).add(1, 0, 1);
|
||||||
|
@ -20,14 +20,6 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.intellectualcrafters.plot.object;
|
package com.intellectualcrafters.plot.object;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PlotSquared;
|
import com.intellectualcrafters.plot.PlotSquared;
|
||||||
import com.intellectualcrafters.plot.config.Configuration;
|
import com.intellectualcrafters.plot.config.Configuration;
|
||||||
import com.intellectualcrafters.plot.config.ConfigurationNode;
|
import com.intellectualcrafters.plot.config.ConfigurationNode;
|
||||||
@ -35,6 +27,13 @@ import com.intellectualcrafters.plot.config.Settings;
|
|||||||
import com.intellectualcrafters.plot.flag.Flag;
|
import com.intellectualcrafters.plot.flag.Flag;
|
||||||
import com.intellectualcrafters.plot.flag.FlagManager;
|
import com.intellectualcrafters.plot.flag.FlagManager;
|
||||||
import com.intellectualcrafters.plot.util.EconHandler;
|
import com.intellectualcrafters.plot.util.EconHandler;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Jesse Boyd
|
* @author Jesse Boyd
|
||||||
@ -111,7 +110,7 @@ public abstract class PlotWorld {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PlotWorld plotworld = (PlotWorld) obj;
|
PlotWorld plotworld = (PlotWorld) obj;
|
||||||
ConfigurationSection section = PlotSquared.config.getConfigurationSection("worlds");
|
ConfigurationSection section = PlotSquared.getInstance().config.getConfigurationSection("worlds");
|
||||||
for (ConfigurationNode setting : plotworld.getSettingNodes()) {
|
for (ConfigurationNode setting : plotworld.getSettingNodes()) {
|
||||||
Object constant = section.get(plotworld.worldname + "." + setting.getConstant());
|
Object constant = section.get(plotworld.worldname + "." + setting.getConstant());
|
||||||
if (constant == null) {
|
if (constant == null) {
|
||||||
|
@ -1,15 +1,11 @@
|
|||||||
package com.intellectualcrafters.plot.util;
|
package com.intellectualcrafters.plot.util;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PlotSquared;
|
import com.intellectualcrafters.plot.PlotSquared;
|
||||||
import com.intellectualcrafters.plot.flag.Flag;
|
import com.intellectualcrafters.plot.flag.Flag;
|
||||||
import com.intellectualcrafters.plot.object.Location;
|
import com.intellectualcrafters.plot.object.*;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotCluster;
|
import java.util.ArrayList;
|
||||||
import com.intellectualcrafters.plot.object.PlotId;
|
import java.util.UUID;
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
|
||||||
|
|
||||||
public abstract class EventUtil {
|
public abstract class EventUtil {
|
||||||
|
|
||||||
@ -21,7 +17,7 @@ public abstract class EventUtil {
|
|||||||
SetupUtils.setupMap.remove(name);
|
SetupUtils.setupMap.remove(name);
|
||||||
}
|
}
|
||||||
CmdConfirm.removePending(name);
|
CmdConfirm.removePending(name);
|
||||||
PlotSquared.IMP.unregister(player);
|
PlotSquared.getInstance().IMP.unregister(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract boolean callClaim(final PlotPlayer player, final Plot plot, final boolean auto);
|
public abstract boolean callClaim(final PlotPlayer player, final Plot plot, final boolean auto);
|
||||||
|
@ -1,30 +1,6 @@
|
|||||||
package com.intellectualcrafters.plot.util;
|
package com.intellectualcrafters.plot.util;
|
||||||
|
|
||||||
import java.io.File;
|
import com.intellectualcrafters.jnbt.*;
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.OutputStream;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.zip.GZIPInputStream;
|
|
||||||
import java.util.zip.GZIPOutputStream;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.jnbt.ByteArrayTag;
|
|
||||||
import com.intellectualcrafters.jnbt.CompoundTag;
|
|
||||||
import com.intellectualcrafters.jnbt.IntTag;
|
|
||||||
import com.intellectualcrafters.jnbt.ListTag;
|
|
||||||
import com.intellectualcrafters.jnbt.NBTInputStream;
|
|
||||||
import com.intellectualcrafters.jnbt.NBTOutputStream;
|
|
||||||
import com.intellectualcrafters.jnbt.ShortTag;
|
|
||||||
import com.intellectualcrafters.jnbt.Tag;
|
|
||||||
import com.intellectualcrafters.plot.PlotSquared;
|
import com.intellectualcrafters.plot.PlotSquared;
|
||||||
import com.intellectualcrafters.plot.config.Settings;
|
import com.intellectualcrafters.plot.config.Settings;
|
||||||
import com.intellectualcrafters.plot.object.Location;
|
import com.intellectualcrafters.plot.object.Location;
|
||||||
@ -34,6 +10,12 @@ import com.intellectualcrafters.plot.object.schematic.PlotItem;
|
|||||||
import com.intellectualcrafters.plot.object.schematic.StateWrapper;
|
import com.intellectualcrafters.plot.object.schematic.StateWrapper;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.BukkitUtil;
|
import com.intellectualcrafters.plot.util.bukkit.BukkitUtil;
|
||||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
|
import java.io.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.zip.GZIPInputStream;
|
||||||
|
import java.util.zip.GZIPOutputStream;
|
||||||
|
|
||||||
public abstract class SchematicHandler {
|
public abstract class SchematicHandler {
|
||||||
public static SchematicHandler manager = new BukkitSchematicHandler();
|
public static SchematicHandler manager = new BukkitSchematicHandler();
|
||||||
@ -82,7 +64,7 @@ public abstract class SchematicHandler {
|
|||||||
else {
|
else {
|
||||||
directory = outputDir.getPath();
|
directory = outputDir.getPath();
|
||||||
}
|
}
|
||||||
if (PlotSquared.worldEdit != null) {
|
if (PlotSquared.getInstance().worldEdit != null) {
|
||||||
new WorldEditSchematic().saveSchematic(directory + File.separator + name + ".schematic", plot.world, plot.id);
|
new WorldEditSchematic().saveSchematic(directory + File.separator + name + ".schematic", plot.world, plot.id);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -254,14 +236,14 @@ public abstract class SchematicHandler {
|
|||||||
*/
|
*/
|
||||||
public Schematic getSchematic(final String name) {
|
public Schematic getSchematic(final String name) {
|
||||||
{
|
{
|
||||||
final File parent = new File(PlotSquared.IMP.getDirectory() + File.separator + "schematics");
|
final File parent = new File(PlotSquared.getInstance().IMP.getDirectory() + File.separator + "schematics");
|
||||||
if (!parent.exists()) {
|
if (!parent.exists()) {
|
||||||
if (!parent.mkdir()) {
|
if (!parent.mkdir()) {
|
||||||
throw new RuntimeException("Could not create schematic parent directory");
|
throw new RuntimeException("Could not create schematic parent directory");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
final File file = new File(PlotSquared.IMP.getDirectory() + File.separator + "schematics" + File.separator + name + ".schematic");
|
final File file = new File(PlotSquared.getInstance().IMP.getDirectory() + File.separator + "schematics" + File.separator + name + ".schematic");
|
||||||
return getSchematic(file);
|
return getSchematic(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -326,7 +308,7 @@ public abstract class SchematicHandler {
|
|||||||
* @return tag
|
* @return tag
|
||||||
*/
|
*/
|
||||||
public CompoundTag getCompoundTag(final String world, final PlotId id) {
|
public CompoundTag getCompoundTag(final String world, final PlotId id) {
|
||||||
if (!PlotSquared.getPlots(world).containsKey(id)) {
|
if (!PlotSquared.getInstance().getPlots(world).containsKey(id)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
final Location pos1 = MainUtil.getPlotBottomLoc(world, id).add(1, 0, 1);
|
final Location pos1 = MainUtil.getPlotBottomLoc(world, id).add(1, 0, 1);
|
||||||
@ -390,6 +372,12 @@ public abstract class SchematicHandler {
|
|||||||
private final File file;
|
private final File file;
|
||||||
private HashSet<PlotItem> items;
|
private HashSet<PlotItem> items;
|
||||||
|
|
||||||
|
public Schematic(final DataCollection[] blockCollection, final Dimension schematicDimension, final File file) {
|
||||||
|
this.blockCollection = blockCollection;
|
||||||
|
this.schematicDimension = schematicDimension;
|
||||||
|
this.file = file;
|
||||||
|
}
|
||||||
|
|
||||||
public void addItem(PlotItem item) {
|
public void addItem(PlotItem item) {
|
||||||
if (this.items == null) {
|
if (this.items == null) {
|
||||||
this.items = new HashSet<>();
|
this.items = new HashSet<>();
|
||||||
@ -400,12 +388,6 @@ public abstract class SchematicHandler {
|
|||||||
public HashSet<PlotItem> getItems() {
|
public HashSet<PlotItem> getItems() {
|
||||||
return this.items;
|
return this.items;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Schematic(final DataCollection[] blockCollection, final Dimension schematicDimension, final File file) {
|
|
||||||
this.blockCollection = blockCollection;
|
|
||||||
this.schematicDimension = schematicDimension;
|
|
||||||
this.file = file;
|
|
||||||
}
|
|
||||||
|
|
||||||
public File getFile() {
|
public File getFile() {
|
||||||
return this.file;
|
return this.file;
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
package com.intellectualcrafters.plot.util;
|
package com.intellectualcrafters.plot.util;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PlotSquared;
|
import com.intellectualcrafters.plot.PlotSquared;
|
||||||
import com.intellectualcrafters.plot.generator.AugmentedPopulator;
|
import com.intellectualcrafters.plot.generator.AugmentedPopulator;
|
||||||
import com.intellectualcrafters.plot.object.ChunkLoc;
|
import com.intellectualcrafters.plot.object.ChunkLoc;
|
||||||
import com.intellectualcrafters.plot.object.PlotBlock;
|
import com.intellectualcrafters.plot.object.PlotBlock;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
public class SetBlockQueue {
|
public class SetBlockQueue {
|
||||||
|
|
||||||
private volatile static HashMap<ChunkWrapper, PlotBlock[][]> blocks;
|
private volatile static HashMap<ChunkWrapper, PlotBlock[][]> blocks;
|
||||||
@ -17,6 +17,9 @@ public class SetBlockQueue {
|
|||||||
private volatile static boolean locked = false;
|
private volatile static boolean locked = false;
|
||||||
private volatile static HashSet<Runnable> runnables;
|
private volatile static HashSet<Runnable> runnables;
|
||||||
private volatile static boolean slow = false;
|
private volatile static boolean slow = false;
|
||||||
|
private static long last;
|
||||||
|
private static int lastInt = 0;
|
||||||
|
private static PlotBlock lastBlock = new PlotBlock((short) 0, (byte) 0);
|
||||||
|
|
||||||
public synchronized static void allocate(int t) {
|
public synchronized static void allocate(int t) {
|
||||||
allocate = t;
|
allocate = t;
|
||||||
@ -40,9 +43,7 @@ public class SetBlockQueue {
|
|||||||
runnables.add(whenDone);
|
runnables.add(whenDone);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static long last;
|
|
||||||
|
|
||||||
public synchronized static void init() {
|
public synchronized static void init() {
|
||||||
if (blocks == null) {
|
if (blocks == null) {
|
||||||
if (AugmentedPopulator.x_loc == null) {
|
if (AugmentedPopulator.x_loc == null) {
|
||||||
@ -61,7 +62,7 @@ public class SetBlockQueue {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (blocks.size() == 0) {
|
if (blocks.size() == 0) {
|
||||||
PlotSquared.TASK.cancelTask(TaskManager.tasks.get(current));
|
PlotSquared.getInstance().TASK.cancelTask(TaskManager.tasks.get(current));
|
||||||
for (Runnable runnable : runnables) {
|
for (Runnable runnable : runnables) {
|
||||||
TaskManager.runTask(runnable);
|
TaskManager.runTask(runnable);
|
||||||
}
|
}
|
||||||
@ -141,7 +142,7 @@ public class SetBlockQueue {
|
|||||||
blocks.put(wrap, result);
|
blocks.put(wrap, result);
|
||||||
locked = false;
|
locked = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setBlock(final String world, int x, final int y, int z, final PlotBlock block) {
|
public static void setBlock(final String world, int x, final int y, int z, final PlotBlock block) {
|
||||||
locked = true;
|
locked = true;
|
||||||
if (!running) {
|
if (!running) {
|
||||||
@ -151,15 +152,15 @@ public class SetBlockQueue {
|
|||||||
int Z = z >> 4;
|
int Z = z >> 4;
|
||||||
x -= X << 4;
|
x -= X << 4;
|
||||||
z -= Z << 4;
|
z -= Z << 4;
|
||||||
|
|
||||||
ChunkWrapper wrap = new ChunkWrapper(world, X, Z);
|
ChunkWrapper wrap = new ChunkWrapper(world, X, Z);
|
||||||
PlotBlock[][] result;
|
PlotBlock[][] result;
|
||||||
result = blocks.get(wrap);
|
result = blocks.get(wrap);
|
||||||
if (!blocks.containsKey(wrap)) {
|
if (!blocks.containsKey(wrap)) {
|
||||||
result = new PlotBlock[16][];
|
result = new PlotBlock[16][];
|
||||||
blocks.put(wrap, result);
|
blocks.put(wrap, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result[y >> 4] == null) {
|
if (result[y >> 4] == null) {
|
||||||
result[y >> 4] = new PlotBlock[4096];
|
result[y >> 4] = new PlotBlock[4096];
|
||||||
}
|
}
|
||||||
@ -167,9 +168,6 @@ public class SetBlockQueue {
|
|||||||
locked = false;
|
locked = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int lastInt = 0;
|
|
||||||
private static PlotBlock lastBlock = new PlotBlock((short) 0, (byte) 0);
|
|
||||||
|
|
||||||
public static void setData(final String world, int x, final int y, int z, final byte data) {
|
public static void setData(final String world, int x, final int y, int z, final byte data) {
|
||||||
locked = true;
|
locked = true;
|
||||||
if (!running) {
|
if (!running) {
|
||||||
|
@ -1,18 +1,53 @@
|
|||||||
package com.intellectualcrafters.plot.util;
|
package com.intellectualcrafters.plot.util;
|
||||||
|
|
||||||
|
import com.intellectualcrafters.plot.PlotSquared;
|
||||||
|
import org.apache.commons.lang.mutable.MutableInt;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|
||||||
import org.apache.commons.lang.mutable.MutableInt;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PlotSquared;
|
|
||||||
|
|
||||||
public abstract class TaskManager {
|
public abstract class TaskManager {
|
||||||
public static HashSet<String> TELEPORT_QUEUE = new HashSet<>();
|
public static HashSet<String> TELEPORT_QUEUE = new HashSet<>();
|
||||||
|
|
||||||
public static MutableInt index = new MutableInt(0);
|
public static MutableInt index = new MutableInt(0);
|
||||||
public static HashMap<Integer, Integer> tasks = new HashMap<>();
|
public static HashMap<Integer, Integer> tasks = new HashMap<>();
|
||||||
|
|
||||||
|
public static int runTaskRepeat(final Runnable r, final int interval) {
|
||||||
|
if (r != null) {
|
||||||
|
return PlotSquared.getInstance().TASK.taskRepeat(r, interval);
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void runTaskAsync(final Runnable r) {
|
||||||
|
if (r != null) {
|
||||||
|
PlotSquared.getInstance().TASK.taskAsync(r);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void runTask(final Runnable r) {
|
||||||
|
if (r != null) {
|
||||||
|
PlotSquared.getInstance().TASK.task(r);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Run task later (delay in ticks)
|
||||||
|
* @param r
|
||||||
|
* @param delay
|
||||||
|
*/
|
||||||
|
public static void runTaskLater(final Runnable r, final int delay) {
|
||||||
|
if (r != null) {
|
||||||
|
PlotSquared.getInstance().TASK.taskLater(r, delay);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void runTaskLaterAsync(final Runnable r, final int delay) {
|
||||||
|
if (r != null) {
|
||||||
|
PlotSquared.getInstance().TASK.taskLaterAsync(r, delay);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public abstract int taskRepeat(final Runnable r, int interval);
|
public abstract int taskRepeat(final Runnable r, int interval);
|
||||||
|
|
||||||
public abstract void taskAsync(final Runnable r);
|
public abstract void taskAsync(final Runnable r);
|
||||||
@ -24,40 +59,4 @@ public abstract class TaskManager {
|
|||||||
public abstract void taskLaterAsync(final Runnable r, int delay);
|
public abstract void taskLaterAsync(final Runnable r, int delay);
|
||||||
|
|
||||||
public abstract void cancelTask(int task);
|
public abstract void cancelTask(int task);
|
||||||
|
|
||||||
public static int runTaskRepeat(final Runnable r, final int interval) {
|
|
||||||
if (r != null) {
|
|
||||||
return PlotSquared.TASK.taskRepeat(r, interval);
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void runTaskAsync(final Runnable r) {
|
|
||||||
if (r != null) {
|
|
||||||
PlotSquared.TASK.taskAsync(r);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void runTask(final Runnable r) {
|
|
||||||
if (r != null) {
|
|
||||||
PlotSquared.TASK.task(r);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Run task later (delay in ticks)
|
|
||||||
* @param r
|
|
||||||
* @param delay
|
|
||||||
*/
|
|
||||||
public static void runTaskLater(final Runnable r, final int delay) {
|
|
||||||
if (r != null) {
|
|
||||||
PlotSquared.TASK.taskLater(r, delay);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void runTaskLaterAsync(final Runnable r, final int delay) {
|
|
||||||
if (r != null) {
|
|
||||||
PlotSquared.TASK.taskLaterAsync(r, delay);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
package com.intellectualcrafters.plot.util;
|
package com.intellectualcrafters.plot.util;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PlotSquared;
|
import com.intellectualcrafters.plot.PlotSquared;
|
||||||
import com.intellectualcrafters.plot.object.Location;
|
import com.intellectualcrafters.plot.object.Location;
|
||||||
import com.intellectualcrafters.plot.object.PlotId;
|
import com.intellectualcrafters.plot.object.PlotId;
|
||||||
@ -11,6 +7,9 @@ import com.sk89q.worldedit.CuboidClipboard;
|
|||||||
import com.sk89q.worldedit.EditSession;
|
import com.sk89q.worldedit.EditSession;
|
||||||
import com.sk89q.worldedit.Vector;
|
import com.sk89q.worldedit.Vector;
|
||||||
import com.sk89q.worldedit.bukkit.BukkitWorld;
|
import com.sk89q.worldedit.bukkit.BukkitWorld;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
public class WorldEditSchematic {
|
public class WorldEditSchematic {
|
||||||
public void saveSchematic(String file, final String world, final PlotId id) {
|
public void saveSchematic(String file, final String world, final PlotId id) {
|
||||||
@ -21,7 +20,7 @@ public class WorldEditSchematic {
|
|||||||
CuboidClipboard clipboard = new CuboidClipboard(size, origin);
|
CuboidClipboard clipboard = new CuboidClipboard(size, origin);
|
||||||
Vector pos1 = new Vector(bot.getX(), bot.getY(), bot.getZ());
|
Vector pos1 = new Vector(bot.getX(), bot.getY(), bot.getZ());
|
||||||
Vector pos2 = new Vector(top.getX(), top.getY(), top.getZ());
|
Vector pos2 = new Vector(top.getX(), top.getY(), top.getZ());
|
||||||
EditSession session = PlotSquared.worldEdit.getWorldEdit().getEditSessionFactory().getEditSession(new BukkitWorld(Bukkit.getWorld(world)), 999999999);
|
EditSession session = PlotSquared.getInstance().worldEdit.getWorldEdit().getEditSessionFactory().getEditSession(new BukkitWorld(Bukkit.getWorld(world)), 999999999);
|
||||||
clipboard.copy(session);
|
clipboard.copy(session);
|
||||||
try {
|
try {
|
||||||
clipboard.saveSchematic(new File(file));
|
clipboard.saveSchematic(new File(file));
|
||||||
|
@ -1,22 +1,20 @@
|
|||||||
package com.intellectualcrafters.plot.util.bukkit;
|
package com.intellectualcrafters.plot.util.bukkit;
|
||||||
|
|
||||||
import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Chunk;
|
|
||||||
import org.bukkit.World;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.BukkitMain;
|
|
||||||
import com.intellectualcrafters.plot.PlotSquared;
|
import com.intellectualcrafters.plot.PlotSquared;
|
||||||
import com.intellectualcrafters.plot.object.ChunkLoc;
|
import com.intellectualcrafters.plot.object.ChunkLoc;
|
||||||
import com.intellectualcrafters.plot.util.ReflectionUtils.RefClass;
|
import com.intellectualcrafters.plot.util.ReflectionUtils.RefClass;
|
||||||
import com.intellectualcrafters.plot.util.ReflectionUtils.RefConstructor;
|
import com.intellectualcrafters.plot.util.ReflectionUtils.RefConstructor;
|
||||||
import com.intellectualcrafters.plot.util.ReflectionUtils.RefField;
|
import com.intellectualcrafters.plot.util.ReflectionUtils.RefField;
|
||||||
import com.intellectualcrafters.plot.util.ReflectionUtils.RefMethod;
|
import com.intellectualcrafters.plot.util.ReflectionUtils.RefMethod;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Chunk;
|
||||||
|
import org.bukkit.World;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An utility that can be used to send chunks, rather than using bukkit code to do so (uses heavy NMS)
|
* An utility that can be used to send chunks, rather than using bukkit code to do so (uses heavy NMS)
|
||||||
@ -25,13 +23,13 @@ import com.intellectualcrafters.plot.util.ReflectionUtils.RefMethod;
|
|||||||
*/
|
*/
|
||||||
public class SendChunk {
|
public class SendChunk {
|
||||||
|
|
||||||
private static boolean v1_7_10 = PlotSquared.IMP.checkVersion(1, 7, 10) && !PlotSquared.IMP.checkVersion(1, 8, 0);
|
|
||||||
// Ref Class
|
// Ref Class
|
||||||
private static final RefClass classWorld = getRefClass("{nms}.World");
|
private static final RefClass classWorld = getRefClass("{nms}.World");
|
||||||
private static final RefClass classEntityPlayer = getRefClass("{nms}.EntityPlayer");
|
private static final RefClass classEntityPlayer = getRefClass("{nms}.EntityPlayer");
|
||||||
private static final RefClass classChunkCoordIntPair = getRefClass("{nms}.ChunkCoordIntPair");
|
private static final RefClass classChunkCoordIntPair = getRefClass("{nms}.ChunkCoordIntPair");
|
||||||
private static final RefClass classCraftChunk = getRefClass("{cb}.CraftChunk");
|
private static final RefClass classCraftChunk = getRefClass("{cb}.CraftChunk");
|
||||||
private static final RefClass classChunk = getRefClass("{nms}.Chunk");
|
private static final RefClass classChunk = getRefClass("{nms}.Chunk");
|
||||||
|
private static boolean v1_7_10 = PlotSquared.getInstance().IMP.checkVersion(1, 7, 10) && !PlotSquared.getInstance().IMP.checkVersion(1, 8, 0);
|
||||||
// Ref Method
|
// Ref Method
|
||||||
private static RefMethod methodGetHandle;
|
private static RefMethod methodGetHandle;
|
||||||
// Ref Field
|
// Ref Field
|
||||||
|
@ -1,14 +1,13 @@
|
|||||||
package com.intellectualsites.translation.bukkit;
|
package com.intellectualsites.translation.bukkit;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
import org.bukkit.Material;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PlotSquared;
|
import com.intellectualcrafters.plot.PlotSquared;
|
||||||
import com.intellectualsites.translation.TranslationAsset;
|
import com.intellectualsites.translation.TranslationAsset;
|
||||||
import com.intellectualsites.translation.TranslationLanguage;
|
import com.intellectualsites.translation.TranslationLanguage;
|
||||||
import com.intellectualsites.translation.TranslationManager;
|
import com.intellectualsites.translation.TranslationManager;
|
||||||
import com.intellectualsites.translation.TranslationObject;
|
import com.intellectualsites.translation.TranslationObject;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Citymonstret
|
* @author Citymonstret
|
||||||
@ -34,16 +33,7 @@ public class BukkitTranslation {
|
|||||||
* @return parent folder
|
* @return parent folder
|
||||||
*/
|
*/
|
||||||
public static File getParent() {
|
public static File getParent() {
|
||||||
return new File(PlotSquared.IMP.getDirectory() + File.separator + "translations");
|
return new File(PlotSquared.getInstance().IMP.getDirectory() + File.separator + "translations");
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The default translation language
|
|
||||||
*
|
|
||||||
* @return default translation language
|
|
||||||
*/
|
|
||||||
public TranslationLanguage getDefaultLanguage() {
|
|
||||||
return TranslationLanguage.englishAmerican;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -54,4 +44,13 @@ public class BukkitTranslation {
|
|||||||
manager.addTranslationObject(new TranslationObject(material.name(), material.name().replace("_", " ").toLowerCase(), "Material." + material.toString(), ""));
|
manager.addTranslationObject(new TranslationObject(material.name(), material.name().replace("_", " ").toLowerCase(), "Material." + material.toString(), ""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The default translation language
|
||||||
|
*
|
||||||
|
* @return default translation language
|
||||||
|
*/
|
||||||
|
public TranslationLanguage getDefaultLanguage() {
|
||||||
|
return TranslationLanguage.englishAmerican;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user