Crossfire JXClient, Trunk
|
Go to the documentation of this file.
23 package com.realtime.crossfire.jxclient.settings;
28 import java.util.HashMap;
30 import java.util.regex.Matcher;
31 import java.util.regex.Pattern;
32 import org.jetbrains.annotations.NotNull;
44 private static final String
REPLY_TO =
"reply_to";
50 private final Pattern
macroPattern = Pattern.compile(
"<<([a-z_]+)>>");
56 private final Map<String, String>
expansions =
new HashMap<>();
62 @SuppressWarnings(
"FieldCanBeLocal")
66 public void commandDrawextinfoReceived(
final int color,
final int type,
final int subtype, @NotNull
final String message) {
86 final int index = message.indexOf(
" tells you:");
88 final String name = message.substring(0, index);
105 public void setDebugMode(
final boolean printMessageTypes) {
128 StringBuilder result =
null;
130 final Matcher macroMatcher =
macroPattern.matcher(
string);
131 while (macroMatcher.find()) {
132 if (result ==
null) {
133 result =
new StringBuilder();
136 final String name = macroMatcher.group(1);
138 if (expansion ==
null) {
139 expansion = macroMatcher.group();
141 result.append(
string, index, macroMatcher.start());
142 result.append(expansion);
143 index = macroMatcher.end();
145 if (result !=
null) {
146 result.append(
string.substring(index));
148 return result ==
null ? string : result.toString();
final CrossfireDrawextinfoListener crossfireDrawextinfoListener
static final int MSG_TYPE_PAPER
static final int MSG_TYPE_CLIENT
final Map< String, String > expansions
static final int MSG_TYPE_MISC
static final int MSG_TYPE_SIGN
static final int MSG_TYPE_COMMAND
static final int MSG_TYPE_SPELL
static final int MSG_TYPE_APPLY
static final int MSG_SUBTYPE_COMMUNICATION_TELL
static final String REPLY_TO
static final int MSG_TYPE_ATTACK
static final int MSG_TYPE_CARD
static final int MSG_TYPE_MOTD
static final int MSG_TYPE_SKILL
static final int MSG_TYPE_ATTRIBUTE
static final int MSG_TYPE_ITEM
final Pattern macroPattern
static final int MSG_TYPE_COMMUNICATION
static final int MSG_TYPE_VICTIM
String expandMacros(@NotNull final String string)
static final int MSG_TYPE_MONUMENT
static final int MSG_TYPE_ADMIN
static final int MSG_TYPE_DIALOG
static final int MSG_TYPE_SHOP
Macros(@NotNull final CrossfireServerConnection crossfireServerConnection)
static final int MSG_TYPE_BOOK