mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-06-28 11:44:42 +02:00
Attempt to fix db, might not always work. We got to add a warning to spigot.
This commit is contained in:
@ -1,23 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="IntelliGuard" name="Obfuscation">
|
||||
<configuration>
|
||||
<option name="yGuardJar" value="C:\Users\Citymonstret\Desktop\lib\yguard.jar" />
|
||||
<option name="mainclass" value="com.intellectualcrafters.plot.PlotMain" />
|
||||
<option name="errorChecking" value="false" />
|
||||
<option name="jarConfig">
|
||||
<JarConfig>
|
||||
<option name="jarEntries">
|
||||
<list>
|
||||
<option value="C:\Users\Citymonstret\Desktop\workspace\bukkit\plot_news\out\production\PlotSquared" />
|
||||
</list>
|
||||
</option>
|
||||
</JarConfig>
|
||||
</option>
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
|
@ -14,10 +14,7 @@ import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Biome;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.sql.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
@ -267,6 +264,43 @@ public class DBFunc {
|
||||
* @return
|
||||
*/
|
||||
public static HashMap<String, HashMap<PlotId, Plot>> getPlots() {
|
||||
try {
|
||||
DatabaseMetaData data = connection.getMetaData();
|
||||
ResultSet rs = data.getColumns(null, null, "plot", "plot_id");
|
||||
boolean execute = rs.next();
|
||||
if(execute) {
|
||||
Statement statement = connection.createStatement();
|
||||
statement.addBatch(
|
||||
"ALTER IGNORE TABLE `plot` ADD `plot_id_x` int(11) DEFAULT 0"
|
||||
);
|
||||
statement.addBatch(
|
||||
"ALTER IGNORE TABLE `plot` ADD `plot_id_z` int(11) DEFAULT 0"
|
||||
);
|
||||
statement.addBatch(
|
||||
"UPDATE `plot` SET\n" +
|
||||
" `plot_id_x` = IF(" +
|
||||
" LOCATE(';', `plot_id`) > 0," +
|
||||
" SUBSTRING(`plot_id`, 1, LOCATE(';', `plot_id`) - 1)," +
|
||||
" `plot_id`" +
|
||||
" )," +
|
||||
" `plot_id_z` = IF(" +
|
||||
" LOCATE(';', `plot_id`) > 0," +
|
||||
" SUBSTRING(`plot_id`, LOCATE(';', `plot_id`) + 1)," +
|
||||
" NULL" +
|
||||
" )"
|
||||
);
|
||||
statement.addBatch(
|
||||
"ALTER TABLE `plot` DROP `plot_id`"
|
||||
);
|
||||
statement.addBatch(
|
||||
"ALTER IGNORE TABLE `plot_settings` ADD `flags` VARCHAR(512) DEFAULT NULL"
|
||||
);
|
||||
statement.executeBatch();
|
||||
statement.close();
|
||||
}
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
HashMap<String, HashMap<PlotId, Plot>> plots = new HashMap<String, HashMap<PlotId, Plot>>();
|
||||
HashMap<String, World> worldMap = new HashMap<String, World>();
|
||||
Statement stmt = null;
|
||||
|
Reference in New Issue
Block a user