Merge pull request #10453 from Alexsuperfly/woodcutting-timers2

woodcutting: fix inaccurate despawn events
This commit is contained in:
Adam
2019-12-29 11:09:38 -05:00
committed by GitHub

View File

@@ -103,6 +103,7 @@ public class WoodcuttingPlugin extends Plugin
@Getter(AccessLevel.PACKAGE) @Getter(AccessLevel.PACKAGE)
private final List<TreeRespawn> respawns = new ArrayList<>(); private final List<TreeRespawn> respawns = new ArrayList<>();
private boolean recentlyLoggedIn; private boolean recentlyLoggedIn;
private int currentPlane;
@Provides @Provides
WoodcuttingConfig getConfig(ConfigManager configManager) WoodcuttingConfig getConfig(ConfigManager configManager)
@@ -144,6 +145,7 @@ public class WoodcuttingPlugin extends Plugin
public void onGameTick(GameTick gameTick) public void onGameTick(GameTick gameTick)
{ {
recentlyLoggedIn = false; recentlyLoggedIn = false;
currentPlane = client.getPlane();
respawns.removeIf(TreeRespawn::isExpired); respawns.removeIf(TreeRespawn::isExpired);
@@ -204,7 +206,7 @@ public class WoodcuttingPlugin extends Plugin
Tree tree = Tree.findTree(object.getId()); Tree tree = Tree.findTree(object.getId());
if (tree != null) if (tree != null)
{ {
if (tree.getRespawnTime() != null && !recentlyLoggedIn) if (tree.getRespawnTime() != null && !recentlyLoggedIn && currentPlane == object.getPlane())
{ {
Point max = object.getSceneMaxLocation(); Point max = object.getSceneMaxLocation();
Point min = object.getSceneMinLocation(); Point min = object.getSceneMinLocation();