Getting EXP level to be displayed in a scoreboard

Discussion in 'Plugin Development' started by Wirexin, Jan 8, 2020.

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


    I am currently trying to make a plugin that displays players' EXP level (minecraft level) right under their nametags (the names appearing on top of their heads) but I am a total beginner in plugin making and I know almost nothing about the syntax.
    I am currently trying to get the players' level data to be displayed in the scoreboard but I don't know how to.

    Here is the code I have so far:

        public void onEnable() {
            s = Bukkit.getScoreboardManager().getMainScoreboard();
            Bukkit.getPluginManager().registerEvents(this, (Plugin) this);
        public void onPlayerJoin(PlayerJoinEvent e) {
            e.getPlayer().sendMessage("HELLO THERE.");
        public void registerLevelBar() {
            //Player p = e.getPlayer();
            //int plvl = p.getLevel();
            if (s.getObjective("plvl") != null) {
            Objective o = s.registerNewObjective("plvl", "plvl");
            o.setDisplayName(ChatColor.AQUA + " lv");

    Any thoughts?
  2. Offline


    @Wirexin What are you having problems with?
  3. Offline


    The point is, it doesn't work at all. Nothing shows up and I am not %100 sure what I did wrong I need some handholding level guidance here
  4. Offline


    @Wirexin I haven't worked with scoreboards a lot but, don't you need to set the scoreboard using Player#setScoreboard(Scoreboard)?
  5. Offline


    How do I even implement this ? Also are you sure I got the level variable right ? I think the issue could be because it cannot reach the level variable from the player.
Thread Status:
Not open for further replies.

Share This Page