mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-15 11:00:17 -07:00
Added additional safety when cleaning up cutscene attributes
This commit is contained in:
parent
7300e746b1
commit
b5213c40b4
2 changed files with 23 additions and 12 deletions
|
|
@ -370,6 +370,7 @@ public class DuelArea extends MapZone {
|
|||
* @param p the player.
|
||||
*/
|
||||
private void leave(Player p) {
|
||||
p.getProperties().setSafeZone(false);
|
||||
if (p.getAttribute("duel:ammo", null) != null) {
|
||||
List<GroundItem> ammo = p.getAttribute("duel:ammo");
|
||||
Container c = new Container(40);
|
||||
|
|
|
|||
|
|
@ -256,23 +256,33 @@ abstract class Cutscene(val player: Player) {
|
|||
8 -> player.properties.teleportLocation = exitLocation
|
||||
9 -> fadeFromBlack()
|
||||
16 -> {
|
||||
endActions?.invoke()
|
||||
player.removeAttribute(ATTRIBUTE_CUTSCENE)
|
||||
player.removeAttribute(ATTRIBUTE_CUTSCENE_STAGE)
|
||||
player.properties.isSafeZone = false
|
||||
player.properties.safeRespawn = ServerConstants.HOME_LOCATION
|
||||
player.interfaceManager.restoreTabs()
|
||||
player.unlock()
|
||||
clearNPCs()
|
||||
player.unhook(CUTSCENE_DEATH_HOOK)
|
||||
player.logoutListeners.remove("cutscene")
|
||||
RandomEventManager.getInstance(player)!!.enabled = true
|
||||
PacketRepository.send(MinimapState::class.java, MinimapStateContext(player, 0))
|
||||
try {
|
||||
endActions?.invoke()
|
||||
} catch (e: Exception) {
|
||||
SystemLogger.logErr("There's some bad nasty code in ${this::class.java.simpleName} end actions!")
|
||||
e.printStackTrace()
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
override fun stop() {
|
||||
super.stop()
|
||||
player ?: return
|
||||
player.removeAttribute(ATTRIBUTE_CUTSCENE)
|
||||
player.removeAttribute(ATTRIBUTE_CUTSCENE_STAGE)
|
||||
player.properties.isSafeZone = false
|
||||
player.properties.safeRespawn = ServerConstants.HOME_LOCATION
|
||||
player.interfaceManager.restoreTabs()
|
||||
player.unlock()
|
||||
clearNPCs()
|
||||
player.unhook(CUTSCENE_DEATH_HOOK)
|
||||
player.logoutListeners.remove("cutscene")
|
||||
RandomEventManager.getInstance(player)?.enabled = true
|
||||
PacketRepository.send(MinimapState::class.java, MinimapStateContext(player, 0))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue