Scoreboard Fehler!!!?

Dieses Thema im Forum "Programmierung" wurde erstellt von Calib0ur, 25. April 2014.

  1. Calib0ur
    Offline

    Calib0ur Gesperrt

    Registriert seit:
    16. November 2013
    Beiträge:
    72
    Minecraft:
    CubeyHD
    Hey,
    Mein Fehler ist der
    "void is an invalid type for the variable onJoin"???
    Hier mein Code

    Code (Text):
    1.  
    2.  
    3. package me.cubeyhd.scoreboard;
    4.  
    5. import java.util.Calendar;
    6.  
    7. import org.bukkit.Bukkit;
    8. import org.bukkit.command.Command;
    9. import org.bukkit.command.CommandSender;
    10. import org.bukkit.entity.Player;
    11. import org.bukkit.event.EventHandler;
    12. import org.bukkit.event.Listener;
    13. import org.bukkit.event.player.PlayerJoinEvent;
    14. import org.bukkit.plugin.java.JavaPlugin;
    15. import org.bukkit.potion.PotionEffect;
    16. import org.bukkit.potion.PotionEffectType;
    17. import org.bukkit.scoreboard.DisplaySlot;
    18. import org.bukkit.scoreboard.Objective;
    19. import org.bukkit.scoreboard.Scoreboard;
    20.  
    21. public class scoreboard extends JavaPlugin implements Listener {
    22.     public void onEnable() {
    23.        
    24.         getServer().getPluginManager().registerEvents(this, this);
    25.        
    26.         System.out.println("[Scoreboard]Plugin gestartet");
    27.     }
    28.     public void onDisable() {
    29.             System.out.println("[Scoreboard]Plugin gestoppt");
    30.         }
    31.         public boolean onCommand(CommandSender sender, Command cmd, String cmdLabel, String[] args) {
    32.            
    33.             Player p = (Player)sender;
    34.             if (cmd.getName().equalsIgnoreCase("bier")) {
    35.                 if(p.hasPermission("bier.bier")) {
    36.                     if (args.length == 0) {
    37.                       p.sendMessage("§a§Guten Durst");
    38.                       p.addPotionEffect(new PotionEffect(PotionEffectType.JUMP,400,1));
    39.                       p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED,400,2));
    40.                       p.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION,440,2));
    41.                     }
    42.     @EventHandler
    43.     public void onJoin(PlayerJoinEvent e) {        //Fehler
    44.         Scoreboard board = Bukkit.getScoreboardManager().getNewScoreboard();
    45.         Objective obj = board.getObjective("Datum");
    46.         if (obj == null) {
    47.             obj = board.registerNewObjective("Datum","dummy");
    48.         }
    49.         obj.setDisplaySlot(DisplaySlot.SIDEBAR);
    50.         obj.setDisplayName("§6Dates");
    51.        
    52.         Calendar cal = Calendar.getInstance();
    53.         obj.getScore(Bukkit.getOfflinePlayer("§2Jahr")).setScore(cal.get(Calendar.YEAR));
    54.         obj.getScore(Bukkit.getOfflinePlayer("§2Monat")).setScore(cal.get(Calendar.MONTH));
    55.         obj.getScore(Bukkit.getOfflinePlayer("§2Tag")).setScore(cal.get(Calendar.DAY_OF_MONTH));
    56.        
    57.         e.getPlayer().setScoreboard(board);
    58.     }
    59.                 }
    60.     return true;
    61.     } else{
    62.     return false;
    63. }
    64. }
    65. }
    66.  
    67.  
    Hoffe ihr könnt mir hefen :D
     
    #1
  2. MiCrJonas
    Offline

    MiCrJonas

    Registriert seit:
    29. Oktober 2012
    Beiträge:
    1.069
    Eine Methode mit void gibt nichts zurück. Also mach das "return false" und "return true" weg!
     
    #2