mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-12-27 17:28:28 +01:00
minor conversion tweaks + fix plot sorting with empty worlds.
This commit is contained in:
parent
4002ed4de1
commit
b524d5fcfe
2
pom.xml
2
pom.xml
@ -8,7 +8,7 @@
|
|||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
</properties>
|
</properties>
|
||||||
<artifactId>PlotSquared</artifactId>
|
<artifactId>PlotSquared</artifactId>
|
||||||
<version>3.1.9</version>
|
<version>3.1.10</version>
|
||||||
<name>PlotSquared</name>
|
<name>PlotSquared</name>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<build>
|
<build>
|
||||||
|
@ -559,7 +559,9 @@ public class PS {
|
|||||||
}
|
}
|
||||||
final Set<Plot> result = new HashSet<>(size);
|
final Set<Plot> result = new HashSet<>(size);
|
||||||
for (final Entry<String, ConcurrentHashMap<PlotId, Plot>> entry : plots.entrySet()) {
|
for (final Entry<String, ConcurrentHashMap<PlotId, Plot>> entry : plots.entrySet()) {
|
||||||
result.addAll(entry.getValue().values());
|
for (Entry<PlotId, Plot> entry2 : entry.getValue().entrySet()) {
|
||||||
|
result.add(entry2.getValue());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -961,13 +963,13 @@ public class PS {
|
|||||||
for (final String world : worlds) {
|
for (final String world : worlds) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case CREATION_DATE:
|
case CREATION_DATE:
|
||||||
toReturn.addAll(sortPlotsByTemp(map.get(world)));
|
toReturn.addAll(sortPlotsByTemp(getPlotsInWorld(world)));
|
||||||
break;
|
break;
|
||||||
case CREATION_DATE_TIMESTAMP:
|
case CREATION_DATE_TIMESTAMP:
|
||||||
toReturn.addAll(sortPlotsByTimestamp(map.get(world)));
|
toReturn.addAll(sortPlotsByTimestamp(getPlotsInWorld(world)));
|
||||||
break;
|
break;
|
||||||
case DISTANCE_FROM_ORIGIN:
|
case DISTANCE_FROM_ORIGIN:
|
||||||
toReturn.addAll(sortPlotsByHash(map.get(world)));
|
toReturn.addAll(sortPlotsByHash(getPlotsInWorld(world)));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -27,10 +27,15 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
|
|||||||
public class ClassicPlotMeConnector extends APlotMeConnector {
|
public class ClassicPlotMeConnector extends APlotMeConnector {
|
||||||
|
|
||||||
private String plugin;
|
private String plugin;
|
||||||
|
private String prefix;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Connection getPlotMeConnection(final String plugin, final FileConfiguration plotConfig, final String dataFolder) {
|
public Connection getPlotMeConnection(final String plugin, final FileConfiguration plotConfig, final String dataFolder) {
|
||||||
this.plugin = plugin.toLowerCase();
|
this.plugin = plugin.toLowerCase();
|
||||||
|
prefix = plotConfig.getString("mySQLprefix");
|
||||||
|
if (prefix == null) {
|
||||||
|
prefix = plugin;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
if (plotConfig.getBoolean("usemySQL")) {
|
if (plotConfig.getBoolean("usemySQL")) {
|
||||||
final String user = plotConfig.getString("mySQLuname");
|
final String user = plotConfig.getString("mySQLuname");
|
||||||
@ -53,7 +58,7 @@ public class ClassicPlotMeConnector extends APlotMeConnector {
|
|||||||
final HashMap<String, Integer> roadWidth = new HashMap<>();
|
final HashMap<String, Integer> roadWidth = new HashMap<>();
|
||||||
final HashMap<String, HashMap<PlotId, Plot>> plots = new HashMap<>();
|
final HashMap<String, HashMap<PlotId, Plot>> plots = new HashMap<>();
|
||||||
final HashMap<String, HashMap<PlotId, boolean[]>> merges = new HashMap<>();
|
final HashMap<String, HashMap<PlotId, boolean[]>> merges = new HashMap<>();
|
||||||
stmt = connection.prepareStatement("SELECT * FROM `" + plugin + "Plots`");
|
stmt = connection.prepareStatement("SELECT * FROM `" + prefix + "Plots`");
|
||||||
r = stmt.executeQuery();
|
r = stmt.executeQuery();
|
||||||
String column = null;
|
String column = null;
|
||||||
final boolean checkUUID = DBFunc.hasColumn(r, "ownerid");
|
final boolean checkUUID = DBFunc.hasColumn(r, "ownerid");
|
||||||
@ -166,8 +171,8 @@ public class ClassicPlotMeConnector extends APlotMeConnector {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
MainUtil.sendConsoleMessage(" - " + plugin + "Denied");
|
MainUtil.sendConsoleMessage(" - " + prefix + "Denied");
|
||||||
stmt = connection.prepareStatement("SELECT * FROM `" + plugin + "Denied`");
|
stmt = connection.prepareStatement("SELECT * FROM `" + prefix + "Denied`");
|
||||||
r = stmt.executeQuery();
|
r = stmt.executeQuery();
|
||||||
|
|
||||||
while (r.next()) {
|
while (r.next()) {
|
||||||
@ -267,6 +272,6 @@ public class ClassicPlotMeConnector extends APlotMeConnector {
|
|||||||
if (version == null) {
|
if (version == null) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return PS.get().canUpdate(version, "0.17.0");
|
return PS.get().canUpdate(version, "0.17.0") || PS.get().canUpdate("0.999.999", version);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -98,6 +98,24 @@ public class LikePlotMeConverter {
|
|||||||
return plotConfig.getConfigurationSection("worlds").getKeys(false);
|
return plotConfig.getConfigurationSection("worlds").getKeys(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void mergeWorldYml(final String plugin, 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)) {
|
||||||
|
plotConfig.set(key, yml.get(key));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
genConfig.delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void updateWorldYml(final String plugin, final String location) {
|
public void updateWorldYml(final String plugin, final String location) {
|
||||||
try {
|
try {
|
||||||
final Path path = Paths.get(location);
|
final Path path = Paths.get(location);
|
||||||
@ -139,6 +157,9 @@ public class LikePlotMeConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sendMessage(plugin + " conversion has started. To disable this, please set 'plotme-convert.enabled' in the 'settings.yml'");
|
sendMessage(plugin + " conversion has started. To disable this, please set 'plotme-convert.enabled' in the 'settings.yml'");
|
||||||
|
|
||||||
|
mergeWorldYml(plugin, plotConfig);
|
||||||
|
|
||||||
sendMessage("Connecting to " + plugin + " DB");
|
sendMessage("Connecting to " + plugin + " DB");
|
||||||
|
|
||||||
int plotCount = 0;
|
int plotCount = 0;
|
||||||
@ -256,6 +277,7 @@ public class LikePlotMeConverter {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (done.get()) {
|
if (done.get()) {
|
||||||
|
done();
|
||||||
sendMessage("&aDatabase conversion is now complete!");
|
sendMessage("&aDatabase conversion is now complete!");
|
||||||
PS.debug("&c - Stop the server");
|
PS.debug("&c - Stop the server");
|
||||||
PS.debug("&c - Disable 'plotme-convert.enabled' and 'plotme-convert.cache-uuids' in the settings.yml");
|
PS.debug("&c - Disable 'plotme-convert.enabled' and 'plotme-convert.cache-uuids' in the settings.yml");
|
||||||
@ -325,6 +347,7 @@ public class LikePlotMeConverter {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
if (done.get()) {
|
if (done.get()) {
|
||||||
|
done();
|
||||||
sendMessage("&aDatabase conversion is now complete!");
|
sendMessage("&aDatabase conversion is now complete!");
|
||||||
PS.debug("&c - Stop the server");
|
PS.debug("&c - Stop the server");
|
||||||
PS.debug("&c - Disable 'plotme-convert.enabled' and 'plotme-convert.cache-uuids' in the settings.yml");
|
PS.debug("&c - Disable 'plotme-convert.enabled' and 'plotme-convert.cache-uuids' in the settings.yml");
|
||||||
@ -342,4 +365,8 @@ public class LikePlotMeConverter {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void done() {
|
||||||
|
PS.get().setAllPlotsRaw(DBFunc.getPlots());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,10 +24,12 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
|
|||||||
|
|
||||||
public class PlotMeConnector_017 extends APlotMeConnector {
|
public class PlotMeConnector_017 extends APlotMeConnector {
|
||||||
private String plugin;
|
private String plugin;
|
||||||
|
private String prefix;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Connection getPlotMeConnection(final String plugin, final FileConfiguration plotConfig, final String dataFolder) {
|
public Connection getPlotMeConnection(final String plugin, final FileConfiguration plotConfig, final String dataFolder) {
|
||||||
this.plugin = plugin.toLowerCase();
|
this.plugin = plugin.toLowerCase();
|
||||||
|
prefix = plugin + "core_";
|
||||||
try {
|
try {
|
||||||
if (plotConfig.getBoolean("usemySQL")) {
|
if (plotConfig.getBoolean("usemySQL")) {
|
||||||
final String user = plotConfig.getString("mySQLuname");
|
final String user = plotConfig.getString("mySQLuname");
|
||||||
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user