mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2026-08-22 02:45:10 -06:00
"lastActivity" to static String
"POH_Activity" to static String added Debug message when Recovery happens.
This commit is contained in:
parent
e9f39b5217
commit
e100cfc276
8 changed files with 32 additions and 20 deletions
|
|
@ -24,6 +24,7 @@ import java.awt.*;
|
|||
import static core.api.ContentAPIKt.*;
|
||||
import static core.api.regionspec.RegionSpecificationKt.fillWith;
|
||||
import static core.api.regionspec.RegionSpecificationKt.using;
|
||||
import static core.game.activity.ActivityManager.lastActivity;
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -33,6 +34,7 @@ import static core.api.regionspec.RegionSpecificationKt.using;
|
|||
*/
|
||||
public final class HouseManager {
|
||||
|
||||
public static String POH_Activity = "POH-Activity";
|
||||
/**
|
||||
* The current region.
|
||||
*/
|
||||
|
|
@ -215,7 +217,7 @@ public final class HouseManager {
|
|||
if (house.isInHouse(player)) {
|
||||
player.animate(Animation.RESET);
|
||||
player.getProperties().setTeleportLocation(house.location.getExitLocation());
|
||||
player.removeAttribute("lastActivity");
|
||||
player.removeAttribute(lastActivity);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,9 @@ import core.game.world.map.Region;
|
|||
import core.game.system.task.Pulse;
|
||||
import core.game.world.map.zone.ZoneType;
|
||||
|
||||
import static content.global.skill.construction.HouseManager.POH_Activity;
|
||||
import static core.api.ContentAPIKt.*;
|
||||
import static core.game.activity.ActivityManager.lastActivity;
|
||||
|
||||
/**
|
||||
* Handles the player owned house zone.
|
||||
|
|
@ -67,7 +69,7 @@ public final class HouseZone extends MapZone {
|
|||
public boolean enter(Entity e) {
|
||||
if (e instanceof Player) {
|
||||
Player pl = (Player) e;
|
||||
pl.setAttribute("/save:lastActivity","POH-Activity");
|
||||
pl.setAttribute("/save:"+lastActivity,POH_Activity);
|
||||
if (house == pl.getHouseManager()) {
|
||||
previousRegion = house.getHouseRegion().getId();
|
||||
if (house.getDungeonRegion() != null)
|
||||
|
|
@ -75,7 +77,7 @@ public final class HouseZone extends MapZone {
|
|||
}
|
||||
registerLogoutListener(pl, "houselogout", (p) -> {
|
||||
p.setLocation(house.getLocation().getExitLocation());
|
||||
p.removeAttribute("lastActivity");
|
||||
p.removeAttribute(lastActivity);
|
||||
return kotlin.Unit.INSTANCE;
|
||||
});
|
||||
}
|
||||
|
|
@ -144,7 +146,7 @@ public final class HouseZone extends MapZone {
|
|||
clearLogoutListener(p, "houselogout");
|
||||
if (!getAttribute(p, "kidnapped-by-random", false)) {
|
||||
removeAttribute(p, "/save:original-loc");
|
||||
removeAttribute(p,"lastActivity");
|
||||
removeAttribute(p,lastActivity);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import core.game.world.map.zone.ZoneRestriction
|
|||
import core.plugin.Initializable
|
||||
import core.tools.ticksToSeconds
|
||||
import core.game.activity.ActivityManager
|
||||
import core.game.activity.ActivityManager.lastActivity
|
||||
import core.game.activity.ActivityPlugin
|
||||
import core.game.world.map.zone.ZoneBorders
|
||||
import core.tools.colorize
|
||||
|
|
@ -83,7 +84,7 @@ class FishingTrawlerActivity : ActivityPlugin("fishing trawler",false,false,true
|
|||
|
||||
fun removePlayer(player: Player){
|
||||
waitingPlayers.remove(player)
|
||||
player.removeAttribute("lastActivity")
|
||||
player.removeAttribute(lastActivity)
|
||||
}
|
||||
|
||||
override fun newInstance(p: Player?): ActivityPlugin {
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package content.minigame.fishingtrawler
|
|||
import core.api.MapArea
|
||||
import core.api.getRegionBorders
|
||||
import core.api.*
|
||||
import core.game.activity.ActivityManager.lastActivity
|
||||
import core.game.component.Component
|
||||
import core.game.node.entity.Entity
|
||||
import core.game.node.scenery.Scenery
|
||||
|
|
@ -158,7 +159,7 @@ class FishingTrawlerSession(val activity: FishingTrawlerActivity? = null) : MapA
|
|||
player.removeAttribute("ft-session")
|
||||
player.setAttribute("/save:ft-rolls", rolls)
|
||||
clearLogoutListener(player, "ft-logout")
|
||||
player.removeAttribute("lastActivity")
|
||||
player.removeAttribute(lastActivity)
|
||||
}
|
||||
session.zone.unregister(getRegionBorders(session.region.id))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ import core.tools.RandomFunction;
|
|||
import core.tools.StringUtils;
|
||||
|
||||
import static core.api.ContentAPIKt.*;
|
||||
import static core.game.activity.ActivityManager.lastActivity;
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -264,8 +265,7 @@ public final class PestControlActivityPlugin extends ActivityPlugin {
|
|||
@Override
|
||||
public void recover(Player player) {
|
||||
player.setLocation(getLeaveLocation());
|
||||
//player.setLocation(getSpawnLocation());
|
||||
player.removeAttribute("lastActivity");
|
||||
player.removeAttribute(lastActivity);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import core.game.world.GameWorld;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static content.global.skill.construction.HouseManager.POH_Activity;
|
||||
import static core.api.ContentAPIKt.*;
|
||||
|
||||
/**
|
||||
|
|
@ -25,6 +26,8 @@ public final class ActivityManager {
|
|||
*/
|
||||
private static final Map<String, ActivityPlugin> ACTIVITIES = new HashMap<>();
|
||||
|
||||
public static String lastActivity = "lastActivity";
|
||||
|
||||
/**
|
||||
* Constructs a new {@code ActivityManager} {@code Object}.
|
||||
*/
|
||||
|
|
@ -85,7 +88,7 @@ public final class ActivityManager {
|
|||
}
|
||||
|
||||
public static void ActivityRecover(Player player) {
|
||||
String activityName = player.getAttribute("lastActivity", null);
|
||||
String activityName = player.getAttribute(lastActivity, null);
|
||||
if (activityName == null) {
|
||||
int yLoc = player.getLocation().getY();
|
||||
if (yLoc < 2000) { //credits to PlayerName
|
||||
|
|
@ -94,12 +97,12 @@ public final class ActivityManager {
|
|||
}
|
||||
return;
|
||||
}
|
||||
//sendMessage(player,player.getUsername() + " recovering from " + activityName);
|
||||
if (activityName.equals("POH-Activity")) {
|
||||
player.debug("[ActivityManager] Recovering from " + activityName);
|
||||
if (activityName.equals(POH_Activity)) {
|
||||
HouseZone.remove_items(player);
|
||||
player.setLocation(player.getHouseManager().getLocation().getExitLocation());
|
||||
player.removeAttribute("/save:original-loc");
|
||||
player.removeAttribute("lastActivity");
|
||||
player.removeAttribute("original-loc");
|
||||
player.removeAttribute(lastActivity);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
|
|
@ -120,6 +123,6 @@ public final class ActivityManager {
|
|||
sendMessage(player, "Activity: THROWABLE, please report this!");
|
||||
player.setLocation(ServerConstants.HOME_LOCATION);
|
||||
}
|
||||
player.removeAttribute("lastActivity");
|
||||
player.removeAttribute(lastActivity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ import core.tools.Log;
|
|||
|
||||
import static core.api.ContentAPIKt.log;
|
||||
import static core.api.ContentAPIKt.sendMessage;
|
||||
import static core.game.activity.ActivityManager.lastActivity;
|
||||
|
||||
/**
|
||||
* A plugin implementation used for activity plugins.
|
||||
|
|
@ -134,7 +135,7 @@ public abstract class ActivityPlugin extends MapZone implements Plugin<Player> {
|
|||
*/
|
||||
public boolean start(Player player, boolean login, Object... args) {
|
||||
this.player = player;
|
||||
player.setAttribute("/save:lastActivity", this.getName());
|
||||
player.setAttribute("/save:"+lastActivity, this.getName());
|
||||
//player.sendMessage(this.getName());
|
||||
return true;
|
||||
}
|
||||
|
|
@ -163,7 +164,7 @@ public abstract class ActivityPlugin extends MapZone implements Plugin<Player> {
|
|||
e.getProperties().setSafeZone(false);
|
||||
e.getProperties().safeRespawn = ServerConstants.HOME_LOCATION;
|
||||
e.removeAttribute("activity");
|
||||
e.removeAttribute("lastActivity");
|
||||
e.removeAttribute(lastActivity);
|
||||
return super.leave(e, logout);
|
||||
}
|
||||
|
||||
|
|
@ -176,13 +177,13 @@ public abstract class ActivityPlugin extends MapZone implements Plugin<Player> {
|
|||
public void recover(Player player) {
|
||||
Location spawn = getSpawnLocation();
|
||||
if (spawn == null) {
|
||||
String lastActivity = player.getAttribute("lastActivity", null);
|
||||
String lastActivity = player.getAttribute(core.game.activity.ActivityManager.lastActivity, null);
|
||||
sendMessage(player, "You were safely removed from an invalid location.");
|
||||
sendMessage(player, "Activity: " + lastActivity + ", please report this!");
|
||||
spawn = ServerConstants.HOME_LOCATION;
|
||||
}
|
||||
player.setLocation(spawn);
|
||||
player.removeAttribute("lastActivity");
|
||||
player.removeAttribute(lastActivity);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -17,6 +17,8 @@ import core.plugin.PluginType;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static core.game.activity.ActivityManager.lastActivity;
|
||||
|
||||
/**
|
||||
* Represents the plugin used to handle a cutscene.
|
||||
* @author Vexia
|
||||
|
|
@ -142,7 +144,7 @@ public abstract class CutscenePlugin extends ActivityPlugin {
|
|||
player.getInterfaceManager().restoreTabs();
|
||||
player.unlock();// incase he was locked.
|
||||
player.getWalkingQueue().reset();
|
||||
player.removeAttribute("lastActivity");
|
||||
player.removeAttribute(lastActivity);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue