Code improvements.

This commit is contained in:
MobiusDev
2016-04-24 16:30:15 +00:00
parent 8bd51aba1c
commit 2dd14bef9b
860 changed files with 8865 additions and 17041 deletions

View File

@@ -122,12 +122,9 @@ public final class FloodProtectorAction
return false;
}
if (_count.get() > 0)
if ((_count.get() > 0) && _config.LOG_FLOODING && _log.isLoggable(Level.WARNING))
{
if (_config.LOG_FLOODING && _log.isLoggable(Level.WARNING))
{
log(" issued ", String.valueOf(_count), " extra requests within ~", String.valueOf(_config.FLOOD_PROTECTION_INTERVAL * GameTimeController.MILLIS_IN_TICK), " ms");
}
log(" issued ", String.valueOf(_count), " extra requests within ~", String.valueOf(_config.FLOOD_PROTECTION_INTERVAL * GameTimeController.MILLIS_IN_TICK), " ms");
}
_nextGameTick = curTick + _config.FLOOD_PROTECTION_INTERVAL;
@@ -173,18 +170,20 @@ public final class FloodProtectorAction
*/
private void jailChar()
{
if (_client.getActiveChar() != null)
if (_client.getActiveChar() == null)
{
final int charId = _client.getActiveChar().getObjectId();
if (charId > 0)
{
PunishmentManager.getInstance().startPunishment(new PunishmentTask(charId, PunishmentAffect.CHARACTER, PunishmentType.JAIL, System.currentTimeMillis() + _config.PUNISHMENT_TIME, "", getClass().getSimpleName()));
}
if (_log.isLoggable(Level.WARNING))
{
log(" jailed for flooding ", _config.PUNISHMENT_TIME <= 0 ? "forever" : "for " + (_config.PUNISHMENT_TIME / 60000) + " mins");
}
return;
}
final int charId = _client.getActiveChar().getObjectId();
if (charId > 0)
{
PunishmentManager.getInstance().startPunishment(new PunishmentTask(charId, PunishmentAffect.CHARACTER, PunishmentType.JAIL, System.currentTimeMillis() + _config.PUNISHMENT_TIME, "", getClass().getSimpleName()));
}
if (_log.isLoggable(Level.WARNING))
{
log(" jailed for flooding ", _config.PUNISHMENT_TIME <= 0 ? "forever" : "for " + (_config.PUNISHMENT_TIME / 60000) + " mins");
}
}