mostly done

This commit is contained in:
boy0001 2015-02-23 00:20:41 +11:00
parent 02623d9cc2
commit a5731d94be
8 changed files with 40 additions and 9 deletions

View File

@ -29,7 +29,9 @@ import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.database.PlotMeConverter;
import com.intellectualcrafters.plot.events.PlotDeleteEvent;
import com.intellectualcrafters.plot.generator.BukkitHybridUtils;
import com.intellectualcrafters.plot.generator.HybridGen;
import com.intellectualcrafters.plot.generator.HybridUtils;
import com.intellectualcrafters.plot.listeners.ForceFieldListener;
import com.intellectualcrafters.plot.listeners.InventoryListener;
import com.intellectualcrafters.plot.listeners.PlayerEvents;
@ -37,9 +39,12 @@ import com.intellectualcrafters.plot.listeners.PlayerEvents_1_8;
import com.intellectualcrafters.plot.listeners.PlotPlusListener;
import com.intellectualcrafters.plot.listeners.WorldEditListener;
import com.intellectualcrafters.plot.object.PlotId;
import com.intellectualcrafters.plot.util.BlockManager;
import com.intellectualcrafters.plot.util.ConsoleColors;
import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.SetupUtils;
import com.intellectualcrafters.plot.util.TaskManager;
import com.intellectualcrafters.plot.util.bukkit.BukkitSetupUtils;
import com.intellectualcrafters.plot.util.bukkit.BukkitTaskManager;
import com.intellectualcrafters.plot.util.bukkit.BukkitUtil;
import com.intellectualcrafters.plot.util.bukkit.Metrics;
@ -265,7 +270,7 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
}
@Override
public void initSetBlockManager() {
public BlockManager initBlockManager() {
if (checkVersion(1, 8, 0)) {
try {
SetBlockManager.setBlockManager = new SetBlockFast_1_8();
@ -286,6 +291,7 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
} catch (final Throwable e) {
MainUtil.canSendChunk = false;
}
return BlockManager.manager = new BukkitUtil();
}
@Override
@ -321,4 +327,14 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
}
return true;
}
@Override
public HybridUtils initHybridUtils() {
return new BukkitHybridUtils();
}
@Override
public SetupUtils initSetupUtils() {
return new BukkitSetupUtils();
}
}

View File

@ -4,7 +4,10 @@ import java.io.File;
import net.milkbowl.vault.economy.Economy;
import com.intellectualcrafters.plot.generator.HybridUtils;
import com.intellectualcrafters.plot.object.PlotId;
import com.intellectualcrafters.plot.util.BlockManager;
import com.intellectualcrafters.plot.util.SetupUtils;
import com.intellectualcrafters.plot.util.TaskManager;
public interface IPlotMain {
@ -34,7 +37,11 @@ public interface IPlotMain {
public Economy getEconomy();
public void initSetBlockManager();
public BlockManager initBlockManager();
public SetupUtils initSetupUtils();
public HybridUtils initHybridUtils();
public boolean initPlotMeConverter();

View File

@ -38,6 +38,7 @@ import com.intellectualcrafters.plot.generator.AugmentedPopulator;
import com.intellectualcrafters.plot.generator.ClassicPlotWorld;
import com.intellectualcrafters.plot.generator.HybridGen;
import com.intellectualcrafters.plot.generator.HybridPlotWorld;
import com.intellectualcrafters.plot.generator.HybridUtils;
import com.intellectualcrafters.plot.generator.SquarePlotManager;
import com.intellectualcrafters.plot.generator.SquarePlotWorld;
import com.intellectualcrafters.plot.object.Plot;
@ -48,9 +49,11 @@ import com.intellectualcrafters.plot.object.PlotId;
import com.intellectualcrafters.plot.object.PlotManager;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.PlotWorld;
import com.intellectualcrafters.plot.util.BlockManager;
import com.intellectualcrafters.plot.util.ClusterManager;
import com.intellectualcrafters.plot.util.ExpireManager;
import com.intellectualcrafters.plot.util.Logger;
import com.intellectualcrafters.plot.util.SetupUtils;
import com.intellectualcrafters.plot.util.Logger.LogLevel;
import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.TaskManager;
@ -434,8 +437,12 @@ public class PlotSquared {
IMP.registerPlotPlusEvents();
IMP.registerForceFieldEvents();
IMP.registerWorldEditEvents();
// create Hybrid utility class
HybridUtils.manager = IMP.initHybridUtils();
// create setup util class
SetupUtils.manager = IMP.initSetupUtils();
// Set block
IMP.initSetBlockManager();
BlockManager.manager = IMP.initBlockManager();
// PlotMe
TaskManager.runTaskLater(new Runnable() {
@Override

View File

@ -19,7 +19,7 @@ import com.intellectualcrafters.plot.util.bukkit.BukkitUtil;
public abstract class HybridUtils {
public static HybridUtils manager = new BukkitHybridUtils();
public static HybridUtils manager;
public boolean checkModified(final Plot plot, int requiredChanges) {
final Location bottom = MainUtil.getPlotBottomLoc(plot.world, plot.id).add(1, 0, 1);

View File

@ -101,6 +101,7 @@ import com.intellectualcrafters.plot.object.PlotWorld;
import com.intellectualcrafters.plot.object.StringWrapper;
import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.Permissions;
import com.intellectualcrafters.plot.util.SetupUtils;
import com.intellectualcrafters.plot.util.TaskManager;
import com.intellectualcrafters.plot.util.bukkit.BukkitUtil;
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
@ -752,8 +753,8 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
@EventHandler
public static void onLeave(final PlayerQuitEvent event) {
String name = event.getPlayer().getName();
if (Setup.setupMap.containsKey(name)) {
Setup.setupMap.remove(name);
if (SetupUtils.setupMap.containsKey(name)) {
SetupUtils.setupMap.remove(name);
}
BukkitUtil.removePlayer(name);
if (Settings.DELETE_PLOTS_ON_BAN && event.getPlayer().isBanned()) {

View File

@ -5,7 +5,7 @@ import com.intellectualcrafters.plot.object.PlotBlock;
import com.intellectualcrafters.plot.util.bukkit.BukkitUtil;
public abstract class BlockManager {
public static BlockManager manager = new BukkitUtil();
public static BlockManager manager;
private static long state = 1;
public static long nextLong() {

View File

@ -109,7 +109,7 @@ public class ExpireManager {
}
final PlotManager manager = PlotSquared.getPlotManager(world);
if (plot.settings.isMerged()) {
Unlink.unlinkPlot(Bukkit.getWorld(world), plot);
Unlink.unlinkPlot(plot);
}
final PlotWorld plotworld = PlotSquared.getPlotWorld(world);
manager.clearPlot(plotworld, plot, false, null);

View File

@ -9,7 +9,7 @@ import com.intellectualcrafters.plot.util.bukkit.BukkitSetupUtils;
public abstract class SetupUtils {
public static SetupUtils manager = new BukkitSetupUtils();
public static SetupUtils manager;
public final static Map<String, SetupObject> setupMap = new HashMap<>();
public static HashMap<String, PlotGenerator> generators = new HashMap<>();