Disconnect player after being dead for 1 hour.
Contributed by nasseka.
This commit is contained in:
@@ -306,6 +306,7 @@ public class Config
|
||||
public static int MAX_FREE_TELEPORT_LEVEL;
|
||||
public static int MAX_NEWBIE_BUFF_LEVEL;
|
||||
public static int DELETE_DAYS;
|
||||
public static boolean DISCONNECT_AFTER_DEATH;
|
||||
public static String PARTY_XP_CUTOFF_METHOD;
|
||||
public static double PARTY_XP_CUTOFF_PERCENT;
|
||||
public static int PARTY_XP_CUTOFF_LEVEL;
|
||||
@@ -1856,6 +1857,7 @@ public class Config
|
||||
MAX_FREE_TELEPORT_LEVEL = characterConfig.getInt("MaxFreeTeleportLevel", 99);
|
||||
MAX_NEWBIE_BUFF_LEVEL = characterConfig.getInt("MaxNewbieBuffLevel", 0);
|
||||
DELETE_DAYS = characterConfig.getInt("DeleteCharAfterDays", 1);
|
||||
DISCONNECT_AFTER_DEATH = characterConfig.getBoolean("DisconnectAfterDeath", true);
|
||||
PARTY_XP_CUTOFF_METHOD = characterConfig.getString("PartyXpCutoffMethod", "level").toLowerCase();
|
||||
PARTY_XP_CUTOFF_PERCENT = characterConfig.getDouble("PartyXpCutoffPercent", 3);
|
||||
PARTY_XP_CUTOFF_LEVEL = characterConfig.getInt("PartyXpCutoffLevel", 20);
|
||||
|
@@ -50,6 +50,7 @@ import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import org.l2jmobius.gameserver.cache.RelationCache;
|
||||
import org.l2jmobius.gameserver.data.xml.CategoryData;
|
||||
import org.l2jmobius.gameserver.data.xml.NpcData;
|
||||
import org.l2jmobius.gameserver.data.xml.SendMessageLocalisationData;
|
||||
import org.l2jmobius.gameserver.data.xml.SkillData;
|
||||
import org.l2jmobius.gameserver.data.xml.TransformData;
|
||||
import org.l2jmobius.gameserver.enums.AttributeType;
|
||||
@@ -140,6 +141,7 @@ import org.l2jmobius.gameserver.model.stats.MoveType;
|
||||
import org.l2jmobius.gameserver.model.stats.Stat;
|
||||
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import org.l2jmobius.gameserver.model.zone.ZoneRegion;
|
||||
import org.l2jmobius.gameserver.network.Disconnection;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.ActionFailed;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.Attack;
|
||||
@@ -566,26 +568,33 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
||||
*/
|
||||
public void onDecay()
|
||||
{
|
||||
decayMe();
|
||||
final ZoneRegion region = ZoneManager.getInstance().getRegion(this);
|
||||
if (region != null)
|
||||
if (Config.DISCONNECT_AFTER_DEATH && isPlayer())
|
||||
{
|
||||
region.removeFromZones(this);
|
||||
Disconnection.of(getActingPlayer()).deleteMe().defaultSequence(new SystemMessage(SendMessageLocalisationData.getLocalisation(getActingPlayer(), "60 min. have passed after the death of your character, so you were disconnected from the game.")));
|
||||
}
|
||||
|
||||
// Removes itself from the summoned list.
|
||||
if ((_summoner != null))
|
||||
else
|
||||
{
|
||||
_summoner.removeSummonedNpc(getObjectId());
|
||||
decayMe();
|
||||
final ZoneRegion region = ZoneManager.getInstance().getRegion(this);
|
||||
if (region != null)
|
||||
{
|
||||
region.removeFromZones(this);
|
||||
}
|
||||
|
||||
// Removes itself from the summoned list.
|
||||
if ((_summoner != null))
|
||||
{
|
||||
_summoner.removeSummonedNpc(getObjectId());
|
||||
}
|
||||
|
||||
_onCreatureAttack = null;
|
||||
_onCreatureAttacked = null;
|
||||
_onCreatureDamageDealt = null;
|
||||
_onCreatureDamageReceived = null;
|
||||
_onCreatureAttackAvoid = null;
|
||||
onCreatureSkillFinishCast = null;
|
||||
onCreatureSkillUse = null;
|
||||
}
|
||||
|
||||
_onCreatureAttack = null;
|
||||
_onCreatureAttacked = null;
|
||||
_onCreatureDamageDealt = null;
|
||||
_onCreatureDamageReceived = null;
|
||||
_onCreatureAttackAvoid = null;
|
||||
onCreatureSkillFinishCast = null;
|
||||
onCreatureSkillUse = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -344,6 +344,7 @@ import org.l2jmobius.gameserver.network.serverpackets.ValidateLocation;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.commission.ExResponseCommissionInfo;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.friend.FriendStatus;
|
||||
import org.l2jmobius.gameserver.taskmanager.AttackStanceTaskManager;
|
||||
import org.l2jmobius.gameserver.taskmanager.DecayTaskManager;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
import org.l2jmobius.gameserver.taskmanager.ItemsAutoDestroyTaskManager;
|
||||
import org.l2jmobius.gameserver.taskmanager.PlayerAutoSaveTaskManager;
|
||||
@@ -5032,6 +5033,11 @@ public class Player extends Playable
|
||||
setReputation(newRep < -20 ? newRep : 0);
|
||||
}
|
||||
|
||||
if (Config.DISCONNECT_AFTER_DEATH)
|
||||
{
|
||||
DecayTaskManager.getInstance().add(this);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -10105,6 +10111,11 @@ public class Player extends Playable
|
||||
{
|
||||
super.doRevive();
|
||||
|
||||
if (Config.DISCONNECT_AFTER_DEATH)
|
||||
{
|
||||
DecayTaskManager.getInstance().cancel(this);
|
||||
}
|
||||
|
||||
sendPacket(new EtcStatusUpdate(this));
|
||||
_revivePet = false;
|
||||
_reviveRequested = 0;
|
||||
|
@@ -89,6 +89,11 @@ public class DecayTaskManager implements Runnable
|
||||
delay += Config.SPOILED_CORPSE_EXTEND_TIME;
|
||||
}
|
||||
|
||||
if (Config.DISCONNECT_AFTER_DEATH && creature.isPlayer())
|
||||
{
|
||||
delay = 3600; // 1 hour
|
||||
}
|
||||
|
||||
// Add to decay schedules.
|
||||
DECAY_SCHEDULES.put(creature, System.currentTimeMillis() + (delay * 1000));
|
||||
}
|
||||
|
Reference in New Issue
Block a user