mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 07:06:45 +01:00
Fix issue with tables without party names.
This commit is contained in:
parent
a25bddba5e
commit
bc706109e0
@ -150,6 +150,8 @@ public final class SQLDatabaseManager {
|
|||||||
checkDatabaseStructure(DatabaseUpdateType.BLAST_MINING);
|
checkDatabaseStructure(DatabaseUpdateType.BLAST_MINING);
|
||||||
checkDatabaseStructure(DatabaseUpdateType.INDEX);
|
checkDatabaseStructure(DatabaseUpdateType.INDEX);
|
||||||
checkDatabaseStructure(DatabaseUpdateType.MOB_HEALTHBARS);
|
checkDatabaseStructure(DatabaseUpdateType.MOB_HEALTHBARS);
|
||||||
|
checkDatabaseStructure(DatabaseUpdateType.PARTY_NAMES);
|
||||||
|
checkDatabaseStructure(DatabaseUpdateType.USER_COLUMN);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -170,7 +172,9 @@ public final class SQLDatabaseManager {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (SQLException ex) {
|
catch (SQLException ex) {
|
||||||
|
if (!sql.equalsIgnoreCase("ALTER TABLE `" + tablePrefix + "users` DROP COLUMN `party` ;")) {
|
||||||
printErrors(ex);
|
printErrors(ex);
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
@ -566,6 +570,14 @@ public final class SQLDatabaseManager {
|
|||||||
sql = "SELECT * FROM `" + tablePrefix + "huds` ORDER BY `" + tablePrefix + "huds`.`mobhealthbar` ASC LIMIT 0 , 30";
|
sql = "SELECT * FROM `" + tablePrefix + "huds` ORDER BY `" + tablePrefix + "huds`.`mobhealthbar` ASC LIMIT 0 , 30";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PARTY_NAMES:
|
||||||
|
write("ALTER TABLE `" + tablePrefix + "users` DROP COLUMN `party` ;");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case USER_COLUMN:
|
||||||
|
sql = "SELECT * FROM `" + tablePrefix + "users` ORDER BY `" + tablePrefix + "users`.`user` ASC LIMIT 0 , 30";
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -607,6 +619,10 @@ public final class SQLDatabaseManager {
|
|||||||
write("ALTER TABLE `" + tablePrefix + "huds` ADD `mobhealthbar` varchar(50) NOT NULL DEFAULT '" + Config.getInstance().getMobHealthbarDefault() + "' ;");
|
write("ALTER TABLE `" + tablePrefix + "huds` ADD `mobhealthbar` varchar(50) NOT NULL DEFAULT '" + Config.getInstance().getMobHealthbarDefault() + "' ;");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case USER_COLUMN:
|
||||||
|
mcMMO.p.getLogger().info("Updating mcMMO MySQL tables for user column name...");
|
||||||
|
write("ALTER TABLE `" + tablePrefix + "users` RENAME COLUMN `userr` to `user`;");
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -4,5 +4,7 @@ public enum DatabaseUpdateType {
|
|||||||
FISHING,
|
FISHING,
|
||||||
BLAST_MINING,
|
BLAST_MINING,
|
||||||
INDEX,
|
INDEX,
|
||||||
MOB_HEALTHBARS;
|
MOB_HEALTHBARS,
|
||||||
|
PARTY_NAMES,
|
||||||
|
USER_COLUMN;
|
||||||
}
|
}
|
||||||
|
@ -322,58 +322,57 @@ public class PlayerProfile {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Remove from list the user_id's from various tables
|
// Remove from list the user_id's from various tables
|
||||||
playerData.remove(43);
|
playerData.remove(42);
|
||||||
playerData.remove(30);
|
playerData.remove(29);
|
||||||
playerData.remove(17);
|
playerData.remove(16);
|
||||||
playerData.remove(4);
|
playerData.remove(3);
|
||||||
|
|
||||||
userId = Integer.valueOf(playerData.get(0));
|
userId = Integer.valueOf(playerData.get(0));
|
||||||
|
|
||||||
// UserName 1 - Already loaded
|
// UserName 1 - Already loaded
|
||||||
// LastLogin 2 - Doesn't need to be loaded
|
// LastLogin 2 - Doesn't need to be loaded
|
||||||
// PartyName 3 - Loaded elsewhere I believe
|
|
||||||
|
|
||||||
skills.put(SkillType.TAMING, Integer.valueOf(playerData.get(4)));
|
skills.put(SkillType.TAMING, Integer.valueOf(playerData.get(3)));
|
||||||
skills.put(SkillType.MINING, Integer.valueOf(playerData.get(5)));
|
skills.put(SkillType.MINING, Integer.valueOf(playerData.get(4)));
|
||||||
skills.put(SkillType.REPAIR, Integer.valueOf(playerData.get(6)));
|
skills.put(SkillType.REPAIR, Integer.valueOf(playerData.get(5)));
|
||||||
skills.put(SkillType.WOODCUTTING, Integer.valueOf(playerData.get(7)));
|
skills.put(SkillType.WOODCUTTING, Integer.valueOf(playerData.get(6)));
|
||||||
skills.put(SkillType.UNARMED, Integer.valueOf(playerData.get(8)));
|
skills.put(SkillType.UNARMED, Integer.valueOf(playerData.get(7)));
|
||||||
skills.put(SkillType.HERBALISM, Integer.valueOf(playerData.get(9)));
|
skills.put(SkillType.HERBALISM, Integer.valueOf(playerData.get(8)));
|
||||||
skills.put(SkillType.EXCAVATION, Integer.valueOf(playerData.get(10)));
|
skills.put(SkillType.EXCAVATION, Integer.valueOf(playerData.get(9)));
|
||||||
skills.put(SkillType.ARCHERY, Integer.valueOf(playerData.get(11)));
|
skills.put(SkillType.ARCHERY, Integer.valueOf(playerData.get(10)));
|
||||||
skills.put(SkillType.SWORDS, Integer.valueOf(playerData.get(12)));
|
skills.put(SkillType.SWORDS, Integer.valueOf(playerData.get(11)));
|
||||||
skills.put(SkillType.AXES, Integer.valueOf(playerData.get(13)));
|
skills.put(SkillType.AXES, Integer.valueOf(playerData.get(12)));
|
||||||
skills.put(SkillType.ACROBATICS, Integer.valueOf(playerData.get(14)));
|
skills.put(SkillType.ACROBATICS, Integer.valueOf(playerData.get(13)));
|
||||||
skills.put(SkillType.FISHING, Integer.valueOf(playerData.get(15)));
|
skills.put(SkillType.FISHING, Integer.valueOf(playerData.get(14)));
|
||||||
|
|
||||||
skillsXp.put(SkillType.TAMING, (float) Integer.valueOf(playerData.get(16)));
|
skillsXp.put(SkillType.TAMING, (float) Integer.valueOf(playerData.get(15)));
|
||||||
skillsXp.put(SkillType.MINING, (float) Integer.valueOf(playerData.get(17)));
|
skillsXp.put(SkillType.MINING, (float) Integer.valueOf(playerData.get(16)));
|
||||||
skillsXp.put(SkillType.REPAIR, (float) Integer.valueOf(playerData.get(18)));
|
skillsXp.put(SkillType.REPAIR, (float) Integer.valueOf(playerData.get(17)));
|
||||||
skillsXp.put(SkillType.WOODCUTTING, (float) Integer.valueOf(playerData.get(19)));
|
skillsXp.put(SkillType.WOODCUTTING, (float) Integer.valueOf(playerData.get(18)));
|
||||||
skillsXp.put(SkillType.UNARMED, (float) Integer.valueOf(playerData.get(20)));
|
skillsXp.put(SkillType.UNARMED, (float) Integer.valueOf(playerData.get(19)));
|
||||||
skillsXp.put(SkillType.HERBALISM, (float) Integer.valueOf(playerData.get(21)));
|
skillsXp.put(SkillType.HERBALISM, (float) Integer.valueOf(playerData.get(20)));
|
||||||
skillsXp.put(SkillType.EXCAVATION, (float) Integer.valueOf(playerData.get(22)));
|
skillsXp.put(SkillType.EXCAVATION, (float) Integer.valueOf(playerData.get(21)));
|
||||||
skillsXp.put(SkillType.ARCHERY, (float) Integer.valueOf(playerData.get(23)));
|
skillsXp.put(SkillType.ARCHERY, (float) Integer.valueOf(playerData.get(22)));
|
||||||
skillsXp.put(SkillType.SWORDS, (float) Integer.valueOf(playerData.get(24)));
|
skillsXp.put(SkillType.SWORDS, (float) Integer.valueOf(playerData.get(23)));
|
||||||
skillsXp.put(SkillType.AXES, (float) Integer.valueOf(playerData.get(25)));
|
skillsXp.put(SkillType.AXES, (float) Integer.valueOf(playerData.get(24)));
|
||||||
skillsXp.put(SkillType.ACROBATICS, (float) Integer.valueOf(playerData.get(26)));
|
skillsXp.put(SkillType.ACROBATICS, (float) Integer.valueOf(playerData.get(25)));
|
||||||
skillsXp.put(SkillType.FISHING, (float) Integer.valueOf(playerData.get(27)));
|
skillsXp.put(SkillType.FISHING, (float) Integer.valueOf(playerData.get(26)));
|
||||||
|
|
||||||
// Taming 28 - Unused
|
// Taming 27 - Unused
|
||||||
skillsDATS.put(AbilityType.SUPER_BREAKER, Integer.valueOf(playerData.get(29)));
|
skillsDATS.put(AbilityType.SUPER_BREAKER, Integer.valueOf(playerData.get(28)));
|
||||||
skillsDATS.put(AbilityType.TREE_FELLER, Integer.valueOf(playerData.get(30)));
|
skillsDATS.put(AbilityType.TREE_FELLER, Integer.valueOf(playerData.get(29)));
|
||||||
// Repair 31 - Unused
|
// Repair 30 - Unused
|
||||||
skillsDATS.put(AbilityType.BERSERK, Integer.valueOf(playerData.get(32)));
|
skillsDATS.put(AbilityType.BERSERK, Integer.valueOf(playerData.get(31)));
|
||||||
skillsDATS.put(AbilityType.GREEN_TERRA, Integer.valueOf(playerData.get(33)));
|
skillsDATS.put(AbilityType.GREEN_TERRA, Integer.valueOf(playerData.get(32)));
|
||||||
skillsDATS.put(AbilityType.GIGA_DRILL_BREAKER, Integer.valueOf(playerData.get(34)));
|
skillsDATS.put(AbilityType.GIGA_DRILL_BREAKER, Integer.valueOf(playerData.get(33)));
|
||||||
// Archery 35 - Unused
|
// Archery 34 - Unused
|
||||||
skillsDATS.put(AbilityType.SERRATED_STRIKES, Integer.valueOf(playerData.get(36)));
|
skillsDATS.put(AbilityType.SERRATED_STRIKES, Integer.valueOf(playerData.get(35)));
|
||||||
skillsDATS.put(AbilityType.SKULL_SPLITTER, Integer.valueOf(playerData.get(37)));
|
skillsDATS.put(AbilityType.SKULL_SPLITTER, Integer.valueOf(playerData.get(36)));
|
||||||
// Acrobatics 38 - Unused
|
// Acrobatics 37 - Unused
|
||||||
skillsDATS.put(AbilityType.BLAST_MINING, Integer.valueOf(playerData.get(39)));
|
skillsDATS.put(AbilityType.BLAST_MINING, Integer.valueOf(playerData.get(38)));
|
||||||
|
|
||||||
hudType = HudType.valueOf(playerData.get(40));
|
hudType = HudType.valueOf(playerData.get(39));
|
||||||
mobHealthbarType = MobHealthbarType.valueOf(playerData.get(41));
|
mobHealthbarType = MobHealthbarType.valueOf(playerData.get(40));
|
||||||
|
|
||||||
loaded = true;
|
loaded = true;
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user