Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use delimiters literally in macro functions #4381

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions src/main/java/net/rptools/maptool/client/MapTool.java
Original file line number Diff line number Diff line change
Expand Up @@ -876,23 +876,6 @@ public static void addGlobalMessage(String message) {
addMessage(TextMessage.say(null, message));
}

/**
* Add a message all specified clients will see. This is a shortcut for addMessage(WHISPER, ...)
* and addMessage(GM, ...). The <code>targets</code> is expected do be in a string list built with
* <code>separator</code>.
*
* @param message message to be sent
* @param targets string specifying clients to send the message to (spaces are trimmed)
* @param separator the separator between entries in <code>targets</code>
*/
public static void addGlobalMessage(String message, String targets, String separator) {
List<String> list = new LinkedList<String>();
for (String target : targets.split(separator)) {
list.add(target.trim());
}
addGlobalMessage(message, list);
}

/**
* Add a message all specified clients will see. This is a shortcut for addMessage(WHISPER, ...)
* and addMessage(GM, ...).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import net.rptools.maptool.client.ui.commandpanel.CommandPanel;
import net.rptools.maptool.language.I18N;
import net.rptools.maptool.model.TextMessage;
import net.rptools.maptool.util.StringUtil;
import net.rptools.parser.Parser;
import net.rptools.parser.ParserException;
import net.rptools.parser.VariableResolver;
Expand Down Expand Up @@ -93,7 +94,9 @@ private Object broadcast(VariableResolver resolver, List<Object> param) throws P
jarray = JsonParser.parseString(temp).getAsJsonArray();
else {
jarray = new JsonArray();
for (String t : temp.split(delim)) jarray.add(t.trim());
for (String t : StringUtil.split(temp, delim)) {
jarray.add(t.trim());
}
}
if (jarray.size() == 0) {
return ""; // dont send to empty lists
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import net.rptools.maptool.client.functions.json.JsonArrayFunctions;
import net.rptools.maptool.language.I18N;
import net.rptools.maptool.util.FunctionUtil;
import net.rptools.maptool.util.StringUtil;
import net.rptools.parser.Parser;
import net.rptools.parser.ParserException;
import net.rptools.parser.VariableResolver;
Expand Down Expand Up @@ -88,7 +89,7 @@ public Object childEvaluate(
jsonTargets = jsonArrayFunctions.parseJsonArray(strTargets);
} else {
jsonTargets = new JsonArray();
for (String t : strTargets.split(delim)) {
for (String t : StringUtil.split(strTargets, delim)) {
jsonTargets.add(t.trim());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import net.rptools.maptool.model.Token;
import net.rptools.maptool.model.Zone;
import net.rptools.maptool.util.FunctionUtil;
import net.rptools.maptool.util.StringUtil;
import net.rptools.parser.Parser;
import net.rptools.parser.ParserException;
import net.rptools.parser.VariableResolver;
Expand Down Expand Up @@ -172,7 +173,7 @@ private Set<GUID> getTokenSetFromList(final Zone zone, final String paramStr, fi
}
} else {
// String List
String[] strList = paramStr.split(delim);
String[] strList = StringUtil.split(paramStr, delim);
for (String s : strList) {
Token t = zone.resolveToken(s.trim());
if (t != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
import net.rptools.maptool.language.I18N;
import net.rptools.maptool.model.Token;
import net.rptools.maptool.util.ImageManager;
import net.rptools.maptool.util.StringUtil;
import net.rptools.parser.Parser;
import net.rptools.parser.ParserException;
import net.rptools.parser.VariableResolver;
Expand Down Expand Up @@ -394,7 +395,7 @@ public List<String> parseStringList(String valueString, String delim) {
}
}
} else {
String[] values = valueString.split(delim);
String[] values = StringUtil.split(valueString, delim);
for (String s : values) {
ret.add(s.trim());
}
Expand Down
Loading
Loading