summaryrefslogtreecommitdiff
path: root/NET/worlds/console/ChatPart.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/console/ChatPart.java
downloadworldsplayer-c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9.tar.xz
worldsplayer-c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9.zip
Initial commit
Diffstat (limited to 'NET/worlds/console/ChatPart.java')
-rw-r--r--NET/worlds/console/ChatPart.java72
1 files changed, 72 insertions, 0 deletions
diff --git a/NET/worlds/console/ChatPart.java b/NET/worlds/console/ChatPart.java
new file mode 100644
index 0000000..dfdf161
--- /dev/null
+++ b/NET/worlds/console/ChatPart.java
@@ -0,0 +1,72 @@
+package NET.worlds.console;
+
+import NET.worlds.scape.FrameEvent;
+import NET.worlds.scape.Pilot;
+import java.awt.Container;
+
+public class ChatPart extends DuplexPart {
+ private Window renderWindow;
+ private DefaultConsole console;
+ private static final String activateVCselfWhisper = "&|+debug<selfWhisperON";
+ private static final String deactivateVCselfWhisper = "&|+debug<selfWhisperOFF";
+ private static final String VCextraCommand = "&|+debug<VCcommand";
+
+ @Override
+ protected void sendText(String s) {
+ int ii = s.indexOf(92);
+ if (s.startsWith("&|+debug<")) {
+ this.triggerLocalDebug(s);
+ } else if (ii >= 0 && ii < s.length() - 1 && s.charAt(ii + 1) == 'u') {
+ Pilot.sendText(Console.parseUnicode(s));
+ } else {
+ Pilot.sendText(s);
+ }
+ }
+
+ @Override
+ public void activate(Console c, Container f, Console prev) {
+ super.activate(c, f, prev);
+ this.console = (DefaultConsole)c;
+ }
+
+ @Override
+ public void deactivate() {
+ super.deactivate();
+ this.renderWindow = null;
+ this.console = null;
+ }
+
+ @Override
+ public synchronized boolean handle(FrameEvent f) {
+ boolean ret = super.handle(f);
+ if (this.renderWindow == null && this.console != null) {
+ RenderCanvas rc = this.console.getRender();
+ if (rc != null) {
+ Window w = rc.getWindow();
+ if (w != null) {
+ try {
+ w.hookChatLine(this.line);
+ this.renderWindow = w;
+ } catch (WindowNotFoundException var6) {
+ }
+ }
+ }
+ }
+
+ return ret;
+ }
+
+ private void triggerLocalDebug(String s) {
+ if (s.startsWith("&|+debug<selfWhisperON")) {
+ VoiceChat.activateSelfWhisper();
+ }
+
+ if (s.startsWith("&|+debug<selfWhisperOFF")) {
+ VoiceChat.deactivateSelfWhisper();
+ }
+
+ if (s.startsWith("&|+debug<VCcommand")) {
+ VoiceChat.setExtra(s);
+ }
+ }
+}