diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/config/Character.ini b/L2J_Mobius_1.0_Ertheia/dist/game/config/Character.ini index 9443d4b1a6..953db43818 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/config/Character.ini +++ b/L2J_Mobius_1.0_Ertheia/dist/game/config/Character.ini @@ -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. diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/bypasshandlers/FindPvP.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/bypasshandlers/FindPvP.java index 516544f2ec..98e21540cf 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/bypasshandlers/FindPvP.java +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/bypasshandlers/FindPvP.java @@ -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); diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java index b43dcfd124..ad87177ee8 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java @@ -669,7 +669,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 _lastCommissionInfos; @@ -677,18 +678,6 @@ public final class L2PcInstance extends L2Playable private volatile Map, 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; @@ -3878,24 +3867,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; } /** @@ -10275,7 +10264,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); diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/clientpackets/EnterWorld.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/clientpackets/EnterWorld.java index e41e04209a..2a17c1f259 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/clientpackets/EnterWorld.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/clientpackets/EnterWorld.java @@ -427,7 +427,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()); diff --git a/L2J_Mobius_2.5_Underground/dist/game/config/Character.ini b/L2J_Mobius_2.5_Underground/dist/game/config/Character.ini index d4026e0f73..596d5eaed6 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/config/Character.ini +++ b/L2J_Mobius_2.5_Underground/dist/game/config/Character.ini @@ -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. diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/bypasshandlers/FindPvP.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/bypasshandlers/FindPvP.java index 516544f2ec..98e21540cf 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/bypasshandlers/FindPvP.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/bypasshandlers/FindPvP.java @@ -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); diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java index e3768d739c..e55824d937 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java @@ -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 _lastCommissionInfos; @@ -679,18 +680,6 @@ public final class L2PcInstance extends L2Playable private volatile Map, 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); diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/clientpackets/EnterWorld.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/clientpackets/EnterWorld.java index 040487891b..78d79fd27b 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/clientpackets/EnterWorld.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/clientpackets/EnterWorld.java @@ -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()); diff --git a/L2J_Mobius_3.0_Helios/dist/game/config/Character.ini b/L2J_Mobius_3.0_Helios/dist/game/config/Character.ini index d4026e0f73..596d5eaed6 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/config/Character.ini +++ b/L2J_Mobius_3.0_Helios/dist/game/config/Character.ini @@ -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. diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/bypasshandlers/FindPvP.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/bypasshandlers/FindPvP.java index 516544f2ec..98e21540cf 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/bypasshandlers/FindPvP.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/bypasshandlers/FindPvP.java @@ -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); diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java index 0fda00eaf9..63a86b9db1 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java @@ -673,7 +673,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 _lastCommissionInfos; @@ -681,18 +682,6 @@ public final class L2PcInstance extends L2Playable private volatile Map, 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; @@ -3886,24 +3875,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; } /** @@ -10292,7 +10281,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); diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/clientpackets/EnterWorld.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/clientpackets/EnterWorld.java index 040487891b..78d79fd27b 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/clientpackets/EnterWorld.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/clientpackets/EnterWorld.java @@ -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()); diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/config/Character.ini b/L2J_Mobius_4.0_GrandCrusade/dist/game/config/Character.ini index 8050237905..daab30e78a 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/config/Character.ini +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/config/Character.ini @@ -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. diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/bypasshandlers/FindPvP.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/bypasshandlers/FindPvP.java index 516544f2ec..98e21540cf 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/bypasshandlers/FindPvP.java +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/bypasshandlers/FindPvP.java @@ -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); diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java index 993aeed7b3..0449e6d51d 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java @@ -676,7 +676,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 _lastCommissionInfos; @@ -684,18 +685,6 @@ public final class L2PcInstance extends L2Playable private volatile Map, 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; @@ -3877,24 +3866,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; } /** @@ -10285,7 +10274,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); diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/clientpackets/EnterWorld.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/clientpackets/EnterWorld.java index 1ed25d2f2e..7e2e1dfb85 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/clientpackets/EnterWorld.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/clientpackets/EnterWorld.java @@ -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()); diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/config/Character.ini b/L2J_Mobius_CT_2.6_HighFive/dist/game/config/Character.ini index 6a6764bb26..28e43d942d 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/config/Character.ini +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/config/Character.ini @@ -21,7 +21,7 @@ DecreaseSkillOnDelevel = True # Weight limit multiplier. Example: Setting this to 5 will give players 5x the normal weight limit. # Default: 1 -AltWeightLimit = 2 +AltWeightLimit = 1 # Run speed modifier. Example: Setting this to 5 will give players +5 to their running speed. # Default: 0 @@ -753,15 +753,15 @@ 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 -PlayerTeleportProtection = 30 +# 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. # If disabled the first spawn location from zone.xml is used. diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/bypasshandlers/FindPvP.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/bypasshandlers/FindPvP.java index 516544f2ec..98e21540cf 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/bypasshandlers/FindPvP.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/bypasshandlers/FindPvP.java @@ -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); diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java index a237f0a9f3..32df0c4c95 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java @@ -688,21 +688,10 @@ public final class L2PcInstance extends L2Playable private L2ItemInstance _boltItem; // Used for protection after teleport - private long _protectEndTime = 0; - - private L2ItemInstance _lure = null; - - public boolean isSpawnProtected() - { - return _protectEndTime > GameTimeController.getInstance().getGameTicks(); - } - + private long _spawnProtectEndTime = 0; private long _teleportProtectEndTime = 0; - public boolean isTeleportProtected() - { - return _teleportProtectEndTime > GameTimeController.getInstance().getGameTicks(); - } + private L2ItemInstance _lure = null; // protects a char from aggro mobs when getting up from fake death private long _recentFakeDeathEndTime = 0; @@ -3846,32 +3835,28 @@ public final class L2PcInstance extends L2Playable return item; } - /** - * Set _protectEndTime according settings. - * @param protect - */ - 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; } /** - * Set protection from agro mobs when getting up from fake death, according settings. + * Set protection from aggro mobs when getting up from fake death, according settings. * @param protect */ public void setRecentFakeDeath(boolean protect) @@ -10738,7 +10723,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); diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/EnterWorld.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/EnterWorld.java index 0a5bc1c722..93a790a782 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/EnterWorld.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/EnterWorld.java @@ -437,7 +437,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()); diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/config/Character.ini b/L2J_Mobius_Classic_2.0_Saviors/dist/game/config/Character.ini index d53afa2999..e86aac5fe6 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/config/Character.ini +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/config/Character.ini @@ -664,14 +664,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. diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/bypasshandlers/FindPvP.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/bypasshandlers/FindPvP.java index 516544f2ec..98e21540cf 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/bypasshandlers/FindPvP.java +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/bypasshandlers/FindPvP.java @@ -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); diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java index 7f6639fe3d..bfb654e8dc 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java @@ -668,7 +668,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 _lastCommissionInfos; @@ -676,18 +677,6 @@ public final class L2PcInstance extends L2Playable private volatile Map, 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; @@ -3854,24 +3843,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; } /** @@ -10216,7 +10205,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); diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/clientpackets/EnterWorld.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/clientpackets/EnterWorld.java index 35aca1fe55..fc1ed0058e 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/clientpackets/EnterWorld.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/clientpackets/EnterWorld.java @@ -431,7 +431,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()); diff --git a/L2J_Mobius_Classic_2.0_Zaken/dist/game/config/Character.ini b/L2J_Mobius_Classic_2.0_Zaken/dist/game/config/Character.ini index d53afa2999..e86aac5fe6 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/dist/game/config/Character.ini +++ b/L2J_Mobius_Classic_2.0_Zaken/dist/game/config/Character.ini @@ -664,14 +664,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. diff --git a/L2J_Mobius_Classic_2.0_Zaken/dist/game/data/scripts/handlers/bypasshandlers/FindPvP.java b/L2J_Mobius_Classic_2.0_Zaken/dist/game/data/scripts/handlers/bypasshandlers/FindPvP.java index 516544f2ec..98e21540cf 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/dist/game/data/scripts/handlers/bypasshandlers/FindPvP.java +++ b/L2J_Mobius_Classic_2.0_Zaken/dist/game/data/scripts/handlers/bypasshandlers/FindPvP.java @@ -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); diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java index d7ad931465..1de6b48753 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java @@ -668,7 +668,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 _lastCommissionInfos; @@ -676,18 +677,6 @@ public final class L2PcInstance extends L2Playable private volatile Map, 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; @@ -3854,24 +3843,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; } /** @@ -10216,7 +10205,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); diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/network/clientpackets/EnterWorld.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/network/clientpackets/EnterWorld.java index 3c28b311bf..d6195e0635 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/network/clientpackets/EnterWorld.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/network/clientpackets/EnterWorld.java @@ -431,7 +431,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());