mirror of
https://github.com/songoda/EpicHoppers.git
synced 2024-11-26 12:16:18 +01:00
MySQL data fix
This commit is contained in:
parent
0dff6dabb3
commit
1e298e4f75
@ -54,6 +54,7 @@ public class StorageItem {
|
|||||||
|
|
||||||
public boolean asBoolean() {
|
public boolean asBoolean() {
|
||||||
if (object == null) return false;
|
if (object == null) return false;
|
||||||
|
if (object instanceof Integer) return (Integer) object == 1;
|
||||||
return (boolean) object;
|
return (boolean) object;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,6 +64,8 @@ public class StorageItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Object asObject() {
|
public Object asObject() {
|
||||||
|
if (object == null) return null;
|
||||||
|
if (object instanceof Boolean) return (Boolean) object ? 1 : 0;
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,8 +105,10 @@ public class StorageMysql extends Storage {
|
|||||||
continue;
|
continue;
|
||||||
toSave.remove(to.getKey());
|
toSave.remove(to.getKey());
|
||||||
for (int i = 0; i < to.getValue().length; i ++) {
|
for (int i = 0; i < to.getValue().length; i ++) {
|
||||||
if (!to.getValue()[i].asObject().toString()
|
if ((to.getValue()[i].asObject() != null && last.getValue()[i].asObject() == null)
|
||||||
.equals(last.getValue()[i].asObject().toString())) {
|
|| (last.getValue()[i].asObject() == null && to.getValue()[i].asObject() != null)
|
||||||
|
|| (last.getValue()[i].asObject() != null && to.getValue()[i].asObject() != null
|
||||||
|
&& !to.getValue()[i].asObject().toString().equals(last.getValue()[i].asObject().toString()))) {
|
||||||
//Update
|
//Update
|
||||||
StorageItem[] items = to.getValue();
|
StorageItem[] items = to.getValue();
|
||||||
StringBuilder sql = new StringBuilder(String.format("UPDATE `" + instance.getConfig().getString("Database.Prefix") + "%s`", toKey));
|
StringBuilder sql = new StringBuilder(String.format("UPDATE `" + instance.getConfig().getString("Database.Prefix") + "%s`", toKey));
|
||||||
|
@ -35,7 +35,7 @@ public class MySQLDatabase {
|
|||||||
"\t`blacklist` TEXT NULL,\n" +
|
"\t`blacklist` TEXT NULL,\n" +
|
||||||
"\t`void` TEXT NULL,\n" +
|
"\t`void` TEXT NULL,\n" +
|
||||||
"\t`black` TEXT NULL,\n" +
|
"\t`black` TEXT NULL,\n" +
|
||||||
"\t`autobreak` TEXT NULL\n" +
|
"\t`autobreak` TINYINT(1) NULL\n" +
|
||||||
")");
|
")");
|
||||||
|
|
||||||
connection.createStatement().execute("CREATE TABLE IF NOT EXISTS `" + instance.getConfig().getString("Database.Prefix") + "boosts` (\n" +
|
connection.createStatement().execute("CREATE TABLE IF NOT EXISTS `" + instance.getConfig().getString("Database.Prefix") + "boosts` (\n" +
|
||||||
|
Loading…
Reference in New Issue
Block a user