Solved Advanced - How to get scoreboard statistics?

Discussion in 'Plugin Development' started by TheTinySpider, Jul 1, 2014.

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

    TheTinySpider

    I 've been trying to find a way to get the values of scoreboard stat like you use them with command blocks.
    Example: "stat.fallOneCm" and "stat.mineBlock.stone"

    This probaly required NMS and I'm fine with that.
    After some research I found these classes that use some of statistic stuff:

    List for getting Statistic classes:
    https://github.com/Bukkit/mc-dev/blob/master/net/minecraft/server/StatisticList.java

    Statistic class:
    https://github.com/Bukkit/mc-dev/blob/master/net/minecraft/server/Statistic.java

    And something that has todo with server and stats:
    https://github.com/Bukkit/mc-dev/blob/master/net/minecraft/server/ServerStatisticManager.java

    I hope some of you advanced coders can help me out with this!
     
  2. Offline

    xTigerRebornx

  3. Offline

    MoeMix

    TheTinySpider
    I'm not entirely sure about the example you provided above however, I do know how to mess with the NMS part.

    To use NMS you have to override the original class so create a new class and have it extend the class provided in the original NMS class. Then you have to create a constructor that simply passes in the same variable as in the normal class. This constructor contains a super so super(whateverclass);

    Now the hard part is actually coding since NMS is so obfuscated. You're going to have to mess with the methods yourself since I, personally, have never touched any of the classes you've provided in the OP. Hope I kinda helped getting you started on overriding the original NMS code :p
     
  4. Offline

    Treblue

    I don't think you need to mess with NMS at all. Bukkit does the dirty work all for you:
    Code:java
    1. player.getStatistic(Statistic.FALL_ONE_CM);
    2. player.getStatistic(Statistic.MINE_BLOCK, Material.STONE);

    Hope this helps :D.
     
  5. Offline

    TheTinySpider

    Treblue xTigerRebornx Yeah I found out that Bukkit already did a implementation for the statistics. The reason I thought this was required was because I've barely seen anyone about this subject, also I haven't used Bukkit in quite a while ;)
     
Thread Status:
Not open for further replies.

Share This Page