From e7c4d6f1326dc1177f865ccff81bbd1138ebfc16 Mon Sep 17 00:00:00 2001 From: mcrcortex <18544518+MCRcortex@users.noreply.github.com> Date: Mon, 2 Jun 2025 12:23:06 +1000 Subject: [PATCH] more state checking --- src/main/java/me/cortex/voxy/common/world/WorldEngine.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/me/cortex/voxy/common/world/WorldEngine.java b/src/main/java/me/cortex/voxy/common/world/WorldEngine.java index 4d7e37cb..d83e0ba7 100644 --- a/src/main/java/me/cortex/voxy/common/world/WorldEngine.java +++ b/src/main/java/me/cortex/voxy/common/world/WorldEngine.java @@ -163,15 +163,18 @@ public class WorldEngine { } public void markActive() { + if (!this.isLive) throw new IllegalStateException(); this.lastActiveTime = System.currentTimeMillis(); } public void acquireRef() { + if (!this.isLive) throw new IllegalStateException(); this.refCount.incrementAndGet(); this.lastActiveTime = System.currentTimeMillis(); } public void releaseRef() { + if (!this.isLive) throw new IllegalStateException(); if (this.refCount.decrementAndGet()<0) { throw new IllegalStateException("ref count less than 0"); }