Disconnect player after being dead for 1 hour.
Contributed by nasseka.
This commit is contained in:
@@ -301,6 +301,7 @@ public class Config
|
||||
public static int MAX_PETITIONS_PENDING;
|
||||
public static int MAX_FREE_TELEPORT_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;
|
||||
@@ -1937,6 +1938,7 @@ public class Config
|
||||
MAX_PETITIONS_PENDING = characterConfig.getInt("MaxPetitionsPending", 25);
|
||||
MAX_FREE_TELEPORT_LEVEL = characterConfig.getInt("MaxFreeTeleportLevel", 99);
|
||||
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);
|
||||
|
@@ -140,6 +140,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 +567,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(SystemMessageId.SIXTY_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
|
||||
|
@@ -368,6 +368,7 @@ import org.l2jmobius.gameserver.network.serverpackets.limitshop.ExBloodyCoinCoun
|
||||
import org.l2jmobius.gameserver.taskmanager.AttackStanceTaskManager;
|
||||
import org.l2jmobius.gameserver.taskmanager.AutoPlayTaskManager;
|
||||
import org.l2jmobius.gameserver.taskmanager.AutoUseTaskManager;
|
||||
import org.l2jmobius.gameserver.taskmanager.DecayTaskManager;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
import org.l2jmobius.gameserver.taskmanager.ItemsAutoDestroyTaskManager;
|
||||
import org.l2jmobius.gameserver.taskmanager.PlayerAutoSaveTaskManager;
|
||||
@@ -5119,6 +5120,11 @@ public class Player extends Playable
|
||||
setReputation(newRep < -20 ? newRep : 0);
|
||||
}
|
||||
|
||||
if (Config.DISCONNECT_AFTER_DEATH)
|
||||
{
|
||||
DecayTaskManager.getInstance().add(this);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -10482,6 +10488,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