Fixed Toobian Bug ;-)

This commit is contained in:
Michel Roux 2012-05-05 01:10:59 +02:00
parent b19fd41b39
commit 72b26bcdb4

View File

@ -90,7 +90,7 @@ public class ConfigSQL implements PermsConfig {
public void removePlayerGroups(String player) { public void removePlayerGroups(String player) {
if (init()) { if (init()) {
try { try {
PreparedStatement sql = connection.prepareStatement("DELETE FROM " + table_groups + " WHERE " + column_playerid + " = ?"); PreparedStatement sql = connection.prepareStatement("DELETE FROM " + table_groups + " WHERE " + column_playerid + " = LOWER(?)");
sql.setString(1, player); sql.setString(1, player);
sql.executeUpdate(); sql.executeUpdate();
} catch (SQLException e) { } catch (SQLException e) {
@ -103,7 +103,7 @@ public class ConfigSQL implements PermsConfig {
public void removePlayerGroup(String player, String group) { public void removePlayerGroup(String player, String group) {
if (init()) { if (init()) {
try { try {
PreparedStatement sql = connection.prepareStatement("DELETE FROM " + table_groups + " WHERE " + column_playerid + " = ? AND " + column_groupname + " = ?"); PreparedStatement sql = connection.prepareStatement("DELETE FROM " + table_groups + " WHERE " + column_playerid + " = LOWER(?) AND " + column_groupname + " = ?");
sql.setString(1, player); sql.setString(1, player);
sql.setString(2, group); sql.setString(2, group);
sql.executeUpdate(); sql.executeUpdate();
@ -172,7 +172,7 @@ public class ConfigSQL implements PermsConfig {
public void removePlayerPermissions(String player) { public void removePlayerPermissions(String player) {
if (init()) { if (init()) {
try { try {
PreparedStatement sql = connection.prepareStatement("DELETE FROM " + table_players + " WHERE " + column_playerid + " = ?"); PreparedStatement sql = connection.prepareStatement("DELETE FROM " + table_players + " WHERE " + column_playerid + " = LOWER(?)");
sql.setString(1, player); sql.setString(1, player);
sql.executeUpdate(); sql.executeUpdate();
} catch (SQLException e) { } catch (SQLException e) {
@ -190,7 +190,7 @@ public class ConfigSQL implements PermsConfig {
public void removePlayerPermission(String player, String world, String permission) { public void removePlayerPermission(String player, String world, String permission) {
if (init()) { if (init()) {
try { try {
PreparedStatement sql = connection.prepareStatement("DELETE FROM " + table_players + " WHERE " + column_playerid + " = ? AND " + column_world + " = ? AND " + column_permission + " = ?"); PreparedStatement sql = connection.prepareStatement("DELETE FROM " + table_players + " WHERE " + column_playerid + " = LOWER(?) AND " + column_world + " = ? AND " + column_permission + " = ?");
sql.setString(1, player); sql.setString(1, player);
sql.setString(2, world); sql.setString(2, world);
sql.setString(3, permission); sql.setString(3, permission);
@ -224,7 +224,7 @@ public class ConfigSQL implements PermsConfig {
List<String> results = new ArrayList<String>(); List<String> results = new ArrayList<String>();
if (init()) { if (init()) {
try { try {
PreparedStatement sql = connection.prepareStatement("SELECT " + column_groupname + " FROM " + table_groups + " WHERE " + column_playerid + " = ?"); PreparedStatement sql = connection.prepareStatement("SELECT " + column_groupname + " FROM " + table_groups + " WHERE " + column_playerid + " = LOWER(?)");
sql.setString(1, player); sql.setString(1, player);
ResultSet players = sql.executeQuery(); ResultSet players = sql.executeQuery();
while (players.next()) { while (players.next()) {
@ -247,7 +247,7 @@ public class ConfigSQL implements PermsConfig {
Map<String, Boolean> results = new HashMap<String, Boolean>(); Map<String, Boolean> results = new HashMap<String, Boolean>();
if (init()) { if (init()) {
try { try {
PreparedStatement sql = connection.prepareStatement("SELECT " + column_permission + ", " + column_value + " FROM " + table_players + " WHERE " + column_playerid + " = ? AND " + column_world + " = ?"); PreparedStatement sql = connection.prepareStatement("SELECT " + column_permission + ", " + column_value + " FROM " + table_players + " WHERE " + column_playerid + " = LOWER(?) AND " + column_world + " = ?");
sql.setString(1, player); sql.setString(1, player);
sql.setString(2, world); sql.setString(2, world);
ResultSet permissions = sql.executeQuery(); ResultSet permissions = sql.executeQuery();
@ -266,13 +266,13 @@ public class ConfigSQL implements PermsConfig {
if (init()) { if (init()) {
try { try {
int count = 0; int count = 0;
PreparedStatement sql = connection.prepareStatement("SELECT COUNT(" + column_playerid + ") FROM " + table_groups + " WHERE " + column_playerid + " = ?"); PreparedStatement sql = connection.prepareStatement("SELECT COUNT(" + column_playerid + ") FROM " + table_groups + " WHERE " + column_playerid + " = LOWER(?)");
sql.setString(1, player); sql.setString(1, player);
ResultSet results = sql.executeQuery(); ResultSet results = sql.executeQuery();
if (results.next()) { if (results.next()) {
count += results.getInt(1); count += results.getInt(1);
} }
sql = connection.prepareStatement("SELECT COUNT(" + column_playerid + ") FROM " + table_players + " WHERE " + column_playerid + " = ?"); sql = connection.prepareStatement("SELECT COUNT(" + column_playerid + ") FROM " + table_players + " WHERE " + column_playerid + " = LOWER(?)");
sql.setString(1, player); sql.setString(1, player);
results = sql.executeQuery(); results = sql.executeQuery();
if (results.next()) { if (results.next()) {
@ -292,7 +292,7 @@ public class ConfigSQL implements PermsConfig {
List<String> results = new ArrayList<String>(); List<String> results = new ArrayList<String>();
if (init()) { if (init()) {
try { try {
PreparedStatement sql = connection.prepareStatement("SELECT " + column_world + " FROM " + table_players + " WHERE " + column_playerid + " = ?"); PreparedStatement sql = connection.prepareStatement("SELECT " + column_world + " FROM " + table_players + " WHERE " + column_playerid + " = LOWER(?)");
sql.setString(1, player); sql.setString(1, player);
ResultSet players = sql.executeQuery(); ResultSet players = sql.executeQuery();
while (players.next()) { while (players.next()) {