Fixed spawn protection.

This commit is contained in:
MobiusDev
2018-04-02 13:43:29 +00:00
parent e1734d9970
commit 711581a2bc
12 changed files with 66 additions and 60 deletions

View File

@ -678,7 +678,7 @@ public final class L2PcInstance extends L2Playable
public boolean isSpawnProtected()
{
return false; // TODO this is bugged. _protectEndTime > GameTimeController.getInstance().getGameTicks();
return _protectEndTime > GameTimeController.getInstance().getGameTicks();
}
private long _teleportProtectEndTime = 0;
@ -3873,10 +3873,6 @@ public final class L2PcInstance extends L2Playable
return item;
}
/**
* Set _protectEndTime according settings.
* @param protect
*/
public void setProtection(boolean protect)
{
if (Config.DEVELOPER && (protect || (_protectEndTime > 0)))
@ -3898,7 +3894,7 @@ public final class L2PcInstance extends L2Playable
}
/**
* 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)
@ -6179,7 +6175,7 @@ public final class L2PcInstance extends L2Playable
@Override
public boolean isInvul()
{
return super.isInvul() || (_teleportProtectEndTime > GameTimeController.getInstance().getGameTicks());
return super.isInvul() || isTeleportProtected();
}
/**
@ -10269,8 +10265,8 @@ public final class L2PcInstance extends L2Playable
{
if (isSpawnProtected())
{
setProtection(false);
sendPacket(SystemMessageId.YOU_ARE_NO_LONGER_PROTECTED_FROM_AGGRESSIVE_MONSTERS);
if (Config.RESTORE_SERVITOR_ON_RECONNECT && !hasSummon() && CharSummonTable.getInstance().getServitors().containsKey(getObjectId()))
{
CharSummonTable.getInstance().restoreServitor(this);
@ -10282,10 +10278,9 @@ public final class L2PcInstance extends L2Playable
}
if (isTeleportProtected())
{
setTeleportProtection(false);
sendMessage("Teleport spawn protection ended.");
}
setProtection(false);
setTeleportProtection(false);
}
/**

View File

@ -157,5 +157,11 @@ public class MoveBackwardToLocation implements IClientIncomingPacket
break;
}
}
// Mobius: Check spawn protections.
if (activeChar.isSpawnProtected() || activeChar.isTeleportProtected())
{
activeChar.onActionRequest();
}
}
}