AntiFeedManager related improvements.
This commit is contained in:
@@ -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<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>
|
||||
* False if number of all simultaneous connections from player's IP address higher than max.
|
||||
*/
|
||||
public final boolean tryAddPlayer(int eventId, L2PcInstance player, int max)
|
||||
public boolean tryAddPlayer(int eventId, L2PcInstance player, int max)
|
||||
{
|
||||
return tryAddClient(eventId, player.getClient(), max);
|
||||
}
|
||||
@@ -144,7 +144,7 @@ public final class AntiFeedManager
|
||||
* @return If number of all simultaneous connections from player's IP address lower than max then increment connection count and return true.<br>
|
||||
* False if number of all simultaneous connections from player's IP address higher than max.
|
||||
*/
|
||||
public final boolean tryAddClient(int eventId, L2GameClient client, int max)
|
||||
public boolean tryAddClient(int eventId, L2GameClient client, int max)
|
||||
{
|
||||
if (client == null)
|
||||
{
|
||||
@@ -175,7 +175,7 @@ public final class AntiFeedManager
|
||||
* @param player
|
||||
* @return true if success and false if any problem detected.
|
||||
*/
|
||||
public final boolean removePlayer(int eventId, L2PcInstance player)
|
||||
public boolean removePlayer(int eventId, L2PcInstance player)
|
||||
{
|
||||
return removeClient(eventId, player.getClient());
|
||||
}
|
||||
@@ -186,7 +186,7 @@ public final class AntiFeedManager
|
||||
* @param client
|
||||
* @return true if success and false if any problem detected.
|
||||
*/
|
||||
public final boolean removeClient(int eventId, L2GameClient client)
|
||||
public boolean removeClient(int eventId, L2GameClient client)
|
||||
{
|
||||
if (client == null)
|
||||
{
|
||||
@@ -215,7 +215,7 @@ public final class AntiFeedManager
|
||||
* Remove player connection IP address from all registered events lists.
|
||||
* @param client
|
||||
*/
|
||||
public final void onDisconnect(L2GameClient client)
|
||||
public void onDisconnect(L2GameClient client)
|
||||
{
|
||||
if ((client == null) || (client.getConnectionAddress() == null))
|
||||
{
|
||||
@@ -232,7 +232,7 @@ public final class AntiFeedManager
|
||||
* Clear all entries for this eventId.
|
||||
* @param eventId
|
||||
*/
|
||||
public final void clear(int eventId)
|
||||
public void clear(int eventId)
|
||||
{
|
||||
final Map<Integer, AtomicInteger> event = _eventIPs.get(eventId);
|
||||
if (event != null)
|
||||
@@ -246,7 +246,7 @@ public final class AntiFeedManager
|
||||
* @param max
|
||||
* @return maximum number of allowed connections (whitelist + max)
|
||||
*/
|
||||
public final int getLimit(L2PcInstance player, int max)
|
||||
public int getLimit(L2PcInstance player, int max)
|
||||
{
|
||||
return getLimit(player.getClient(), max);
|
||||
}
|
||||
@@ -256,7 +256,7 @@ public final class AntiFeedManager
|
||||
* @param max
|
||||
* @return maximum number of allowed connections (whitelist + max)
|
||||
*/
|
||||
public final int getLimit(L2GameClient client, int max)
|
||||
public int getLimit(L2GameClient client, int max)
|
||||
{
|
||||
if (client == null)
|
||||
{
|
||||
|
@@ -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);
|
||||
|
||||
|
@@ -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);
|
||||
|
@@ -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();
|
||||
|
||||
|
Reference in New Issue
Block a user