#950 Add unregister by name to API

- Add method to API
- Ensure that unregistering in datasource is case-insensitive
This commit is contained in:
ljacqu
2016-09-18 14:46:02 +02:00
parent f804b528e5
commit 405bd563d8
5 changed files with 42 additions and 3 deletions
@@ -221,6 +221,15 @@ public class NewAPI {
management.performUnregisterByAdmin(null, player.getName(), player);
}
/**
* Unregister a player from AuthMe by name.
*
* @param name the name of the player (case-insensitive)
*/
public void forceUnregister(String name) {
management.performUnregisterByAdmin(null, name, Bukkit.getPlayer(name));
}
/**
* Get all the registered names (lowercase)
*
@@ -612,7 +612,7 @@ public class MySQL implements DataSource {
}
}
}
pst.setString(1, user);
pst.setString(1, user.toLowerCase());
pst.executeUpdate();
return true;
} catch (SQLException ex) {
@@ -335,7 +335,7 @@ public class SQLite implements DataSource {
PreparedStatement pst = null;
try {
pst = con.prepareStatement("DELETE FROM " + tableName + " WHERE " + col.NAME + "=?;");
pst.setString(1, user);
pst.setString(1, user.toLowerCase());
pst.executeUpdate();
return true;
} catch (SQLException ex) {