The bug
If a score callback corresponding to /execute store (result|success) score <targets> <objective> contains targets with 41 or more characters, it throws java.lang.IllegalArgumentException while executing the chained callbacks.
This causes the remaining callbacks not to be executed.
How to reproduce
/scoreboard objectives add mc-182362 dummy/scoreboard objectives add mc-182362 dummy/execute store success score a mc-182362 store success score _________________________________________ mc-182362 store success score b mc-182362 run me */execute store success score a mc-182362 store success score _________________________________________ mc-182362 store success score b mc-182362 run me *→ ❌
An unexpected error occurred trying to execute that command(The player name '_________________________________________' is too long!)/scoreboard players get a mc-182362/scoreboard players get a mc-182362→ ✔
a has 1 [mc-182362], the callback corresponding to/execute store success score a mc-182362is successfully executed./scoreboard players get b mc-182362/scoreboard players get b mc-182362→ ❌
Can't get value of mc-182362 for b; none is set, the callback corresponding to/execute store success score b mc-182362is not executed.
Code analysis
Scoreboard#getOrCreatePlayerScore throws IllegalArgumentException iff target.length() > 40 at runtime. This breaks the callback chain created by CALLBACK_CHAINER.
// net.minecraft.server.commands.ExecuteCommand
private static CommandSourceStack storeValue(CommandSourceStack source, Collection<String> targets, Objective objective, boolean result) {
Scoreboard scoreboard = source.getServer().getScoreboard();
return source.withCallback((c, s, r) -> {
for (String target : targets) {
Score score = scoreboard.getOrCreatePlayerScore(target, objective);
int count = result ? r : (s ? 1 : 0);
score.setScore(count);
}
}, CALLBACK_CHAINER);
}// net.minecraft.server.commands.ExecuteCommand
private static CommandSourceStack storeValue(CommandSourceStack source, Collection<String> targets, Objective objective, boolean result) {
Scoreboard scoreboard = source.getServer().getScoreboard();
return source.withCallback((c, s, r) -> {
for (String target : targets) {
Score score = scoreboard.getOrCreatePlayerScore(target, objective);
int count = result ? r : (s ? 1 : 0);
score.setScore(count);
}
}, CALLBACK_CHAINER);
}Comments 0
No comments.