summaryrefslogtreecommitdiff
path: root/NET/worlds/network/SMState.java
diff options
context:
space:
mode:
authorFuwn <[email protected]>2026-02-12 22:33:32 -0800
committerFuwn <[email protected]>2026-02-12 22:33:32 -0800
commitc7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9 (patch)
treedf9f48bf128a6c0186a8e91857d6ff30fe0e9f18 /NET/worlds/network/SMState.java
downloadworldsplayer-c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9.tar.xz
worldsplayer-c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9.zip
Initial commit
Diffstat (limited to 'NET/worlds/network/SMState.java')
-rw-r--r--NET/worlds/network/SMState.java59
1 files changed, 59 insertions, 0 deletions
diff --git a/NET/worlds/network/SMState.java b/NET/worlds/network/SMState.java
new file mode 100644
index 0000000..0138559
--- /dev/null
+++ b/NET/worlds/network/SMState.java
@@ -0,0 +1,59 @@
+package NET.worlds.network;
+
+import NET.worlds.core.IniFile;
+
+class SMState {
+ private int _state;
+ private WorldServer _ws;
+ private static int _debugLevel;
+
+ static {
+ try {
+ _debugLevel = Integer.parseInt(IniFile.gamma().getIniString("netdebug", "0"));
+ } catch (NumberFormatException var1) {
+ _debugLevel = 0;
+ }
+ }
+
+ public SMState(WorldServer ws, int state) {
+ this._state = state;
+ this._ws = ws;
+ }
+
+ public int getState() {
+ return this._state;
+ }
+
+ public synchronized void setState(int state) {
+ if ((_debugLevel & 8) > 0) {
+ synchronized (System.out) {
+ System.out.println(this._ws + ": *** new state: " + state);
+ if ((_debugLevel & 16) > 0) {
+ try {
+ throw new InterruptedException();
+ } catch (InterruptedException var4) {
+ var4.printStackTrace(System.out);
+ System.out.println("******************************");
+ }
+ }
+ }
+ }
+
+ this._state = state;
+ this.notifyAll();
+ }
+
+ public synchronized void waitForState(int state) throws InfiniteWaitException {
+ while (this._state != state) {
+ try {
+ this.wait();
+ } catch (InterruptedException var3) {
+ assert false;
+ }
+
+ if (this._state == -1) {
+ throw new InfiniteWaitException();
+ }
+ }
+ }
+}