mirror of
https://github.com/moparisthebest/xAuth
synced 2024-12-21 22:58:51 -05:00
1. Fixed ENTITY_DAMAGE ClassCastException (http://forums.bukkit.org/threads/sec-xauth-v2-0-beta-1-offline-mode-security-suite-689-860.8712/page-18#post-397808)
2. Account activation fixed for servers using web registration 3. Error when a MySQL DATETIME field is 0000-00-00 00:00:00 fixed
This commit is contained in:
parent
79ef31afff
commit
78e827eade
@ -47,7 +47,8 @@ public class LoginCommand implements CommandExecutor {
|
||||
|
||||
xAuthMessages.send("loginErrPassword", player);
|
||||
return true;
|
||||
} else if (xAuthSettings.activation && account.getActive() == 0) {
|
||||
//} else if (xAuthSettings.activation && account.getActive() == 0) {
|
||||
} else if (xAuthSettings.activation && plugin.getDataManager().getActive(player.getName()) == 0) {
|
||||
xAuthMessages.send("loginErrActivate", player);
|
||||
return true;
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ public class DataManager {
|
||||
try {
|
||||
Class.forName("com.mysql.jdbc.Driver");
|
||||
connection = DriverManager.getConnection("jdbc:mysql://" + xAuthSettings.mysqlHost + ":" + xAuthSettings.mysqlPort + "/" +
|
||||
xAuthSettings.mysqlDb, xAuthSettings.mysqlUser, xAuthSettings.mysqlPass);
|
||||
xAuthSettings.mysqlDb + "?zeroDateTimeBehavior=convertToNull", xAuthSettings.mysqlUser, xAuthSettings.mysqlPass);
|
||||
stmt = connection.createStatement();
|
||||
xAuthLog.info("Connection to MySQL server established!");
|
||||
} catch (ClassNotFoundException e) {
|
||||
@ -190,6 +190,25 @@ public class DataManager {
|
||||
return xPlayer;
|
||||
}
|
||||
|
||||
public int getActive(String playerName) {
|
||||
try {
|
||||
prepStmt = connection.prepareStatement(
|
||||
"SELECT `active`" +
|
||||
" FROM `" + xAuthSettings.tblAccount + "`" +
|
||||
" WHERE playername = ?"
|
||||
);
|
||||
prepStmt.setString(1, playerName);
|
||||
rs = prepStmt.executeQuery();
|
||||
|
||||
if (rs.next())
|
||||
return rs.getInt("active");
|
||||
} catch (SQLException e) {
|
||||
xAuthLog.severe("Could not check active status of player: " + playerName, e);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void saveAccount(Account account) {
|
||||
if (account.getId() == 0)
|
||||
insertAccount(account);
|
||||
|
@ -46,7 +46,7 @@ public class xAuthEntityListener extends EntityListener {
|
||||
Entity damager = edbeEvent.getDamager();
|
||||
|
||||
if (damager instanceof Player) {
|
||||
xAuthPlayer xPlayer = plugin.getDataManager().getPlayerByName(((Player)entity).getName());
|
||||
xAuthPlayer xPlayer = plugin.getDataManager().getPlayerByName(((Player)damager).getName());
|
||||
|
||||
//if (!xAuthSettings.rstrDmgGiven && !xPlayer.isRegistered())
|
||||
//return;
|
||||
|
Loading…
Reference in New Issue
Block a user