Addition of OfflineDisconnectSameAccount configuration.

This commit is contained in:
MobiusDevelopment
2022-08-21 21:01:31 +00:00
parent 029982862e
commit 2a4a17b73f
112 changed files with 896 additions and 588 deletions

View File

@@ -1047,6 +1047,7 @@ public class Config
public static boolean RESTORE_OFFLINERS;
public static int OFFLINE_MAX_DAYS;
public static boolean OFFLINE_DISCONNECT_FINISHED;
public static boolean OFFLINE_DISCONNECT_SAME_ACCOUNT;
public static boolean OFFLINE_SET_NAME_COLOR;
public static int OFFLINE_NAME_COLOR;
public static boolean OFFLINE_FAME;
@@ -3187,6 +3188,7 @@ public class Config
RESTORE_OFFLINERS = offlineTradeConfig.getBoolean("RestoreOffliners", false);
OFFLINE_MAX_DAYS = offlineTradeConfig.getInt("OfflineMaxDays", 10);
OFFLINE_DISCONNECT_FINISHED = offlineTradeConfig.getBoolean("OfflineDisconnectFinished", true);
OFFLINE_DISCONNECT_SAME_ACCOUNT = offlineTradeConfig.getBoolean("OfflineDisconnectSameAccount", false);
STORE_OFFLINE_TRADE_IN_REALTIME = offlineTradeConfig.getBoolean("StoreOfflineTradeInRealtime", true);
// Load PasswordChange config file (if exists)

View File

@@ -102,6 +102,13 @@ public class CharacterSelect implements IClientIncomingPacket
return;
}
// Disconnect offline trader.
final Player player = World.getInstance().getPlayer(info.getObjectId());
if (player != null)
{
Disconnection.of(player).storeMe().deleteMe();
}
// Banned?
if (PunishmentManager.getInstance().hasPunishment(info.getObjectId(), PunishmentAffect.CHARACTER, PunishmentType.BAN) //
|| PunishmentManager.getInstance().hasPunishment(client.getAccountName(), PunishmentAffect.ACCOUNT, PunishmentType.BAN) //

View File

@@ -206,10 +206,15 @@ public class CharSelectionInfo implements IClientOutgoingPacket
if (charInfopackage != null)
{
characterList.add(charInfopackage);
final Player player = World.getInstance().getPlayer(charInfopackage.getObjectId());
if (player != null)
// Disconnect offline trader.
if (Config.OFFLINE_DISCONNECT_SAME_ACCOUNT)
{
Disconnection.of(player).storeMe().deleteMe();
final Player player = World.getInstance().getPlayer(charInfopackage.getObjectId());
if (player != null)
{
Disconnection.of(player).storeMe().deleteMe();
}
}
}
}