Need help for a scoreboard !

Discussion in 'Plugin Development' started by xFoundation, Jun 12, 2015.

Thread Status:
Not open for further replies.
  1. Offline


    Hey everyone,

    Today, i'm developping a new custom minigame bukkit plugin

    I want to create a custom scoreboard with stats (Kills Coins and shot fired)

    That is good now but there are always erros when i code an @EventHandler to add +1.

    I want to add +1 kills to the killer when he kill a HOSTILE mob.

    That is the code :

    package fr.hugo.cks;
    import java.util.HashMap;
    import org.bukkit.Bukkit;
    import org.bukkit.ChatColor;
    import org.bukkit.OfflinePlayer;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.player.PlayerJoinEvent;
    import org.bukkit.scoreboard.DisplaySlot;
    import org.bukkit.scoreboard.Objective;
    import org.bukkit.scoreboard.Score;
    import org.bukkit.scoreboard.Scoreboard;
    public class Main extends JavaPlugin implements Listener {
        private Scoreboard board;
        private Objective o;
        private HashMap<OfflinePlayer, Score> kills = new HashMap<OfflinePlayer, Score>();
        public void onEnable() {
                Bukkit.getServer().getPluginManager().registerEvents(this, this);
                board = Bukkit.getServer().getScoreboardManager().getNewScoreboard();
                o = board.registerNewObjective("test", "dummy");
                o.setDisplayName(ChatColor.WHITE + "Stats");
                Score score = o.getScore(ChatColor.WHITE + "Kills:");
                Score score1 = o.getScore(ChatColor.WHITE + "Coins:");
                Score score11 = o.getScore(ChatColor.WHITE + "Shots:");
        public void onPlayerJoin(PlayerJoinEvent playerJoinEvent) {
            Player eventPlayer = playerJoinEvent.getPlayer();
  2. Offline


    You need a scoreboard register a scoreboard for every player apart... There is also a tutorial on this in the resource section
  3. Offline


    What code i must add and where please ?
Thread Status:
Not open for further replies.

Share This Page