Fix issue with tables without party names.

This commit is contained in:
GJ 2013-05-16 13:37:22 -04:00
parent a25bddba5e
commit bc706109e0
4 changed files with 65 additions and 48 deletions

View File

@ -6,7 +6,7 @@ Key:
= Fix = Fix
! Change ! Change
- Removal - Removal
Version 1.4.06-dev Version 1.4.06-dev
+ Added "Ice Fishing" ability to Fishing + Added "Ice Fishing" ability to Fishing
+ Added global scoreboards to track skill rankings (display using /mctop) + Added global scoreboards to track skill rankings (display using /mctop)

View File

@ -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) {
printErrors(ex); if (!sql.equalsIgnoreCase("ALTER TABLE `" + tablePrefix + "users` DROP COLUMN `party` ;")) {
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;
} }

View File

@ -4,5 +4,7 @@ public enum DatabaseUpdateType {
FISHING, FISHING,
BLAST_MINING, BLAST_MINING,
INDEX, INDEX,
MOB_HEALTHBARS; MOB_HEALTHBARS,
PARTY_NAMES,
USER_COLUMN;
} }

View File

@ -320,60 +320,59 @@ public class PlayerProfile {
"WHERE u.user = '" + playerName + "'" "WHERE u.user = '" + playerName + "'"
).get(1); ).get(1);
} }
// 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;