Discord

  • Es freut uns dass du in unser Minecraft Forum gefunden hast. Hier kannst du mit über 130.000 Minecraft Fans über Minecraft diskutieren, Fragen stellen und anderen helfen. In diesem Minecraft Forum kannst du auch nach Teammitgliedern, Administratoren, Moderatoren , Supporter oder Sponsoren suchen. Gerne kannst du im Offtopic Bereich unseres Minecraft Forums auch über nicht Minecraft spezifische Themen reden. Wir hoffen dir gefällt es in unserem Minecraft Forum!

Spigot PlugIn Spigot 1.14 und Scoreboards

dmmk218

Redstoneengineer
Mitglied seit
28 Juni 2018
Beiträge
42
Alter
21
Hey zusammen,

ich hab da mal ne Frage ich habe jetzt ein Scoreboard für die 1.14 programmiert wie ich es seit eh und je mache (seit 1.8 bis zur 1.12). Wenn jetzt allerdings ein weiterer Spieler joint verschwindet mein Scoreboard. Kennt sich da jemand aus und hab ich was übersehen im meinem Code?

setBoard Methode:
public void setSidebar(Player p) {

        ScoreboardManager sm = Bukkit.getScoreboardManager();
        final Scoreboard board = sm.getNewScoreboard();
        final Objective o = board.registerNewObjective("test", "dummy");

        o.setDisplaySlot(DisplaySlot.SIDEBAR);
        o.setDisplayName("§b§lServer");

        o.getScore("§3").setScore(14);


        o.getScore("§8§l»§3§lRang").setScore(13);

        o.getScore(getRank(p)).setScore(12);


        o.getScore("§3 ").setScore(11);
        o.getScore("§8§l»§3§lServer").setScore(10);
        o.getScore("§f" + Data.serverName).setScore(9);
        o.getScore("§b ").setScore(8);
        o.getScore("§8§l»§3§lKontostand ").setScore(7);

        Team team = board.getTeam("money") == null ? board.registerNewTeam("money") : board.getTeam("money");
        team.setPrefix("§fN/A");
        team.addEntry("§r");

        o.getScore("§r").setScore(6);
        o.getScore("§5 ").setScore(5);

        o.getScore("§8§l»§3§lOnlinezeit").setScore(4);

        Team teamot = board.getTeam("time") == null ? board.registerNewTeam("time") : board.getTeam("time");
        teamot.setPrefix("§fN/A");
        teamot.addEntry("§0");

        o.getScore("§0").setScore(3);

        o.getScore("§f ").setScore(2);

        o.getScore("§8§l»§3§lShop").setScore(1);

        o.getScore("§f/shop").setScore(0);



        p.setScoreboard(board);

    }
getRank Methode:
public String getRank(Player p) {

        User user = PrefixHandler.luckPermsApi.getUserManager().getUser(p.getUniqueId());

        ContextManager cm = PrefixHandler.luckPermsApi.getContextManager();

        Contexts contexts = cm.lookupApplicableContexts(user).orElse(cm.getStaticContexts());

        MetaData metaData = user.getCachedData().getMetaData(contexts);

        String s = metaData.getPrefix().replaceAll("&", "§");

        int lenght = s.length();

        if (s.endsWith("l")) {

            return s.substring(0, lenght - 7);


        }

        return s.substring(0, lenght - 5);

    }
JoinEvent:
@EventHandler
    public void onJoin(PlayerJoinEvent e) {
        setSidebar(e.getPlayer());
    }

Vielen Dank vorab für eure Hilfe

Lg
 

Salvationsoul

Minecrafter
Mitglied seit
22 Juni 2019
Beiträge
1
Hallo zunächst,
gibt es eine detailliertere Fehlerbeschreibung ? Also werden in der Konsole irgendwelche Fehler ausgegeben ? Oder wird es beim joinen erst gar nicht gesetzt ? Wenn es mehr Infos gibt, haben wir auch eine bessere Möglichkeit dir zu helfen... :D
 

Exepta

