mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-29 16:46:45 +01:00
Removed PlotMe converting features.
Signed-off-by: matt <4009945+MattBDev@users.noreply.github.com>
This commit is contained in:
parent
0e0a534620
commit
0817d7de5a
@ -1,14 +1,36 @@
|
|||||||
package com.github.intellectualsites.plotsquared.bukkit;
|
package com.github.intellectualsites.plotsquared.bukkit;
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.bukkit.database.plotme.ClassicPlotMeConnector;
|
import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils.getRefClass;
|
||||||
import com.github.intellectualsites.plotsquared.bukkit.database.plotme.LikePlotMeConverter;
|
|
||||||
import com.github.intellectualsites.plotsquared.bukkit.database.plotme.PlotMeConnector_017;
|
|
||||||
import com.github.intellectualsites.plotsquared.bukkit.generator.BukkitPlotGenerator;
|
import com.github.intellectualsites.plotsquared.bukkit.generator.BukkitPlotGenerator;
|
||||||
import com.github.intellectualsites.plotsquared.bukkit.listeners.*;
|
import com.github.intellectualsites.plotsquared.bukkit.listeners.ChunkListener;
|
||||||
|
import com.github.intellectualsites.plotsquared.bukkit.listeners.EntitySpawnListener;
|
||||||
|
import com.github.intellectualsites.plotsquared.bukkit.listeners.PlayerEvents;
|
||||||
|
import com.github.intellectualsites.plotsquared.bukkit.listeners.PlotPlusListener;
|
||||||
|
import com.github.intellectualsites.plotsquared.bukkit.listeners.SingleWorldListener;
|
||||||
|
import com.github.intellectualsites.plotsquared.bukkit.listeners.WorldEvents;
|
||||||
import com.github.intellectualsites.plotsquared.bukkit.titles.DefaultTitle_111;
|
import com.github.intellectualsites.plotsquared.bukkit.titles.DefaultTitle_111;
|
||||||
import com.github.intellectualsites.plotsquared.bukkit.util.*;
|
import com.github.intellectualsites.plotsquared.bukkit.util.BukkitBlockRegistry;
|
||||||
|
import com.github.intellectualsites.plotsquared.bukkit.util.BukkitChatManager;
|
||||||
|
import com.github.intellectualsites.plotsquared.bukkit.util.BukkitChunkManager;
|
||||||
|
import com.github.intellectualsites.plotsquared.bukkit.util.BukkitCommand;
|
||||||
|
import com.github.intellectualsites.plotsquared.bukkit.util.BukkitEconHandler;
|
||||||
|
import com.github.intellectualsites.plotsquared.bukkit.util.BukkitEventUtil;
|
||||||
|
import com.github.intellectualsites.plotsquared.bukkit.util.BukkitHybridUtils;
|
||||||
|
import com.github.intellectualsites.plotsquared.bukkit.util.BukkitInventoryUtil;
|
||||||
|
import com.github.intellectualsites.plotsquared.bukkit.util.BukkitLegacyMappings;
|
||||||
|
import com.github.intellectualsites.plotsquared.bukkit.util.BukkitSchematicHandler;
|
||||||
|
import com.github.intellectualsites.plotsquared.bukkit.util.BukkitSetupUtils;
|
||||||
|
import com.github.intellectualsites.plotsquared.bukkit.util.BukkitTaskManager;
|
||||||
|
import com.github.intellectualsites.plotsquared.bukkit.util.BukkitUtil;
|
||||||
|
import com.github.intellectualsites.plotsquared.bukkit.util.SendChunk;
|
||||||
|
import com.github.intellectualsites.plotsquared.bukkit.util.SetGenCB;
|
||||||
import com.github.intellectualsites.plotsquared.bukkit.util.block.BukkitLocalQueue;
|
import com.github.intellectualsites.plotsquared.bukkit.util.block.BukkitLocalQueue;
|
||||||
import com.github.intellectualsites.plotsquared.bukkit.uuid.*;
|
import com.github.intellectualsites.plotsquared.bukkit.uuid.DefaultUUIDWrapper;
|
||||||
|
import com.github.intellectualsites.plotsquared.bukkit.uuid.FileUUIDHandler;
|
||||||
|
import com.github.intellectualsites.plotsquared.bukkit.uuid.LowerOfflineUUIDWrapper;
|
||||||
|
import com.github.intellectualsites.plotsquared.bukkit.uuid.OfflineUUIDWrapper;
|
||||||
|
import com.github.intellectualsites.plotsquared.bukkit.uuid.SQLUUIDHandler;
|
||||||
import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection;
|
import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection;
|
||||||
import com.github.intellectualsites.plotsquared.plot.IPlotMain;
|
import com.github.intellectualsites.plotsquared.plot.IPlotMain;
|
||||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
||||||
@ -19,22 +41,57 @@ import com.github.intellectualsites.plotsquared.plot.generator.GeneratorWrapper;
|
|||||||
import com.github.intellectualsites.plotsquared.plot.generator.HybridGen;
|
import com.github.intellectualsites.plotsquared.plot.generator.HybridGen;
|
||||||
import com.github.intellectualsites.plotsquared.plot.generator.HybridUtils;
|
import com.github.intellectualsites.plotsquared.plot.generator.HybridUtils;
|
||||||
import com.github.intellectualsites.plotsquared.plot.generator.IndependentPlotGenerator;
|
import com.github.intellectualsites.plotsquared.plot.generator.IndependentPlotGenerator;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
import com.github.intellectualsites.plotsquared.plot.object.BlockRegistry;
|
||||||
|
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
||||||
|
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
||||||
|
import com.github.intellectualsites.plotsquared.plot.object.PlotId;
|
||||||
|
import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer;
|
||||||
|
import com.github.intellectualsites.plotsquared.plot.object.RunnableVal;
|
||||||
|
import com.github.intellectualsites.plotsquared.plot.object.SetupObject;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.chat.PlainChatManager;
|
import com.github.intellectualsites.plotsquared.plot.object.chat.PlainChatManager;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.worlds.PlotAreaManager;
|
import com.github.intellectualsites.plotsquared.plot.object.worlds.PlotAreaManager;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.worlds.SinglePlotArea;
|
import com.github.intellectualsites.plotsquared.plot.object.worlds.SinglePlotArea;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.worlds.SinglePlotAreaManager;
|
import com.github.intellectualsites.plotsquared.plot.object.worlds.SinglePlotAreaManager;
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.worlds.SingleWorldGenerator;
|
import com.github.intellectualsites.plotsquared.plot.object.worlds.SingleWorldGenerator;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.*;
|
import com.github.intellectualsites.plotsquared.plot.util.AbstractTitle;
|
||||||
|
import com.github.intellectualsites.plotsquared.plot.util.ChatManager;
|
||||||
|
import com.github.intellectualsites.plotsquared.plot.util.ChunkManager;
|
||||||
|
import com.github.intellectualsites.plotsquared.plot.util.ConsoleColors;
|
||||||
|
import com.github.intellectualsites.plotsquared.plot.util.EconHandler;
|
||||||
|
import com.github.intellectualsites.plotsquared.plot.util.EventUtil;
|
||||||
|
import com.github.intellectualsites.plotsquared.plot.util.InventoryUtil;
|
||||||
|
import com.github.intellectualsites.plotsquared.plot.util.LegacyMappings;
|
||||||
|
import com.github.intellectualsites.plotsquared.plot.util.MainUtil;
|
||||||
|
import com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils;
|
||||||
|
import com.github.intellectualsites.plotsquared.plot.util.SchematicHandler;
|
||||||
|
import com.github.intellectualsites.plotsquared.plot.util.SetupUtils;
|
||||||
|
import com.github.intellectualsites.plotsquared.plot.util.StringMan;
|
||||||
|
import com.github.intellectualsites.plotsquared.plot.util.TaskManager;
|
||||||
|
import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler;
|
||||||
|
import com.github.intellectualsites.plotsquared.plot.util.UUIDHandlerImplementation;
|
||||||
|
import com.github.intellectualsites.plotsquared.plot.util.WorldUtil;
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.block.QueueProvider;
|
import com.github.intellectualsites.plotsquared.plot.util.block.QueueProvider;
|
||||||
import com.github.intellectualsites.plotsquared.plot.uuid.UUIDWrapper;
|
import com.github.intellectualsites.plotsquared.plot.uuid.UUIDWrapper;
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
||||||
import com.sk89q.worldedit.extension.platform.Capability;
|
import com.sk89q.worldedit.extension.platform.Capability;
|
||||||
|
import java.io.File;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
import org.bukkit.*;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.OfflinePlayer;
|
||||||
|
import org.bukkit.World;
|
||||||
import org.bukkit.command.PluginCommand;
|
import org.bukkit.command.PluginCommand;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
@ -47,63 +104,16 @@ import org.bukkit.plugin.Plugin;
|
|||||||
import org.bukkit.plugin.PluginManager;
|
import org.bukkit.plugin.PluginManager;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import java.io.File;
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
|
|
||||||
import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils.getRefClass;
|
|
||||||
|
|
||||||
public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||||
|
|
||||||
@Getter private static WorldEdit worldEdit;
|
@Getter private static WorldEdit worldEdit;
|
||||||
private static Map<String, Plugin> pluginMap;
|
|
||||||
|
|
||||||
static {
|
static {
|
||||||
// Disable AWE as otherwise both fail to load
|
// Disable AWE as otherwise both fail to load
|
||||||
PluginManager manager = Bukkit.getPluginManager();
|
PluginManager manager = Bukkit.getPluginManager();
|
||||||
try {
|
try {
|
||||||
Settings.load(new File("plugins/PlotSquared/config/settings.yml"));
|
Settings.load(new File("plugins/PlotSquared/config/settings.yml"));
|
||||||
if (Settings.Enabled_Components.PLOTME_CONVERTER) { // Only disable PlotMe if conversion is enabled
|
} catch (Throwable ignored) {
|
||||||
Field pluginsField = manager.getClass().getDeclaredField("plugins");
|
|
||||||
Field lookupNamesField = manager.getClass().getDeclaredField("lookupNames");
|
|
||||||
pluginsField.setAccessible(true);
|
|
||||||
lookupNamesField.setAccessible(true);
|
|
||||||
List<Plugin> plugins = (List<Plugin>) pluginsField.get(manager);
|
|
||||||
Iterator<Plugin> iter = plugins.iterator();
|
|
||||||
while (iter.hasNext()) {
|
|
||||||
if (iter.next().getName().startsWith("PlotMe")) {
|
|
||||||
iter.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Map<String, Plugin> lookupNames =
|
|
||||||
(Map<String, Plugin>) lookupNamesField.get(manager);
|
|
||||||
lookupNames.remove("PlotMe");
|
|
||||||
lookupNames.remove("PlotMe-DefaultGenerator");
|
|
||||||
pluginsField.set(manager, new ArrayList<Plugin>(plugins) {
|
|
||||||
@Override public boolean add(Plugin plugin) {
|
|
||||||
if (plugin.getName().startsWith("PlotMe")) {
|
|
||||||
System.out.print("Disabling `" + plugin.getName()
|
|
||||||
+ "` for PlotMe conversion (configure in PlotSquared settings.yml)");
|
|
||||||
} else {
|
|
||||||
return super.add(plugin);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
pluginMap = new ConcurrentHashMap<String, Plugin>(lookupNames) {
|
|
||||||
@Override public Plugin put(String key, Plugin plugin) {
|
|
||||||
if (!plugin.getName().startsWith("PlotMe")) {
|
|
||||||
return super.put(key, plugin);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
lookupNamesField.set(manager, pluginMap);
|
|
||||||
}
|
|
||||||
} catch (Throwable ignore) {
|
|
||||||
}
|
}
|
||||||
// Force WorldEdit to load
|
// Force WorldEdit to load
|
||||||
try {
|
try {
|
||||||
@ -156,9 +166,6 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override public void onEnable() {
|
@Override public void onEnable() {
|
||||||
if (pluginMap != null) {
|
|
||||||
pluginMap.put("PlotMe-DefaultGenerator", this);
|
|
||||||
}
|
|
||||||
this.pluginName = getDescription().getName();
|
this.pluginName = getDescription().getName();
|
||||||
getServer().getName();
|
getServer().getName();
|
||||||
|
|
||||||
@ -205,8 +212,8 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
|||||||
this.methodUnloadChunk0 = classCraftWorld.getRealClass()
|
this.methodUnloadChunk0 = classCraftWorld.getRealClass()
|
||||||
.getDeclaredMethod("unloadChunk0", int.class, int.class, boolean.class);
|
.getDeclaredMethod("unloadChunk0", int.class, int.class, boolean.class);
|
||||||
this.methodUnloadChunk0.setAccessible(true);
|
this.methodUnloadChunk0.setAccessible(true);
|
||||||
} catch (Throwable ignore) {
|
} catch (Throwable event) {
|
||||||
ignore.printStackTrace();
|
event.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
final PlotAreaManager manager = PlotSquared.get().getPlotAreaManager();
|
final PlotAreaManager manager = PlotSquared.get().getPlotAreaManager();
|
||||||
@ -577,10 +584,6 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
|||||||
|
|
||||||
@Override @Nullable
|
@Override @Nullable
|
||||||
public final ChunkGenerator getDefaultWorldGenerator(final String world, final String id) {
|
public final ChunkGenerator getDefaultWorldGenerator(final String world, final String id) {
|
||||||
if (Settings.Enabled_Components.PLOTME_CONVERTER) {
|
|
||||||
initPlotMeConverter();
|
|
||||||
Settings.Enabled_Components.PLOTME_CONVERTER = false;
|
|
||||||
}
|
|
||||||
final IndependentPlotGenerator result;
|
final IndependentPlotGenerator result;
|
||||||
if (id != null && id.equalsIgnoreCase("single")) {
|
if (id != null && id.equalsIgnoreCase("single")) {
|
||||||
result = new SingleWorldGenerator();
|
result = new SingleWorldGenerator();
|
||||||
@ -653,15 +656,6 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
|||||||
return new BukkitUtil();
|
return new BukkitUtil();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public boolean initPlotMeConverter() {
|
|
||||||
if (new LikePlotMeConverter("PlotMe").run(new ClassicPlotMeConnector())) {
|
|
||||||
return true;
|
|
||||||
} else if (new LikePlotMeConverter("PlotMe").run(new PlotMeConnector_017())) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override @Nullable public GeneratorWrapper<?> getGenerator(@NonNull final String world,
|
@Override @Nullable public GeneratorWrapper<?> getGenerator(@NonNull final String world,
|
||||||
@Nullable final String name) {
|
@Nullable final String name) {
|
||||||
if (name == null) {
|
if (name == null) {
|
||||||
|
@ -1,87 +0,0 @@
|
|||||||
package com.github.intellectualsites.plotsquared.bukkit.database.plotme;
|
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.configuration.file.FileConfiguration;
|
|
||||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.Location;
|
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.PlotId;
|
|
||||||
|
|
||||||
import java.sql.Connection;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
public abstract class APlotMeConnector {
|
|
||||||
|
|
||||||
public abstract Connection getPlotMeConnection(String plugin, FileConfiguration plotConfig,
|
|
||||||
String dataFolder);
|
|
||||||
|
|
||||||
public abstract HashMap<String, HashMap<PlotId, Plot>> getPlotMePlots(Connection connection)
|
|
||||||
throws SQLException;
|
|
||||||
|
|
||||||
public abstract boolean accepts(String version);
|
|
||||||
|
|
||||||
public boolean isValidConnection(Connection connection) {
|
|
||||||
return connection != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void copyConfig(FileConfiguration plotConfig, String world, String actualWorldName) {
|
|
||||||
int pathWidth = plotConfig.getInt("worlds." + world + ".PathWidth"); //
|
|
||||||
PlotSquared.get().worlds.set("worlds." + actualWorldName + ".road.width", pathWidth);
|
|
||||||
int plotSize = plotConfig.getInt("worlds." + world + ".PlotSize"); //
|
|
||||||
PlotSquared.get().worlds.set("worlds." + actualWorldName + ".plot.size", plotSize);
|
|
||||||
String wallBlock = plotConfig.getString("worlds." + world + ".WallBlockId"); //
|
|
||||||
PlotSquared.get().worlds.set("worlds." + actualWorldName + ".wall.block", wallBlock);
|
|
||||||
String floor = plotConfig.getString("worlds." + world + ".PlotFloorBlockId"); //
|
|
||||||
PlotSquared.get().worlds
|
|
||||||
.set("worlds." + actualWorldName + ".plot.floor", Collections.singletonList(floor));
|
|
||||||
String filling = plotConfig.getString("worlds." + world + ".PlotFillingBlockId"); //
|
|
||||||
PlotSquared.get().worlds
|
|
||||||
.set("worlds." + actualWorldName + ".plot.filling", Collections.singletonList(filling));
|
|
||||||
String road = plotConfig.getString("worlds." + world + ".RoadMainBlockId");
|
|
||||||
PlotSquared.get().worlds.set("worlds." + actualWorldName + ".road.block", road);
|
|
||||||
int height = plotConfig.getInt("worlds." + world + ".RoadHeight"); //
|
|
||||||
PlotSquared.get().worlds.set("worlds." + actualWorldName + ".road.height", height);
|
|
||||||
PlotSquared.get().worlds.set("worlds." + actualWorldName + ".plot.height", height);
|
|
||||||
PlotSquared.get().worlds.set("worlds." + actualWorldName + ".wall.height", height);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Location getPlotTopLocAbs(int path, int plot, PlotId plotId) {
|
|
||||||
int px = plotId.x;
|
|
||||||
int pz = plotId.y;
|
|
||||||
int x = px * (path + plot) - (int) Math.floor(path / 2) - 1;
|
|
||||||
int z = pz * (path + plot) - (int) Math.floor(path / 2) - 1;
|
|
||||||
return new Location(null, x, 256, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Location getPlotBottomLocAbs(int path, int plot, PlotId plotId) {
|
|
||||||
int px = plotId.x;
|
|
||||||
int pz = plotId.y;
|
|
||||||
int x = px * (path + plot) - plot - (int) Math.floor(path / 2) - 1;
|
|
||||||
int z = pz * (path + plot) - plot - (int) Math.floor(path / 2) - 1;
|
|
||||||
return new Location(null, x, 1, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMerged(HashMap<String, HashMap<PlotId, boolean[]>> merges, String world,
|
|
||||||
PlotId id, int direction) {
|
|
||||||
HashMap<PlotId, boolean[]> plots = merges.get(world);
|
|
||||||
PlotId id2 = new PlotId(id.x, id.y);
|
|
||||||
boolean[] merge1;
|
|
||||||
if (plots.containsKey(id)) {
|
|
||||||
merge1 = plots.get(id);
|
|
||||||
} else {
|
|
||||||
merge1 = new boolean[] {false, false, false, false};
|
|
||||||
}
|
|
||||||
boolean[] merge2;
|
|
||||||
if (plots.containsKey(id2)) {
|
|
||||||
merge2 = plots.get(id2);
|
|
||||||
} else {
|
|
||||||
merge2 = new boolean[] {false, false, false, false};
|
|
||||||
}
|
|
||||||
merge1[direction] = true;
|
|
||||||
merge2[(direction + 2) % 4] = true;
|
|
||||||
plots.put(id, merge1);
|
|
||||||
plots.put(id2, merge1);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,240 +0,0 @@
|
|||||||
package com.github.intellectualsites.plotsquared.bukkit.database.plotme;
|
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.configuration.file.FileConfiguration;
|
|
||||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
|
||||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
|
||||||
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
|
||||||
import com.github.intellectualsites.plotsquared.plot.database.SQLite;
|
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler;
|
|
||||||
import com.google.common.base.Charsets;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.nio.ByteBuffer;
|
|
||||||
import java.sql.*;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public class ClassicPlotMeConnector extends APlotMeConnector {
|
|
||||||
|
|
||||||
private String plugin = "PlotMe";
|
|
||||||
private String prefix;
|
|
||||||
|
|
||||||
@Override public Connection getPlotMeConnection(String plugin, FileConfiguration plotConfig,
|
|
||||||
String dataFolder) {
|
|
||||||
this.plugin = plugin.toLowerCase();
|
|
||||||
this.prefix = plotConfig.getString("mySQLprefix", this.plugin.toLowerCase());
|
|
||||||
try {
|
|
||||||
if (plotConfig.getBoolean("usemySQL")) {
|
|
||||||
String user = plotConfig.getString("mySQLuname");
|
|
||||||
String password = plotConfig.getString("mySQLpass");
|
|
||||||
String con = plotConfig.getString("mySQLconn");
|
|
||||||
return DriverManager.getConnection(con, user, password);
|
|
||||||
} else {
|
|
||||||
return new SQLite(new File(dataFolder + File.separator + "plots.db"))
|
|
||||||
.openConnection();
|
|
||||||
}
|
|
||||||
} catch (SQLException | ClassNotFoundException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public HashMap<String, HashMap<PlotId, Plot>> getPlotMePlots(Connection connection)
|
|
||||||
throws SQLException {
|
|
||||||
HashMap<String, Integer> plotWidth = new HashMap<>();
|
|
||||||
HashMap<String, Integer> roadWidth = new HashMap<>();
|
|
||||||
HashMap<String, HashMap<PlotId, Plot>> plots = new HashMap<>();
|
|
||||||
HashMap<String, HashMap<PlotId, boolean[]>> merges = new HashMap<>();
|
|
||||||
PreparedStatement statement =
|
|
||||||
connection.prepareStatement("SELECT * FROM `" + this.prefix + "Plots`");
|
|
||||||
ResultSet resultSet = statement.executeQuery();
|
|
||||||
String column = null;
|
|
||||||
boolean checkUUID = DBFunc.hasColumn(resultSet, "ownerid");
|
|
||||||
boolean checkUUID2 = DBFunc.hasColumn(resultSet, "ownerId");
|
|
||||||
if (checkUUID) {
|
|
||||||
column = "ownerid";
|
|
||||||
} else if (checkUUID2) {
|
|
||||||
column = "ownerId";
|
|
||||||
}
|
|
||||||
boolean merge =
|
|
||||||
!"plotme".equalsIgnoreCase(this.plugin) && Settings.Enabled_Components.PLOTME_CONVERTER;
|
|
||||||
int missing = 0;
|
|
||||||
while (resultSet.next()) {
|
|
||||||
PlotId id = new PlotId(resultSet.getInt("idX"), resultSet.getInt("idZ"));
|
|
||||||
String name = resultSet.getString("owner");
|
|
||||||
String world = LikePlotMeConverter.getWorld(resultSet.getString("world"));
|
|
||||||
if (!plots.containsKey(world)) {
|
|
||||||
plots.put(world, new HashMap<PlotId, Plot>());
|
|
||||||
if (merge) {
|
|
||||||
int plot = PlotSquared.get().worlds.getInt("worlds." + world + ".plot.size");
|
|
||||||
int path = PlotSquared.get().worlds.getInt("worlds." + world + ".road.width");
|
|
||||||
plotWidth.put(world, plot);
|
|
||||||
roadWidth.put(world, path);
|
|
||||||
merges.put(world, new HashMap<PlotId, boolean[]>());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (merge) {
|
|
||||||
int tx = resultSet.getInt("topX");
|
|
||||||
int tz = resultSet.getInt("topZ");
|
|
||||||
int bx = resultSet.getInt("bottomX") - 1;
|
|
||||||
int bz = resultSet.getInt("bottomZ") - 1;
|
|
||||||
int path = roadWidth.get(world);
|
|
||||||
int plot = plotWidth.get(world);
|
|
||||||
Location top = getPlotTopLocAbs(path, plot, id);
|
|
||||||
Location bot = getPlotBottomLocAbs(path, plot, id);
|
|
||||||
if (tx > top.getX()) {
|
|
||||||
setMerged(merges, world, id, 1);
|
|
||||||
}
|
|
||||||
if (tz > top.getZ()) {
|
|
||||||
setMerged(merges, world, id, 2);
|
|
||||||
}
|
|
||||||
if (bx < bot.getX()) {
|
|
||||||
setMerged(merges, world, id, 3);
|
|
||||||
}
|
|
||||||
if (bz > bot.getZ()) {
|
|
||||||
setMerged(merges, world, id, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
UUID owner = UUIDHandler.getUUID(name, null);
|
|
||||||
if (owner == null) {
|
|
||||||
if ("*".equals(name)) {
|
|
||||||
owner = DBFunc.EVERYONE;
|
|
||||||
} else {
|
|
||||||
if (checkUUID || checkUUID2) {
|
|
||||||
byte[] bytes = resultSet.getBytes(column);
|
|
||||||
if (bytes != null) {
|
|
||||||
ByteBuffer bb = ByteBuffer.wrap(bytes);
|
|
||||||
long high = bb.getLong();
|
|
||||||
long low = bb.getLong();
|
|
||||||
owner = new UUID(high, low);
|
|
||||||
UUIDHandler.add(new StringWrapper(name), owner);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (name.isEmpty()) {
|
|
||||||
PlotSquared.log(
|
|
||||||
"&cCould not identify owner for plot: " + id + " -> '" + name + "'");
|
|
||||||
missing++;
|
|
||||||
owner = UUID.nameUUIDFromBytes(
|
|
||||||
("OfflinePlayer:" + name.toLowerCase()).getBytes(Charsets.UTF_8));
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
UUIDHandler.add(new StringWrapper(name), owner);
|
|
||||||
}
|
|
||||||
Plot plot = new Plot(PlotArea.createGeneric(world), id, owner);
|
|
||||||
plots.get(world).put(id, plot);
|
|
||||||
}
|
|
||||||
if (missing > 0) {
|
|
||||||
PlotSquared.log("&cSome names could not be identified:");
|
|
||||||
PlotSquared
|
|
||||||
.log("&7 - Empty quotes mean PlotMe just stored an unowned plot in the database");
|
|
||||||
PlotSquared.log(
|
|
||||||
"&7 - Names you have never seen before could be from people mistyping commands");
|
|
||||||
PlotSquared.log(
|
|
||||||
"&7 - Converting from a non-uuid version of PlotMe can't identify owners if the playerdata files are deleted (these plots will "
|
|
||||||
+ "remain unknown until the player connects)");
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Entry<String, HashMap<PlotId, boolean[]>> entry : merges.entrySet()) {
|
|
||||||
String world = entry.getKey();
|
|
||||||
for (Entry<PlotId, boolean[]> entry2 : entry.getValue().entrySet()) {
|
|
||||||
HashMap<PlotId, Plot> newPlots = plots.get(world);
|
|
||||||
Plot plot = newPlots.get(entry2.getKey());
|
|
||||||
if (plot != null) {
|
|
||||||
plot.setMerged(entry2.getValue());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
resultSet.close();
|
|
||||||
statement.close();
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
PlotSquared.log(" - " + this.prefix + "Denied");
|
|
||||||
statement = connection.prepareStatement("SELECT * FROM `" + this.prefix + "Denied`");
|
|
||||||
resultSet = statement.executeQuery();
|
|
||||||
|
|
||||||
while (resultSet.next()) {
|
|
||||||
PlotId id = new PlotId(resultSet.getInt("idX"), resultSet.getInt("idZ"));
|
|
||||||
String name = resultSet.getString("player");
|
|
||||||
String world = LikePlotMeConverter.getWorld(resultSet.getString("world"));
|
|
||||||
UUID denied = UUIDHandler.getUUID(name, null);
|
|
||||||
if (denied == null) {
|
|
||||||
if ("*".equals(name)) {
|
|
||||||
denied = DBFunc.EVERYONE;
|
|
||||||
} else if (DBFunc.hasColumn(resultSet, "playerid")) {
|
|
||||||
byte[] bytes = resultSet.getBytes("playerid");
|
|
||||||
if (bytes != null) {
|
|
||||||
ByteBuffer bb = ByteBuffer.wrap(bytes);
|
|
||||||
long mostSigBits = bb.getLong();
|
|
||||||
long leastSigBits = bb.getLong();
|
|
||||||
denied = new UUID(mostSigBits, leastSigBits);
|
|
||||||
UUIDHandler.add(new StringWrapper(name), denied);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (denied == null) {
|
|
||||||
PlotSquared.log("&6Could not identify denied for plot: " + id);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
HashMap<PlotId, Plot> worldMap = plots.get(world);
|
|
||||||
if (worldMap != null) {
|
|
||||||
Plot plot = worldMap.get(id);
|
|
||||||
if (plot != null) {
|
|
||||||
plot.getDenied().add(denied);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
statement = connection.prepareStatement("SELECT * FROM `" + this.plugin + "Allowed`");
|
|
||||||
resultSet = statement.executeQuery();
|
|
||||||
|
|
||||||
while (resultSet.next()) {
|
|
||||||
PlotId id = new PlotId(resultSet.getInt("idX"), resultSet.getInt("idZ"));
|
|
||||||
String name = resultSet.getString("player");
|
|
||||||
String world = LikePlotMeConverter.getWorld(resultSet.getString("world"));
|
|
||||||
UUID helper = UUIDHandler.getUUID(name, null);
|
|
||||||
if (helper == null) {
|
|
||||||
if ("*".equals(name)) {
|
|
||||||
helper = DBFunc.EVERYONE;
|
|
||||||
} else if (DBFunc.hasColumn(resultSet, "playerid")) {
|
|
||||||
byte[] bytes = resultSet.getBytes("playerid");
|
|
||||||
if (bytes != null) {
|
|
||||||
ByteBuffer bb = ByteBuffer.wrap(bytes);
|
|
||||||
long mostSigBits = bb.getLong();
|
|
||||||
long leastSigBits = bb.getLong();
|
|
||||||
helper = new UUID(mostSigBits, leastSigBits);
|
|
||||||
UUIDHandler.add(new StringWrapper(name), helper);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (helper == null) {
|
|
||||||
PlotSquared.log("&6Could not identify helper for plot: " + id);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
HashMap<PlotId, Plot> worldMap = plots.get(world);
|
|
||||||
if (worldMap != null) {
|
|
||||||
Plot plot = worldMap.get(id);
|
|
||||||
if (plot != null) {
|
|
||||||
plot.getTrusted().add(helper);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
resultSet.close();
|
|
||||||
statement.close();
|
|
||||||
|
|
||||||
} catch (SQLException ignored) {
|
|
||||||
}
|
|
||||||
return plots;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public boolean accepts(String version) {
|
|
||||||
return version == null || PlotSquared.get().canUpdate(version, "0.17.0") || PlotSquared
|
|
||||||
.get().canUpdate("0.999.999", version);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,393 +0,0 @@
|
|||||||
package com.github.intellectualsites.plotsquared.bukkit.database.plotme;
|
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.bukkit.generator.BukkitPlotGenerator;
|
|
||||||
import com.github.intellectualsites.plotsquared.configuration.ConfigurationSection;
|
|
||||||
import com.github.intellectualsites.plotsquared.configuration.MemorySection;
|
|
||||||
import com.github.intellectualsites.plotsquared.configuration.file.FileConfiguration;
|
|
||||||
import com.github.intellectualsites.plotsquared.configuration.file.YamlConfiguration;
|
|
||||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
|
||||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
|
||||||
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.Plot;
|
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.PlotArea;
|
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.PlotId;
|
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.TaskManager;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.WorldCreator;
|
|
||||||
import org.bukkit.command.CommandException;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
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.SQLException;
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
|
||||||
|
|
||||||
public class LikePlotMeConverter {
|
|
||||||
|
|
||||||
private final String plugin;
|
|
||||||
|
|
||||||
public LikePlotMeConverter(String plugin) {
|
|
||||||
this.plugin = plugin;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getWorld(String world) {
|
|
||||||
for (World newWorld : Bukkit.getWorlds()) {
|
|
||||||
if (newWorld.getName().equalsIgnoreCase(world)) {
|
|
||||||
return newWorld.getName();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return world;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void sendMessage(String message) {
|
|
||||||
PlotSquared
|
|
||||||
.debug("&3PlotMe&8->&3" + PlotSquared.imp().getPluginName() + "&8: &7" + message);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPlotMePath() {
|
|
||||||
return new File(".").getAbsolutePath() + File.separator + "plugins" + File.separator
|
|
||||||
+ plugin + File.separator;
|
|
||||||
}
|
|
||||||
|
|
||||||
public FileConfiguration getPlotMeConfig(String dataFolder) {
|
|
||||||
File plotMeFile = new File(dataFolder + "config.yml");
|
|
||||||
if (!plotMeFile.exists()) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return YamlConfiguration.loadConfiguration(plotMeFile);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Set<String> getPlotMeWorlds(FileConfiguration plotConfig) {
|
|
||||||
return plotConfig.getConfigurationSection("worlds").getKeys(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void mergeWorldYml(FileConfiguration plotConfig) {
|
|
||||||
try {
|
|
||||||
File genConfig = new File(
|
|
||||||
"plugins" + File.separator + plugin + File.separator + "PlotMe-DefaultGenerator"
|
|
||||||
+ File.separator + "config.yml");
|
|
||||||
if (genConfig.exists()) {
|
|
||||||
YamlConfiguration yml = YamlConfiguration.loadConfiguration(genConfig);
|
|
||||||
for (String key : yml.getKeys(true)) {
|
|
||||||
if (!plotConfig.contains(key)) {
|
|
||||||
Object value = yml.get(key);
|
|
||||||
if (!(value instanceof MemorySection)) {
|
|
||||||
plotConfig.set(key, value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void updateWorldYml(String location) {
|
|
||||||
try {
|
|
||||||
Path path = Paths.get(location);
|
|
||||||
File file = new File(location);
|
|
||||||
if (!file.exists()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
String content = new String(Files.readAllBytes(path), StandardCharsets.UTF_8);
|
|
||||||
String pluginName = PlotSquared.imp().getPluginName();
|
|
||||||
content = content.replace("PlotMe-DefaultGenerator", pluginName);
|
|
||||||
content = content.replace("PlotMe", pluginName);
|
|
||||||
content = content.replace("AthionPlots", pluginName);
|
|
||||||
content = content.replace("PlotZWorld", pluginName);
|
|
||||||
Files.write(path, content.getBytes(StandardCharsets.UTF_8));
|
|
||||||
} catch (IOException ignored) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void copyConfig(ConfigurationSection plotmeDgYml, String world) throws IOException {
|
|
||||||
String actualWorldName = getWorld(world);
|
|
||||||
String plotMeWorldName = world.toLowerCase();
|
|
||||||
Integer pathWidth = plotmeDgYml.getInt("worlds." + plotMeWorldName + ".PathWidth"); //
|
|
||||||
PlotSquared.get().worlds.set("worlds." + world + ".road.width", pathWidth);
|
|
||||||
int height = plotmeDgYml.getInt("worlds." + plotMeWorldName + ".RoadHeight",
|
|
||||||
plotmeDgYml.getInt("worlds." + plotMeWorldName + ".GroundHeight", 64)); //
|
|
||||||
PlotSquared.get().worlds.set("worlds." + world + ".road.height", height);
|
|
||||||
PlotSquared.get().worlds.set("worlds." + world + ".wall.height", height);
|
|
||||||
PlotSquared.get().worlds.set("worlds." + world + ".plot.height", height);
|
|
||||||
int plotSize = plotmeDgYml.getInt("worlds." + plotMeWorldName + ".PlotSize", 32); //
|
|
||||||
PlotSquared.get().worlds.set("worlds." + world + ".plot.size", plotSize);
|
|
||||||
String wallblock = plotmeDgYml.getString("worlds." + plotMeWorldName + ".UnclaimedBorder",
|
|
||||||
plotmeDgYml.getString("worlds." + plotMeWorldName + ".WallBlock", "44")); //
|
|
||||||
PlotSquared.get().worlds.set("worlds." + world + ".wall.block", wallblock);
|
|
||||||
String claimed =
|
|
||||||
plotmeDgYml.getString("worlds." + plotMeWorldName + ".ProtectedWallBlock", "44:1"); //
|
|
||||||
PlotSquared.get().worlds.set("worlds." + world + ".wall.block_claimed", claimed);
|
|
||||||
String floor =
|
|
||||||
plotmeDgYml.getString("worlds." + plotMeWorldName + ".PlotFloorBlock", "2"); //
|
|
||||||
PlotSquared.get().worlds
|
|
||||||
.set("worlds." + world + ".plot.floor", Collections.singletonList(floor));
|
|
||||||
String filling = plotmeDgYml.getString("worlds." + plotMeWorldName + ".FillBlock", "3"); //
|
|
||||||
PlotSquared.get().worlds
|
|
||||||
.set("worlds." + world + ".plot.filling", Collections.singletonList(filling));
|
|
||||||
String road = plotmeDgYml.getString("worlds." + plotMeWorldName + ".RoadMainBlock", "5");
|
|
||||||
PlotSquared.get().worlds.set("worlds." + world + ".road.block", road);
|
|
||||||
PlotSquared.get().worlds.set("worlds." + actualWorldName + ".road.height", height);
|
|
||||||
PlotSquared.get().worlds.set("worlds." + actualWorldName + ".plot.height", height);
|
|
||||||
PlotSquared.get().worlds.set("worlds." + actualWorldName + ".wall.height", height);
|
|
||||||
PlotSquared.get().worlds.save(PlotSquared.get().worldsFile);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean run(APlotMeConnector connector) {
|
|
||||||
try {
|
|
||||||
String dataFolder = getPlotMePath();
|
|
||||||
FileConfiguration plotConfig = getPlotMeConfig(dataFolder);
|
|
||||||
if (plotConfig == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
String version = plotConfig.getString("Version");
|
|
||||||
if (version == null) {
|
|
||||||
version = plotConfig.getString("version");
|
|
||||||
}
|
|
||||||
if (!connector.accepts(version)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
PlotSquared.debug("&3Using connector: " + connector.getClass().getCanonicalName());
|
|
||||||
|
|
||||||
Connection connection = connector.getPlotMeConnection(plugin, plotConfig, dataFolder);
|
|
||||||
|
|
||||||
if (!connector.isValidConnection(connection)) {
|
|
||||||
sendMessage("Cannot connect to PlotMe DB. Conversion process will not continue");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
sendMessage(
|
|
||||||
"PlotMe conversion has started. To disable this, please set 'enabled-components -> plotme-converter' to false in the 'settings.yml'");
|
|
||||||
|
|
||||||
mergeWorldYml(plotConfig);
|
|
||||||
|
|
||||||
sendMessage("Connecting to PlotMe DB");
|
|
||||||
|
|
||||||
ArrayList<Plot> createdPlots = new ArrayList<>();
|
|
||||||
|
|
||||||
sendMessage("Collecting plot data");
|
|
||||||
|
|
||||||
String dbPrefix = "PlotMe".toLowerCase();
|
|
||||||
sendMessage(" - " + dbPrefix + "Plots");
|
|
||||||
final Set<String> worlds = getPlotMeWorlds(plotConfig);
|
|
||||||
|
|
||||||
if (Settings.Enabled_Components.PLOTME_CONVERTER) {
|
|
||||||
sendMessage("Updating bukkit.yml");
|
|
||||||
updateWorldYml("bukkit.yml");
|
|
||||||
updateWorldYml("plugins/Multiverse-Core/worlds.yml");
|
|
||||||
for (String world : plotConfig.getConfigurationSection("worlds").getKeys(false)) {
|
|
||||||
sendMessage("Copying config for: " + world);
|
|
||||||
try {
|
|
||||||
String actualWorldName = getWorld(world);
|
|
||||||
connector.copyConfig(plotConfig, world, actualWorldName);
|
|
||||||
PlotSquared.get().worlds.save(PlotSquared.get().worldsFile);
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
sendMessage("&c-- &lFailed to save configuration for world '" + world
|
|
||||||
+ "'\nThis will need to be done using the setup command, or manually");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
HashMap<String, HashMap<PlotId, Plot>> plots = connector.getPlotMePlots(connection);
|
|
||||||
int plotCount = 0;
|
|
||||||
for (Entry<String, HashMap<PlotId, Plot>> entry : plots.entrySet()) {
|
|
||||||
plotCount += entry.getValue().size();
|
|
||||||
}
|
|
||||||
if (!Settings.Enabled_Components.PLOTME_CONVERTER) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
sendMessage(" - " + dbPrefix + "Allowed");
|
|
||||||
|
|
||||||
sendMessage("Collected " + plotCount + " plots from PlotMe");
|
|
||||||
File plotmeDgFile = new File(
|
|
||||||
dataFolder + File.separator + "PlotMe-DefaultGenerator" + File.separator
|
|
||||||
+ "config.yml");
|
|
||||||
if (plotmeDgFile.exists()) {
|
|
||||||
YamlConfiguration plotmeDgYml = YamlConfiguration.loadConfiguration(plotmeDgFile);
|
|
||||||
try {
|
|
||||||
HashSet<String> allWorlds = new HashSet<>(plots.keySet());
|
|
||||||
allWorlds.addAll(worlds);
|
|
||||||
for (String world : allWorlds) {
|
|
||||||
copyConfig(plotmeDgYml, world);
|
|
||||||
}
|
|
||||||
} catch (IOException ignored) {
|
|
||||||
ignored.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (Entry<String, HashMap<PlotId, Plot>> entry : plots.entrySet()) {
|
|
||||||
String world = entry.getKey();
|
|
||||||
PlotArea area = PlotSquared.get().getPlotArea(world, null);
|
|
||||||
int duplicate = 0;
|
|
||||||
if (area != null) {
|
|
||||||
for (Entry<PlotId, Plot> entry2 : entry.getValue().entrySet()) {
|
|
||||||
if (area.getOwnedPlotAbs(entry2.getKey()) != null) {
|
|
||||||
duplicate++;
|
|
||||||
} else {
|
|
||||||
createdPlots.add(entry2.getValue());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (duplicate > 0) {
|
|
||||||
PlotSquared.debug("&c[WARNING] Found " + duplicate
|
|
||||||
+ " duplicate plots already in DB for world: '" + world
|
|
||||||
+ "'. Have you run the converter already?");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (PlotSquared.get().plots_tmp != null) {
|
|
||||||
HashMap<PlotId, Plot> map = PlotSquared.get().plots_tmp.get(world);
|
|
||||||
if (map != null) {
|
|
||||||
for (Entry<PlotId, Plot> entry2 : entry.getValue().entrySet()) {
|
|
||||||
if (map.containsKey(entry2.getKey())) {
|
|
||||||
duplicate++;
|
|
||||||
} else {
|
|
||||||
createdPlots.add(entry2.getValue());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (duplicate > 0) {
|
|
||||||
PlotSquared.debug("&c[WARNING] Found " + duplicate
|
|
||||||
+ " duplicate plots already in DB for world: '" + world
|
|
||||||
+ "'. Have you run the converter already?");
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
createdPlots.addAll(entry.getValue().values());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
sendMessage("Creating plot DB");
|
|
||||||
Thread.sleep(1000);
|
|
||||||
final AtomicBoolean done = new AtomicBoolean(false);
|
|
||||||
DBFunc.createPlotsAndData(createdPlots, new Runnable() {
|
|
||||||
@Override public void run() {
|
|
||||||
if (done.get()) {
|
|
||||||
done();
|
|
||||||
sendMessage("&aDatabase conversion is now complete!");
|
|
||||||
PlotSquared.debug("&c - Stop the server");
|
|
||||||
PlotSquared.debug(
|
|
||||||
"&c - Disable 'plotme-converter' and 'plotme-convert.cache-uuids' in the settings.yml");
|
|
||||||
PlotSquared.debug(
|
|
||||||
"&c - Correct any generator settings that haven't copied to 'settings.yml' properly");
|
|
||||||
PlotSquared.debug("&c - Start the server");
|
|
||||||
PlotSquared.get().setPlots(DBFunc.getPlots());
|
|
||||||
} else {
|
|
||||||
sendMessage(
|
|
||||||
"&cPlease wait until database conversion is complete. You will be notified with instructions when this happens!");
|
|
||||||
done.set(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
sendMessage("Saving configuration...");
|
|
||||||
try {
|
|
||||||
PlotSquared.get().worlds.save(PlotSquared.get().worldsFile);
|
|
||||||
} catch (IOException ignored) {
|
|
||||||
sendMessage(" - &cFailed to save configuration.");
|
|
||||||
}
|
|
||||||
TaskManager.runTask(new Runnable() {
|
|
||||||
@Override public void run() {
|
|
||||||
try {
|
|
||||||
boolean mv = false;
|
|
||||||
boolean mw = false;
|
|
||||||
if ((Bukkit.getPluginManager().getPlugin("Multiverse-Core") != null)
|
|
||||||
&& Bukkit.getPluginManager().getPlugin("Multiverse-Core").isEnabled()) {
|
|
||||||
mv = true;
|
|
||||||
} else if ((Bukkit.getPluginManager().getPlugin("MultiWorld") != null)
|
|
||||||
&& Bukkit.getPluginManager().getPlugin("MultiWorld").isEnabled()) {
|
|
||||||
mw = true;
|
|
||||||
}
|
|
||||||
for (String worldName : worlds) {
|
|
||||||
World world = Bukkit.getWorld(getWorld(worldName));
|
|
||||||
if (world == null) {
|
|
||||||
sendMessage(
|
|
||||||
"&cInvalid world in PlotMe configuration: " + worldName);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
String actualWorldName = world.getName();
|
|
||||||
sendMessage(
|
|
||||||
"Reloading generator for world: '" + actualWorldName + "'...");
|
|
||||||
if (!Bukkit.getWorlds().isEmpty() && Bukkit.getWorlds().get(0).getName()
|
|
||||||
.equals(worldName)) {
|
|
||||||
sendMessage(
|
|
||||||
"&cYou need to stop the server to reload this world properly");
|
|
||||||
} else {
|
|
||||||
PlotSquared.get().removePlotAreas(actualWorldName);
|
|
||||||
if (mv) {
|
|
||||||
// unload world with MV
|
|
||||||
Bukkit.getServer()
|
|
||||||
.dispatchCommand(Bukkit.getServer().getConsoleSender(),
|
|
||||||
"mv unload " + actualWorldName);
|
|
||||||
try {
|
|
||||||
Thread.sleep(1000);
|
|
||||||
} catch (InterruptedException ignored) {
|
|
||||||
Thread.currentThread().interrupt();
|
|
||||||
}
|
|
||||||
// load world with MV
|
|
||||||
Bukkit.getServer()
|
|
||||||
.dispatchCommand(Bukkit.getServer().getConsoleSender(),
|
|
||||||
"mv import " + actualWorldName + " normal -g "
|
|
||||||
+ PlotSquared.imp().getPluginName());
|
|
||||||
} else if (mw) {
|
|
||||||
// unload world with MW
|
|
||||||
Bukkit.getServer()
|
|
||||||
.dispatchCommand(Bukkit.getServer().getConsoleSender(),
|
|
||||||
"mw unload " + actualWorldName);
|
|
||||||
try {
|
|
||||||
Thread.sleep(1000);
|
|
||||||
} catch (InterruptedException ignored) {
|
|
||||||
Thread.currentThread().interrupt();
|
|
||||||
}
|
|
||||||
// load world with MW
|
|
||||||
Bukkit.getServer()
|
|
||||||
.dispatchCommand(Bukkit.getServer().getConsoleSender(),
|
|
||||||
"mw create " + actualWorldName + " plugin:"
|
|
||||||
+ PlotSquared.imp().getPluginName());
|
|
||||||
} else {
|
|
||||||
// Load using Bukkit API
|
|
||||||
// - User must set generator manually
|
|
||||||
Bukkit.getServer().unloadWorld(world, true);
|
|
||||||
World myWorld = WorldCreator.name(actualWorldName).generator(
|
|
||||||
new BukkitPlotGenerator(
|
|
||||||
PlotSquared.get().IMP.getDefaultGenerator()))
|
|
||||||
.createWorld();
|
|
||||||
myWorld.save();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (CommandException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
if (done.get()) {
|
|
||||||
done();
|
|
||||||
sendMessage("&aDatabase conversion is now complete!");
|
|
||||||
PlotSquared.debug("&c - Stop the server");
|
|
||||||
PlotSquared.debug(
|
|
||||||
"&c - Disable 'plotme-converter' and 'plotme-convert.cache-uuids' in the settings.yml");
|
|
||||||
PlotSquared.debug(
|
|
||||||
"&c - Correct any generator settings that haven't copied to 'settings.yml' properly");
|
|
||||||
PlotSquared.debug("&c - Start the server");
|
|
||||||
} else {
|
|
||||||
sendMessage(
|
|
||||||
"&cPlease wait until database conversion is complete. You will be notified with instructions when this happens!");
|
|
||||||
done.set(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} catch (InterruptedException | SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
PlotSquared.debug("&/end/");
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void done() {
|
|
||||||
PlotSquared.get().setPlots(DBFunc.getPlots());
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,197 +0,0 @@
|
|||||||
package com.github.intellectualsites.plotsquared.bukkit.database.plotme;
|
|
||||||
|
|
||||||
import com.github.intellectualsites.plotsquared.configuration.file.FileConfiguration;
|
|
||||||
import com.github.intellectualsites.plotsquared.plot.PlotSquared;
|
|
||||||
import com.github.intellectualsites.plotsquared.plot.config.Settings;
|
|
||||||
import com.github.intellectualsites.plotsquared.plot.database.DBFunc;
|
|
||||||
import com.github.intellectualsites.plotsquared.plot.database.SQLite;
|
|
||||||
import com.github.intellectualsites.plotsquared.plot.object.*;
|
|
||||||
import com.github.intellectualsites.plotsquared.plot.util.UUIDHandler;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.sql.*;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public class PlotMeConnector_017 extends APlotMeConnector {
|
|
||||||
|
|
||||||
private String plugin;
|
|
||||||
|
|
||||||
@Override public Connection getPlotMeConnection(String plugin, FileConfiguration plotConfig,
|
|
||||||
String dataFolder) {
|
|
||||||
this.plugin = plugin.toLowerCase();
|
|
||||||
try {
|
|
||||||
if (plotConfig.getBoolean("usemySQL")) {
|
|
||||||
String user = plotConfig.getString("mySQLuname");
|
|
||||||
String password = plotConfig.getString("mySQLpass");
|
|
||||||
String con = plotConfig.getString("mySQLconn");
|
|
||||||
return DriverManager.getConnection(con, user, password);
|
|
||||||
} else {
|
|
||||||
File file = new File(dataFolder + File.separator + "plotmecore.db");
|
|
||||||
if (file.exists()) {
|
|
||||||
return new SQLite(file).openConnection();
|
|
||||||
}
|
|
||||||
return new SQLite(new File(dataFolder + File.separator + "plots.db"))
|
|
||||||
.openConnection();
|
|
||||||
}
|
|
||||||
} catch (SQLException | ClassNotFoundException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public HashMap<String, HashMap<PlotId, Plot>> getPlotMePlots(Connection connection)
|
|
||||||
throws SQLException {
|
|
||||||
ResultSet resultSet;
|
|
||||||
PreparedStatement statement;
|
|
||||||
HashMap<String, Integer> plotWidth = new HashMap<>();
|
|
||||||
HashMap<String, Integer> roadWidth = new HashMap<>();
|
|
||||||
HashMap<Integer, Plot> plots = new HashMap<>();
|
|
||||||
HashMap<String, HashMap<PlotId, boolean[]>> merges = new HashMap<>();
|
|
||||||
try {
|
|
||||||
statement =
|
|
||||||
connection.prepareStatement("SELECT * FROM `" + this.plugin + "core_plots`");
|
|
||||||
resultSet = statement.executeQuery();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
PlotSquared.debug("========= Table does not exist =========");
|
|
||||||
e.printStackTrace();
|
|
||||||
PlotSquared.debug("=======================================");
|
|
||||||
PlotSquared.debug(
|
|
||||||
"&8 - &7The database does not match the version specified in the PlotMe config");
|
|
||||||
PlotSquared.debug(
|
|
||||||
"&8 - &7Please correct this, or if you are unsure, the most common is 0.16.3");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
boolean checkUUID = DBFunc.hasColumn(resultSet, "ownerID");
|
|
||||||
boolean merge =
|
|
||||||
!"plotme".equals(this.plugin) && Settings.Enabled_Components.PLOTME_CONVERTER;
|
|
||||||
while (resultSet.next()) {
|
|
||||||
int key = resultSet.getInt("plot_id");
|
|
||||||
PlotId id = new PlotId(resultSet.getInt("plotX"), resultSet.getInt("plotZ"));
|
|
||||||
String name = resultSet.getString("owner");
|
|
||||||
String world = LikePlotMeConverter.getWorld(resultSet.getString("world"));
|
|
||||||
if (!plots.containsKey(world) && merge) {
|
|
||||||
int plot = PlotSquared.get().worlds.getInt("worlds." + world + ".plot.size");
|
|
||||||
int path = PlotSquared.get().worlds.getInt("worlds." + world + ".road.width");
|
|
||||||
plotWidth.put(world, plot);
|
|
||||||
roadWidth.put(world, path);
|
|
||||||
merges.put(world, new HashMap<PlotId, boolean[]>());
|
|
||||||
}
|
|
||||||
if (merge) {
|
|
||||||
int tx = resultSet.getInt("topX");
|
|
||||||
int tz = resultSet.getInt("topZ");
|
|
||||||
int bx = resultSet.getInt("bottomX") - 1;
|
|
||||||
int bz = resultSet.getInt("bottomZ") - 1;
|
|
||||||
int path = roadWidth.get(world);
|
|
||||||
int plot = plotWidth.get(world);
|
|
||||||
Location top = getPlotTopLocAbs(path, plot, id);
|
|
||||||
Location bot = getPlotBottomLocAbs(path, plot, id);
|
|
||||||
if (tx > top.getX()) {
|
|
||||||
setMerged(merges, world, id, 1);
|
|
||||||
}
|
|
||||||
if (tz > top.getZ()) {
|
|
||||||
setMerged(merges, world, id, 2);
|
|
||||||
}
|
|
||||||
if (bx < bot.getX()) {
|
|
||||||
setMerged(merges, world, id, 3);
|
|
||||||
}
|
|
||||||
if (bz > bot.getZ()) {
|
|
||||||
setMerged(merges, world, id, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
UUID owner = UUIDHandler.getUUID(name, null);
|
|
||||||
if (owner == null) {
|
|
||||||
if (name.equals("*")) {
|
|
||||||
owner = DBFunc.EVERYONE;
|
|
||||||
} else {
|
|
||||||
if (checkUUID) {
|
|
||||||
byte[] bytes = resultSet.getBytes("ownerid");
|
|
||||||
if (bytes != null) {
|
|
||||||
owner = UUID.nameUUIDFromBytes(bytes);
|
|
||||||
UUIDHandler.add(new StringWrapper(name), owner);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (owner == null) {
|
|
||||||
PlotSquared.log(
|
|
||||||
"&cCould not identify owner for plot: " + id + " -> '" + name + '\'');
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
UUIDHandler.add(new StringWrapper(name), owner);
|
|
||||||
}
|
|
||||||
Plot plot = new Plot(PlotArea.createGeneric(world), id, owner);
|
|
||||||
plots.put(key, plot);
|
|
||||||
}
|
|
||||||
for (Plot plot : plots.values()) {
|
|
||||||
HashMap<PlotId, boolean[]> mergeMap = merges.get(plot.getWorldName());
|
|
||||||
if (mergeMap != null) {
|
|
||||||
if (mergeMap.containsKey(plot.getId())) {
|
|
||||||
plot.setMerged(mergeMap.get(plot.getId()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
resultSet.close();
|
|
||||||
statement.close();
|
|
||||||
try {
|
|
||||||
PlotSquared.log(" - " + this.plugin + "core_denied");
|
|
||||||
statement =
|
|
||||||
connection.prepareStatement("SELECT * FROM `" + this.plugin + "core_denied`");
|
|
||||||
resultSet = statement.executeQuery();
|
|
||||||
|
|
||||||
while (resultSet.next()) {
|
|
||||||
int key = resultSet.getInt("plot_id");
|
|
||||||
Plot plot = plots.get(key);
|
|
||||||
if (plot == null) {
|
|
||||||
PlotSquared
|
|
||||||
.log("&6Denied (" + key + ") references deleted plot; ignoring entry.");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
String player = resultSet.getString("player");
|
|
||||||
UUID denied = player.equals("*") ? DBFunc.EVERYONE : UUID.fromString(player);
|
|
||||||
plot.getDenied().add(denied);
|
|
||||||
}
|
|
||||||
|
|
||||||
PlotSquared.log(" - " + this.plugin + "core_allowed");
|
|
||||||
statement =
|
|
||||||
connection.prepareStatement("SELECT * FROM `" + this.plugin + "core_allowed`");
|
|
||||||
resultSet = statement.executeQuery();
|
|
||||||
|
|
||||||
while (resultSet.next()) {
|
|
||||||
int key = resultSet.getInt("plot_id");
|
|
||||||
Plot plot = plots.get(key);
|
|
||||||
if (plot == null) {
|
|
||||||
PlotSquared
|
|
||||||
.log("&6Allowed (" + key + ") references deleted plot; ignoring entry.");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
String player = resultSet.getString("player");
|
|
||||||
UUID allowed = player.equals("*") ? DBFunc.EVERYONE : UUID.fromString(player);
|
|
||||||
plot.getTrusted().add(allowed);
|
|
||||||
}
|
|
||||||
resultSet.close();
|
|
||||||
statement.close();
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
HashMap<String, HashMap<PlotId, Plot>> processed = new HashMap<>();
|
|
||||||
|
|
||||||
for (Plot plot : plots.values()) {
|
|
||||||
HashMap<PlotId, Plot> map = processed.get(plot.getWorldName());
|
|
||||||
if (map == null) {
|
|
||||||
map = new HashMap<>();
|
|
||||||
processed.put(plot.getWorldName(), map);
|
|
||||||
}
|
|
||||||
map.put(plot.getId(), plot);
|
|
||||||
}
|
|
||||||
return processed;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public boolean accepts(String version) {
|
|
||||||
if (version == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return !PlotSquared.get().canUpdate(version, "0.17");
|
|
||||||
}
|
|
||||||
}
|
|
@ -230,14 +230,6 @@ public interface IPlotMain extends ILogger {
|
|||||||
*/
|
*/
|
||||||
InventoryUtil initInventoryUtil();
|
InventoryUtil initInventoryUtil();
|
||||||
|
|
||||||
/**
|
|
||||||
* Run the converter for the implementation (not necessarily PlotMe, just
|
|
||||||
* any plugin that we can convert from).
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
boolean initPlotMeConverter();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unregister a PlotPlayer from cache e.g. if they have logged off.
|
* Unregister a PlotPlayer from cache e.g. if they have logged off.
|
||||||
*
|
*
|
||||||
|
@ -171,7 +171,6 @@ import java.util.zip.ZipInputStream;
|
|||||||
// Start these separately
|
// Start these separately
|
||||||
UUIDHandler.add(new StringWrapper("*"), DBFunc.EVERYONE);
|
UUIDHandler.add(new StringWrapper("*"), DBFunc.EVERYONE);
|
||||||
startExpiryTasks();
|
startExpiryTasks();
|
||||||
startPlotMeConversion();
|
|
||||||
}
|
}
|
||||||
// create event util class
|
// create event util class
|
||||||
EventUtil.manager = this.IMP.initEventUtil();
|
EventUtil.manager = this.IMP.initEventUtil();
|
||||||
@ -359,7 +358,6 @@ import java.util.zip.ZipInputStream;
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
startExpiryTasks();
|
startExpiryTasks();
|
||||||
startPlotMeConversion();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -377,28 +375,6 @@ import java.util.zip.ZipInputStream;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void startPlotMeConversion() {
|
|
||||||
if (Settings.Enabled_Components.PLOTME_CONVERTER || Settings.PlotMe.CACHE_UUDS) {
|
|
||||||
TaskManager.IMP.taskAsync(new Runnable() {
|
|
||||||
@Override public void run() {
|
|
||||||
if (PlotSquared.this.IMP.initPlotMeConverter()) {
|
|
||||||
PlotSquared.log("&c=== IMPORTANT ===");
|
|
||||||
PlotSquared.log(
|
|
||||||
"&cTHIS MESSAGE MAY BE EXTREMELY HELPFUL IF YOU HAVE TROUBLE CONVERTING PlotMe!");
|
|
||||||
PlotSquared
|
|
||||||
.log("&c - Make sure 'UUID.read-from-disk' is disabled (false)!");
|
|
||||||
PlotSquared.log(
|
|
||||||
"&c - Sometimes the database can be locked, deleting PlotMe.jar beforehand will fix the issue!");
|
|
||||||
PlotSquared.log(
|
|
||||||
"&c - After the conversion is finished, please set 'plotme-converter' to false in the "
|
|
||||||
+ "'settings.yml'");
|
|
||||||
}
|
|
||||||
Settings.Enabled_Components.PLOTME_CONVERTER = false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isMainThread(Thread thread) {
|
public boolean isMainThread(Thread thread) {
|
||||||
return this.thread == thread;
|
return this.thread == thread;
|
||||||
}
|
}
|
||||||
|
@ -54,11 +54,6 @@ public class Settings extends Config {
|
|||||||
Redstone.DISABLE_UNOCCUPIED = config
|
Redstone.DISABLE_UNOCCUPIED = config
|
||||||
.getBoolean("protection.redstone.disable-unoccupied", Redstone.DISABLE_UNOCCUPIED);
|
.getBoolean("protection.redstone.disable-unoccupied", Redstone.DISABLE_UNOCCUPIED);
|
||||||
|
|
||||||
// PlotMe
|
|
||||||
Enabled_Components.PLOTME_CONVERTER =
|
|
||||||
config.getBoolean("plotme-convert.enabled", Enabled_Components.PLOTME_CONVERTER);
|
|
||||||
PlotMe.CACHE_UUDS = config.getBoolean("plotme-convert.cache-uuids", PlotMe.CACHE_UUDS);
|
|
||||||
|
|
||||||
// UUID
|
// UUID
|
||||||
UUID.USE_SQLUUIDHANDLER =
|
UUID.USE_SQLUUIDHANDLER =
|
||||||
config.getBoolean("uuid.use_sqluuidhandler", UUID.USE_SQLUUIDHANDLER);
|
config.getBoolean("uuid.use_sqluuidhandler", UUID.USE_SQLUUIDHANDLER);
|
||||||
@ -272,13 +267,6 @@ public class Settings extends Config {
|
|||||||
MAX_PLOTS = 127;
|
MAX_PLOTS = 127;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Comment("Switching from PlotMe?") public static final class PlotMe {
|
|
||||||
@Comment("Cache the uuids from the PlotMe database") public static boolean CACHE_UUDS =
|
|
||||||
false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static final class Confirmation {
|
public static final class Confirmation {
|
||||||
@Comment("Teleport to your plot on death") public static int CONFIRMATION_TIMEOUT_SECONDS =
|
@Comment("Teleport to your plot on death") public static int CONFIRMATION_TIMEOUT_SECONDS =
|
||||||
20;
|
20;
|
||||||
@ -331,8 +319,6 @@ public class Settings extends Config {
|
|||||||
@Comment("Optimizes block changing code") public static boolean BLOCK_CACHE = true;
|
@Comment("Optimizes block changing code") public static boolean BLOCK_CACHE = true;
|
||||||
@Comment("Getting a rating won't need the database") public static boolean RATING_CACHE =
|
@Comment("Getting a rating won't need the database") public static boolean RATING_CACHE =
|
||||||
true;
|
true;
|
||||||
@Comment("The converter will attempt to convert the PlotMe database") public static boolean
|
|
||||||
PLOTME_CONVERTER = true;
|
|
||||||
@Comment("Allow WorldEdit to be restricted to plots") public static boolean
|
@Comment("Allow WorldEdit to be restricted to plots") public static boolean
|
||||||
WORLDEDIT_RESTRICTIONS = true;
|
WORLDEDIT_RESTRICTIONS = true;
|
||||||
@Comment("Allow economy to be used") public static boolean ECONOMY = true;
|
@Comment("Allow economy to be used") public static boolean ECONOMY = true;
|
||||||
|
@ -142,7 +142,7 @@ public abstract class UUIDHandlerImplementation {
|
|||||||
UUID offlineUpper = UUID.nameUUIDFromBytes(
|
UUID offlineUpper = UUID.nameUUIDFromBytes(
|
||||||
("OfflinePlayer:" + name.value).getBytes(Charsets.UTF_8));
|
("OfflinePlayer:" + name.value).getBytes(Charsets.UTF_8));
|
||||||
if (UUIDHandlerImplementation.this.unknown.contains(offlineUpper)
|
if (UUIDHandlerImplementation.this.unknown.contains(offlineUpper)
|
||||||
&& offlineUpper != null && !offlineUpper.equals(uuid)) {
|
&& !offlineUpper.equals(uuid)) {
|
||||||
UUIDHandlerImplementation.this.unknown.remove(offlineUpper);
|
UUIDHandlerImplementation.this.unknown.remove(offlineUpper);
|
||||||
Set<Plot> plots = PlotSquared.get().getPlotsAbs(offlineUpper);
|
Set<Plot> plots = PlotSquared.get().getPlotsAbs(offlineUpper);
|
||||||
if (!plots.isEmpty()) {
|
if (!plots.isEmpty()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user