From 64177f7413f817b64c4e86323aff2e0f30e5cb00 Mon Sep 17 00:00:00 2001 From: MobiusDev <8391001+MobiusDevelopment@users.noreply.github.com> Date: Tue, 17 Apr 2018 17:45:54 +0000 Subject: [PATCH] AntiFeedManager related improvements. --- .../instancemanager/AntiFeedManager.java | 24 ++++----- .../model/actor/instance/L2PcInstance.java | 3 -- .../gameserver/network/Disconnection.java | 4 ++ .../instancemanager/AntiFeedManager.java | 24 ++++----- .../model/actor/instance/L2PcInstance.java | 3 -- .../gameserver/network/Disconnection.java | 4 ++ .../instancemanager/AntiFeedManager.java | 24 ++++----- .../model/actor/instance/L2PcInstance.java | 3 -- .../gameserver/network/Disconnection.java | 4 ++ .../instancemanager/AntiFeedManager.java | 24 ++++----- .../model/actor/instance/L2PcInstance.java | 3 -- .../gameserver/network/Disconnection.java | 4 ++ .../instancemanager/AntiFeedManager.java | 26 ++++----- .../model/actor/instance/L2PcInstance.java | 32 +++++++++-- .../gameserver/network/Disconnection.java | 4 ++ .../network/clientpackets/Logout.java | 53 +------------------ .../instancemanager/AntiFeedManager.java | 24 ++++----- .../model/actor/instance/L2PcInstance.java | 3 -- .../gameserver/network/Disconnection.java | 4 ++ .../instancemanager/AntiFeedManager.java | 24 ++++----- .../model/actor/instance/L2PcInstance.java | 3 -- .../gameserver/network/Disconnection.java | 4 ++ 22 files changed, 143 insertions(+), 158 deletions(-) diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/AntiFeedManager.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/AntiFeedManager.java index 87c082bbab..d06ae64012 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/AntiFeedManager.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/AntiFeedManager.java @@ -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.
* 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.
* 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 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) { diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java index 3b3b94d540..b43dcfd124 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java @@ -11116,9 +11116,6 @@ public final class L2PcInstance extends L2Playable L2Event.savePlayerEventStatus(this); } - // Anti Feed - AntiFeedManager.getInstance().onDisconnect(getClient()); - try { notifyFriends(L2FriendStatus.MODE_OFFLINE); diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/Disconnection.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/Disconnection.java index dd0aefae85..f11b3da8bf 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/Disconnection.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/Disconnection.java @@ -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); diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/AntiFeedManager.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/AntiFeedManager.java index 87c082bbab..d06ae64012 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/AntiFeedManager.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/AntiFeedManager.java @@ -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.
* 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.
* 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 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) { diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java index bf7e988d0a..e3768d739c 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java @@ -11123,9 +11123,6 @@ public final class L2PcInstance extends L2Playable L2Event.savePlayerEventStatus(this); } - // Anti Feed - AntiFeedManager.getInstance().onDisconnect(getClient()); - try { notifyFriends(L2FriendStatus.MODE_OFFLINE); diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/Disconnection.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/Disconnection.java index dd0aefae85..f11b3da8bf 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/Disconnection.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/Disconnection.java @@ -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); diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/AntiFeedManager.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/AntiFeedManager.java index 87c082bbab..d06ae64012 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/AntiFeedManager.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/AntiFeedManager.java @@ -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.
* 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.
* 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 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) { diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java index f657faf777..0fda00eaf9 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java @@ -11133,9 +11133,6 @@ public final class L2PcInstance extends L2Playable L2Event.savePlayerEventStatus(this); } - // Anti Feed - AntiFeedManager.getInstance().onDisconnect(getClient()); - try { notifyFriends(L2FriendStatus.MODE_OFFLINE); diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/Disconnection.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/Disconnection.java index dd0aefae85..f11b3da8bf 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/Disconnection.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/Disconnection.java @@ -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); diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/AntiFeedManager.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/AntiFeedManager.java index 87c082bbab..d06ae64012 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/AntiFeedManager.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/AntiFeedManager.java @@ -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.
* 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.
* 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 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) { diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java index 1a41392925..993aeed7b3 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java @@ -11116,9 +11116,6 @@ public final class L2PcInstance extends L2Playable L2Event.savePlayerEventStatus(this); } - // Anti Feed - AntiFeedManager.getInstance().onDisconnect(getClient()); - try { notifyFriends(L2FriendStatus.MODE_OFFLINE); diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/Disconnection.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/Disconnection.java index 5fde2489f9..b2440b70ab 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/Disconnection.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/Disconnection.java @@ -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); diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/AntiFeedManager.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/AntiFeedManager.java index 837dd6d3fd..fae74c1462 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/AntiFeedManager.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/AntiFeedManager.java @@ -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,9 +120,9 @@ 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()); + _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.
* 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.
* 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 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) { diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java index 8b2c85dbf8..a237f0a9f3 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java @@ -8213,8 +8213,14 @@ public final class L2PcInstance extends L2Playable return false; } + if ((getActiveEnchantItemId() != L2PcInstance.ID_NONE) || (getActiveEnchantAttrItemId() != L2PcInstance.ID_NONE)) + { + return false; + } + if (AttackStanceTaskManager.getInstance().hasAttackStanceTask(this) && !(isGM() && Config.GM_RESTART_FIGHTING)) { + sendPacket(SystemMessageId.YOU_CANNOT_EXIT_THE_GAME_WHILE_IN_COMBAT); return false; } @@ -8223,6 +8229,29 @@ public final class L2PcInstance extends L2Playable 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; } @@ -11519,9 +11548,6 @@ public final class L2PcInstance extends L2Playable L2Event.savePlayerEventStatus(this); } - // Anti Feed - AntiFeedManager.getInstance().onDisconnect(getClient()); - // Remove L2Object object from _allObjects of L2World L2World.getInstance().removeObject(this); diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/Disconnection.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/Disconnection.java index dd0aefae85..f11b3da8bf 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/Disconnection.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/Disconnection.java @@ -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); diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/Logout.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/Logout.java index fca6dc2bda..05aecc5dca 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/Logout.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/Logout.java @@ -20,17 +20,11 @@ import java.util.logging.Level; import java.util.logging.LogRecord; import java.util.logging.Logger; -import com.l2jmobius.Config; import com.l2jmobius.commons.network.PacketReader; -import com.l2jmobius.gameserver.SevenSignsFestival; 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.L2GameClient; -import com.l2jmobius.gameserver.network.SystemMessageId; 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; /** @@ -57,57 +51,12 @@ public final class Logout implements IClientIncomingPacket return; } - if ((player.getActiveEnchantItemId() != L2PcInstance.ID_NONE) || (player.getActiveEnchantAttrItemId() != L2PcInstance.ID_NONE)) + if (!player.canLogout()) { player.sendPacket(ActionFailed.STATIC_PACKET); 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 player.removeFromBossZone(); diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/AntiFeedManager.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/AntiFeedManager.java index 87c082bbab..d06ae64012 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/AntiFeedManager.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/AntiFeedManager.java @@ -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.
* 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.
* 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 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) { diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java index 13b98a8c9d..7f6639fe3d 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java @@ -11057,9 +11057,6 @@ public final class L2PcInstance extends L2Playable L2Event.savePlayerEventStatus(this); } - // Anti Feed - AntiFeedManager.getInstance().onDisconnect(getClient()); - try { notifyFriends(L2FriendStatus.MODE_OFFLINE); diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/Disconnection.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/Disconnection.java index dd0aefae85..f11b3da8bf 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/Disconnection.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/Disconnection.java @@ -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); diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/instancemanager/AntiFeedManager.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/instancemanager/AntiFeedManager.java index 87c082bbab..d06ae64012 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/instancemanager/AntiFeedManager.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/instancemanager/AntiFeedManager.java @@ -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.
* 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.
* 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 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) { diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java index 7dc854ae85..d7ad931465 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java @@ -11057,9 +11057,6 @@ public final class L2PcInstance extends L2Playable L2Event.savePlayerEventStatus(this); } - // Anti Feed - AntiFeedManager.getInstance().onDisconnect(getClient()); - try { notifyFriends(L2FriendStatus.MODE_OFFLINE); diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/network/Disconnection.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/network/Disconnection.java index dd0aefae85..f11b3da8bf 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/network/Disconnection.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/network/Disconnection.java @@ -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);