mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-04-06 03:36:23 +02:00
Minor cleanup.
This commit is contained in:
parent
599bbe73b4
commit
bfe8403d75
@ -25,22 +25,12 @@ public class PrimitiveChunkStore implements ChunkStore {
|
|||||||
private List<UUID> spawnedMobs = new ArrayList<UUID>();
|
private List<UUID> spawnedMobs = new ArrayList<UUID>();
|
||||||
transient private int worldHeight;
|
transient private int worldHeight;
|
||||||
|
|
||||||
transient private int xBitShifts;
|
|
||||||
transient private int zBitShifts;
|
|
||||||
transient private boolean conversionNeeded;
|
|
||||||
|
|
||||||
public PrimitiveChunkStore(World world, int cx, int cz) {
|
public PrimitiveChunkStore(World world, int cx, int cz) {
|
||||||
this.cx = cx;
|
this.cx = cx;
|
||||||
this.cz = cz;
|
this.cz = cz;
|
||||||
this.worldUid = world.getUID();
|
this.worldUid = world.getUID();
|
||||||
|
this.worldHeight = world.getMaxHeight();
|
||||||
this.worldHeight = world != null ? world.getMaxHeight() : 128;
|
|
||||||
this.xBitShifts = 11;
|
|
||||||
this.zBitShifts = 7;
|
|
||||||
|
|
||||||
this.store = new boolean[16][16][this.worldHeight];
|
this.store = new boolean[16][16][this.worldHeight];
|
||||||
|
|
||||||
conversionNeeded = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -207,8 +197,6 @@ public class PrimitiveChunkStore implements ChunkStore {
|
|||||||
World world = mcMMO.p.getServer().getWorld(this.worldUid);
|
World world = mcMMO.p.getServer().getWorld(this.worldUid);
|
||||||
|
|
||||||
this.worldHeight = world.getMaxHeight();
|
this.worldHeight = world.getMaxHeight();
|
||||||
this.xBitShifts = 11;
|
|
||||||
this.zBitShifts = 7;
|
|
||||||
|
|
||||||
store = (boolean[][][]) in.readObject();
|
store = (boolean[][][]) in.readObject();
|
||||||
|
|
||||||
|
@ -480,7 +480,8 @@ public final class Database {
|
|||||||
String sql;
|
String sql;
|
||||||
if (skillType != SkillType.ALL) {
|
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 + "')";
|
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 + "')";
|
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);
|
PreparedStatement statement = connection.prepareStatement(sql);
|
||||||
@ -489,7 +490,8 @@ public final class Database {
|
|||||||
int rank = resultSet.getInt("rank");
|
int rank = resultSet.getInt("rank");
|
||||||
if (skillType != SkillType.ALL) {
|
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";
|
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";
|
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);
|
statement = connection.prepareStatement(sql);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user