 |
Crossfire JXClient, Trunk
|
Go to the documentation of this file.
23 package com.realtime.crossfire.jxclient.scripts;
28 import java.util.Collection;
29 import java.util.HashSet;
30 import java.util.regex.Pattern;
31 import org.jetbrains.annotations.NotNull;
32 import org.jetbrains.annotations.Nullable;
44 private final Collection<String>
commands =
new HashSet<>();
76 final String args2 = args.getMonitorCommand();
77 if (args2.isEmpty()) {
113 final StringBuilder sb =
new StringBuilder();
115 sb.append(Pattern.quote(command));
118 final int length = sb.length();
128 sb.setLength(length-1);
129 pattern = Pattern.compile(sb.toString());
An external command executed as a client-sided script.
void rebuildPattern()
Rebuilds pattern from commands.
void addCommand(@NotNull final String command)
Adds a command to watch for.
void removePacketWatcherListener(@NotNull ReceivedPacketListener listener)
Removes a listener to be notified about received packets.
void destroy()
Releases allocated resources.
Adds encoding/decoding of crossfire protocol packets to a ServerConnection.
void removeCommand(@NotNull final String command)
Removes a command to watch for.
void addPacketWatcherListener(@NotNull ReceivedPacketListener listener)
Adds a listener to be notified about received packets.
final Collection< String > commands
The commands to watch for.
Pattern pattern
A Pattern matching all commands.
final ReceivedPacketListener receivedPacketListener
The ReceivedPacketListener attached to crossfireServerConnection.
final CrossfireServerConnection crossfireServerConnection
The CrossfireServerConnection to watch.
Interface for listeners interested in received packets.
PacketWatcher(@NotNull final CrossfireServerConnection crossfireServerConnection, @NotNull final ScriptProcess scriptProcess)
Creates a new instance.
boolean matchesCommand(@NotNull final CharSequence command)
Returns whether a command matches the currently watched commands.
final ScriptProcess scriptProcess
The ScriptProcess for sending commands.
Implements the "watch" function for client-sided scripts.
Interface for querying monitor commands for script processes.
void commandSent(@NotNull String cmd)
Sends a message to the script process.