Renamed table players to lb-players
This commit is contained in:
1 parent
86fd87444e
commit
614879d344
7 files changed
+15
-15
No files matched your search
@@ -38,7 +38,7 @@ public class AreaBlockSearch implements Runnable
|
|||||||
SimpleDateFormat formatter = new SimpleDateFormat("MM-dd HH:mm:ss");
|
SimpleDateFormat formatter = new SimpleDateFormat("MM-dd HH:mm:ss");
|
||||||
try {
|
try {
|
||||||
conn.setAutoCommit(false);
|
conn.setAutoCommit(false);
|
||||||
ps = conn.prepareStatement("SELECT * FROM `" + table + "` INNER JOIN `players` USING (`playerid`) WHERE (type = ? or replaced = ?) and y > ? and y < ? and x > ? and x < ? and z > ? and z < ? order by date desc limit 10", Statement.RETURN_GENERATED_KEYS);
|
ps = conn.prepareStatement("SELECT * FROM `" + table + "` INNER JOIN `lb-players` USING (`playerid`) WHERE (type = ? or replaced = ?) and y > ? and y < ? and x > ? and x < ? and z > ? and z < ? order by date desc limit 10", Statement.RETURN_GENERATED_KEYS);
|
||||||
ps.setInt(1, type);
|
ps.setInt(1, type);
|
||||||
ps.setInt(2, type);
|
ps.setInt(2, type);
|
||||||
ps.setInt(3, location.getBlockY() - size);
|
ps.setInt(3, location.getBlockY() - size);
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public class AreaStats implements Runnable
|
|||||||
ResultSet rs = null;
|
ResultSet rs = null;
|
||||||
try {
|
try {
|
||||||
conn.setAutoCommit(false);
|
conn.setAutoCommit(false);
|
||||||
ps = conn.prepareStatement("SELECT playername, count(playername) as num from `" + table + "` INNER JOIN `players` USING (`playerid`) where type > 0 and y > ? and y < ? and x > ? and x < ? and z > ? and z < ? group by playername order by count(playername) desc limit 10", Statement.RETURN_GENERATED_KEYS);
|
ps = conn.prepareStatement("SELECT playername, count(playername) as num from `" + table + "` INNER JOIN `lb-players` USING (`playerid`) where type > 0 and y > ? and y < ? and x > ? and x < ? and z > ? and z < ? group by playername order by count(playername) desc limit 10", Statement.RETURN_GENERATED_KEYS);
|
||||||
ps.setInt(1, player.getLocation().getBlockY()-size);
|
ps.setInt(1, player.getLocation().getBlockY()-size);
|
||||||
ps.setInt(2, player.getLocation().getBlockY()+size);
|
ps.setInt(2, player.getLocation().getBlockY()+size);
|
||||||
ps.setInt(3, player.getLocation().getBlockX()-size);
|
ps.setInt(3, player.getLocation().getBlockX()-size);
|
||||||
@@ -48,7 +48,7 @@ public class AreaStats implements Runnable
|
|||||||
}
|
}
|
||||||
rs.close();
|
rs.close();
|
||||||
ps.close();
|
ps.close();
|
||||||
ps = conn.prepareStatement("SELECT playername, count(playername) as num from `" + table + "` INNER JOIN `players` USING (`playerid`) where replaced > 0 and y > ? and y < ? and x > ? and x < ? and z > ? and z < ? group by playername order by count(playername) desc limit 10", Statement.RETURN_GENERATED_KEYS);
|
ps = conn.prepareStatement("SELECT playername, count(playername) as num from `" + table + "` INNER JOIN `lb-players` USING (`playerid`) where replaced > 0 and y > ? and y < ? and x > ? and x < ? and z > ? and z < ? group by playername order by count(playername) desc limit 10", Statement.RETURN_GENERATED_KEYS);
|
||||||
ps.setInt(1, player.getLocation().getBlockY()-size);
|
ps.setInt(1, player.getLocation().getBlockY()-size);
|
||||||
ps.setInt(2, player.getLocation().getBlockY()+size);
|
ps.setInt(2, player.getLocation().getBlockY()+size);
|
||||||
ps.setInt(3, player.getLocation().getBlockX()-size);
|
ps.setInt(3, player.getLocation().getBlockX()-size);
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ public class BlockStats implements Runnable
|
|||||||
SimpleDateFormat formatter = new SimpleDateFormat("MM-dd HH:mm:ss");
|
SimpleDateFormat formatter = new SimpleDateFormat("MM-dd HH:mm:ss");
|
||||||
try {
|
try {
|
||||||
conn.setAutoCommit(false);
|
conn.setAutoCommit(false);
|
||||||
ps = conn.prepareStatement("SELECT * FROM `" + table + "` LEFT JOIN `" + table + "-sign` USING (`id`) INNER JOIN `players` USING (`playerid`) WHERE `x` = ? AND `y` = ? AND `z` = ? ORDER BY `date` DESC", Statement.RETURN_GENERATED_KEYS);
|
ps = conn.prepareStatement("SELECT * FROM `" + table + "` LEFT JOIN `" + table + "-sign` USING (`id`) INNER JOIN `lb-players` USING (`playerid`) WHERE `x` = ? AND `y` = ? AND `z` = ? ORDER BY `date` DESC", Statement.RETURN_GENERATED_KEYS);
|
||||||
ps.setInt(1, block.getX());
|
ps.setInt(1, block.getX());
|
||||||
ps.setInt(2, block.getY());
|
ps.setInt(2, block.getY());
|
||||||
ps.setInt(3, block.getZ());
|
ps.setInt(3, block.getZ());
|
||||||
|
|||||||
@@ -263,11 +263,11 @@ public class LogBlock extends JavaPlugin
|
|||||||
try {
|
try {
|
||||||
DatabaseMetaData dbm = conn.getMetaData();
|
DatabaseMetaData dbm = conn.getMetaData();
|
||||||
state = conn.createStatement();
|
state = conn.createStatement();
|
||||||
if (!dbm.getTables(null, null, "players", null).next()) {
|
if (!dbm.getTables(null, null, "lb-players", null).next()) {
|
||||||
log.log(Level.INFO, "[LogBlock] Crating table players.");
|
log.log(Level.INFO, "[LogBlock] Crating table players.");
|
||||||
state.execute("CREATE TABLE `players` (`playerid` SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT, `playername` varchar(32) NOT NULL DEFAULT '-', PRIMARY KEY (`playerid`), UNIQUE (`playername`))");
|
state.execute("CREATE TABLE `lb-players` (`playerid` SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT, `playername` varchar(32) NOT NULL DEFAULT '-', PRIMARY KEY (`playerid`), UNIQUE (`playername`))");
|
||||||
state.execute("INSERT INTO `players` (`playername`) VALUES ('environment');");
|
state.execute("INSERT INTO `lb-players` (`playername`) VALUES ('environment');");
|
||||||
if (!dbm.getTables(null, null, "players", null).next())
|
if (!dbm.getTables(null, null, "lb-players", null).next())
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < Config.worldNames.size(); i++) {
|
for (int i = 0; i < Config.worldNames.size(); i++) {
|
||||||
@@ -448,7 +448,7 @@ private boolean CheckPermission(Player player, String permission) {
|
|||||||
return;
|
return;
|
||||||
try {
|
try {
|
||||||
state = conn.createStatement();
|
state = conn.createStatement();
|
||||||
state.execute("INSERT IGNORE INTO `players` (`playername`) VALUES ('" + event.getPlayer().getName() + "');");
|
state.execute("INSERT IGNORE INTO `lb-players` (`playername`) VALUES ('" + event.getPlayer().getName() + "');");
|
||||||
} catch (SQLException ex) {
|
} catch (SQLException ex) {
|
||||||
log.log(Level.SEVERE, "[LogBlock] SQL exception", ex);
|
log.log(Level.SEVERE, "[LogBlock] SQL exception", ex);
|
||||||
} finally {
|
} finally {
|
||||||
@@ -567,7 +567,7 @@ private boolean CheckPermission(Player player, String permission) {
|
|||||||
b = bqueue.poll(1L, TimeUnit.SECONDS);
|
b = bqueue.poll(1L, TimeUnit.SECONDS);
|
||||||
if (b == null)
|
if (b == null)
|
||||||
continue;
|
continue;
|
||||||
ps = conn.prepareStatement("INSERT INTO `" + b.table + "` (`date`, `playerid`, `replaced`, `type`, `data`, `x`, `y`, `z`) SELECT now(), `playerid`, ?, ?, ?, ?, ? , ? FROM `players` WHERE `playername` = ?", Statement.RETURN_GENERATED_KEYS);
|
ps = conn.prepareStatement("INSERT INTO `" + b.table + "` (`date`, `playerid`, `replaced`, `type`, `data`, `x`, `y`, `z`) SELECT now(), `playerid`, ?, ?, ?, ?, ? , ? FROM `lb-players` WHERE `playername` = ?", Statement.RETURN_GENERATED_KEYS);
|
||||||
ps.setInt(1, b.replaced);
|
ps.setInt(1, b.replaced);
|
||||||
ps.setInt(2, b.type);
|
ps.setInt(2, b.type);
|
||||||
ps.setByte(3, b.data);
|
ps.setByte(3, b.data);
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public class PlayerAreaStats implements Runnable
|
|||||||
ResultSet rs = null;
|
ResultSet rs = null;
|
||||||
try {
|
try {
|
||||||
conn.setAutoCommit(false);
|
conn.setAutoCommit(false);
|
||||||
ps = conn.prepareStatement("SELECT type, count(type) as num from `" + table + "` INNER JOIN `players` USING (`playerid`) where type > 0 and playername = ? and y > 0 and x > ? and x < ? and z > ? and z < ? group by type order by count(replaced) desc limit 10", Statement.RETURN_GENERATED_KEYS);
|
ps = conn.prepareStatement("SELECT type, count(type) as num from `" + table + "` INNER JOIN `lb-players` USING (`playerid`) where type > 0 and playername = ? and y > 0 and x > ? and x < ? and z > ? and z < ? group by type order by count(replaced) desc limit 10", Statement.RETURN_GENERATED_KEYS);
|
||||||
ps.setString(1, name);
|
ps.setString(1, name);
|
||||||
ps.setInt(2, player.getLocation().getBlockX()-size);
|
ps.setInt(2, player.getLocation().getBlockX()-size);
|
||||||
ps.setInt(3, player.getLocation().getBlockX()+size);
|
ps.setInt(3, player.getLocation().getBlockX()+size);
|
||||||
@@ -50,7 +50,7 @@ public class PlayerAreaStats implements Runnable
|
|||||||
}
|
}
|
||||||
rs.close();
|
rs.close();
|
||||||
ps.close();
|
ps.close();
|
||||||
ps = conn.prepareStatement("SELECT replaced, count(replaced) as num from `" + table + "` INNER JOIN `players` USING (`playerid`) where replaced > 0 and playername = ? and y > 0 and x > ? and x < ? and z > ? and z < ? group by replaced order by count(replaced) desc limit 10", Statement.RETURN_GENERATED_KEYS);
|
ps = conn.prepareStatement("SELECT replaced, count(replaced) as num from `" + table + "` INNER JOIN `lb-players` USING (`playerid`) where replaced > 0 and playername = ? and y > 0 and x > ? and x < ? and z > ? and z < ? group by replaced order by count(replaced) desc limit 10", Statement.RETURN_GENERATED_KEYS);
|
||||||
ps.setString(1, name);
|
ps.setString(1, name);
|
||||||
ps.setInt(2, player.getLocation().getBlockX()-size);
|
ps.setInt(2, player.getLocation().getBlockX()-size);
|
||||||
ps.setInt(3, player.getLocation().getBlockX()+size);
|
ps.setInt(3, player.getLocation().getBlockX()+size);
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ public class Rollback implements Runnable
|
|||||||
this.conn = conn;
|
this.conn = conn;
|
||||||
try {
|
try {
|
||||||
conn.setAutoCommit(false);
|
conn.setAutoCommit(false);
|
||||||
ps = conn.prepareStatement("SELECT type, data, replaced, x, y, z FROM `" + table + "` INNER JOIN `players` USING (`playerid`) WHERE playername = ? AND date > date_sub(now(), INTERVAL ? MINUTE) ORDER BY date DESC", Statement.RETURN_GENERATED_KEYS);
|
ps = conn.prepareStatement("SELECT type, data, replaced, x, y, z FROM `" + table + "` INNER JOIN `lb-players` USING (`playerid`) WHERE playername = ? AND date > date_sub(now(), INTERVAL ? MINUTE) ORDER BY date DESC", Statement.RETURN_GENERATED_KEYS);
|
||||||
ps.setString(1, name);
|
ps.setString(1, name);
|
||||||
ps.setInt(2, minutes);
|
ps.setInt(2, minutes);
|
||||||
} catch (SQLException ex) {
|
} catch (SQLException ex) {
|
||||||
@@ -41,7 +41,7 @@ public class Rollback implements Runnable
|
|||||||
this.conn = conn;
|
this.conn = conn;
|
||||||
try {
|
try {
|
||||||
conn.setAutoCommit(false);
|
conn.setAutoCommit(false);
|
||||||
ps = conn.prepareStatement("SELECT type, data, replaced, x, y, z FROM `" + table + "` WHERE y > 0 and x > ? and x < ? and z > ? and z < ? AND date > date_sub(now(), INTERVAL ? MINUTE) ORDER BY date DESC", Statement.RETURN_GENERATED_KEYS);
|
ps = conn.prepareStatement("SELECT type, data, replaced, x, y, z FROM `" + table + "` and x > ? and x < ? and z > ? and z < ? AND date > date_sub(now(), INTERVAL ? MINUTE) ORDER BY date DESC", Statement.RETURN_GENERATED_KEYS);
|
||||||
ps.setInt(1, player.getLocation().getBlockX()-radius);
|
ps.setInt(1, player.getLocation().getBlockX()-radius);
|
||||||
ps.setInt(2, player.getLocation().getBlockX()+radius);
|
ps.setInt(2, player.getLocation().getBlockX()+radius);
|
||||||
ps.setInt(3, player.getLocation().getBlockZ()-radius);
|
ps.setInt(3, player.getLocation().getBlockZ()-radius);
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
name: LogBlock
|
name: LogBlock
|
||||||
version: 0.7
|
version: 0.7b
|
||||||
author: DiddiZ, bootswithdefer
|
author: DiddiZ, bootswithdefer
|
||||||
website: http://www.diddiz.de/minecraft/
|
website: http://www.diddiz.de/minecraft/
|
||||||
main: de.diddiz.LogBlock.LogBlock
|
main: de.diddiz.LogBlock.LogBlock
|
||||||
|
|||||||
Reference in new issue
Block a user