1
0
mirror of https://github.com/essentials/Essentials.git synced 2025-09-28 07:09:14 +02:00

Switch to the new I18n class and format cleanup of all classes

This commit is contained in:
snowleo
2011-11-21 02:55:26 +01:00
parent 0d0eb1e8bd
commit e3fa243753
207 changed files with 1247 additions and 1306 deletions

View File

@@ -5,41 +5,45 @@ import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
public class ProtectedBlockSQLite extends ProtectedBlockJDBC {
public ProtectedBlockSQLite(String url) throws PropertyVetoException {
public class ProtectedBlockSQLite extends ProtectedBlockJDBC
{
public ProtectedBlockSQLite(String url) throws PropertyVetoException
{
super("org.sqlite.JDBC", url);
}
private static final String QueryCreateTable =
"CREATE TABLE IF NOT EXISTS EssentialsProtect ("
+ "worldName TEXT ,playerName TEXT, "
+ "x NUMERIC, y NUMERIC, z NUMERIC)";
"CREATE TABLE IF NOT EXISTS EssentialsProtect ("
+ "worldName TEXT ,playerName TEXT, "
+ "x NUMERIC, y NUMERIC, z NUMERIC)";
@Override
protected PreparedStatement getStatementCreateTable(Connection conn) throws SQLException {
protected PreparedStatement getStatementCreateTable(Connection conn) throws SQLException
{
return conn.prepareStatement(QueryCreateTable);
}
private static final String QueryUpdateFrom2_0Table =
"CREATE INDEX IF NOT EXISTS position ON EssentialsProtect ("
+ "worldName, x, z, y)";
"CREATE INDEX IF NOT EXISTS position ON EssentialsProtect ("
+ "worldName, x, z, y)";
@Override
protected PreparedStatement getStatementUpdateFrom2_0Table(Connection conn) throws SQLException {
protected PreparedStatement getStatementUpdateFrom2_0Table(Connection conn) throws SQLException
{
return conn.prepareStatement(QueryUpdateFrom2_0Table);
}
private static final String QueryDeleteAll = "DELETE FROM EssentialsProtect;";
@Override
protected PreparedStatement getStatementDeleteAll(Connection conn) throws SQLException {
protected PreparedStatement getStatementDeleteAll(Connection conn) throws SQLException
{
return conn.prepareStatement(QueryDeleteAll);
}
private static final String QueryInsert =
"INSERT INTO EssentialsProtect (worldName, x, y, z, playerName) VALUES (?, ?, ?, ?, ?);";
"INSERT INTO EssentialsProtect (worldName, x, y, z, playerName) VALUES (?, ?, ?, ?, ?);";
@Override
protected PreparedStatement getStatementInsert(Connection conn, String world, int x, int y, int z, String playerName) throws SQLException {
protected PreparedStatement getStatementInsert(Connection conn, String world, int x, int y, int z, String playerName) throws SQLException
{
PreparedStatement ps = conn.prepareStatement(QueryInsert);
ps.setString(1, world);
ps.setInt(2, x);
@@ -49,11 +53,12 @@ public class ProtectedBlockSQLite extends ProtectedBlockJDBC {
return ps;
}
private static final String QueryPlayerCountByLocation =
"SELECT COUNT(playerName), SUM(playerName = ?) FROM EssentialsProtect "
+ "WHERE worldName = ? AND x = ? AND y = ? AND z = ? GROUP BY x;";
"SELECT COUNT(playerName), SUM(playerName = ?) FROM EssentialsProtect "
+ "WHERE worldName = ? AND x = ? AND y = ? AND z = ? GROUP BY x;";
@Override
protected PreparedStatement getStatementPlayerCountByLocation(Connection conn, String world, int x, int y, int z, String playerName) throws SQLException {
protected PreparedStatement getStatementPlayerCountByLocation(Connection conn, String world, int x, int y, int z, String playerName) throws SQLException
{
PreparedStatement ps = conn.prepareStatement(QueryPlayerCountByLocation);
ps.setString(1, playerName);
ps.setString(2, world);
@@ -63,10 +68,11 @@ public class ProtectedBlockSQLite extends ProtectedBlockJDBC {
return ps;
}
private static final String QueryPlayersByLocation =
"SELECT playerName FROM EssentialsProtect WHERE worldname = ? AND x = ? AND y = ? AND z = ?;";
"SELECT playerName FROM EssentialsProtect WHERE worldname = ? AND x = ? AND y = ? AND z = ?;";
@Override
protected PreparedStatement getStatementPlayersByLocation(Connection conn, String world, int x, int y, int z) throws SQLException {
protected PreparedStatement getStatementPlayersByLocation(Connection conn, String world, int x, int y, int z) throws SQLException
{
PreparedStatement ps = conn.prepareStatement(QueryPlayersByLocation);
ps.setString(1, world);
ps.setInt(2, x);
@@ -75,10 +81,11 @@ public class ProtectedBlockSQLite extends ProtectedBlockJDBC {
return ps;
}
private static final String QueryDeleteByLocation =
"DELETE FROM EssentialsProtect WHERE worldName = ? AND x = ? AND y = ? AND z = ?;";
"DELETE FROM EssentialsProtect WHERE worldName = ? AND x = ? AND y = ? AND z = ?;";
@Override
protected PreparedStatement getStatementDeleteByLocation(Connection conn, String world, int x, int y, int z) throws SQLException {
protected PreparedStatement getStatementDeleteByLocation(Connection conn, String world, int x, int y, int z) throws SQLException
{
PreparedStatement ps = conn.prepareStatement(QueryDeleteByLocation);
ps.setString(1, world);
ps.setInt(2, x);
@@ -87,10 +94,11 @@ public class ProtectedBlockSQLite extends ProtectedBlockJDBC {
return ps;
}
private static final String QueryAllBlocks =
"SELECT worldName, x, y, z, playerName FROM EssentialsProtect;";
"SELECT worldName, x, y, z, playerName FROM EssentialsProtect;";
@Override
protected PreparedStatement getStatementAllBlocks(Connection conn) throws SQLException {
protected PreparedStatement getStatementAllBlocks(Connection conn) throws SQLException
{
return conn.prepareStatement(QueryAllBlocks);
}
}