-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[bugreport]: Scoreboard does not update #33
Comments
Could you please provide the code for your sidebar as well as the snippet from which you call the update method? |
i don't call the update method but the code gets executed. @CreateSidebar(identifier = "", setOnJoin = true)
public AnimatedSidebar defaultSidebar(Player player) {
AnimatedSidebar sidebar = sidebarFactory.newAnimatedSidebar();
//sidebar.withTitle(animationFactory.newStaticTextAnimation("§6\u2022§e\u25cf §eDunityGames"));
sidebar.withTitle(animationFactory.newStaticTextAnimation("§e§lDunityGames"));
sidebar.addComponent(componentFactory.simpleTextComponent("§8➜ §eBargeld§8").line(15));
sidebar.addComponent(componentFactory.simpleTextComponent("§8 ➥ §7"+ Economy.getMoney(player.getUniqueId())+"$").line(14));
sidebar.addComponent(componentFactory.emptyLineComponent(13));
sidebar.addComponent(componentFactory.simpleTextComponent("§8➜ §eBank§8").line(12));
sidebar.addComponent(componentFactory.simpleTextComponent("§8 ➥ §7"+ Economy.getBank(player.getUniqueId())+"$").line(11));
return sidebar;
} |
I set an breakpoint at |
But how should the Sidebar update if the update method is never called? Try assigning a real identifier to the sidebar and call the update method in order to update it without rejoining EDIT: What do you mean by |
yes the code is always executed and i never called the method |
Could you try removing the breakpoint? |
when i replace the AnimatedSidebar with the SimpleSidebar the method isn't called always |
Ah ok now I get your point. Yes, if you choose AnimatedSidebar as sidebar type, Kelp calls the sidebar method in the given animation interval in order to send the title update to the player. In your case, this does not make much sense, because you have chosen a static title. Here is the corresponding code from the Kelp source code: // load the sidebar for the player
AnimatedSidebar sidebar = (AnimatedSidebar) getSidebar(identifier, player);
Preconditions.checkNotNull(sidebar);
// update the state. If the state index it out of bounds, reset it to 0.
animationStates.put(player, animationStates.get(player) + 1);
if (state >= sidebar.maxStates() - 1) {
this.animationStates.put(player, 0);
}
// finally update the title.
sidebar.updateTitleOnly(player, state); But thank you very much for reporting this issue, when developing the sidebar system I did not think of possible side effects, which can occur when the entire sidebar method is called every few seconds (querying databases within the sidebar method for example would cause a huge server lag). I think I will have to change the design of sidebar creation and apply the same principle used in the command system, where specific attributes such as permission, etc. are set in a different method ( I think for the future, sidebars will take a dedicated class or lambda class in order to avoid this problem. I'll try my best to fix this issue! pxav. |
Describe the bug
The method in that the scoreboard is declared is called but the scoreboard is not changing. i need to reconnect to apply the changes
Environment information
The text was updated successfully, but these errors were encountered: