Added option to only set footer, and clear both
This commit is contained in:
1 parent
a106f2611f
commit
eaa242c8eb
2 files changed
+21
-5
No files matched your search
@@ -277,9 +277,12 @@ Sends the player (or players if `players` is a list) a title of a specific type,
|
|||||||
Executing with those will set the times to the specified ones.
|
Executing with those will set the times to the specified ones.
|
||||||
Note that `actionbar` type doesn't support changing times (vanilla bug, see [MC-106167](https://bugs.mojang.com/browse/MC-106167)).
|
Note that `actionbar` type doesn't support changing times (vanilla bug, see [MC-106167](https://bugs.mojang.com/browse/MC-106167)).
|
||||||
|
|
||||||
### `display_title(players, 'player_list', header, footer),`
|
### `display_title(players, 'player_list')`
|
||||||
|
### `display_title(players, 'player_list', footer)`
|
||||||
|
### `display_title(players, 'player_list', header, footer)`
|
||||||
|
|
||||||
Changes the header and footer of the player list.
|
Changes the header and footer of the player list.
|
||||||
|
When no `header` and `footer` is specified, they will be reset.
|
||||||
Keep in mind this would interfere with carpet's loggers, so if you are using this, you need to keep them off.
|
Keep in mind this would interfere with carpet's loggers, so if you are using this, you need to keep them off.
|
||||||
|
|
||||||
### `logger(msg), logger(type, msg)`
|
### `logger(msg), logger(type, msg)`
|
||||||
|
|||||||
@@ -561,21 +561,34 @@ public class Auxiliary {
|
|||||||
action = Action.CLEAR;
|
action = Action.CLEAR;
|
||||||
break;
|
break;
|
||||||
case "player_list":
|
case "player_list":
|
||||||
Text header;
|
|
||||||
Text footer;
|
Text footer;
|
||||||
if (lv.size() > 3)
|
Text header;
|
||||||
{
|
|
||||||
|
if(lv.size() == 2) {
|
||||||
|
footer = new LiteralText("");
|
||||||
|
header = new LiteralText("");
|
||||||
|
} else if(lv.size() == 3) {
|
||||||
|
pVal = lv.get(2).evalValue(c);
|
||||||
|
if (pVal instanceof FormattedTextValue)
|
||||||
|
footer = ((FormattedTextValue) pVal).getText();
|
||||||
|
else
|
||||||
|
footer = new LiteralText(pVal.getString());
|
||||||
|
|
||||||
|
header = new LiteralText("");
|
||||||
|
} else {
|
||||||
pVal = lv.get(2).evalValue(c);
|
pVal = lv.get(2).evalValue(c);
|
||||||
if (pVal instanceof FormattedTextValue)
|
if (pVal instanceof FormattedTextValue)
|
||||||
header = ((FormattedTextValue) pVal).getText();
|
header = ((FormattedTextValue) pVal).getText();
|
||||||
else
|
else
|
||||||
header = new LiteralText(pVal.getString());
|
header = new LiteralText(pVal.getString());
|
||||||
|
|
||||||
pVal = lv.get(3).evalValue(c);
|
pVal = lv.get(3).evalValue(c);
|
||||||
if (pVal instanceof FormattedTextValue)
|
if (pVal instanceof FormattedTextValue)
|
||||||
footer = ((FormattedTextValue) pVal).getText();
|
footer = ((FormattedTextValue) pVal).getText();
|
||||||
else
|
else
|
||||||
footer = new LiteralText(pVal.getString());
|
footer = new LiteralText(pVal.getString());
|
||||||
} else throw new InternalExpressionException("Third and fourth argument of 'display_title' must be present for 'player_list' type");
|
}
|
||||||
|
|
||||||
PlayerListHeaderS2CPacket packet = new PlayerListHeaderS2CPacket();
|
PlayerListHeaderS2CPacket packet = new PlayerListHeaderS2CPacket();
|
||||||
((PlayerListHeaderS2CPacketMixin) packet).setFooter(footer);
|
((PlayerListHeaderS2CPacketMixin) packet).setFooter(footer);
|
||||||
((PlayerListHeaderS2CPacketMixin) packet).setHeader(header);
|
((PlayerListHeaderS2CPacketMixin) packet).setHeader(header);
|
||||||
|
|||||||
Reference in new issue
Block a user