Adding getTextByValue method to replace duplicate code (#823)
* Added FormattedTextValue.getTextByValue() * changed getBoolean() and added to display_title
This commit is contained in:
1 parent
de92d47f70
commit
e26e332a6d
4 files changed
+14
-34
No files matched your search
@@ -520,7 +520,7 @@ public class Auxiliary {
|
||||
targets = playerTargets;
|
||||
res = lv.get(1).evalValue(c);
|
||||
}
|
||||
Text message = (res instanceof FormattedTextValue)?((FormattedTextValue) res).getText():new LiteralText(res.getString());
|
||||
Text message = FormattedTextValue.getTextByValue(res);
|
||||
if (targets == null)
|
||||
{
|
||||
s.sendFeedback(message, false);
|
||||
@@ -573,16 +573,8 @@ public class Auxiliary {
|
||||
if (lv.size() > 2)
|
||||
{
|
||||
pVal = lv.get(2).evalValue(c);
|
||||
if (pVal instanceof FormattedTextValue)
|
||||
{
|
||||
title = ((FormattedTextValue) pVal).getText();
|
||||
soundsTrue = !title.asString().isEmpty();
|
||||
}
|
||||
else
|
||||
{
|
||||
title = new LiteralText(pVal.getString());
|
||||
soundsTrue = pVal.getBoolean();
|
||||
}
|
||||
title = FormattedTextValue.getTextByValue(pVal);
|
||||
soundsTrue = pVal.getBoolean();
|
||||
}
|
||||
else title = null; // Will never happen, just to make lambda happy
|
||||
if (action == null)
|
||||
|
||||
Reference in new issue
Block a user