Minor cleanup.

This commit is contained in:
GJ 2013-01-30 12:22:14 -05:00
parent 599bbe73b4
commit bfe8403d75
2 changed files with 9 additions and 19 deletions

View File

@ -25,22 +25,12 @@ public class PrimitiveChunkStore implements ChunkStore {
private List<UUID> spawnedMobs = new ArrayList<UUID>();
transient private int worldHeight;
transient private int xBitShifts;
transient private int zBitShifts;
transient private boolean conversionNeeded;
public PrimitiveChunkStore(World world, int cx, int cz) {
this.cx = cx;
this.cz = cz;
this.worldUid = world.getUID();
this.worldHeight = world != null ? world.getMaxHeight() : 128;
this.xBitShifts = 11;
this.zBitShifts = 7;
this.worldHeight = world.getMaxHeight();
this.store = new boolean[16][16][this.worldHeight];
conversionNeeded = false;
}
@Override
@ -207,8 +197,6 @@ public class PrimitiveChunkStore implements ChunkStore {
World world = mcMMO.p.getServer().getWorld(this.worldUid);
this.worldHeight = world.getMaxHeight();
this.xBitShifts = 11;
this.zBitShifts = 7;
store = (boolean[][][]) in.readObject();

View File

@ -480,7 +480,8 @@ public final class Database {
String sql;
if (skillType != SkillType.ALL) {
sql = "SELECT COUNT(*) AS rank FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON user_id = id WHERE " + skillType.name().toLowerCase() + " > 0 AND " + skillType.name().toLowerCase() + " > (SELECT " + skillType.name().toLowerCase() + " FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON user_id = id WHERE user = '" + playerName + "')";
} else {
}
else {
sql = "SELECT COUNT(*) AS rank FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON user_id = id WHERE taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing > 0 AND taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing > (SELECT taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON user_id = id WHERE user = '" + playerName + "')";
}
PreparedStatement statement = connection.prepareStatement(sql);
@ -489,7 +490,8 @@ public final class Database {
int rank = resultSet.getInt("rank");
if (skillType != SkillType.ALL) {
sql = "SELECT user, " + skillType.name().toLowerCase() + " FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON user_id = id WHERE " + skillType.name().toLowerCase() + " > 0 AND " + skillType.name().toLowerCase() + " = (SELECT " + skillType.name().toLowerCase() + " FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON user_id = id WHERE user = '" + playerName + "') ORDER BY user";
} else {
}
else {
sql = "SELECT user, taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON user_id = id WHERE taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing > 0 AND taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing = (SELECT taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON user_id = id WHERE user = '" + playerName + "') ORDER BY user";
}
statement = connection.prepareStatement(sql);