fixed a billion of broken references

This commit is contained in:
sauilitired 2015-07-03 13:21:21 +02:00
parent 0b75874c20
commit 4926cae53e
17 changed files with 168 additions and 227 deletions

View File

@ -92,7 +92,7 @@ public class Database extends SubCommand {
}
Connection n;
try {
n = new MySQL(PlotSquared.THIS, host, port, database, username, password).openConnection();
n = new MySQL(PlotSquared.getInstance(), host, port, database, username, password).openConnection();
// Connection
if (n.isClosed()) {
return sendMessage(plr, "Failed to open connection");

View File

@ -20,33 +20,21 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
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.config.C;
import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.flag.Flag;
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.object.*;
import com.intellectualcrafters.plot.util.MainUtil;
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 {
/*
@ -61,7 +49,7 @@ public class Rate extends SubCommand {
public boolean execute(final PlotPlayer player, final String... args) {
if (args.length == 1) {
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>() {
@Override
public int compare(Plot p1, Plot p2) {

View File

@ -134,7 +134,7 @@ public class SchematicCmd extends SubCommand {
SchematicHandler.manager.pasteStates(schematic, plot, 0, 0);
sendMessage(plr, C.SCHEMATIC_PASTE_SUCCESS);
SchematicCmd.this.running = false;
PlotSquared.TASK.cancelTask(SchematicCmd.this.task);
PlotSquared.getInstance().TASK.cancelTask(SchematicCmd.this.task);
return;
}
final int end = Math.min(start + 5000, blen);

View File

@ -34,7 +34,7 @@ public class WE_Anywhere extends SubCommand {
@Override
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");
return false;
}

View File

@ -20,17 +20,17 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
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.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
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 static String downloads, version;
@ -93,7 +93,7 @@ public class plugin extends SubCommand {
public void run() {
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>> &6Download at &lhttp://www.spigotmc.org/resources/1177"));
add(String.format("&c>> &cNewest Version (Spigot): %s", version));

View File

@ -1,26 +1,5 @@
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.database.DBFunc;
import com.intellectualcrafters.plot.database.SQLite;
@ -30,11 +9,30 @@ import com.intellectualcrafters.plot.object.PlotId;
import com.intellectualcrafters.plot.object.StringWrapper;
import com.intellectualcrafters.plot.util.MainUtil;
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 {
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
public Connection getPlotMeConnection(String plugin, FileConfiguration plotConfig, String dataFolder) {
this.plugin = plugin.toLowerCase();
@ -46,7 +44,7 @@ public class ClassicPlotMeConnector extends APlotMeConnector {
return DriverManager.getConnection(con, user, password);
// return new MySQL(plotsquared, hostname, port, database, username, password)
} 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) {}
@ -97,15 +95,6 @@ public class ClassicPlotMeConnector extends APlotMeConnector {
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
public HashMap<String, HashMap<PlotId, Plot>> getPlotMePlots(Connection connection) throws SQLException {
ResultSet r;
@ -123,8 +112,8 @@ public class ClassicPlotMeConnector extends APlotMeConnector {
final String name = r.getString("owner");
final String world = LikePlotMeConverter.getWorld(r.getString("world"));
if (!plots.containsKey(world)) {
int plot = PlotSquared.config.getInt("worlds." + world + ".plot.size");
int path = PlotSquared.config.getInt("worlds." + world + ".road.width");
int plot = PlotSquared.getInstance().config.getInt("worlds." + world + ".plot.size");
int path = PlotSquared.getInstance().config.getInt("worlds." + world + ".road.width");
if (plot == 0 && path == 0) {
}

View File

@ -20,6 +20,14 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
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.IOException;
import java.nio.file.Files;
@ -27,26 +35,12 @@ import java.util.Arrays;
import java.util.HashMap;
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 {
@Override
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 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 newDir = "schematics" + File.separator + "GEN_ROAD_SCHEMATIC" + File.separator + "__TEMP_DIR__" + File.separator;
try {

View File

@ -122,7 +122,7 @@ public abstract class SquarePlotManager extends GridPlotManager {
// This means you are in the intersection
final Location loc = new Location(plotworld.worldname, x + dpw.ROAD_WIDTH, 0, z + dpw.ROAD_WIDTH);
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) {
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)
final Location loc = new Location(plotworld.worldname, x, 0, z + dpw.ROAD_WIDTH);
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) {
return null;
}
@ -148,7 +148,7 @@ public abstract class SquarePlotManager extends GridPlotManager {
// This is the road separating an Eastern and Western plot
final Location loc = new Location(plotworld.worldname, x + dpw.ROAD_WIDTH, 0, z);
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) {
return null;
}
@ -158,7 +158,7 @@ public abstract class SquarePlotManager extends GridPlotManager {
return null;
}
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) {
return id;
}

View File

@ -1,8 +1,5 @@
package com.intellectualcrafters.plot.listeners.worldedit;
import java.util.HashSet;
import java.util.UUID;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.config.Settings;
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.util.MainUtil;
import java.util.HashSet;
import java.util.UUID;
public class WEManager {
public static HashSet<String> bypass = new HashSet<>();
@ -26,7 +26,7 @@ public class WEManager {
public static HashSet<RegionWrapper> getMask(PlotPlayer player) {
HashSet<RegionWrapper> regions = new HashSet<>();
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 (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);

View File

@ -20,14 +20,6 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
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.config.Configuration;
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.FlagManager;
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
@ -111,7 +110,7 @@ public abstract class PlotWorld {
return false;
}
PlotWorld plotworld = (PlotWorld) obj;
ConfigurationSection section = PlotSquared.config.getConfigurationSection("worlds");
ConfigurationSection section = PlotSquared.getInstance().config.getConfigurationSection("worlds");
for (ConfigurationNode setting : plotworld.getSettingNodes()) {
Object constant = section.get(plotworld.worldname + "." + setting.getConstant());
if (constant == null) {

View File

@ -1,15 +1,11 @@
package com.intellectualcrafters.plot.util;
import java.util.ArrayList;
import java.util.UUID;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.flag.Flag;
import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotCluster;
import com.intellectualcrafters.plot.object.PlotId;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.*;
import java.util.ArrayList;
import java.util.UUID;
public abstract class EventUtil {
@ -21,7 +17,7 @@ public abstract class EventUtil {
SetupUtils.setupMap.remove(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);

View File

@ -1,30 +1,6 @@
package com.intellectualcrafters.plot.util;
import java.io.File;
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.jnbt.*;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.config.Settings;
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.util.bukkit.BukkitUtil;
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 static SchematicHandler manager = new BukkitSchematicHandler();
@ -82,7 +64,7 @@ public abstract class SchematicHandler {
else {
directory = outputDir.getPath();
}
if (PlotSquared.worldEdit != null) {
if (PlotSquared.getInstance().worldEdit != null) {
new WorldEditSchematic().saveSchematic(directory + File.separator + name + ".schematic", plot.world, plot.id);
}
else {
@ -254,14 +236,14 @@ public abstract class SchematicHandler {
*/
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.mkdir()) {
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);
}
@ -326,7 +308,7 @@ public abstract class SchematicHandler {
* @return tag
*/
public CompoundTag getCompoundTag(final String world, final PlotId id) {
if (!PlotSquared.getPlots(world).containsKey(id)) {
if (!PlotSquared.getInstance().getPlots(world).containsKey(id)) {
return null;
}
final Location pos1 = MainUtil.getPlotBottomLoc(world, id).add(1, 0, 1);
@ -390,6 +372,12 @@ public abstract class SchematicHandler {
private final File file;
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) {
if (this.items == null) {
this.items = new HashSet<>();
@ -401,12 +389,6 @@ public abstract class SchematicHandler {
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() {
return this.file;
}

View File

@ -1,14 +1,14 @@
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.generator.AugmentedPopulator;
import com.intellectualcrafters.plot.object.ChunkLoc;
import com.intellectualcrafters.plot.object.PlotBlock;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map.Entry;
public class SetBlockQueue {
private volatile static HashMap<ChunkWrapper, PlotBlock[][]> blocks;
@ -17,6 +17,9 @@ public class SetBlockQueue {
private volatile static boolean locked = false;
private volatile static HashSet<Runnable> runnables;
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) {
allocate = t;
@ -41,8 +44,6 @@ public class SetBlockQueue {
}
}
private static long last;
public synchronized static void init() {
if (blocks == null) {
if (AugmentedPopulator.x_loc == null) {
@ -61,7 +62,7 @@ public class SetBlockQueue {
return;
}
if (blocks.size() == 0) {
PlotSquared.TASK.cancelTask(TaskManager.tasks.get(current));
PlotSquared.getInstance().TASK.cancelTask(TaskManager.tasks.get(current));
for (Runnable runnable : runnables) {
TaskManager.runTask(runnable);
}
@ -167,9 +168,6 @@ public class SetBlockQueue {
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) {
locked = true;
if (!running) {

View File

@ -1,18 +1,53 @@
package com.intellectualcrafters.plot.util;
import com.intellectualcrafters.plot.PlotSquared;
import org.apache.commons.lang.mutable.MutableInt;
import java.util.HashMap;
import java.util.HashSet;
import org.apache.commons.lang.mutable.MutableInt;
import com.intellectualcrafters.plot.PlotSquared;
public abstract class TaskManager {
public static HashSet<String> TELEPORT_QUEUE = new HashSet<>();
public static MutableInt index = new MutableInt(0);
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 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 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);
}
}
}

View File

@ -1,9 +1,5 @@
package com.intellectualcrafters.plot.util;
import java.io.File;
import org.bukkit.Bukkit;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.PlotId;
@ -11,6 +7,9 @@ import com.sk89q.worldedit.CuboidClipboard;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.bukkit.BukkitWorld;
import org.bukkit.Bukkit;
import java.io.File;
public class WorldEditSchematic {
public void saveSchematic(String file, final String world, final PlotId id) {
@ -21,7 +20,7 @@ public class WorldEditSchematic {
CuboidClipboard clipboard = new CuboidClipboard(size, origin);
Vector pos1 = new Vector(bot.getX(), bot.getY(), bot.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);
try {
clipboard.saveSchematic(new File(file));

View File

@ -1,22 +1,20 @@
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.object.ChunkLoc;
import com.intellectualcrafters.plot.util.ReflectionUtils.RefClass;
import com.intellectualcrafters.plot.util.ReflectionUtils.RefConstructor;
import com.intellectualcrafters.plot.util.ReflectionUtils.RefField;
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)
@ -25,13 +23,13 @@ import com.intellectualcrafters.plot.util.ReflectionUtils.RefMethod;
*/
public class SendChunk {
private static boolean v1_7_10 = PlotSquared.IMP.checkVersion(1, 7, 10) && !PlotSquared.IMP.checkVersion(1, 8, 0);
// Ref Class
private static final RefClass classWorld = getRefClass("{nms}.World");
private static final RefClass classEntityPlayer = getRefClass("{nms}.EntityPlayer");
private static final RefClass classChunkCoordIntPair = getRefClass("{nms}.ChunkCoordIntPair");
private static final RefClass classCraftChunk = getRefClass("{cb}.CraftChunk");
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
private static RefMethod methodGetHandle;
// Ref Field

View File

@ -1,14 +1,13 @@
package com.intellectualsites.translation.bukkit;
import java.io.File;
import org.bukkit.Material;
import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualsites.translation.TranslationAsset;
import com.intellectualsites.translation.TranslationLanguage;
import com.intellectualsites.translation.TranslationManager;
import com.intellectualsites.translation.TranslationObject;
import org.bukkit.Material;
import java.io.File;
/**
* @author Citymonstret
@ -34,16 +33,7 @@ public class BukkitTranslation {
* @return parent folder
*/
public static File getParent() {
return new File(PlotSquared.IMP.getDirectory() + File.separator + "translations");
}
/**
* The default translation language
*
* @return default translation language
*/
public TranslationLanguage getDefaultLanguage() {
return TranslationLanguage.englishAmerican;
return new File(PlotSquared.getInstance().IMP.getDirectory() + File.separator + "translations");
}
/**
@ -54,4 +44,13 @@ public class BukkitTranslation {
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;
}
}