Index: net/sf/l2j/loginserver/clientpackets/RequestServerList.java =================================================================== --- net/sf/l2j/loginserver/clientpackets/RequestServerList.java (revision 125) +++ net/sf/l2j/loginserver/clientpackets/RequestServerList.java (working copy) @@ -18,6 +18,7 @@ */ package net.sf.l2j.loginserver.clientpackets; +import net.sf.l2j.loginserver.l2guard.l2GuardConnector; import net.sf.l2j.loginserver.serverpackets.ServerList; import net.sf.l2j.loginserver.serverpackets.LoginFail.LoginFailReason; @@ -79,7 +80,10 @@ { if (this.getClient().getSessionKey().checkLoginPair(_skey1, _skey2)) { - this.getClient().sendPacket(new ServerList(this.getClient())); + if (l2GuardConnector.getInstance().isAuth(this.getClient())) + this.getClient().sendPacket(new ServerList(this.getClient())); + else + this.getClient().close(LoginFailReason.REASON_ACCESS_FAILED); } else { Index: net/sf/l2j/loginserver/l2guard/l2GuardConnector.java =================================================================== --- net/sf/l2j/loginserver/l2guard/l2GuardConnector.java (revision 0) +++ net/sf/l2j/loginserver/l2guard/l2GuardConnector.java (revision 0) @@ -0,0 +1,62 @@ +package net.sf.l2j.loginserver.l2guard; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.logging.Logger; + +import net.sf.l2j.L2DatabaseFactory; +import net.sf.l2j.loginserver.L2LoginClient; + +/** + * + * @author Noctarius + */ +public class l2GuardConnector +{ + private static l2GuardConnector _instance; + private Logger _log = Logger.getLogger(l2GuardConnector.class.getName()); + + public static l2GuardConnector getInstance() + { + if (_instance == null) + _instance = new l2GuardConnector(); + + return _instance; + } + + private l2GuardConnector() + { + } + + public boolean isAuth(L2LoginClient _client) + { + boolean _isAuth = false; + + try + { + java.sql.Connection con = null; + PreparedStatement statement = null; + + con = L2DatabaseFactory.getInstance().getConnection(); + statement = con.prepareStatement("SELECT blocked FROM characters WHERE login=?"); + statement.setString(1, _client.getAccount()); + ResultSet rset = statement.executeQuery(); + + if (rset != null) + { + rset.next(); + + if (rset.getInt("blocked") == 0) + _isAuth = true; + } + } + catch (SQLException e) + { + _log.warning("Error while getting blockedstatus of user: "+_client.getAccount()); + e.printStackTrace(); + } + + return _isAuth; + } +} Index: net/sf/l2j/loginserver/l2guard/l2GuardConnector.java =================================================================== --- net/sf/l2j/loginserver/l2guard/l2GuardConnector.java (revision 0) +++ net/sf/l2j/loginserver/l2guard/l2GuardConnector.java (revision 0) @@ -0,0 +1,62 @@ +package net.sf.l2j.loginserver.l2guard; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.logging.Logger; + +import net.sf.l2j.L2DatabaseFactory; +import net.sf.l2j.loginserver.L2LoginClient; + +/** + * + * @author Noctarius + */ +public class l2GuardConnector +{ + private static l2GuardConnector _instance; + private Logger _log = Logger.getLogger(l2GuardConnector.class.getName()); + + public static l2GuardConnector getInstance() + { + if (_instance == null) + _instance = new l2GuardConnector(); + + return _instance; + } + + private l2GuardConnector() + { + } + + public boolean isAuth(L2LoginClient _client) + { + boolean _isAuth = false; + + try + { + java.sql.Connection con = null; + PreparedStatement statement = null; + + con = L2DatabaseFactory.getInstance().getConnection(); + statement = con.prepareStatement("SELECT blocked FROM characters WHERE login=?"); + statement.setString(1, _client.getAccount()); + ResultSet rset = statement.executeQuery(); + + if (rset != null) + { + rset.next(); + + if (rset.getInt("blocked") == 0) + _isAuth = true; + } + } + catch (SQLException e) + { + _log.warning("Error while getting blockedstatus of user: "+_client.getAccount()); + e.printStackTrace(); + } + + return _isAuth; + } +}