Dropped the use of GameTimeController for spawn protection.
This commit is contained in:
@@ -715,14 +715,14 @@ UnstuckInterval = 300
|
||||
# Default: 0
|
||||
TeleportWatchdogTimeout = 0
|
||||
|
||||
# After a player teleports, this is the time the player is protected.
|
||||
# After a player spawns, this is the time the player is protected.
|
||||
# This time is in seconds, leave it at 0 if you want this feature disabled.
|
||||
# Retail (Since GE): 600 (10 minutes)
|
||||
# Default: 600
|
||||
PlayerSpawnProtection = 600
|
||||
|
||||
# Teleport spawn protection time. It will protect the player in the
|
||||
# teleport spawn for the given time. 0 to disable feature
|
||||
# After a player teleports, this is the time the player is protected.
|
||||
# This time is in seconds, leave it at 0 if you want this feature disabled.
|
||||
PlayerTeleportProtection = 0
|
||||
|
||||
# If enabled, players respawn in town on different locations defined in zone.xml for given town.
|
||||
|
@@ -130,7 +130,7 @@ public class FindPvP implements IBypassHandler
|
||||
}
|
||||
|
||||
activeChar.teleToLocation((mostPvP.getX() + Rnd.get(300)) - 150, (mostPvP.getY() + Rnd.get(300)) - 150, mostPvP.getZ());
|
||||
activeChar.setProtection(true);
|
||||
activeChar.setSpawnProtection(true);
|
||||
if (!activeChar.isGM())
|
||||
{
|
||||
activeChar.setPvpFlagLasts(System.currentTimeMillis() + Config.PVP_PVP_TIME);
|
||||
|
@@ -671,7 +671,8 @@ public final class L2PcInstance extends L2Playable
|
||||
private final L2Request _request = new L2Request(this);
|
||||
|
||||
// Used for protection after teleport
|
||||
private long _protectEndTime = 0;
|
||||
private long _spawnProtectEndTime = 0;
|
||||
private long _teleportProtectEndTime = 0;
|
||||
|
||||
private volatile Map<Integer, ExResponseCommissionInfo> _lastCommissionInfos;
|
||||
|
||||
@@ -679,18 +680,6 @@ public final class L2PcInstance extends L2Playable
|
||||
private volatile Map<Class<? extends AbstractEvent>, AbstractEvent<?>> _events;
|
||||
private boolean _isOnCustomEvent = false;
|
||||
|
||||
public boolean isSpawnProtected()
|
||||
{
|
||||
return _protectEndTime > GameTimeController.getInstance().getGameTicks();
|
||||
}
|
||||
|
||||
private long _teleportProtectEndTime = 0;
|
||||
|
||||
public boolean isTeleportProtected()
|
||||
{
|
||||
return _teleportProtectEndTime > GameTimeController.getInstance().getGameTicks();
|
||||
}
|
||||
|
||||
// protects a char from aggro mobs when getting up from fake death
|
||||
private long _recentFakeDeathEndTime = 0;
|
||||
|
||||
@@ -3884,24 +3873,24 @@ public final class L2PcInstance extends L2Playable
|
||||
return item;
|
||||
}
|
||||
|
||||
public void setProtection(boolean protect)
|
||||
public boolean isSpawnProtected()
|
||||
{
|
||||
if (Config.DEVELOPER && (protect || (_protectEndTime > 0)))
|
||||
{
|
||||
LOGGER.warning(getName() + ": Protection " + (protect ? "ON " + (GameTimeController.getInstance().getGameTicks() + (Config.PLAYER_SPAWN_PROTECTION * GameTimeController.TICKS_PER_SECOND)) : "OFF") + " (currently " + GameTimeController.getInstance().getGameTicks() + ")");
|
||||
}
|
||||
|
||||
_protectEndTime = protect ? GameTimeController.getInstance().getGameTicks() + (Config.PLAYER_SPAWN_PROTECTION * GameTimeController.TICKS_PER_SECOND) : 0;
|
||||
return _spawnProtectEndTime > System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public boolean isTeleportProtected()
|
||||
{
|
||||
return _teleportProtectEndTime > System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public void setSpawnProtection(boolean protect)
|
||||
{
|
||||
_spawnProtectEndTime = protect ? System.currentTimeMillis() + (Config.PLAYER_SPAWN_PROTECTION * 1000) : 0;
|
||||
}
|
||||
|
||||
public void setTeleportProtection(boolean protect)
|
||||
{
|
||||
if (Config.DEVELOPER && (protect || (_teleportProtectEndTime > 0)))
|
||||
{
|
||||
LOGGER.warning(getName() + ": Tele Protection " + (protect ? "ON " + (GameTimeController.getInstance().getGameTicks() + (Config.PLAYER_TELEPORT_PROTECTION * GameTimeController.TICKS_PER_SECOND)) : "OFF") + " (currently " + GameTimeController.getInstance().getGameTicks() + ")");
|
||||
}
|
||||
|
||||
_teleportProtectEndTime = protect ? GameTimeController.getInstance().getGameTicks() + (Config.PLAYER_TELEPORT_PROTECTION * GameTimeController.TICKS_PER_SECOND) : 0;
|
||||
_teleportProtectEndTime = protect ? System.currentTimeMillis() + (Config.PLAYER_TELEPORT_PROTECTION * 1000) : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -10282,7 +10271,7 @@ public final class L2PcInstance extends L2Playable
|
||||
{
|
||||
if (isSpawnProtected())
|
||||
{
|
||||
setProtection(false);
|
||||
setSpawnProtection(false);
|
||||
if (!isInsideZone(ZoneId.PEACE))
|
||||
{
|
||||
sendPacket(SystemMessageId.YOU_ARE_NO_LONGER_PROTECTED_FROM_AGGRESSIVE_MONSTERS);
|
||||
|
@@ -432,7 +432,7 @@ public class EnterWorld implements IClientIncomingPacket
|
||||
|
||||
if (Config.PLAYER_SPAWN_PROTECTION > 0)
|
||||
{
|
||||
activeChar.setProtection(true);
|
||||
activeChar.setSpawnProtection(true);
|
||||
}
|
||||
|
||||
activeChar.spawnMe(activeChar.getX(), activeChar.getY(), activeChar.getZ());
|
||||
|
Reference in New Issue
Block a user