diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotMain.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotMain.java index 84c234e1b..4eeb7ff92 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotMain.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotMain.java @@ -38,13 +38,16 @@ import com.intellectualcrafters.plot.listeners.*; import com.intellectualcrafters.plot.object.*; import com.intellectualcrafters.plot.util.*; import com.intellectualcrafters.plot.util.Logger.LogLevel; +import com.intellectualcrafters.plot.uuid.DefaultUUIDWrapper; import com.intellectualcrafters.plot.uuid.OfflineUUIDWrapper; import com.intellectualcrafters.plot.uuid.PlotUUIDSaver; import com.intellectualcrafters.plot.uuid.UUIDSaver; import com.sk89q.worldedit.bukkit.WorldEditPlugin; import com.sk89q.worldguard.bukkit.WorldGuardPlugin; + import me.confuser.barapi.BarAPI; import net.milkbowl.vault.economy.Economy; + import org.bukkit.*; import org.bukkit.command.PluginCommand; import org.bukkit.configuration.file.YamlConfiguration; @@ -1528,6 +1531,12 @@ import java.util.concurrent.TimeUnit; if (Settings.OFFLINE_MODE) { UUIDHandler.uuidWrapper = new OfflineUUIDWrapper(); } + else if (checkVersion() && Bukkit.getOnlineMode()) { + UUIDHandler.uuidWrapper = new DefaultUUIDWrapper(); + } + else { + UUIDHandler.uuidWrapper = new OfflineUUIDWrapper(); + } setUUIDSaver(new PlotUUIDSaver()); // Looks really cool xD getUUIDSaver().globalPopulate(); @@ -1537,6 +1546,33 @@ import java.util.concurrent.TimeUnit; Broadcast(C.ENABLED); } } + + public static boolean checkVersion() { + try { + String[] version = Bukkit.getBukkitVersion().split("-")[0].split("\\."); + int a = Integer.parseInt(version[0]); + int b = Integer.parseInt(version[1]); + int c = 0; + if (version.length == 3) { + c = Integer.parseInt(version[2]); + } + if (a < 2) { + if (a < 1) { + return false; + } + if (b < 7) { + return false; + } + if (b == 7 && c < 5) { + return false; + } + } + return true; + } + catch (Exception e) { + return false; + } + } /** * On unload diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Setup.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Setup.java index 8ad5f5517..901725935 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Setup.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Setup.java @@ -111,9 +111,7 @@ public class Setup extends SubCommand implements Listener { try { plr.teleport(Bukkit.getWorld(world).getSpawnLocation()); } - catch (Exception e) { - - } + catch (Exception e) {} sendMessage(plr, C.SETUP_FINISHED, object.world); setupMap.remove(plrname); @@ -126,6 +124,14 @@ public class Setup extends SubCommand implements Listener { return true; } else { if (args[0].equalsIgnoreCase("cancel")) { + final String world = object.world; + PlotMain.config.set(world, null); + try { + PlotMain.config.save(PlotMain.configFile); + PlotMain.config.load(PlotMain.configFile); + } catch (final IOException | InvalidConfigurationException e) { + e.printStackTrace(); + } setupMap.remove(plrname); PlayerFunctions.sendMessage(plr, "&cCancelled setup."); return true; @@ -185,7 +191,7 @@ public class Setup extends SubCommand implements Listener { for (final Plugin plugin : Bukkit.getPluginManager().getPlugins()) { if (plugin.isEnabled()) { - if (plugin.getDefaultWorldGenerator("world", "") != null) { + if (plugin.getDefaultWorldGenerator(world, "") != null) { final String name = plugin.getDescription().getName(); generators.add(name); if (args[1].equals(name)) { diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotWorld.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotWorld.java index d1f5aa939..d2d1e520d 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotWorld.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotWorld.java @@ -306,6 +306,9 @@ public abstract class PlotWorld { this.SELL_PRICE = config.getDouble("economy.prices.sell"); this.PLOT_CHAT = config.getBoolean("chat.enabled"); this.DEFAULT_FLAGS = config.getStringList("flags.default"); + if (this.DEFAULT_FLAGS == null) { + this.DEFAULT_FLAGS = new ArrayList<>(); + } this.PVP = config.getBoolean("event.pvp"); this.PVE = config.getBoolean("event.pve"); this.SPAWN_EGGS = config.getBoolean("event.spawn.egg"); @@ -336,7 +339,7 @@ public abstract class PlotWorld { options.put("economy.prices.merge", PlotWorld.MERGE_PRICE_DEFAULT); options.put("economy.prices.sell", PlotWorld.SELL_PRICE_DEFAULT); options.put("chat.enabled", PlotWorld.PLOT_CHAT_DEFAULT); - options.put("flags.default", PlotWorld.DEFAULT_FLAGS_DEFAULT); + options.put("flags.default", null); options.put("event.pvp", PlotWorld.PVP_DEFAULT); options.put("event.pve", PlotWorld.PVE_DEFAULT); options.put("event.spawn.egg", PlotWorld.SPAWN_EGGS_DEFAULT); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/UUIDHandler.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/UUIDHandler.java index d450ff557..aa3805689 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/UUIDHandler.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/UUIDHandler.java @@ -315,7 +315,6 @@ import java.util.UUID; */ public static UUID getUUID(final OfflinePlayer player) { if (uuidWrapper == null) { - if (Settings.OFFLINE_MODE) { uuidWrapper = new OfflineUUIDWrapper(); } else {