-
Bug
-
Resolution: Awaiting Response
-
None
-
1.20.12 Hotfix, 1.20.13 Hotfix, 1.20.14 Hotfix
-
Unconfirmed
-
Windows
When removing a participant from a scoreboard and the scoreboard is in the sidebar setdisplay position, the scoreboard does not automatically remove the player or fake player on the scoreboard display. I am using version 1.4.0-beta of script API.
To reproduce, download the attached behavior pack attached, unzip it, put it in either the "development_behavior_packs" or "behavior_packs", and add it to a world with beta-APIs enabled. Then type "!scoreboardSetup" in chat. You should see an objective in the sidebar position titled "Scoreboard". Then, type "!addMe" in chat. You should see your username added to the objective in the sidebar area, with a score of 0. At this point you should run the command "/scoreboard players list @s" to check that you are indeed in the objective with the score of 0. Now type "!removeMe" in chat. You will not see the objective in the sidebar area change. To check if you were removed, run the same command you did before: "/scoreboard players list @s". If you type "!updateDisplay" in chat you will see your username removed from the sidebar objective.
This is the code used in that behavior pack:
import { world, system } from "@minecraft/server";
world.beforeEvents.chatSend.subscribe((eventData) =>
Unknown macro: { const message = eventData.message; const player = eventData.sender; if (!message.startsWith("!")) return; var args = message.slice(1).split(/ /); var command = args.shift(); eventData.cancel = true; system.run(() => Unknown macro});
break;
case "addMe":
world.scoreboard.getObjective("scoreboard").setScore(player, 0);
break;
case "removeMe":
world.scoreboard.getObjective("scoreboard").removeParticipant(player);
break;
case "updateDisplay":
world.scoreboard.clearObjectiveAtDisplaySlot("Sidebar");
world.scoreboard.setObjectiveAtDisplaySlot("Sidebar", { "objective": world.scoreboard.getObjective("scoreboard") });
break;
}
});
});