summaryrefslogtreecommitdiff
path: root/NET/worlds/scape/WObjectHighlighter.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/scape/WObjectHighlighter.java
downloadworldsplayer-c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9.tar.xz
worldsplayer-c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9.zip
Initial commit
Diffstat (limited to 'NET/worlds/scape/WObjectHighlighter.java')
-rw-r--r--NET/worlds/scape/WObjectHighlighter.java52
1 files changed, 52 insertions, 0 deletions
diff --git a/NET/worlds/scape/WObjectHighlighter.java b/NET/worlds/scape/WObjectHighlighter.java
new file mode 100644
index 0000000..8a94f02
--- /dev/null
+++ b/NET/worlds/scape/WObjectHighlighter.java
@@ -0,0 +1,52 @@
+package NET.worlds.scape;
+
+import NET.worlds.console.Main;
+import NET.worlds.console.MainCallback;
+
+class WObjectHighlighter implements MainCallback {
+ private WObject target;
+ private Room room;
+ private boolean newState;
+ private boolean registered;
+
+ public WObjectHighlighter(WObject target) {
+ this.target = target;
+ this.start();
+ }
+
+ @Override
+ public synchronized void mainCallback() {
+ if (this.newState != this.target.getHighlit()) {
+ this.target.setHighlit(this.newState);
+ if (this.newState) {
+ this.room = this.target.getRoom();
+ if (this.room != null) {
+ this.room.highlightTarget = this.target;
+ }
+ } else if (this.room != null) {
+ this.room.highlightTarget = null;
+ this.room = null;
+ }
+ }
+
+ Main.unregister(this);
+ this.registered = false;
+ }
+
+ public synchronized void start() {
+ this.newState = true;
+ this.registerMe();
+ }
+
+ public synchronized void stop() {
+ this.newState = false;
+ this.registerMe();
+ }
+
+ private synchronized void registerMe() {
+ if (!this.registered) {
+ Main.register(this);
+ this.registered = true;
+ }
+ }
+}