AntiFeedManager related improvements.
This commit is contained in:
+12
-12
@@ -43,7 +43,7 @@ public final class AntiFeedManager
|
|||||||
* Set time of the last player's death to current
|
* Set time of the last player's death to current
|
||||||
* @param objectId Player's objectId
|
* @param objectId Player's objectId
|
||||||
*/
|
*/
|
||||||
public final void setLastDeathTime(int objectId)
|
public void setLastDeathTime(int objectId)
|
||||||
{
|
{
|
||||||
_lastDeathTimes.put(objectId, System.currentTimeMillis());
|
_lastDeathTimes.put(objectId, System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
@@ -54,7 +54,7 @@ public final class AntiFeedManager
|
|||||||
* @param target Target character
|
* @param target Target character
|
||||||
* @return True if kill is non-feeded.
|
* @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)
|
if (!Config.ANTIFEED_ENABLE)
|
||||||
{
|
{
|
||||||
@@ -111,7 +111,7 @@ public final class AntiFeedManager
|
|||||||
/**
|
/**
|
||||||
* Clears all timestamps
|
* Clears all timestamps
|
||||||
*/
|
*/
|
||||||
public final void clear()
|
public void clear()
|
||||||
{
|
{
|
||||||
_lastDeathTimes.clear();
|
_lastDeathTimes.clear();
|
||||||
}
|
}
|
||||||
@@ -120,7 +120,7 @@ public final class AntiFeedManager
|
|||||||
* Register new event for dualbox check. Should be called only once.
|
* Register new event for dualbox check. Should be called only once.
|
||||||
* @param eventId
|
* @param eventId
|
||||||
*/
|
*/
|
||||||
public final void registerEvent(int eventId)
|
public void registerEvent(int eventId)
|
||||||
{
|
{
|
||||||
_eventIPs.putIfAbsent(eventId, new ConcurrentHashMap<>());
|
_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>
|
* @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.
|
* 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);
|
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>
|
* @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.
|
* 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)
|
if (client == null)
|
||||||
{
|
{
|
||||||
@@ -175,7 +175,7 @@ public final class AntiFeedManager
|
|||||||
* @param player
|
* @param player
|
||||||
* @return true if success and false if any problem detected.
|
* @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());
|
return removeClient(eventId, player.getClient());
|
||||||
}
|
}
|
||||||
@@ -186,7 +186,7 @@ public final class AntiFeedManager
|
|||||||
* @param client
|
* @param client
|
||||||
* @return true if success and false if any problem detected.
|
* @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)
|
if (client == null)
|
||||||
{
|
{
|
||||||
@@ -215,7 +215,7 @@ public final class AntiFeedManager
|
|||||||
* Remove player connection IP address from all registered events lists.
|
* Remove player connection IP address from all registered events lists.
|
||||||
* @param client
|
* @param client
|
||||||
*/
|
*/
|
||||||
public final void onDisconnect(L2GameClient client)
|
public void onDisconnect(L2GameClient client)
|
||||||
{
|
{
|
||||||
if ((client == null) || (client.getConnectionAddress() == null))
|
if ((client == null) || (client.getConnectionAddress() == null))
|
||||||
{
|
{
|
||||||
@@ -232,7 +232,7 @@ public final class AntiFeedManager
|
|||||||
* Clear all entries for this eventId.
|
* Clear all entries for this eventId.
|
||||||
* @param eventId
|
* @param eventId
|
||||||
*/
|
*/
|
||||||
public final void clear(int eventId)
|
public void clear(int eventId)
|
||||||
{
|
{
|
||||||
final Map<Integer, AtomicInteger> event = _eventIPs.get(eventId);
|
final Map<Integer, AtomicInteger> event = _eventIPs.get(eventId);
|
||||||
if (event != null)
|
if (event != null)
|
||||||
@@ -246,7 +246,7 @@ public final class AntiFeedManager
|
|||||||
* @param max
|
* @param max
|
||||||
* @return maximum number of allowed connections (whitelist + 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);
|
return getLimit(player.getClient(), max);
|
||||||
}
|
}
|
||||||
@@ -256,7 +256,7 @@ public final class AntiFeedManager
|
|||||||
* @param max
|
* @param max
|
||||||
* @return maximum number of allowed connections (whitelist + 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)
|
if (client == null)
|
||||||
{
|
{
|
||||||
|
|||||||
-3
@@ -11116,9 +11116,6 @@ public final class L2PcInstance extends L2Playable
|
|||||||
L2Event.savePlayerEventStatus(this);
|
L2Event.savePlayerEventStatus(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Anti Feed
|
|
||||||
AntiFeedManager.getInstance().onDisconnect(getClient());
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
notifyFriends(L2FriendStatus.MODE_OFFLINE);
|
notifyFriends(L2FriendStatus.MODE_OFFLINE);
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ package com.l2jmobius.gameserver.network;
|
|||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import com.l2jmobius.commons.concurrent.ThreadPool;
|
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.actor.instance.L2PcInstance;
|
||||||
import com.l2jmobius.gameserver.model.events.EventDispatcher;
|
import com.l2jmobius.gameserver.model.events.EventDispatcher;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogout;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogout;
|
||||||
@@ -90,6 +91,9 @@ public final class Disconnection
|
|||||||
_client = getClient(client, activeChar);
|
_client = getClient(client, activeChar);
|
||||||
_activeChar = getActiveChar(client, activeChar);
|
_activeChar = getActiveChar(client, activeChar);
|
||||||
|
|
||||||
|
// Anti Feed
|
||||||
|
AntiFeedManager.getInstance().onDisconnect(_client);
|
||||||
|
|
||||||
if (_client != null)
|
if (_client != null)
|
||||||
{
|
{
|
||||||
_client.setActiveChar(null);
|
_client.setActiveChar(null);
|
||||||
|
|||||||
+12
-12
@@ -43,7 +43,7 @@ public final class AntiFeedManager
|
|||||||
* Set time of the last player's death to current
|
* Set time of the last player's death to current
|
||||||
* @param objectId Player's objectId
|
* @param objectId Player's objectId
|
||||||
*/
|
*/
|
||||||
public final void setLastDeathTime(int objectId)
|
public void setLastDeathTime(int objectId)
|
||||||
{
|
{
|
||||||
_lastDeathTimes.put(objectId, System.currentTimeMillis());
|
_lastDeathTimes.put(objectId, System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
@@ -54,7 +54,7 @@ public final class AntiFeedManager
|
|||||||
* @param target Target character
|
* @param target Target character
|
||||||
* @return True if kill is non-feeded.
|
* @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)
|
if (!Config.ANTIFEED_ENABLE)
|
||||||
{
|
{
|
||||||
@@ -111,7 +111,7 @@ public final class AntiFeedManager
|
|||||||
/**
|
/**
|
||||||
* Clears all timestamps
|
* Clears all timestamps
|
||||||
*/
|
*/
|
||||||
public final void clear()
|
public void clear()
|
||||||
{
|
{
|
||||||
_lastDeathTimes.clear();
|
_lastDeathTimes.clear();
|
||||||
}
|
}
|
||||||
@@ -120,7 +120,7 @@ public final class AntiFeedManager
|
|||||||
* Register new event for dualbox check. Should be called only once.
|
* Register new event for dualbox check. Should be called only once.
|
||||||
* @param eventId
|
* @param eventId
|
||||||
*/
|
*/
|
||||||
public final void registerEvent(int eventId)
|
public void registerEvent(int eventId)
|
||||||
{
|
{
|
||||||
_eventIPs.putIfAbsent(eventId, new ConcurrentHashMap<>());
|
_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>
|
* @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.
|
* 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);
|
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>
|
* @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.
|
* 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)
|
if (client == null)
|
||||||
{
|
{
|
||||||
@@ -175,7 +175,7 @@ public final class AntiFeedManager
|
|||||||
* @param player
|
* @param player
|
||||||
* @return true if success and false if any problem detected.
|
* @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());
|
return removeClient(eventId, player.getClient());
|
||||||
}
|
}
|
||||||
@@ -186,7 +186,7 @@ public final class AntiFeedManager
|
|||||||
* @param client
|
* @param client
|
||||||
* @return true if success and false if any problem detected.
|
* @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)
|
if (client == null)
|
||||||
{
|
{
|
||||||
@@ -215,7 +215,7 @@ public final class AntiFeedManager
|
|||||||
* Remove player connection IP address from all registered events lists.
|
* Remove player connection IP address from all registered events lists.
|
||||||
* @param client
|
* @param client
|
||||||
*/
|
*/
|
||||||
public final void onDisconnect(L2GameClient client)
|
public void onDisconnect(L2GameClient client)
|
||||||
{
|
{
|
||||||
if ((client == null) || (client.getConnectionAddress() == null))
|
if ((client == null) || (client.getConnectionAddress() == null))
|
||||||
{
|
{
|
||||||
@@ -232,7 +232,7 @@ public final class AntiFeedManager
|
|||||||
* Clear all entries for this eventId.
|
* Clear all entries for this eventId.
|
||||||
* @param eventId
|
* @param eventId
|
||||||
*/
|
*/
|
||||||
public final void clear(int eventId)
|
public void clear(int eventId)
|
||||||
{
|
{
|
||||||
final Map<Integer, AtomicInteger> event = _eventIPs.get(eventId);
|
final Map<Integer, AtomicInteger> event = _eventIPs.get(eventId);
|
||||||
if (event != null)
|
if (event != null)
|
||||||
@@ -246,7 +246,7 @@ public final class AntiFeedManager
|
|||||||
* @param max
|
* @param max
|
||||||
* @return maximum number of allowed connections (whitelist + 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);
|
return getLimit(player.getClient(), max);
|
||||||
}
|
}
|
||||||
@@ -256,7 +256,7 @@ public final class AntiFeedManager
|
|||||||
* @param max
|
* @param max
|
||||||
* @return maximum number of allowed connections (whitelist + 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)
|
if (client == null)
|
||||||
{
|
{
|
||||||
|
|||||||
-3
@@ -11123,9 +11123,6 @@ public final class L2PcInstance extends L2Playable
|
|||||||
L2Event.savePlayerEventStatus(this);
|
L2Event.savePlayerEventStatus(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Anti Feed
|
|
||||||
AntiFeedManager.getInstance().onDisconnect(getClient());
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
notifyFriends(L2FriendStatus.MODE_OFFLINE);
|
notifyFriends(L2FriendStatus.MODE_OFFLINE);
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ package com.l2jmobius.gameserver.network;
|
|||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import com.l2jmobius.commons.concurrent.ThreadPool;
|
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.actor.instance.L2PcInstance;
|
||||||
import com.l2jmobius.gameserver.model.events.EventDispatcher;
|
import com.l2jmobius.gameserver.model.events.EventDispatcher;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogout;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogout;
|
||||||
@@ -90,6 +91,9 @@ public final class Disconnection
|
|||||||
_client = getClient(client, activeChar);
|
_client = getClient(client, activeChar);
|
||||||
_activeChar = getActiveChar(client, activeChar);
|
_activeChar = getActiveChar(client, activeChar);
|
||||||
|
|
||||||
|
// Anti Feed
|
||||||
|
AntiFeedManager.getInstance().onDisconnect(_client);
|
||||||
|
|
||||||
if (_client != null)
|
if (_client != null)
|
||||||
{
|
{
|
||||||
_client.setActiveChar(null);
|
_client.setActiveChar(null);
|
||||||
|
|||||||
+12
-12
@@ -43,7 +43,7 @@ public final class AntiFeedManager
|
|||||||
* Set time of the last player's death to current
|
* Set time of the last player's death to current
|
||||||
* @param objectId Player's objectId
|
* @param objectId Player's objectId
|
||||||
*/
|
*/
|
||||||
public final void setLastDeathTime(int objectId)
|
public void setLastDeathTime(int objectId)
|
||||||
{
|
{
|
||||||
_lastDeathTimes.put(objectId, System.currentTimeMillis());
|
_lastDeathTimes.put(objectId, System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
@@ -54,7 +54,7 @@ public final class AntiFeedManager
|
|||||||
* @param target Target character
|
* @param target Target character
|
||||||
* @return True if kill is non-feeded.
|
* @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)
|
if (!Config.ANTIFEED_ENABLE)
|
||||||
{
|
{
|
||||||
@@ -111,7 +111,7 @@ public final class AntiFeedManager
|
|||||||
/**
|
/**
|
||||||
* Clears all timestamps
|
* Clears all timestamps
|
||||||
*/
|
*/
|
||||||
public final void clear()
|
public void clear()
|
||||||
{
|
{
|
||||||
_lastDeathTimes.clear();
|
_lastDeathTimes.clear();
|
||||||
}
|
}
|
||||||
@@ -120,7 +120,7 @@ public final class AntiFeedManager
|
|||||||
* Register new event for dualbox check. Should be called only once.
|
* Register new event for dualbox check. Should be called only once.
|
||||||
* @param eventId
|
* @param eventId
|
||||||
*/
|
*/
|
||||||
public final void registerEvent(int eventId)
|
public void registerEvent(int eventId)
|
||||||
{
|
{
|
||||||
_eventIPs.putIfAbsent(eventId, new ConcurrentHashMap<>());
|
_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>
|
* @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.
|
* 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);
|
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>
|
* @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.
|
* 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)
|
if (client == null)
|
||||||
{
|
{
|
||||||
@@ -175,7 +175,7 @@ public final class AntiFeedManager
|
|||||||
* @param player
|
* @param player
|
||||||
* @return true if success and false if any problem detected.
|
* @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());
|
return removeClient(eventId, player.getClient());
|
||||||
}
|
}
|
||||||
@@ -186,7 +186,7 @@ public final class AntiFeedManager
|
|||||||
* @param client
|
* @param client
|
||||||
* @return true if success and false if any problem detected.
|
* @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)
|
if (client == null)
|
||||||
{
|
{
|
||||||
@@ -215,7 +215,7 @@ public final class AntiFeedManager
|
|||||||
* Remove player connection IP address from all registered events lists.
|
* Remove player connection IP address from all registered events lists.
|
||||||
* @param client
|
* @param client
|
||||||
*/
|
*/
|
||||||
public final void onDisconnect(L2GameClient client)
|
public void onDisconnect(L2GameClient client)
|
||||||
{
|
{
|
||||||
if ((client == null) || (client.getConnectionAddress() == null))
|
if ((client == null) || (client.getConnectionAddress() == null))
|
||||||
{
|
{
|
||||||
@@ -232,7 +232,7 @@ public final class AntiFeedManager
|
|||||||
* Clear all entries for this eventId.
|
* Clear all entries for this eventId.
|
||||||
* @param eventId
|
* @param eventId
|
||||||
*/
|
*/
|
||||||
public final void clear(int eventId)
|
public void clear(int eventId)
|
||||||
{
|
{
|
||||||
final Map<Integer, AtomicInteger> event = _eventIPs.get(eventId);
|
final Map<Integer, AtomicInteger> event = _eventIPs.get(eventId);
|
||||||
if (event != null)
|
if (event != null)
|
||||||
@@ -246,7 +246,7 @@ public final class AntiFeedManager
|
|||||||
* @param max
|
* @param max
|
||||||
* @return maximum number of allowed connections (whitelist + 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);
|
return getLimit(player.getClient(), max);
|
||||||
}
|
}
|
||||||
@@ -256,7 +256,7 @@ public final class AntiFeedManager
|
|||||||
* @param max
|
* @param max
|
||||||
* @return maximum number of allowed connections (whitelist + 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)
|
if (client == null)
|
||||||
{
|
{
|
||||||
|
|||||||
-3
@@ -11133,9 +11133,6 @@ public final class L2PcInstance extends L2Playable
|
|||||||
L2Event.savePlayerEventStatus(this);
|
L2Event.savePlayerEventStatus(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Anti Feed
|
|
||||||
AntiFeedManager.getInstance().onDisconnect(getClient());
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
notifyFriends(L2FriendStatus.MODE_OFFLINE);
|
notifyFriends(L2FriendStatus.MODE_OFFLINE);
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ package com.l2jmobius.gameserver.network;
|
|||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import com.l2jmobius.commons.concurrent.ThreadPool;
|
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.actor.instance.L2PcInstance;
|
||||||
import com.l2jmobius.gameserver.model.events.EventDispatcher;
|
import com.l2jmobius.gameserver.model.events.EventDispatcher;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogout;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogout;
|
||||||
@@ -90,6 +91,9 @@ public final class Disconnection
|
|||||||
_client = getClient(client, activeChar);
|
_client = getClient(client, activeChar);
|
||||||
_activeChar = getActiveChar(client, activeChar);
|
_activeChar = getActiveChar(client, activeChar);
|
||||||
|
|
||||||
|
// Anti Feed
|
||||||
|
AntiFeedManager.getInstance().onDisconnect(_client);
|
||||||
|
|
||||||
if (_client != null)
|
if (_client != null)
|
||||||
{
|
{
|
||||||
_client.setActiveChar(null);
|
_client.setActiveChar(null);
|
||||||
|
|||||||
+12
-12
@@ -43,7 +43,7 @@ public final class AntiFeedManager
|
|||||||
* Set time of the last player's death to current
|
* Set time of the last player's death to current
|
||||||
* @param objectId Player's objectId
|
* @param objectId Player's objectId
|
||||||
*/
|
*/
|
||||||
public final void setLastDeathTime(int objectId)
|
public void setLastDeathTime(int objectId)
|
||||||
{
|
{
|
||||||
_lastDeathTimes.put(objectId, System.currentTimeMillis());
|
_lastDeathTimes.put(objectId, System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
@@ -54,7 +54,7 @@ public final class AntiFeedManager
|
|||||||
* @param target Target character
|
* @param target Target character
|
||||||
* @return True if kill is non-feeded.
|
* @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)
|
if (!Config.ANTIFEED_ENABLE)
|
||||||
{
|
{
|
||||||
@@ -111,7 +111,7 @@ public final class AntiFeedManager
|
|||||||
/**
|
/**
|
||||||
* Clears all timestamps
|
* Clears all timestamps
|
||||||
*/
|
*/
|
||||||
public final void clear()
|
public void clear()
|
||||||
{
|
{
|
||||||
_lastDeathTimes.clear();
|
_lastDeathTimes.clear();
|
||||||
}
|
}
|
||||||
@@ -120,7 +120,7 @@ public final class AntiFeedManager
|
|||||||
* Register new event for dualbox check. Should be called only once.
|
* Register new event for dualbox check. Should be called only once.
|
||||||
* @param eventId
|
* @param eventId
|
||||||
*/
|
*/
|
||||||
public final void registerEvent(int eventId)
|
public void registerEvent(int eventId)
|
||||||
{
|
{
|
||||||
_eventIPs.putIfAbsent(eventId, new ConcurrentHashMap<>());
|
_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>
|
* @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.
|
* 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);
|
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>
|
* @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.
|
* 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)
|
if (client == null)
|
||||||
{
|
{
|
||||||
@@ -175,7 +175,7 @@ public final class AntiFeedManager
|
|||||||
* @param player
|
* @param player
|
||||||
* @return true if success and false if any problem detected.
|
* @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());
|
return removeClient(eventId, player.getClient());
|
||||||
}
|
}
|
||||||
@@ -186,7 +186,7 @@ public final class AntiFeedManager
|
|||||||
* @param client
|
* @param client
|
||||||
* @return true if success and false if any problem detected.
|
* @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)
|
if (client == null)
|
||||||
{
|
{
|
||||||
@@ -215,7 +215,7 @@ public final class AntiFeedManager
|
|||||||
* Remove player connection IP address from all registered events lists.
|
* Remove player connection IP address from all registered events lists.
|
||||||
* @param client
|
* @param client
|
||||||
*/
|
*/
|
||||||
public final void onDisconnect(L2GameClient client)
|
public void onDisconnect(L2GameClient client)
|
||||||
{
|
{
|
||||||
if ((client == null) || (client.getConnectionAddress() == null))
|
if ((client == null) || (client.getConnectionAddress() == null))
|
||||||
{
|
{
|
||||||
@@ -232,7 +232,7 @@ public final class AntiFeedManager
|
|||||||
* Clear all entries for this eventId.
|
* Clear all entries for this eventId.
|
||||||
* @param eventId
|
* @param eventId
|
||||||
*/
|
*/
|
||||||
public final void clear(int eventId)
|
public void clear(int eventId)
|
||||||
{
|
{
|
||||||
final Map<Integer, AtomicInteger> event = _eventIPs.get(eventId);
|
final Map<Integer, AtomicInteger> event = _eventIPs.get(eventId);
|
||||||
if (event != null)
|
if (event != null)
|
||||||
@@ -246,7 +246,7 @@ public final class AntiFeedManager
|
|||||||
* @param max
|
* @param max
|
||||||
* @return maximum number of allowed connections (whitelist + 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);
|
return getLimit(player.getClient(), max);
|
||||||
}
|
}
|
||||||
@@ -256,7 +256,7 @@ public final class AntiFeedManager
|
|||||||
* @param max
|
* @param max
|
||||||
* @return maximum number of allowed connections (whitelist + 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)
|
if (client == null)
|
||||||
{
|
{
|
||||||
|
|||||||
-3
@@ -11116,9 +11116,6 @@ public final class L2PcInstance extends L2Playable
|
|||||||
L2Event.savePlayerEventStatus(this);
|
L2Event.savePlayerEventStatus(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Anti Feed
|
|
||||||
AntiFeedManager.getInstance().onDisconnect(getClient());
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
notifyFriends(L2FriendStatus.MODE_OFFLINE);
|
notifyFriends(L2FriendStatus.MODE_OFFLINE);
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ package com.l2jmobius.gameserver.network;
|
|||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import com.l2jmobius.commons.concurrent.ThreadPool;
|
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.actor.instance.L2PcInstance;
|
||||||
import com.l2jmobius.gameserver.model.events.EventDispatcher;
|
import com.l2jmobius.gameserver.model.events.EventDispatcher;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogout;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogout;
|
||||||
@@ -90,6 +91,9 @@ public final class Disconnection
|
|||||||
_client = getClient(client, activeChar);
|
_client = getClient(client, activeChar);
|
||||||
_activeChar = getActiveChar(client, activeChar);
|
_activeChar = getActiveChar(client, activeChar);
|
||||||
|
|
||||||
|
// Anti Feed
|
||||||
|
AntiFeedManager.getInstance().onDisconnect(_client);
|
||||||
|
|
||||||
if (_client != null)
|
if (_client != null)
|
||||||
{
|
{
|
||||||
_client.setActiveChar(null);
|
_client.setActiveChar(null);
|
||||||
|
|||||||
+13
-13
@@ -43,7 +43,7 @@ public final class AntiFeedManager
|
|||||||
* Set time of the last player's death to current
|
* Set time of the last player's death to current
|
||||||
* @param objectId Player's objectId
|
* @param objectId Player's objectId
|
||||||
*/
|
*/
|
||||||
public final void setLastDeathTime(int objectId)
|
public void setLastDeathTime(int objectId)
|
||||||
{
|
{
|
||||||
_lastDeathTimes.put(objectId, System.currentTimeMillis());
|
_lastDeathTimes.put(objectId, System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
@@ -54,7 +54,7 @@ public final class AntiFeedManager
|
|||||||
* @param target Target character
|
* @param target Target character
|
||||||
* @return True if kill is non-feeded.
|
* @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)
|
if (!Config.ANTIFEED_ENABLE)
|
||||||
{
|
{
|
||||||
@@ -111,7 +111,7 @@ public final class AntiFeedManager
|
|||||||
/**
|
/**
|
||||||
* Clears all timestamps
|
* Clears all timestamps
|
||||||
*/
|
*/
|
||||||
public final void clear()
|
public void clear()
|
||||||
{
|
{
|
||||||
_lastDeathTimes.clear();
|
_lastDeathTimes.clear();
|
||||||
}
|
}
|
||||||
@@ -120,9 +120,9 @@ public final class AntiFeedManager
|
|||||||
* Register new event for dualbox check. Should be called only once.
|
* Register new event for dualbox check. Should be called only once.
|
||||||
* @param eventId
|
* @param eventId
|
||||||
*/
|
*/
|
||||||
public final void registerEvent(int eventId)
|
public void registerEvent(int eventId)
|
||||||
{
|
{
|
||||||
_eventIPs.putIfAbsent(eventId, new ConcurrentHashMap<Integer, AtomicInteger>());
|
_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>
|
* @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.
|
* 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);
|
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>
|
* @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.
|
* 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)
|
if (client == null)
|
||||||
{
|
{
|
||||||
@@ -175,7 +175,7 @@ public final class AntiFeedManager
|
|||||||
* @param player
|
* @param player
|
||||||
* @return true if success and false if any problem detected.
|
* @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());
|
return removeClient(eventId, player.getClient());
|
||||||
}
|
}
|
||||||
@@ -186,7 +186,7 @@ public final class AntiFeedManager
|
|||||||
* @param client
|
* @param client
|
||||||
* @return true if success and false if any problem detected.
|
* @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)
|
if (client == null)
|
||||||
{
|
{
|
||||||
@@ -215,7 +215,7 @@ public final class AntiFeedManager
|
|||||||
* Remove player connection IP address from all registered events lists.
|
* Remove player connection IP address from all registered events lists.
|
||||||
* @param client
|
* @param client
|
||||||
*/
|
*/
|
||||||
public final void onDisconnect(L2GameClient client)
|
public void onDisconnect(L2GameClient client)
|
||||||
{
|
{
|
||||||
if ((client == null) || (client.getConnectionAddress() == null))
|
if ((client == null) || (client.getConnectionAddress() == null))
|
||||||
{
|
{
|
||||||
@@ -232,7 +232,7 @@ public final class AntiFeedManager
|
|||||||
* Clear all entries for this eventId.
|
* Clear all entries for this eventId.
|
||||||
* @param eventId
|
* @param eventId
|
||||||
*/
|
*/
|
||||||
public final void clear(int eventId)
|
public void clear(int eventId)
|
||||||
{
|
{
|
||||||
final Map<Integer, AtomicInteger> event = _eventIPs.get(eventId);
|
final Map<Integer, AtomicInteger> event = _eventIPs.get(eventId);
|
||||||
if (event != null)
|
if (event != null)
|
||||||
@@ -246,7 +246,7 @@ public final class AntiFeedManager
|
|||||||
* @param max
|
* @param max
|
||||||
* @return maximum number of allowed connections (whitelist + 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);
|
return getLimit(player.getClient(), max);
|
||||||
}
|
}
|
||||||
@@ -256,7 +256,7 @@ public final class AntiFeedManager
|
|||||||
* @param max
|
* @param max
|
||||||
* @return maximum number of allowed connections (whitelist + 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)
|
if (client == null)
|
||||||
{
|
{
|
||||||
|
|||||||
+29
-3
@@ -8213,8 +8213,14 @@ public final class L2PcInstance extends L2Playable
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((getActiveEnchantItemId() != L2PcInstance.ID_NONE) || (getActiveEnchantAttrItemId() != L2PcInstance.ID_NONE))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (AttackStanceTaskManager.getInstance().hasAttackStanceTask(this) && !(isGM() && Config.GM_RESTART_FIGHTING))
|
if (AttackStanceTaskManager.getInstance().hasAttackStanceTask(this) && !(isGM() && Config.GM_RESTART_FIGHTING))
|
||||||
{
|
{
|
||||||
|
sendPacket(SystemMessageId.YOU_CANNOT_EXIT_THE_GAME_WHILE_IN_COMBAT);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -8223,6 +8229,29 @@ public final class L2PcInstance extends L2Playable
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (L2Event.isParticipant(this))
|
||||||
|
{
|
||||||
|
sendMessage("A superior power doesn't allow you to leave the event.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Prevent player from logging out if they are a festival participant
|
||||||
|
// and it is in progress, otherwise notify party members that the player
|
||||||
|
// is not longer a participant.
|
||||||
|
if (isFestivalParticipant())
|
||||||
|
{
|
||||||
|
if (SevenSignsFestival.getInstance().isFestivalInitialized())
|
||||||
|
{
|
||||||
|
sendMessage("You cannot log out while you are a participant in a Festival.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isInParty())
|
||||||
|
{
|
||||||
|
getParty().broadcastPacket(SystemMessage.sendString(getName() + " has been removed from the upcoming Festival."));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -11519,9 +11548,6 @@ public final class L2PcInstance extends L2Playable
|
|||||||
L2Event.savePlayerEventStatus(this);
|
L2Event.savePlayerEventStatus(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Anti Feed
|
|
||||||
AntiFeedManager.getInstance().onDisconnect(getClient());
|
|
||||||
|
|
||||||
// Remove L2Object object from _allObjects of L2World
|
// Remove L2Object object from _allObjects of L2World
|
||||||
L2World.getInstance().removeObject(this);
|
L2World.getInstance().removeObject(this);
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ package com.l2jmobius.gameserver.network;
|
|||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import com.l2jmobius.commons.concurrent.ThreadPool;
|
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.actor.instance.L2PcInstance;
|
||||||
import com.l2jmobius.gameserver.model.events.EventDispatcher;
|
import com.l2jmobius.gameserver.model.events.EventDispatcher;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogout;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogout;
|
||||||
@@ -90,6 +91,9 @@ public final class Disconnection
|
|||||||
_client = getClient(client, activeChar);
|
_client = getClient(client, activeChar);
|
||||||
_activeChar = getActiveChar(client, activeChar);
|
_activeChar = getActiveChar(client, activeChar);
|
||||||
|
|
||||||
|
// Anti Feed
|
||||||
|
AntiFeedManager.getInstance().onDisconnect(_client);
|
||||||
|
|
||||||
if (_client != null)
|
if (_client != null)
|
||||||
{
|
{
|
||||||
_client.setActiveChar(null);
|
_client.setActiveChar(null);
|
||||||
|
|||||||
+1
-52
@@ -20,17 +20,11 @@ import java.util.logging.Level;
|
|||||||
import java.util.logging.LogRecord;
|
import java.util.logging.LogRecord;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import com.l2jmobius.Config;
|
|
||||||
import com.l2jmobius.commons.network.PacketReader;
|
import com.l2jmobius.commons.network.PacketReader;
|
||||||
import com.l2jmobius.gameserver.SevenSignsFestival;
|
|
||||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||||
import com.l2jmobius.gameserver.model.entity.L2Event;
|
|
||||||
import com.l2jmobius.gameserver.network.Disconnection;
|
import com.l2jmobius.gameserver.network.Disconnection;
|
||||||
import com.l2jmobius.gameserver.network.L2GameClient;
|
import com.l2jmobius.gameserver.network.L2GameClient;
|
||||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
|
||||||
import com.l2jmobius.gameserver.network.serverpackets.ActionFailed;
|
import com.l2jmobius.gameserver.network.serverpackets.ActionFailed;
|
||||||
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
|
||||||
import com.l2jmobius.gameserver.taskmanager.AttackStanceTaskManager;
|
|
||||||
import com.l2jmobius.gameserver.util.OfflineTradeUtil;
|
import com.l2jmobius.gameserver.util.OfflineTradeUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -57,57 +51,12 @@ public final class Logout implements IClientIncomingPacket
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((player.getActiveEnchantItemId() != L2PcInstance.ID_NONE) || (player.getActiveEnchantAttrItemId() != L2PcInstance.ID_NONE))
|
if (!player.canLogout())
|
||||||
{
|
{
|
||||||
player.sendPacket(ActionFailed.STATIC_PACKET);
|
player.sendPacket(ActionFailed.STATIC_PACKET);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player.isLocked())
|
|
||||||
{
|
|
||||||
LOGGER.warning("Player " + player.getName() + " tried to logout during class change.");
|
|
||||||
player.sendPacket(ActionFailed.STATIC_PACKET);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Don't allow leaving if player is fighting
|
|
||||||
if (AttackStanceTaskManager.getInstance().hasAttackStanceTask(player))
|
|
||||||
{
|
|
||||||
if (player.isGM() && Config.GM_RESTART_FIGHTING)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
player.sendPacket(SystemMessageId.YOU_CANNOT_EXIT_THE_GAME_WHILE_IN_COMBAT);
|
|
||||||
player.sendPacket(ActionFailed.STATIC_PACKET);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (L2Event.isParticipant(player))
|
|
||||||
{
|
|
||||||
player.sendMessage("A superior power doesn't allow you to leave the event.");
|
|
||||||
player.sendPacket(ActionFailed.STATIC_PACKET);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Prevent player from logging out if they are a festival participant
|
|
||||||
// and it is in progress, otherwise notify party members that the player
|
|
||||||
// is not longer a participant.
|
|
||||||
if (player.isFestivalParticipant())
|
|
||||||
{
|
|
||||||
if (SevenSignsFestival.getInstance().isFestivalInitialized())
|
|
||||||
{
|
|
||||||
player.sendMessage("You cannot log out while you are a participant in a Festival.");
|
|
||||||
player.sendPacket(ActionFailed.STATIC_PACKET);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (player.isInParty())
|
|
||||||
{
|
|
||||||
player.getParty().broadcastPacket(SystemMessage.sendString(player.getName() + " has been removed from the upcoming Festival."));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove player from Boss Zone
|
// Remove player from Boss Zone
|
||||||
player.removeFromBossZone();
|
player.removeFromBossZone();
|
||||||
|
|
||||||
|
|||||||
+12
-12
@@ -43,7 +43,7 @@ public final class AntiFeedManager
|
|||||||
* Set time of the last player's death to current
|
* Set time of the last player's death to current
|
||||||
* @param objectId Player's objectId
|
* @param objectId Player's objectId
|
||||||
*/
|
*/
|
||||||
public final void setLastDeathTime(int objectId)
|
public void setLastDeathTime(int objectId)
|
||||||
{
|
{
|
||||||
_lastDeathTimes.put(objectId, System.currentTimeMillis());
|
_lastDeathTimes.put(objectId, System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
@@ -54,7 +54,7 @@ public final class AntiFeedManager
|
|||||||
* @param target Target character
|
* @param target Target character
|
||||||
* @return True if kill is non-feeded.
|
* @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)
|
if (!Config.ANTIFEED_ENABLE)
|
||||||
{
|
{
|
||||||
@@ -111,7 +111,7 @@ public final class AntiFeedManager
|
|||||||
/**
|
/**
|
||||||
* Clears all timestamps
|
* Clears all timestamps
|
||||||
*/
|
*/
|
||||||
public final void clear()
|
public void clear()
|
||||||
{
|
{
|
||||||
_lastDeathTimes.clear();
|
_lastDeathTimes.clear();
|
||||||
}
|
}
|
||||||
@@ -120,7 +120,7 @@ public final class AntiFeedManager
|
|||||||
* Register new event for dualbox check. Should be called only once.
|
* Register new event for dualbox check. Should be called only once.
|
||||||
* @param eventId
|
* @param eventId
|
||||||
*/
|
*/
|
||||||
public final void registerEvent(int eventId)
|
public void registerEvent(int eventId)
|
||||||
{
|
{
|
||||||
_eventIPs.putIfAbsent(eventId, new ConcurrentHashMap<>());
|
_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>
|
* @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.
|
* 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);
|
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>
|
* @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.
|
* 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)
|
if (client == null)
|
||||||
{
|
{
|
||||||
@@ -175,7 +175,7 @@ public final class AntiFeedManager
|
|||||||
* @param player
|
* @param player
|
||||||
* @return true if success and false if any problem detected.
|
* @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());
|
return removeClient(eventId, player.getClient());
|
||||||
}
|
}
|
||||||
@@ -186,7 +186,7 @@ public final class AntiFeedManager
|
|||||||
* @param client
|
* @param client
|
||||||
* @return true if success and false if any problem detected.
|
* @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)
|
if (client == null)
|
||||||
{
|
{
|
||||||
@@ -215,7 +215,7 @@ public final class AntiFeedManager
|
|||||||
* Remove player connection IP address from all registered events lists.
|
* Remove player connection IP address from all registered events lists.
|
||||||
* @param client
|
* @param client
|
||||||
*/
|
*/
|
||||||
public final void onDisconnect(L2GameClient client)
|
public void onDisconnect(L2GameClient client)
|
||||||
{
|
{
|
||||||
if ((client == null) || (client.getConnectionAddress() == null))
|
if ((client == null) || (client.getConnectionAddress() == null))
|
||||||
{
|
{
|
||||||
@@ -232,7 +232,7 @@ public final class AntiFeedManager
|
|||||||
* Clear all entries for this eventId.
|
* Clear all entries for this eventId.
|
||||||
* @param eventId
|
* @param eventId
|
||||||
*/
|
*/
|
||||||
public final void clear(int eventId)
|
public void clear(int eventId)
|
||||||
{
|
{
|
||||||
final Map<Integer, AtomicInteger> event = _eventIPs.get(eventId);
|
final Map<Integer, AtomicInteger> event = _eventIPs.get(eventId);
|
||||||
if (event != null)
|
if (event != null)
|
||||||
@@ -246,7 +246,7 @@ public final class AntiFeedManager
|
|||||||
* @param max
|
* @param max
|
||||||
* @return maximum number of allowed connections (whitelist + 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);
|
return getLimit(player.getClient(), max);
|
||||||
}
|
}
|
||||||
@@ -256,7 +256,7 @@ public final class AntiFeedManager
|
|||||||
* @param max
|
* @param max
|
||||||
* @return maximum number of allowed connections (whitelist + 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)
|
if (client == null)
|
||||||
{
|
{
|
||||||
|
|||||||
-3
@@ -11057,9 +11057,6 @@ public final class L2PcInstance extends L2Playable
|
|||||||
L2Event.savePlayerEventStatus(this);
|
L2Event.savePlayerEventStatus(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Anti Feed
|
|
||||||
AntiFeedManager.getInstance().onDisconnect(getClient());
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
notifyFriends(L2FriendStatus.MODE_OFFLINE);
|
notifyFriends(L2FriendStatus.MODE_OFFLINE);
|
||||||
|
|||||||
+4
@@ -19,6 +19,7 @@ package com.l2jmobius.gameserver.network;
|
|||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import com.l2jmobius.commons.concurrent.ThreadPool;
|
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.actor.instance.L2PcInstance;
|
||||||
import com.l2jmobius.gameserver.model.events.EventDispatcher;
|
import com.l2jmobius.gameserver.model.events.EventDispatcher;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogout;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogout;
|
||||||
@@ -90,6 +91,9 @@ public final class Disconnection
|
|||||||
_client = getClient(client, activeChar);
|
_client = getClient(client, activeChar);
|
||||||
_activeChar = getActiveChar(client, activeChar);
|
_activeChar = getActiveChar(client, activeChar);
|
||||||
|
|
||||||
|
// Anti Feed
|
||||||
|
AntiFeedManager.getInstance().onDisconnect(_client);
|
||||||
|
|
||||||
if (_client != null)
|
if (_client != null)
|
||||||
{
|
{
|
||||||
_client.setActiveChar(null);
|
_client.setActiveChar(null);
|
||||||
|
|||||||
+12
-12
@@ -43,7 +43,7 @@ public final class AntiFeedManager
|
|||||||
* Set time of the last player's death to current
|
* Set time of the last player's death to current
|
||||||
* @param objectId Player's objectId
|
* @param objectId Player's objectId
|
||||||
*/
|
*/
|
||||||
public final void setLastDeathTime(int objectId)
|
public void setLastDeathTime(int objectId)
|
||||||
{
|
{
|
||||||
_lastDeathTimes.put(objectId, System.currentTimeMillis());
|
_lastDeathTimes.put(objectId, System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
@@ -54,7 +54,7 @@ public final class AntiFeedManager
|
|||||||
* @param target Target character
|
* @param target Target character
|
||||||
* @return True if kill is non-feeded.
|
* @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)
|
if (!Config.ANTIFEED_ENABLE)
|
||||||
{
|
{
|
||||||
@@ -111,7 +111,7 @@ public final class AntiFeedManager
|
|||||||
/**
|
/**
|
||||||
* Clears all timestamps
|
* Clears all timestamps
|
||||||
*/
|
*/
|
||||||
public final void clear()
|
public void clear()
|
||||||
{
|
{
|
||||||
_lastDeathTimes.clear();
|
_lastDeathTimes.clear();
|
||||||
}
|
}
|
||||||
@@ -120,7 +120,7 @@ public final class AntiFeedManager
|
|||||||
* Register new event for dualbox check. Should be called only once.
|
* Register new event for dualbox check. Should be called only once.
|
||||||
* @param eventId
|
* @param eventId
|
||||||
*/
|
*/
|
||||||
public final void registerEvent(int eventId)
|
public void registerEvent(int eventId)
|
||||||
{
|
{
|
||||||
_eventIPs.putIfAbsent(eventId, new ConcurrentHashMap<>());
|
_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>
|
* @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.
|
* 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);
|
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>
|
* @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.
|
* 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)
|
if (client == null)
|
||||||
{
|
{
|
||||||
@@ -175,7 +175,7 @@ public final class AntiFeedManager
|
|||||||
* @param player
|
* @param player
|
||||||
* @return true if success and false if any problem detected.
|
* @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());
|
return removeClient(eventId, player.getClient());
|
||||||
}
|
}
|
||||||
@@ -186,7 +186,7 @@ public final class AntiFeedManager
|
|||||||
* @param client
|
* @param client
|
||||||
* @return true if success and false if any problem detected.
|
* @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)
|
if (client == null)
|
||||||
{
|
{
|
||||||
@@ -215,7 +215,7 @@ public final class AntiFeedManager
|
|||||||
* Remove player connection IP address from all registered events lists.
|
* Remove player connection IP address from all registered events lists.
|
||||||
* @param client
|
* @param client
|
||||||
*/
|
*/
|
||||||
public final void onDisconnect(L2GameClient client)
|
public void onDisconnect(L2GameClient client)
|
||||||
{
|
{
|
||||||
if ((client == null) || (client.getConnectionAddress() == null))
|
if ((client == null) || (client.getConnectionAddress() == null))
|
||||||
{
|
{
|
||||||
@@ -232,7 +232,7 @@ public final class AntiFeedManager
|
|||||||
* Clear all entries for this eventId.
|
* Clear all entries for this eventId.
|
||||||
* @param eventId
|
* @param eventId
|
||||||
*/
|
*/
|
||||||
public final void clear(int eventId)
|
public void clear(int eventId)
|
||||||
{
|
{
|
||||||
final Map<Integer, AtomicInteger> event = _eventIPs.get(eventId);
|
final Map<Integer, AtomicInteger> event = _eventIPs.get(eventId);
|
||||||
if (event != null)
|
if (event != null)
|
||||||
@@ -246,7 +246,7 @@ public final class AntiFeedManager
|
|||||||
* @param max
|
* @param max
|
||||||
* @return maximum number of allowed connections (whitelist + 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);
|
return getLimit(player.getClient(), max);
|
||||||
}
|
}
|
||||||
@@ -256,7 +256,7 @@ public final class AntiFeedManager
|
|||||||
* @param max
|
* @param max
|
||||||
* @return maximum number of allowed connections (whitelist + 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)
|
if (client == null)
|
||||||
{
|
{
|
||||||
|
|||||||
-3
@@ -11057,9 +11057,6 @@ public final class L2PcInstance extends L2Playable
|
|||||||
L2Event.savePlayerEventStatus(this);
|
L2Event.savePlayerEventStatus(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Anti Feed
|
|
||||||
AntiFeedManager.getInstance().onDisconnect(getClient());
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
notifyFriends(L2FriendStatus.MODE_OFFLINE);
|
notifyFriends(L2FriendStatus.MODE_OFFLINE);
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ package com.l2jmobius.gameserver.network;
|
|||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import com.l2jmobius.commons.concurrent.ThreadPool;
|
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.actor.instance.L2PcInstance;
|
||||||
import com.l2jmobius.gameserver.model.events.EventDispatcher;
|
import com.l2jmobius.gameserver.model.events.EventDispatcher;
|
||||||
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogout;
|
import com.l2jmobius.gameserver.model.events.impl.character.player.OnPlayerLogout;
|
||||||
@@ -90,6 +91,9 @@ public final class Disconnection
|
|||||||
_client = getClient(client, activeChar);
|
_client = getClient(client, activeChar);
|
||||||
_activeChar = getActiveChar(client, activeChar);
|
_activeChar = getActiveChar(client, activeChar);
|
||||||
|
|
||||||
|
// Anti Feed
|
||||||
|
AntiFeedManager.getInstance().onDisconnect(_client);
|
||||||
|
|
||||||
if (_client != null)
|
if (_client != null)
|
||||||
{
|
{
|
||||||
_client.setActiveChar(null);
|
_client.setActiveChar(null);
|
||||||
|
|||||||
Reference in New Issue
Block a user