Minecrafter
Mitglied seit
4 August 2019
Beiträge
19
Erstell das ScoreBoard mal mit Packets.
Hier ein beispiel:
Packet Scoreboard:
    public ScoreBoardExample(Player player) {
        create(player);
    }

    private void create(Player player) {
        Scoreboard scoreboard = new Scoreboard();
        ScoreboardObjective objective;

        objective = new ScoreboardObjective(scoreboard
        , "Test §<-- geht", IScoreboardCriteria.DUMMY, IChatBaseComponent.b(Objects.requireNonNull(IChatBaseComponent.ChatSerializer.b("Test §<-- geht"))),
                IScoreboardCriteria.EnumScoreboardHealthDisplay.INTEGER);
        PacketPlayOutScoreboardObjective removepack = new PacketPlayOutScoreboardObjective(objective, 1);
        PacketPlayOutScoreboardObjective createpack = new PacketPlayOutScoreboardObjective(objective, 0);
        PacketPlayOutScoreboardDisplayObjective display = new PacketPlayOutScoreboardDisplayObjective(1, objective);

        objective.setDisplayName(IChatBaseComponent.b(Objects.requireNonNull(IChatBaseComponent.ChatSerializer.b("Test §<-- geht"))));

        PacketPlayOutScoreboardScore placeholder3 = new PacketPlayOutScoreboardScore(ScoreboardServer.Action.CHANGE, "Test §<-- geht", "   ", 6);
        PacketPlayOutScoreboardScore statusName = new PacketPlayOutScoreboardScore(ScoreboardServer.Action.CHANGE, "Test §<-- geht", "§f§lStatus", 5);
        PacketPlayOutScoreboardScore status = new PacketPlayOutScoreboardScore(ScoreboardServer.Action.CHANGE, "Test §<-- geht", "§8- §7status <---", 4);
        PacketPlayOutScoreboardScore placeholder2 = new PacketPlayOutScoreboardScore(ScoreboardServer.Action.CHANGE, "Test §<-- geht", "  ", 3);
        PacketPlayOutScoreboardScore webName = new PacketPlayOutScoreboardScore(ScoreboardServer.Action.CHANGE, "Test §<-- geht", "§f§lWebsite", 2);
        PacketPlayOutScoreboardScore web = new PacketPlayOutScoreboardScore(ScoreboardServer.Action.CHANGE, "Test §<-- geht", "§8- §7deine seite", 1);
        PacketPlayOutScoreboardScore placeholder1 = new PacketPlayOutScoreboardScore(ScoreboardServer.Action.CHANGE, "Test §<-- geht", " ", 0);

        sendPacket(player, removepack);
        sendPacket(player, createpack);
        sendPacket(player, display);
        sendPacket(player, placeholder3);
        sendPacket(player, statusName);
        sendPacket(player, status);
        sendPacket(player, placeholder2);
        sendPacket(player, webName);
        sendPacket(player, web);
        sendPacket(player, placeholder1);
    }

    private void sendPacket(Player player, Packet<?> packet) {
        ((CraftPlayer)player).getHandle().playerConnection.sendPacket(packet);
    }
 

infinitycraft_eu

Minecrafter
Mitglied seit
17 Februar 2019
Beiträge
3
Erstell das ScoreBoard mal mit Packets.
Hier ein beispiel:
Packet Scoreboard:
    public ScoreBoardExample(Player player) {
        create(player);
    }

    private void create(Player player) {
        Scoreboard scoreboard = new Scoreboard();
        ScoreboardObjective objective;

        objective = new ScoreboardObjective(scoreboard
        , "Test §<-- geht", IScoreboardCriteria.DUMMY, IChatBaseComponent.b(Objects.requireNonNull(IChatBaseComponent.ChatSerializer.b("Test §<-- geht"))),
                IScoreboardCriteria.EnumScoreboardHealthDisplay.INTEGER);
        PacketPlayOutScoreboardObjective removepack = new PacketPlayOutScoreboardObjective(objective, 1);
        PacketPlayOutScoreboardObjective createpack = new PacketPlayOutScoreboardObjective(objective, 0);
        PacketPlayOutScoreboardDisplayObjective display = new PacketPlayOutScoreboardDisplayObjective(1, objective);

        objective.setDisplayName(IChatBaseComponent.b(Objects.requireNonNull(IChatBaseComponent.ChatSerializer.b("Test §<-- geht"))));

        PacketPlayOutScoreboardScore placeholder3 = new PacketPlayOutScoreboardScore(ScoreboardServer.Action.CHANGE, "Test §<-- geht", "   ", 6);
        PacketPlayOutScoreboardScore statusName = new PacketPlayOutScoreboardScore(ScoreboardServer.Action.CHANGE, "Test §<-- geht", "§f§lStatus", 5);
        PacketPlayOutScoreboardScore status = new PacketPlayOutScoreboardScore(ScoreboardServer.Action.CHANGE, "Test §<-- geht", "§8- §7status <---", 4);
        PacketPlayOutScoreboardScore placeholder2 = new PacketPlayOutScoreboardScore(ScoreboardServer.Action.CHANGE, "Test §<-- geht", "  ", 3);
        PacketPlayOutScoreboardScore webName = new PacketPlayOutScoreboardScore(ScoreboardServer.Action.CHANGE, "Test §<-- geht", "§f§lWebsite", 2);
        PacketPlayOutScoreboardScore web = new PacketPlayOutScoreboardScore(ScoreboardServer.Action.CHANGE, "Test §<-- geht", "§8- §7deine seite", 1);
        PacketPlayOutScoreboardScore placeholder1 = new PacketPlayOutScoreboardScore(ScoreboardServer.Action.CHANGE, "Test §<-- geht", " ", 0);

        sendPacket(player, removepack);
        sendPacket(player, createpack);
        sendPacket(player, display);
        sendPacket(player, placeholder3);
        sendPacket(player, statusName);
        sendPacket(player, status);
        sendPacket(player, placeholder2);
        sendPacket(player, webName);
        sendPacket(player, web);
        sendPacket(player, placeholder1);
    }

    private void sendPacket(Player player, Packet<?> packet) {
        ((CraftPlayer)player).getHandle().playerConnection.sendPacket(packet);
    }
Dankeeeeeeeeeeeeeeeeee hab genau danach gesucht!
 

Exepta

Minecrafter
Mitglied seit
4 August 2019
Beiträge
19
In der Theorie ja müsste das aber mal selber erst nachschauen. Sollte ich was finden sage ich bescheid.
 
Oben