KelpFramework / kelp

A cross-version spigot framework to avoid boilerplate code and make your plugin compatible with multiple spigot versions easily
MIT License
54 stars 8 forks source link

[bugreport]: IllegalArgumentException on Scoreboard show/update #26

Closed DSeeLP closed 4 years ago

DSeeLP commented 4 years ago

Describe the bug

The error occurs when you try to show the scoreboard

What do we have to do to reproduce this bug?

Steps to reproduce the behavior: Use the code below. This is the code i used:

import com.google.inject.Inject;
import com.google.inject.Singleton;
import de.pxav.kelp.core.animation.TextAnimationFactory;
import de.pxav.kelp.core.sidebar.CreateSidebar;
import de.pxav.kelp.core.sidebar.component.SidebarComponentFactory;
import de.pxav.kelp.core.sidebar.type.AnimatedSidebar;
import de.pxav.kelp.core.sidebar.type.SidebarFactory;
import de.pxav.kelp.core.sidebar.type.SimpleSidebar;
import org.bukkit.entity.Player;

@Singleton
public class DefaultSidebar {
    private SidebarFactory sidebarFactory;
    private SidebarComponentFactory componentFactory;

    @Inject
    public DefaultSidebar(SidebarFactory sidebarFactory, SidebarComponentFactory componentFactory) {
        this.sidebarFactory = sidebarFactory;
        this.componentFactory = componentFactory;
    }

    @CreateSidebar(identifier = "default", setOnJoin = true)
    public SimpleSidebar defaultSidebar(Player player) {
        SimpleSidebar sidebar = sidebarFactory.newSimpleSidebar();
        sidebar.withTitle("§6\\u2022§e\\u25cf §eMy Server");
        sidebar.addComponent(componentFactory.simpleTextComponent("§6\\u2022§e\\u25cf Username§8"));
        sidebar.addComponent(componentFactory.simpleTextComponent("§8\\u27a5 §7"+player.getName()));

        return sidebar;
    }
}

Provide the stack trace if possible (server logs, etc.). If you can, use the debug mode for that so that debug messages are logged as well

[20:30:18 WARN]: java.lang.reflect.InvocationTargetException
[20:30:18 WARN]:       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[20:30:18 WARN]:       at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
[20:30:18 WARN]:       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[20:30:18 WARN]:       at java.lang.reflect.Method.invoke(Unknown Source)
[20:30:18 WARN]:       at de.pxav.kelp.core.listener.EventRegistration.lambda$null$0(EventRegistration.java:86)
[20:30:18 WARN]:       at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:78)
[20:30:18 WARN]:       at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62)
[20:30:18 WARN]:       at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:517)
[20:30:18 WARN]:       at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:502)
[20:30:18 WARN]:       at net.minecraft.server.v1_8_R3.PlayerList.onPlayerJoin(PlayerList.java:314)
[20:30:18 WARN]:       at net.minecraft.server.v1_8_R3.PlayerList.a(PlayerList.java:173)
[20:30:18 WARN]:       at net.minecraft.server.v1_8_R3.LoginListener.b(LoginListener.java:144)
[20:30:18 WARN]:       at net.minecraft.server.v1_8_R3.LoginListener.c(LoginListener.java:54)
[20:30:18 WARN]:       at net.minecraft.server.v1_8_R3.NetworkManager.a(NetworkManager.java:231)
[20:30:18 WARN]:       at net.minecraft.server.v1_8_R3.ServerConnection.c(ServerConnection.java:148)
[20:30:18 WARN]:       at net.minecraft.server.v1_8_R3.MinecraftServer.B(MinecraftServer.java:875)
[20:30:18 WARN]:       at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:378)
[20:30:18 WARN]:       at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:713)
[20:30:18 WARN]:       at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:616)
[20:30:18 WARN]:       at java.lang.Thread.run(Unknown Source)
[20:30:18 WARN]: Caused by: java.lang.IllegalArgumentException: Team name 'entry_0' is already in use
[20:30:18 WARN]:       at org.apache.commons.lang.Validate.isTrue(Validate.java:136)
[20:30:18 WARN]:       at org.bukkit.craftbukkit.v1_8_R3.scoreboard.CraftScoreboard.registerNewTeam(CraftScoreboard.java:140)
[20:30:18 WARN]:       at de.pxav.kelp.core.sidebar.component.SimpleTextComponent.render(SimpleTextComponent.java:54)
[20:30:18 WARN]:       at de.pxav.kelp.core.sidebar.type.SimpleSidebar.renderSidebar(SimpleSidebar.java:83)
[20:30:18 WARN]:       at de.pxav.kelp.core.sidebar.type.SimpleSidebar.renderAndOpenSidebar(SimpleSidebar.java:91)
[20:30:18 WARN]:       at de.pxav.kelp.core.sidebar.SidebarRepository.openSidebar(SidebarRepository.java:211)
[20:30:18 WARN]:       at de.pxav.kelp.core.sidebar.SidebarStateListener.onPlayerJoin(SidebarStateListener.java:44)
[20:30:18 WARN]:       ... 20 more

Provide some additional info like screenshots or videos if needed

If applicable, add screenshots to help explain your problem.

Environment information

DSeeLP commented 4 years ago

I forget to add line arguments. I added them and i fixed the issue