ServerPlugin Spielername wird nicht richtig angezeigt.

Dieses Thema im Forum "Programmierung" wurde erstellt von majo2702, 1. August 2014.

Status des Themas:
Es sind keine weiteren Antworten möglich.
  1. majo2702
    Offline

    majo2702

    Registriert seit:
    11. Juni 2012
    Beiträge:
    48
    Die Namen der Spieler werden beim betreten und verlassen des Servers, als auch beim sterben nicht richtig angezeigt:
    2014-08-01_20.23.27.jpg
    Source code, der Klasse, um die es geht:
    Code (Text):
    1. [B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]package
    2. [/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] net.majo_online.allgemeines;[/SIZE]
    3. [SIZE=2]
    4.  
    5. [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]import
    6. [/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] org.bukkit.ChatColor;[/SIZE]
    7. [SIZE=2]
    8. [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]import
    9. [/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] org.bukkit.entity.Player;[/SIZE]
    10. [SIZE=2]
    11. [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]import
    12. [/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] org.bukkit.event.EventHandler;[/SIZE]
    13. [SIZE=2]
    14. [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]import
    15. [/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] org.bukkit.event.Listener;[/SIZE]
    16. [SIZE=2]
    17. [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]import
    18. [/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] org.bukkit.event.entity.PlayerDeathEvent;[/SIZE]
    19. [SIZE=2]
    20. [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]import
    21. [/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] org.bukkit.event.player.PlayerJoinEvent;[/SIZE]
    22. [SIZE=2]
    23. [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]import
    24. [/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] org.bukkit.event.player.PlayerQuitEvent;[/SIZE]
    25. [SIZE=2]
    26.  
    27. [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]public
    28. [/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]class[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] EventListener [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]implements[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] Listener {[/SIZE]
    29. [SIZE=2]
    30.    
    31.  
    32.    
    33. [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]public[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] EventListener(Hauptklasse [/SIZE][SIZE=2][COLOR=#6a3e3e][SIZE=2][COLOR=#6a3e3e]hk[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]){[/SIZE]
    34. [SIZE=2]
    35.        
    36.  
    37.        
    38. [/SIZE][SIZE=2][COLOR=#6a3e3e][SIZE=2][COLOR=#6a3e3e]hk[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].getServer().getPluginManager().registerEvents([/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]this[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2], [/SIZE][SIZE=2][COLOR=#6a3e3e][SIZE=2][COLOR=#6a3e3e]hk[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]);[/SIZE]
    39. [SIZE=2]
    40.     }
    41.  
    42.    
    43.  
    44.    
    45. [/SIZE][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]//join message[/COLOR][/SIZE][/COLOR][/SIZE]
    46. [SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]
    47. [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]    
    48. [/SIZE][SIZE=2][COLOR=#646464][SIZE=2][COLOR=#646464]@EventHandler[/COLOR][/SIZE][/COLOR][/SIZE]
    49. [SIZE=2][COLOR=#646464][SIZE=2][COLOR=#646464]
    50. [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]    
    51. [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]public[/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]void[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] join(PlayerJoinEvent [/SIZE][SIZE=2][COLOR=#6a3e3e][SIZE=2][COLOR=#6a3e3e]je[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]){[/SIZE]
    52. [SIZE=2]
    53.        
    54.  
    55.         Player
    56. [/SIZE][SIZE=2][COLOR=#6a3e3e][SIZE=2][COLOR=#6a3e3e]p[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] = [/SIZE][SIZE=2][COLOR=#6a3e3e][SIZE=2][COLOR=#6a3e3e]je[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].getPlayer();[/SIZE]
    57. [SIZE=2]
    58.        
    59. [/SIZE][SIZE=2][COLOR=#6a3e3e][SIZE=2][COLOR=#6a3e3e]je[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].setJoinMessage(ChatColor.[/SIZE][B][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]GREEN[/COLOR][/SIZE][/COLOR][/SIZE][/I][/B][SIZE=2] + [/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"[Info] "[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] + ChatColor.[/SIZE][B][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]AQUA[/COLOR][/SIZE][/COLOR][/SIZE][/I][/B][SIZE=2] + [/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"Der/Die Spieler/-in "[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] + ChatColor.[/SIZE][B][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]GOLD[/COLOR][/SIZE][/COLOR][/SIZE][/I][/B][SIZE=2] + [/SIZE][SIZE=2][COLOR=#6a3e3e][SIZE=2][COLOR=#6a3e3e]p[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] + ChatColor.[/SIZE][B][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]AQUA[/COLOR][/SIZE][/COLOR][/SIZE][/I][/B][SIZE=2] + [/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"hat das Servernetzwerk "[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] + ChatColor.[/SIZE][B][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]GREEN[/COLOR][/SIZE][/COLOR][/SIZE][/I][/B][SIZE=2] + [/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"betreten."[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]);[/SIZE]
    60. [SIZE=2]
    61.        
    62. [/SIZE][SIZE=2][COLOR=#6a3e3e][SIZE=2][COLOR=#6a3e3e]p[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].sendMessage(ChatColor.[/SIZE][B][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]AQUA[/COLOR][/SIZE][/COLOR][/SIZE][/I][/B][SIZE=2] +[/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"Hallo, "[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] + ChatColor.[/SIZE][B][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]GOLD[/COLOR][/SIZE][/COLOR][/SIZE][/I][/B][SIZE=2] + [/SIZE][SIZE=2][COLOR=#6a3e3e][SIZE=2][COLOR=#6a3e3e]p[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] + ChatColor.[/SIZE][B][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]AQUA[/COLOR][/SIZE][/COLOR][/SIZE][/I][/B][SIZE=2] + [/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]". Schön das du dich entschieden hast auf unserem Servernetzwerk zu spielen. Mache /info für mehr Informationen."[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]);[/SIZE]
    63. [SIZE=2]
    64.     }    
    65.  
    66.    
    67.  
    68.    
    69. [/SIZE][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]//quit message[/COLOR][/SIZE][/COLOR][/SIZE]
    70. [SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]
    71. [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]    
    72. [/SIZE][SIZE=2][COLOR=#646464][SIZE=2][COLOR=#646464]@EventHandler[/COLOR][/SIZE][/COLOR][/SIZE]
    73. [SIZE=2][COLOR=#646464][SIZE=2][COLOR=#646464]
    74. [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]    
    75. [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]public[/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]void[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] quit(PlayerQuitEvent [/SIZE][SIZE=2][COLOR=#6a3e3e][SIZE=2][COLOR=#6a3e3e]qe[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]){[/SIZE]
    76. [SIZE=2]
    77.        
    78.  
    79.         Player
    80. [/SIZE][SIZE=2][COLOR=#6a3e3e][SIZE=2][COLOR=#6a3e3e]p[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] = [/SIZE][SIZE=2][COLOR=#6a3e3e][SIZE=2][COLOR=#6a3e3e]qe[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].getPlayer();[/SIZE]
    81. [SIZE=2]
    82.        
    83. [/SIZE][SIZE=2][COLOR=#6a3e3e][SIZE=2][COLOR=#6a3e3e]qe[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].setQuitMessage(ChatColor.[/SIZE][B][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]GREEN[/COLOR][/SIZE][/COLOR][/SIZE][/I][/B][SIZE=2] + [/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"[Info] "[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] + ChatColor.[/SIZE][B][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]AQUA[/COLOR][/SIZE][/COLOR][/SIZE][/I][/B][SIZE=2] + [/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"Der/Die Spieler/-in "[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] + ChatColor.[/SIZE][B][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]GOLD[/COLOR][/SIZE][/COLOR][/SIZE][/I][/B][SIZE=2] + [/SIZE][SIZE=2][COLOR=#6a3e3e][SIZE=2][COLOR=#6a3e3e]p[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] + ChatColor.[/SIZE][B][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]AQUA[/COLOR][/SIZE][/COLOR][/SIZE][/I][/B][SIZE=2] + [/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"hat das Servernetzwerk "[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] + ChatColor.[/SIZE][B][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]RED[/COLOR][/SIZE][/COLOR][/SIZE][/I][/B][SIZE=2] + [/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"verlassen."[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]);[/SIZE]
    84. [SIZE=2]
    85.     }
    86.  
    87.    
    88.  
    89.    
    90. [/SIZE][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]//death message[/COLOR][/SIZE][/COLOR][/SIZE]
    91. [SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]
    92. [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]    
    93. [/SIZE][SIZE=2][COLOR=#646464][SIZE=2][COLOR=#646464]@EventHandler[/COLOR][/SIZE][/COLOR][/SIZE]
    94. [SIZE=2][COLOR=#646464][SIZE=2][COLOR=#646464]
    95. [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]    
    96. [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]public[/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]void[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] death(PlayerDeathEvent [/SIZE][SIZE=2][COLOR=#6a3e3e][SIZE=2][COLOR=#6a3e3e]de[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]){[/SIZE]
    97. [SIZE=2]
    98.        
    99.  
    100.         Player
    101. [/SIZE][SIZE=2][COLOR=#6a3e3e][SIZE=2][COLOR=#6a3e3e]p[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] = [/SIZE][SIZE=2][COLOR=#6a3e3e][SIZE=2][COLOR=#6a3e3e]de[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].getEntity();[/SIZE]
    102. [SIZE=2]
    103.        
    104. [/SIZE][SIZE=2][COLOR=#6a3e3e][SIZE=2][COLOR=#6a3e3e]de[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].setDeathMessage(ChatColor.[/SIZE][B][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]GREEN[/COLOR][/SIZE][/COLOR][/SIZE][/I][/B][SIZE=2] + [/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"[Info]"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] + ChatColor.[/SIZE][B][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]WHITE[/COLOR][/SIZE][/COLOR][/SIZE][/I][/B][SIZE=2] + [/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"Der/Die Spieler/-in "[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] + [/SIZE][SIZE=2][COLOR=#6a3e3e][SIZE=2][COLOR=#6a3e3e]p[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] +[/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"wurde ins Krankenhaus gebracht."[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]);[/SIZE]
    105. [SIZE=2]
    106.     }
    107.  
    108. }
    109. [/SIZE]
    Sorry, für die Formatierung des Codes, beim kopieren aus Eclipse übernimmt der den irgendwie nicht richtig.
    Falls noch weitere Informationen zum fixen benötigt werden, bitte melden.
     
    #1
  2. Paulomart
    Offline

    Paulomart

    Registriert seit:
    3. November 2013
    Beiträge:
    148
    Ort:
    C:/Eclipse/Workspace/
    Minecraft:
    Paulomart
    Du musst

    Code (Text):
    1. Player.getName() oder Player.getDisplayName()
    verwenden
     
    #2
  3. majo2702
    Offline

    majo2702

    Registriert seit:
    11. Juni 2012
    Beiträge:
    48
    Entschuldige, aber ich verstehe nicht wie man das da einfügen soll.
     
    #3
  4. Elrontur
    Offline

    Elrontur Ehem. Teammitglied

    Registriert seit:
    5. April 2013
    Beiträge:
    138
    Minecraft:
    Elrontur
    Code (Text):
    1. [...] + ChatColor.GOLD + p.getName() + [...]
    Oder wahlweise eben p.getDisplayName() ...
     
    #4
  5. majo2702
    Offline

    majo2702

    Registriert seit:
    11. Juni 2012
    Beiträge:
    48
    Vielen Dank, der Thread kann geschlossen werden.
     
    #5
Status des Themas:
Es sind keine weiteren Antworten möglich.