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 Sidebar

EdiNear

Minecrafter
Mitglied seit
11 November 2016
Beiträge
3
Alter
30
Minecraft
EdiNear
Hallo zusammen ich bräuchte eure Unterstützung ich möchte mit dieser Variante die oben angebende Animation abspielen aber wie mache ich das es nicht flackert. Ich möchte quasi nur den "Display" updaten und das Guthaben.

Java:
public class ScoreboardUtil {
    private static Integer animationcount;
    
    private static String[] animation = new String[] {
            "§cRedUnity", "§c§lR§cedUnity", "§cR§le§cdUnity" , "§cRe§ld§cUnity" , "§cRed§lU§cnity" , "§cRedU§ln§city" , "§cRedUn§li§cty" , "§cRedUni§lt§cy" , "§cRedUnit§ly"};
        
public static void sendScoreboard(Player p){
    

        Scoreboard board = new Scoreboard();
        
        ScoreboardObjective obj = board.registerObjective(""+ animation[animationcount] , IScoreboardCriteria.b);
        
        PacketPlayOutScoreboardObjective removePacket = new PacketPlayOutScoreboardObjective(obj, 1);
        PacketPlayOutScoreboardObjective createPacket = new PacketPlayOutScoreboardObjective(obj, 0);
        
        PacketPlayOutScoreboardDisplayObjective display = new PacketPlayOutScoreboardDisplayObjective(1, obj);
      
        
        String rang = "§7Spieler";
        if (p.hasPermission("prefix.owner")){
            rang = "§4Team";
        }else if (p.hasPermission("prefix.admin")){
            rang = "§cTeam";
        }else if (p.hasPermission("prefix.dev")){
            rang = "§bTeam";
        }else if (p.hasPermission("prefix.team")){
            rang = "§eTeam";
        }else if (p.hasPermission("prefix.jrteam")){
            rang = "§eJrTeam";   
        }else if (p.hasPermission("prefix.youtuber")){
            rang = "§5YouTuber";
        }else if (p.hasPermission("prefix.builder")){
            rang = "§6Builder";
        }else if (p.hasPermission("prefix.freund")){
            rang = "§aFreund";
        }else if (p.hasPermission("prefix.legende")){
            rang = "§dLegende";
        }else if (p.hasPermission("prefix.vip")){
            rang = "§eVIP";
        }else if (p.hasPermission("prefix.premiumplus")){
            rang = "§ePremium+";
        }else if (p.hasPermission("prefix.gold")){
            rang = "§6Gold";
        }
        
        obj.setDisplayName(animation[animationcount]);
        SimpleDateFormat date = new SimpleDateFormat("dd/MM/yyyy");
        String original = date.format(new Date());
        Calendar calendar = Calendar.getInstance();
        ScoreboardScore s1 = new ScoreboardScore(board, obj, "§a§l§f");
        ScoreboardScore s2 = new ScoreboardScore(board, obj, "§8×  §f§lProfil§8:");
        ScoreboardScore s3 = new ScoreboardScore(board, obj, "§8➜ §c"  + p.getName());
        ScoreboardScore s4 = new ScoreboardScore(board, obj, "§e§l§f");
        ScoreboardScore s5 = new ScoreboardScore(board, obj, "§8×  §f§lDein Rang§8:");
        ScoreboardScore s6 = new ScoreboardScore(board, obj, "§8➜ "  + rang);
        ScoreboardScore s7 = new ScoreboardScore(board, obj, "§b§l§f");
        ScoreboardScore s8 = new ScoreboardScore(board, obj, "§8×  §f§lGuthaben§8:");
        ScoreboardScore s9 = new ScoreboardScore(board, obj, "§8➜ §c" + CoinsMySQL.getCoins(p.getUniqueId().toString(), p.getName() + "§c€"));
        ScoreboardScore s10 = new ScoreboardScore(board, obj, "§c§l§f");
        ScoreboardScore s11 = new ScoreboardScore(board, obj, "    §7§o"+ original);
        
        s1.setScore(12);
        s2.setScore(11);
        s3.setScore(10);                       
        s4.setScore(9);
        s5.setScore(8);
        s6.setScore(7);
        s7.setScore(6);
        s8.setScore(5);
        s9.setScore(4);
        s10.setScore(3);
        s11.setScore(2);
//        s12.setScore(1);
        
        PacketPlayOutScoreboardScore ss1 = new PacketPlayOutScoreboardScore(s1);
        PacketPlayOutScoreboardScore ss2 = new PacketPlayOutScoreboardScore(s2);
        PacketPlayOutScoreboardScore ss3 = new PacketPlayOutScoreboardScore(s3);
        PacketPlayOutScoreboardScore ss4 = new PacketPlayOutScoreboardScore(s4);
        PacketPlayOutScoreboardScore ss5 = new PacketPlayOutScoreboardScore(s5);
        PacketPlayOutScoreboardScore ss6 = new PacketPlayOutScoreboardScore(s6);
        PacketPlayOutScoreboardScore ss7 = new PacketPlayOutScoreboardScore(s7);
        PacketPlayOutScoreboardScore ss8 = new PacketPlayOutScoreboardScore(s8);
         PacketPlayOutScoreboardScore ss9 = new PacketPlayOutScoreboardScore(s9);
        PacketPlayOutScoreboardScore ss10 = new PacketPlayOutScoreboardScore(s10);
        PacketPlayOutScoreboardScore ss11 = new PacketPlayOutScoreboardScore(s11);
//        PacketPlayOutScoreboardScore ss12 = new PacketPlayOutScoreboardScore(s12);
        
        sendPacket(p, removePacket);
        sendPacket(p, createPacket);
        sendPacket(p, display);
        
        sendPacket(p, ss1);
        sendPacket(p, ss2);
        sendPacket(p, ss3);
        sendPacket(p, ss4);
        sendPacket(p, ss5);
        sendPacket(p, ss6);
        sendPacket(p, ss7);
        sendPacket(p, ss8);
        sendPacket(p, ss9);
        sendPacket(p, ss10);
        sendPacket(p, ss11);
//        sendPacket(p, ss12);
        
        
}
public static void sendPacket(Player p, Packet<?> packet){
    ((CraftPlayer)p).getHandle().playerConnection.sendPacket(packet);
}

  public void startAnimation() {
    animationcount = 0 ;
    Bukkit.getScheduler().runTaskTimer(Main.getPlugin(Main.class), new Runnable() {
        
        @Override
        public void run() {
            Bukkit.getOnlinePlayers().forEach(current -> {       
                if (current.getScoreboard() == null )
                    sendScoreboard(current);       
                
                
//                sendScoreboard(current);
            
                
                    
                
            });
            
            animationcount++;
            if (animationcount == animation.length)
                animationcount =0;
        }
    }, 5, 5 );
 }
 

 
}

Danke <3
 

DerFrZocker

Miner
Mitglied seit
10 Dezember 2017
Beiträge
161
Alter
20
Minecraft
DerFrZocker
Ich Verweis einfach mal auf ein älteren Thread wo das nicht flagern auch behandelt wurde.

 
Oben