AntiFeedManager related improvements.

This commit is contained in:
MobiusDev
2018-04-17 17:45:54 +00:00
parent d79a3f99c5
commit 64177f7413
22 changed files with 143 additions and 158 deletions

View File

@ -43,7 +43,7 @@ public final class AntiFeedManager
* Set time of the last player's death to current
* @param objectId Player's objectId
*/
public final void setLastDeathTime(int objectId)
public void setLastDeathTime(int objectId)
{
_lastDeathTimes.put(objectId, System.currentTimeMillis());
}
@ -54,7 +54,7 @@ public final class AntiFeedManager
* @param target Target character
* @return True if kill is non-feeded.
*/
public final boolean check(L2Character attacker, L2Character target)
public boolean check(L2Character attacker, L2Character target)
{
if (!Config.ANTIFEED_ENABLE)
{
@ -111,7 +111,7 @@ public final class AntiFeedManager
/**
* Clears all timestamps
*/
public final void clear()
public void clear()
{
_lastDeathTimes.clear();
}
@ -120,7 +120,7 @@ public final class AntiFeedManager
* Register new event for dualbox check. Should be called only once.
* @param eventId
*/
public final void registerEvent(int eventId)
public void registerEvent(int eventId)
{
_eventIPs.putIfAbsent(eventId, new ConcurrentHashMap<>());
}
@ -132,7 +132,7 @@ public final class AntiFeedManager
* @return If number of all simultaneous connections from player's IP address lower than max then increment connection count and return true.<br>
* False if number of all simultaneous connections from player's IP address higher than max.
*/
public final boolean tryAddPlayer(int eventId, L2PcInstance player, int max)
public boolean tryAddPlayer(int eventId, L2PcInstance player, int max)
{
return tryAddClient(eventId, player.getClient(), max);
}
@ -144,7 +144,7 @@ public final class AntiFeedManager
* @return If number of all simultaneous connections from player's IP address lower than max then increment connection count and return true.<br>
* False if number of all simultaneous connections from player's IP address higher than max.
*/
public final boolean tryAddClient(int eventId, L2GameClient client, int max)
public boolean tryAddClient(int eventId, L2GameClient client, int max)
{
if (client == null)
{
@ -175,7 +175,7 @@ public final class AntiFeedManager
* @param player
* @return true if success and false if any problem detected.
*/
public final boolean removePlayer(int eventId, L2PcInstance player)
public boolean removePlayer(int eventId, L2PcInstance player)
{
return removeClient(eventId, player.getClient());
}
@ -186,7 +186,7 @@ public final class AntiFeedManager
* @param client
* @return true if success and false if any problem detected.
*/
public final boolean removeClient(int eventId, L2GameClient client)
public boolean removeClient(int eventId, L2GameClient client)
{
if (client == null)
{
@ -215,7 +215,7 @@ public final class AntiFeedManager
* Remove player connection IP address from all registered events lists.
* @param client
*/
public final void onDisconnect(L2GameClient client)
public void onDisconnect(L2GameClient client)
{
if ((client == null) || (client.getConnectionAddress() == null))
{
@ -232,7 +232,7 @@ public final class AntiFeedManager
* Clear all entries for this eventId.
* @param eventId
*/
public final void clear(int eventId)
public void clear(int eventId)
{
final Map<Integer, AtomicInteger> event = _eventIPs.get(eventId);
if (event != null)
@ -246,7 +246,7 @@ public final class AntiFeedManager
* @param max
* @return maximum number of allowed connections (whitelist + max)
*/
public final int getLimit(L2PcInstance player, int max)
public int getLimit(L2PcInstance player, int max)
{
return getLimit(player.getClient(), max);
}
@ -256,7 +256,7 @@ public final class AntiFeedManager
* @param max
* @return maximum number of allowed connections (whitelist + max)
*/
public final int getLimit(L2GameClient client, int max)
public int getLimit(L2GameClient client, int max)
{
if (client == null)
{

View File

@ -11123,9 +11123,6 @@ public final class L2PcInstance extends L2Playable
L2Event.savePlayerEventStatus(this);
}
// Anti Feed
AntiFeedManager.getInstance().onDisconnect(getClient());
try
{
notifyFriends(L2FriendStatus.MODE_OFFLINE);

View File

@ -19,6 +19,7 @@ package com.l2jmobius.gameserver.network;
import java.util.logging.Logger;
import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.gameserver.instancemanager.AntiFeedManager;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.events.EventDispatcher;
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogout;
@ -90,6 +91,9 @@ public final class Disconnection
_client = getClient(client, activeChar);
_activeChar = getActiveChar(client, activeChar);
// Anti Feed
AntiFeedManager.getInstance().onDisconnect(_client);
if (_client != null)
{
_client.setActiveChar(null);