Skip to content

Commit

Permalink
fix(tsl): EXECUTE action breaking tick orders
Browse files Browse the repository at this point in the history
- Fixed EXECUTE action not working with tick order sensitive commands. Such as "fill" or "setblock"
- Added missing default subtitles for SHUFFLE and CHANGE actions
- Fixed an outdated unit test for comment parsing
  • Loading branch information
iGoodie committed Sep 16, 2019
1 parent d836eac commit 37338ab
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 8 deletions.
Expand Up @@ -33,12 +33,16 @@ protected void performAction(ServerPlayerEntity player, EventArguments args) {
.withPermissionLevel(9999) // OVER 9000!
.withFeedbackDisabled();

commands.forEach(command -> {
int result = player.getServer()
.getCommandManager()
.handleCommand(source, replaceExpressions(command, args));
TwitchSpawn.LOGGER.info("Executed (Status:{}) -> {}", result, command);
});

for (String command : commands) {
TwitchSpawn.SERVER.execute(() -> {
int result = TwitchSpawn.SERVER
.getCommandManager()
.handleCommand(source, replaceExpressions(command, args));

TwitchSpawn.LOGGER.info("Executed (Status:{}) -> {}", result, replaceExpressions(command, args));
});
}
}

}
Expand Up @@ -67,6 +67,26 @@
"color": "white"
}
],
"SHUFFLE": [
{
"text": "${actor}",
"color": "aqua"
},
{
"text": " shuffled stuff around!",
"color": "white"
}
],
"CHANGE": [
{
"text": "${actor}",
"color": "aqua"
},
{
"text": " changed some inventory stuff!",
"color": "white"
}
],
"OS_RUN": [
{
"text": "${actor}",
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/comment_expected.tsl
@@ -1 +1 @@
BOTH DROP stick 1 AND DROP %diamond{display:{Name:"\"# Not a \\ comment\""}}% 1 AND DROP %diamond{display:{Name:"\"#Not a \% comment\""}}% 1 AND SEED foo\* ON Twitch Follow
BOTH DROP stick 1 AND DROP %diamond{display:{Name:"\"# Not a \\ comment\""}}% 1 AND DROP %diamond{display:{Name:"\"#Not a \% comment\""}}% 1 AND SEED foo ON Twitch Follow
2 changes: 1 addition & 1 deletion src/test/resources/comment_test.tsl
Expand Up @@ -8,7 +8,7 @@ BOTH # Comment with %
AND
DROP %diamond{display:{Name:"\"#Not a \% comment\""}}% 1
AND
SEED foo\*#%
SEED foo#%
ON Twitch Follow
# Comment starting with whitespace

Expand Down

0 comments on commit 37338ab

Please sign in to comment.