PlotSquared/src/main/java/com/plotsquared/bukkit/BukkitMain.java

590 lines
22 KiB
Java
Raw Normal View History

2015-07-26 16:51:12 +02:00
package com.plotsquared.bukkit;
2015-07-05 17:44:10 +02:00
2015-07-26 16:51:12 +02:00
import com.intellectualcrafters.plot.IPlotMain;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.commands.*;
2015-02-21 05:27:01 +01:00
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings;
2015-07-26 16:51:12 +02:00
import com.plotsquared.bukkit.database.plotme.ClassicPlotMeConnector;
import com.plotsquared.bukkit.database.plotme.LikePlotMeConverter;
import com.plotsquared.bukkit.database.plotme.PlotMeConnector_017;
2015-02-23 00:12:33 +01:00
import com.intellectualcrafters.plot.flag.FlagManager;
2015-02-22 14:20:41 +01:00
import com.intellectualcrafters.plot.generator.BukkitHybridUtils;
2015-07-26 19:00:09 +02:00
import com.intellectualcrafters.plot.generator.PlotGenerator2;
import com.plotsquared.bukkit.generator.BukkitGeneratorWrapper;
import com.plotsquared.bukkit.generator.BukkitPlotGenerator;
2015-07-26 16:51:12 +02:00
import com.plotsquared.bukkit.generator.HybridGen;
2015-02-22 14:20:41 +01:00
import com.intellectualcrafters.plot.generator.HybridUtils;
2015-07-26 16:51:12 +02:00
import com.plotsquared.bukkit.listeners.*;
import com.plotsquared.bukkit.listeners.worldedit.WEListener;
import com.plotsquared.bukkit.listeners.worldedit.WESubscriber;
2015-04-09 07:41:14 +02:00
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.PlotWorld;
2015-07-26 16:51:12 +02:00
import com.plotsquared.bukkit.titles.AbstractTitle;
import com.plotsquared.bukkit.titles.DefaultTitle;
import com.intellectualcrafters.plot.util.*;
2015-02-23 00:12:33 +01:00
import com.intellectualcrafters.plot.uuid.DefaultUUIDWrapper;
import com.intellectualcrafters.plot.uuid.LowerOfflineUUIDWrapper;
2015-02-23 00:12:33 +01:00
import com.intellectualcrafters.plot.uuid.OfflineUUIDWrapper;
import com.intellectualcrafters.plot.uuid.UUIDWrapper;
2015-07-26 16:51:12 +02:00
import com.plotsquared.bukkit.util.SetupUtils;
2015-07-26 18:14:34 +02:00
import com.plotsquared.bukkit.util.UUIDHandler;
2015-07-26 16:51:12 +02:00
import com.plotsquared.bukkit.util.bukkit.*;
import com.sk89q.worldedit.WorldEdit;
2015-02-21 05:27:01 +01:00
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
2015-07-26 17:08:06 +02:00
2015-07-26 16:51:12 +02:00
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.command.PluginCommand;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.generator.ChunkGenerator;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin;
import java.io.File;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
2015-02-19 07:08:15 +01:00
2015-02-20 07:34:19 +01:00
public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
2015-07-26 18:14:34 +02:00
public static BukkitMain THIS;
private int[] version;
2015-07-26 17:08:06 +02:00
@Override
2015-07-26 17:08:06 +02:00
public int[] getServerVersion() {
if (version == null) {
try {
version = new int[3];
final String[] split = Bukkit.getBukkitVersion().split("-")[0].split("\\.");
version[0] = Integer.parseInt(split[0]);
version[1] = Integer.parseInt(split[1]);
if (version.length == 3) {
version[2] = Integer.parseInt(split[2]);
}
} catch (Exception e) {
2015-07-17 05:48:23 +02:00
e.printStackTrace();
2015-07-26 17:08:06 +02:00
return null;
2015-02-20 11:53:18 +01:00
}
}
2015-07-26 17:08:06 +02:00
return version;
2015-02-20 11:53:18 +01:00
}
2015-02-19 07:08:15 +01:00
@Override
public void onEnable() {
THIS = this;
PS.instance = new PS(this);
2015-02-19 07:08:15 +01:00
if (Settings.METRICS) {
try {
final Metrics metrics = new Metrics(this);
metrics.start();
log(C.PREFIX.s() + "&6Metrics enabled.");
} catch (final Exception e) {
log(C.PREFIX.s() + "&cFailed to load up metrics.");
}
} else {
log("&dUsing metrics will allow us to improve the plugin, please consider it :)");
}
2015-03-22 12:43:46 +01:00
List<World> worlds = Bukkit.getWorlds();
if (worlds.size() > 0) {
2015-07-24 16:06:58 +02:00
UUIDHandler.startCaching();
2015-03-22 12:43:46 +01:00
for (World world : worlds) {
try {
SetGenCB.setGenerator(world);
} catch (Exception e) {
log("Failed to reload world: " + world.getName());
Bukkit.getServer().unloadWorld(world, false);
}
2015-03-22 12:43:46 +01:00
}
}
2015-02-19 07:08:15 +01:00
}
2015-04-01 10:25:58 +02:00
2015-02-19 07:08:15 +01:00
@Override
public void onDisable() {
PS.get().disable();
2015-02-19 07:08:15 +01:00
THIS = null;
}
2015-02-19 07:08:15 +01:00
@Override
public void log(String message) {
2015-03-17 09:38:06 +01:00
if (message == null) {
return;
}
if (THIS != null && Bukkit.getServer().getConsoleSender() != null) {
try {
2015-07-17 12:48:13 +02:00
message = C.color(message);
if (!Settings.CONSOLE_COLOR) {
message = ChatColor.stripColor(message);
}
Bukkit.getServer().getConsoleSender().sendMessage(message);
return;
2015-02-19 09:51:10 +01:00
}
catch (Throwable e) {};
2015-02-19 09:51:10 +01:00
}
System.out.println(ConsoleColors.fromString(message));
2015-02-19 07:08:15 +01:00
}
2015-02-19 07:08:15 +01:00
@Override
public void disable() {
2015-07-18 13:18:45 +02:00
if (THIS != null) {
onDisable();
}
2015-02-19 07:08:15 +01:00
}
2015-02-19 07:08:15 +01:00
@Override
2015-07-26 17:08:06 +02:00
public int[] getPluginVersion() {
String[] split = this.getDescription().getVersion().split("\\.");
return new int[] { Integer.parseInt(split[0]), Integer.parseInt(split[1]), Integer.parseInt(split[2]) };
2015-02-19 07:08:15 +01:00
}
2015-05-29 08:07:57 +02:00
@Override
public void handleKick(UUID uuid, C c) {
Player player = Bukkit.getPlayer(uuid);
if (player != null && player.isOnline()) {
MainUtil.sendMessage(BukkitUtil.getPlayer(player), c);
2015-07-02 20:27:15 +02:00
player.teleport(player.getWorld().getSpawnLocation());
2015-05-29 08:07:57 +02:00
}
}
2015-02-19 07:08:15 +01:00
@Override
public void registerCommands() {
2015-02-23 02:32:27 +01:00
new MainCommand();
2015-07-25 20:32:37 +02:00
MainCommand.subCommands.add(new Buy());
2015-07-24 19:37:39 +02:00
MainCommand.subCommands.add(new Save());
MainCommand.subCommands.add(new Load());
MainCommand.subCommands.add(new Download());
MainCommand.subCommands.add(new Disable());
MainCommand.subCommands.add(new Update());
2015-04-26 13:38:29 +02:00
MainCommand.subCommands.add(new Template());
MainCommand.subCommands.add(new Setup());
MainCommand.subCommands.add(new DebugUUID());
2015-04-26 15:38:02 +02:00
MainCommand.subCommands.add(new DebugFill());
2015-04-26 13:38:29 +02:00
MainCommand.subCommands.add(new DebugSaveTest());
MainCommand.subCommands.add(new DebugLoadTest());
MainCommand.subCommands.add(new CreateRoadSchematic());
MainCommand.subCommands.add(new DebugAllowUnsafe());
2015-04-26 13:38:29 +02:00
MainCommand.subCommands.add(new RegenAllRoads());
MainCommand.subCommands.add(new DebugClear());
MainCommand.subCommands.add(new Claim());
MainCommand.subCommands.add(new Auto());
MainCommand.subCommands.add(new Home());
MainCommand.subCommands.add(new Visit());
MainCommand.subCommands.add(new TP());
MainCommand.subCommands.add(new Set());
2015-06-05 15:05:17 +02:00
MainCommand.subCommands.add(new Toggle());
2015-04-26 13:38:29 +02:00
MainCommand.subCommands.add(new Clear());
MainCommand.subCommands.add(new Delete());
MainCommand.subCommands.add(new SetOwner());
2015-06-08 12:30:46 +02:00
if (Settings.ENABLE_CLUSTERS) {
MainCommand.subCommands.add(new Cluster());
}
MainCommand.subCommands.add(new Trust());
MainCommand.subCommands.add(new Add());
MainCommand.subCommands.add(new Deny());
MainCommand.subCommands.add(new Untrust());
MainCommand.subCommands.add(new Remove());
MainCommand.subCommands.add(new Undeny());
2015-04-26 13:38:29 +02:00
MainCommand.subCommands.add(new Info());
MainCommand.subCommands.add(new list());
MainCommand.subCommands.add(new Help());
MainCommand.subCommands.add(new Debug());
MainCommand.subCommands.add(new SchematicCmd());
MainCommand.subCommands.add(new plugin());
MainCommand.subCommands.add(new Inventory());
MainCommand.subCommands.add(new Purge());
MainCommand.subCommands.add(new Reload());
MainCommand.subCommands.add(new Merge());
MainCommand.subCommands.add(new DebugPaste());
2015-04-26 13:38:29 +02:00
MainCommand.subCommands.add(new Unlink());
MainCommand.subCommands.add(new Kick());
MainCommand.subCommands.add(new Rate());
MainCommand.subCommands.add(new DebugClaimTest());
MainCommand.subCommands.add(new Inbox());
MainCommand.subCommands.add(new Comment());
MainCommand.subCommands.add(new Database());
MainCommand.subCommands.add(new Unclaim());
MainCommand.subCommands.add(new Swap());
MainCommand.subCommands.add(new MusicSubcommand());
MainCommand.subCommands.add(new DebugRoadRegen());
MainCommand.subCommands.add(new Trim());
MainCommand.subCommands.add(new DebugExec());
MainCommand.subCommands.add(new FlagCmd());
MainCommand.subCommands.add(new Target());
MainCommand.subCommands.add(new DebugFixFlags());
MainCommand.subCommands.add(new Move());
MainCommand.subCommands.add(new Condense());
MainCommand.subCommands.add(new Confirm());
MainCommand.subCommands.add(new Copy());
2015-05-08 22:58:21 +02:00
MainCommand.subCommands.add(new Chat());
2015-02-21 06:48:49 +01:00
final BukkitCommand bcmd = new BukkitCommand();
2015-02-19 07:08:15 +01:00
final PluginCommand plotCommand = getCommand("plots");
2015-02-21 06:48:49 +01:00
plotCommand.setExecutor(bcmd);
2015-02-19 07:08:15 +01:00
plotCommand.setAliases(Arrays.asList("p", "ps", "plotme", "plot"));
2015-02-21 06:48:49 +01:00
plotCommand.setTabCompleter(bcmd);
2015-02-19 07:08:15 +01:00
}
2015-02-19 07:08:15 +01:00
@Override
public File getDirectory() {
return getDataFolder();
}
2015-02-19 07:08:15 +01:00
@Override
public TaskManager getTaskManager() {
return new BukkitTaskManager();
}
2015-02-19 07:08:15 +01:00
@Override
public void runEntityTask() {
log(C.PREFIX.s() + "KillAllEntities started.");
TaskManager.runTaskRepeat(new Runnable() {
long ticked = 0l;
long error = 0l;
2015-02-23 02:32:27 +01:00
2015-02-19 07:08:15 +01:00
@Override
public void run() {
if (this.ticked > 36_000L) {
this.ticked = 0l;
if (this.error > 0) {
log(C.PREFIX.s() + "KillAllEntities has been running for 6 hours. Errors: " + this.error);
}
this.error = 0l;
}
World world;
for (final PlotWorld pw : PS.get().getPlotWorldObjects()) {
world = Bukkit.getWorld(pw.worldname);
2015-02-19 07:08:15 +01:00
try {
for (Entity entity : world.getEntities()) {
switch (entity.getType()) {
case EGG:
case ENDER_CRYSTAL:
case COMPLEX_PART:
case ARMOR_STAND:
case FISHING_HOOK:
case ENDER_SIGNAL:
case EXPERIENCE_ORB:
case LEASH_HITCH:
case FIREWORK:
case WEATHER:
case LIGHTNING:
case WITHER_SKULL:
case UNKNOWN:
case ITEM_FRAME:
case PAINTING:
case PLAYER: {
// non moving / unremovable
continue;
}
case THROWN_EXP_BOTTLE:
case SPLASH_POTION:
case SNOWBALL:
case ENDER_PEARL:
case ARROW: {
// managed elsewhere | projectile
continue;
}
case MINECART:
case MINECART_CHEST:
case MINECART_COMMAND:
case MINECART_FURNACE:
case MINECART_HOPPER:
case MINECART_MOB_SPAWNER:
case MINECART_TNT:
case BOAT: {
// vehicle
continue;
}
case SMALL_FIREBALL:
case FIREBALL:
case DROPPED_ITEM: {
// dropped item
continue;
}
case PRIMED_TNT:
case FALLING_BLOCK: {
// managed elsewhere
continue;
}
case BAT:
case BLAZE:
case CAVE_SPIDER:
case CHICKEN:
case COW:
case CREEPER:
case ENDERMAN:
case ENDERMITE:
case ENDER_DRAGON:
case GHAST:
case GIANT:
case GUARDIAN:
case HORSE:
case IRON_GOLEM:
case MAGMA_CUBE:
case MUSHROOM_COW:
case OCELOT:
case PIG:
case PIG_ZOMBIE:
case RABBIT:
case SHEEP:
case SILVERFISH:
case SKELETON:
case SLIME:
case SNOWMAN:
case SPIDER:
case SQUID:
case VILLAGER:
case WITCH:
case WITHER:
case WOLF:
case ZOMBIE:
default: {
Location loc = entity.getLocation();
2015-07-21 05:41:04 +02:00
if (MainUtil.isPlotRoad(BukkitUtil.getLocation(loc))) {
2015-02-19 07:08:15 +01:00
entity.remove();
}
break;
2015-02-19 07:08:15 +01:00
}
}
}
2015-02-19 07:08:15 +01:00
} catch (final Throwable e) {
++this.error;
} finally {
++this.ticked;
}
}
}
}, 20);
}
2015-02-19 09:51:10 +01:00
@Override
final public ChunkGenerator getDefaultWorldGenerator(final String world, final String id) {
2015-05-04 15:53:24 +02:00
WorldEvents.lastWorld = world;
if (!PS.get().setupPlotWorld(world, id)) {
2015-02-19 09:51:10 +01:00
return null;
}
HybridGen result = new HybridGen(world);
2015-05-04 15:53:24 +02:00
TaskManager.runTaskLater(new Runnable() {
@Override
public void run() {
if (WorldEvents.lastWorld != null && WorldEvents.lastWorld.equals(world)) {
WorldEvents.lastWorld = null;
}
}
}, 20);
return result;
2015-02-19 09:51:10 +01:00
}
2015-02-19 07:08:15 +01:00
@Override
public void registerPlayerEvents() {
getServer().getPluginManager().registerEvents(new PlayerEvents(), this);
2015-07-26 17:08:06 +02:00
if (PS.get().checkVersion(this.getServerVersion(), 1, 8, 0)) {
2015-02-19 07:08:15 +01:00
getServer().getPluginManager().registerEvents(new PlayerEvents_1_8(), this);
}
2015-07-26 17:08:06 +02:00
if (PS.get().checkVersion(this.getServerVersion(), 1, 8, 3)) {
getServer().getPluginManager().registerEvents(new PlayerEvents_1_8_3(), this);
}
2015-02-19 07:08:15 +01:00
}
2015-02-19 07:08:15 +01:00
@Override
public void registerInventoryEvents() {
getServer().getPluginManager().registerEvents(new InventoryListener(), this);
}
2015-02-19 07:08:15 +01:00
@Override
public void registerPlotPlusEvents() {
PlotPlusListener.startRunnable(this);
getServer().getPluginManager().registerEvents(new PlotPlusListener(), this);
}
2015-02-19 07:08:15 +01:00
@Override
public void registerForceFieldEvents() {
getServer().getPluginManager().registerEvents(new ForceFieldListener(), this);
}
2015-02-19 07:08:15 +01:00
@Override
public void registerWorldEditEvents() {
if (getServer().getPluginManager().getPlugin("WorldEdit") != null) {
PS.get().worldEdit = (WorldEditPlugin) getServer().getPluginManager().getPlugin("WorldEdit");
final String version = PS.get().worldEdit.getDescription().getVersion();
2015-02-19 07:08:15 +01:00
if ((version != null) && version.startsWith("5.")) {
log("&cThis version of WorldEdit does not support PlotSquared.");
log("&cPlease use WorldEdit 6+ for masking support");
log("&c - http://builds.enginehub.org/job/worldedit");
} else {
2015-04-18 15:47:13 +02:00
getServer().getPluginManager().registerEvents(new WEListener(), this);
WorldEdit.getInstance().getEventBus().register(new WESubscriber());
2015-02-19 07:08:15 +01:00
MainCommand.subCommands.add(new WE_Anywhere());
}
}
}
2015-02-19 07:08:15 +01:00
@Override
2015-06-05 14:39:31 +02:00
public EconHandler getEconomyHandler() {
try {
BukkitEconHandler econ = new BukkitEconHandler();
if (econ.init()) {
return econ;
}
2015-07-03 11:30:26 +02:00
} catch (Throwable e) {
2015-02-19 07:08:15 +01:00
}
return null;
}
2015-02-19 09:51:10 +01:00
@Override
2015-02-22 14:20:41 +01:00
public BlockManager initBlockManager() {
2015-07-26 17:08:06 +02:00
if (PS.get().checkVersion(this.getServerVersion(), 1, 8, 0)) {
2015-02-19 09:51:10 +01:00
try {
2015-02-23 06:29:45 +01:00
BukkitSetBlockManager.setBlockManager = new SetBlockFast_1_8();
2015-02-20 07:34:19 +01:00
} catch (final Throwable e) {
2015-02-19 09:51:10 +01:00
e.printStackTrace();
2015-02-23 06:29:45 +01:00
BukkitSetBlockManager.setBlockManager = new SetBlockSlow();
2015-02-19 09:51:10 +01:00
}
2015-06-09 22:00:53 +02:00
try {
new SendChunk();
MainUtil.canSendChunk = true;
} catch (final Throwable e) {
MainUtil.canSendChunk = false;
}
2015-02-20 07:34:19 +01:00
} else {
2015-02-19 09:51:10 +01:00
try {
2015-02-23 06:29:45 +01:00
BukkitSetBlockManager.setBlockManager = new SetBlockFast();
2015-02-20 07:34:19 +01:00
} catch (final Throwable e) {
2015-03-18 06:50:07 +01:00
MainUtil.canSetFast = false;
2015-02-23 06:29:45 +01:00
BukkitSetBlockManager.setBlockManager = new SetBlockSlow();
2015-02-19 09:51:10 +01:00
}
}
2015-02-23 06:29:45 +01:00
BlockUpdateUtil.setBlockManager = BukkitSetBlockManager.setBlockManager;
2015-02-22 14:20:41 +01:00
return BlockManager.manager = new BukkitUtil();
2015-02-19 09:51:10 +01:00
}
2015-02-19 09:51:10 +01:00
@Override
public boolean initPlotMeConverter() {
2015-05-01 13:00:17 +02:00
TaskManager.runTaskLaterAsync(new Runnable() {
@Override
public void run() {
2015-07-09 06:19:49 +02:00
if (new LikePlotMeConverter("PlotMe").run(new ClassicPlotMeConnector())) return;
if (new LikePlotMeConverter("PlotMe").run(new PlotMeConnector_017())) return;
if (new LikePlotMeConverter("AthionPlots").run(new ClassicPlotMeConnector())) return;
2015-05-01 13:00:17 +02:00
}
}, 20);
2015-07-03 11:30:26 +02:00
return Bukkit.getPluginManager().getPlugin("PlotMe") != null || Bukkit.getPluginManager().getPlugin("AthionPlots") != null;
2015-02-19 09:51:10 +01:00
}
2015-02-19 09:51:10 +01:00
@Override
2015-07-26 19:00:09 +02:00
public BukkitGeneratorWrapper getGenerator(final String world, final String name) {
2015-02-20 07:34:19 +01:00
final Plugin gen_plugin = Bukkit.getPluginManager().getPlugin(name);
2015-07-26 19:00:09 +02:00
ChunkGenerator gen;
2015-02-20 07:34:19 +01:00
if ((gen_plugin != null) && gen_plugin.isEnabled()) {
2015-07-26 19:00:09 +02:00
gen = gen_plugin.getDefaultWorldGenerator(world, "");
2015-02-19 09:51:10 +01:00
} else {
2015-07-26 19:00:09 +02:00
gen = new HybridGen(world);
2015-02-19 09:51:10 +01:00
}
2015-07-26 19:00:09 +02:00
return new BukkitGeneratorWrapper(world, gen);
2015-02-19 09:51:10 +01:00
}
2015-02-22 14:20:41 +01:00
@Override
public HybridUtils initHybridUtils() {
return new BukkitHybridUtils();
}
2015-02-23 02:32:27 +01:00
2015-02-22 14:20:41 +01:00
@Override
public SetupUtils initSetupUtils() {
return new BukkitSetupUtils();
}
2015-02-23 02:32:27 +01:00
2015-02-23 00:12:33 +01:00
@Override
public UUIDWrapper initUUIDHandler() {
2015-07-26 17:08:06 +02:00
final boolean checkVersion = PS.get().checkVersion(this.getServerVersion(), 1, 7, 6);
2015-03-13 04:15:00 +01:00
if (Settings.OFFLINE_MODE) {
if (Settings.UUID_LOWERCASE) {
2015-07-24 16:06:58 +02:00
UUIDHandler.setUUIDWrapper(new LowerOfflineUUIDWrapper());
} else {
2015-07-24 16:06:58 +02:00
UUIDHandler.setUUIDWrapper(new OfflineUUIDWrapper());
}
2015-02-23 00:12:33 +01:00
Settings.OFFLINE_MODE = true;
2015-02-23 02:32:27 +01:00
} else if (checkVersion) {
2015-07-24 16:06:58 +02:00
UUIDHandler.setUUIDWrapper(new DefaultUUIDWrapper());
2015-02-23 00:12:33 +01:00
Settings.OFFLINE_MODE = false;
2015-02-23 02:32:27 +01:00
} else {
if (Settings.UUID_LOWERCASE) {
2015-07-24 16:06:58 +02:00
UUIDHandler.setUUIDWrapper(new LowerOfflineUUIDWrapper());
} else {
2015-07-24 16:06:58 +02:00
UUIDHandler.setUUIDWrapper(new OfflineUUIDWrapper());
}
2015-02-23 00:12:33 +01:00
Settings.OFFLINE_MODE = true;
}
2015-05-02 12:08:30 +02:00
if (!checkVersion) {
log(C.PREFIX.s() + " &c[WARN] Titles are disabled - please update your version of Bukkit to support this feature.");
Settings.TITLES = false;
FlagManager.removeFlag(FlagManager.getFlag("titles"));
} else {
AbstractTitle.TITLE_CLASS = new DefaultTitle();
2015-07-24 16:06:58 +02:00
if (UUIDHandler.getUUIDWrapper() instanceof DefaultUUIDWrapper) {
2015-05-02 12:08:30 +02:00
Settings.TWIN_MODE_UUID = true;
2015-07-24 16:06:58 +02:00
} else if (UUIDHandler.getUUIDWrapper() instanceof OfflineUUIDWrapper && !Bukkit.getOnlineMode()) {
2015-05-02 12:08:30 +02:00
Settings.TWIN_MODE_UUID = true;
}
}
2015-02-23 00:12:33 +01:00
if (Settings.OFFLINE_MODE) {
2015-02-23 02:32:27 +01:00
log(C.PREFIX.s() + " &6PlotSquared is using Offline Mode UUIDs either because of user preference, or because you are using an old version of Bukkit");
} else {
log(C.PREFIX.s() + " &6PlotSquared is using online UUIDs");
2015-02-23 00:12:33 +01:00
}
2015-07-24 16:06:58 +02:00
return UUIDHandler.getUUIDWrapper();
2015-02-23 00:12:33 +01:00
}
2015-02-23 02:32:27 +01:00
2015-02-23 01:05:25 +01:00
@Override
2015-02-23 06:29:45 +01:00
public ChunkManager initChunkManager() {
return new BukkitChunkManager();
}
2015-02-23 06:29:45 +01:00
@Override
public EventUtil initEventUtil() {
return new BukkitEventUtil();
2015-02-23 01:05:25 +01:00
}
2015-04-01 10:25:58 +02:00
@Override
public void registerTNTListener() {
getServer().getPluginManager().registerEvents(new TNTListener(), this);
}
2015-04-09 07:41:14 +02:00
@Override
public void unregister(PlotPlayer player) {
BukkitUtil.removePlayer(player.getName());
}
2015-04-26 08:29:58 +02:00
@Override
public APlotListener initPlotListener() {
return new PlotListener();
}
2015-04-26 08:29:58 +02:00
@Override
public void registerChunkProcessor() {
getServer().getPluginManager().registerEvents(new ChunkListener(), this);
}
2015-06-05 16:08:16 +02:00
2015-04-26 08:29:58 +02:00
@Override
public void registerWorldEvents() {
getServer().getPluginManager().registerEvents(new WorldEvents(), this);
}
2015-04-27 11:07:42 +02:00
@Override
public PlayerManager initPlayerManager() {
return new BukkitPlayerManager();
}
@Override
public InventoryUtil initInventoryUtil() {
return new BukkitInventoryUtil();
}
2015-07-24 19:37:39 +02:00
@Override
public String getServerName() {
return Bukkit.getServerName();
}
2015-02-19 04:24:05 +01:00
}