Economy (Money) stats on scoreboard

Discussion in 'Plugin Development' started by AppleMen, Oct 21, 2013.

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

    AppleMen

    Edit: I got this error though:
    void is an invalid type for the variable onPlayerJoin

    Like this?
    http://pastebin.com/EpmnhsDQ
     
  2. Offline

    Minecrell

    No.. :p
    Put the onPlayerJoin method above the setupScoreboard method and put this there where you have the PlayerJoinEvent method now:
    Code:java
    1. Bukkit.getPluginManager().registerEvents(this, this);
     
  3. Offline

    AppleMen

  4. Offline

    Minecrell

    AppleMen
    Where did you add Bukkit.getPluginManager().registerEvents(this, this);?
     
  5. Offline

    AppleMen

    Code:java
    1. @Override
    2. public void onEnable() {
    3. instance = this;
    4.  
    5. deleteIslandWorlds();
    6.  
    7. Bukkit.getPluginManager().registerEvents(this, this);
    8.  
    9. getConfig().options().copyDefaults(true);
    10. saveDefaultConfig();
    11. reloadConfig();


    Wrong… i think...

    Like this?

    Code:java
    1. private void setupScoreboard(Player player) {
    2. Bukkit.getPluginManager().registerEvents(this, this);
    3. // Create the new Scoreboard
    4. Scoreboard scoreboard = Bukkit.getScoreboardManager().getNewScoreboard();
    5. Objective objective = scoreboard.registerNewObjective("skywars", "dummy");
    6.  
    7. objective.setDisplayName("\2476\247lSkyWars \247a\247lServer");
    8. objective.setDisplaySlot(DisplaySlot.SIDEBAR);
    9.  
    10. player.setScoreboard(scoreboard);
    11. updateScoreboard(player);
    12. }


    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 5, 2016
  6. Offline

    Minecrell

  7. Offline

    AppleMen

    So this?

    Code:java
    1. @Override
    2. public void onEnable() {
    3. instance = this;
    4.  
    5. deleteIslandWorlds();
    6.  
    7. Bukkit.getPluginManager().registerEvents(this, this);
    8.  
    9. getConfig().options().copyDefaults(true);
    10. saveDefaultConfig();
    11. reloadConfig();
    12.  
    13. new Messaging(this);
    14.  
    15. getCommand("skywars").setExecutor(new MainCommand());
    16. getCommand("global").setExecutor(new CommandExecutor() {
     
  8. Offline

    Minecrell

  9. Offline

    AppleMen

    btw, other problem too now Just saw it. Where do i need to change that too?

    http://pastebin.com/z40J2Php

    Code:java
    1. SkyWars.get().updateScoreboard();

    The method updateScoreboard(Player) in the type SkyWars is not applicable for the arguments ()
     
  10. Offline

    Minecrell

    AppleMen
    Just remove this line, you've added it in the main class. ;)
     
  11. Offline

    AppleMen

    You know it is the PlayerListener.class?
     
  12. Offline

    Minecrell

    AppleMen
    Yep... You can also remove the onPlayerJoin method in the main class again, and change SkyWars.get().updateScoreboard(); to SkyWars.get().updateScoreboard(event.getPlayer());
     
  13. Offline

    AppleMen

    :/, It doesn't show up

    [​IMG]
     
  14. Offline

    Minecrell

    AppleMen
    Your complete code now? :|
     
  15. Offline

    AppleMen

  16. Offline

    Minecrell

    AppleMen
    Sorry, it should work actually :/ Do you have an error in the console?
     
  17. Offline

    AppleMen

    Yeah
    Code:
    15:40:30 [SEVERE] Could not pass event PlayerJoinEvent to SkyWars v2/1
    org.bukkit.event.EventException
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:427)
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62)
        at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:477)
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:462)
        at net.minecraft.server.v1_6_R3.PlayerList.c(PlayerList.java:207)
        at net.minecraft.server.v1_6_R3.PlayerList.a(PlayerList.java:103)
        at net.minecraft.server.v1_6_R3.PendingConnection.e(PendingConnection.java:131)
        at net.minecraft.server.v1_6_R3.PendingConnection.d(PendingConnection.java:43)
        at net.minecraft.server.v1_6_R3.DedicatedServerConnectionThread.a(DedicatedServerConnectionThread.java:41)
        at net.minecraft.server.v1_6_R3.DedicatedServerConnection.b(SourceFile:29)
        at net.minecraft.server.v1_6_R3.MinecraftServer.t(MinecraftServer.java:592)
        at net.minecraft.server.v1_6_R3.DedicatedServer.t(DedicatedServer.java:227)
        at net.minecraft.server.v1_6_R3.MinecraftServer.s(MinecraftServer.java:488)
        at net.minecraft.server.v1_6_R3.MinecraftServer.run(MinecraftServer.java:421)
        at net.minecraft.server.v1_6_R3.ThreadServerApplication.run(SourceFile:583)
    Caused by: java.lang.NullPointerException
        at vc.pvp.skywars.SkyWars.updateScoreboard(SkyWars.java:183)
        at vc.pvp.skywars.SkyWars.setupScoreboard(SkyWars.java:174)
        at vc.pvp.skywars.SkyWars.onPlayerJoin(SkyWars.java:162)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:425)
        ... 14 more
    15:40:35 [INFO] [WorldEdit] Using inbuilt NmsBlock for t
     
  18. Offline

    Minecrell

    AppleMen
    Do you have an economy plugin installed?
     
  19. Offline

    AppleMen

    No, I only have Essentials, Vault, WhatIsIt, WorldEdit
     
  20. Offline

    Minecrell

    AppleMen
    Hmm, I don't know what's wrong :(
     
Thread Status:
Not open for further replies.

Share This Page