PrisonScoreboard

Discussion in 'Plugin Development' started by GalaxyPrisonMc, Apr 23, 2014.

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

    GalaxyPrisonMc

    im making a custome prison socreboard plugin and it wont display the score board there are no errors in the console i have no clue why it will not display the score board i want it to look like this

    here it is so far
    Code:
    package me.kxpeep93.prisonscoreboard;
    [IMG]http://i.gyazo.com/a4e9c52905910512d06b2aa0bac85478.png[/IMG]
    import org.bukkit.Bukkit;
    import org.bukkit.command.defaults.ScoreboardCommand;
    import org.bukkit.entity.Player;
    import org.bukkit.plugin.PluginDescriptionFile;
    import org.bukkit.plugin.java.JavaPlugin;
    import org.bukkit.scoreboard.DisplaySlot;
    import org.bukkit.scoreboard.Objective;
    import org.bukkit.scoreboard.Score;
    import org.bukkit.scoreboard.Scoreboard;
    import org.bukkit.scoreboard.ScoreboardManager;
     
    public class prisonscoreboard  extends JavaPlugin{
     
        public static Vault getVault(){
            return PrisonRankup.getVault;
        }
     
        public void onEnable()
        {
            PluginDescriptionFile pdfFile = getDescription();
            this.getLogger().info(pdfFile.getName() + " version: " + pdfFile.getVersion() + " has been enabled!");
        }
     
        public void onDisable()
        {
            PluginDescriptionFile pdfFile = getDescription();
            this.getLogger().info(pdfFile.getName() + " version: " + pdfFile.getVersion() + " has been disabled!"); 
        }
     
        public void onScoreBoardEvent() {
            ScoreboardManager manager = Bukkit.getScoreboardManager();
            Scoreboard board = manager.getNewScoreboard();
         
            Objective objective = board.registerNewObjective("test", "econ");
            objective.setDisplaySlot(DisplaySlot.SIDEBAR);
            objective.setDisplayName("Alcatraz Stats");
         
            Score score = objective.getScore(Bukkit.getPlayer("Next rank"));
            score.setScore(PrisonRankup().getRankPrice);
            player.setScoreboard(yourScoreboard);
        }
        public void updateEco(Player player) {
            Score s = get(player);
            if (s !=null) {
                Economy.get().updateScores(player);
                ScoreboardCommand.addScore("Needed To Rank",  (pr.getNext(player) == 0 ? 0 : (pr.getNext(player) - Economy.get().getBalance(player))));
                ScoreboardCommand.addScore("Next rank price", pr.getNext(player)); 
         
            }
        }
    }
     
    
    if you have any suggestions on this please let me know thanks
    ~Kxpeep93

    here is a picture of what i want it to look like also i cant seem to find out how to get the amount of money needed
    for players [​IMG]

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

    mazentheamazin

    GalaxyPrisonMc
    You're not using the PrisonRankup API correctly, even with the way you were doing it, it would not work with v2.0+

    GalaxyPrisonMc
    Instead of me pointing out your faults, let me help you out. So, first download this version of PrisonRankup, this is the latest version, and will work with all future builds.
    First, lets import all the methods statically in the PrisonRankup class:
    Code:java
    1. import static net.craftservers.PrisonRankup.*;

    Here are some basic methods you may be using:
    Code:java
    1. //Rank API Features (As of v2.1):
    2.  
    3. // Get a rank
    4. Rank rank = getRank("rank_name");
    5. // Get the price of a rank as a double
    6. double price = rank.getPrice();
    7. // Get the price as a String
    8. String priceString = rank.getPriceString();
    9.  
    10. //User API Features (As of v2.1):
    11.  
    12. // Get the PrisonRankup Player
    13. PRPlayer prp = getPlayer("playerName");
    14.  
    15. // Get Permission Rank (Taking from Vault directly)
    16. String s = prp.getPermissionRank();
    17.  
    18. // Get nextRank
    19. Rank nextRank = prp.getNextRank();
    20.  
    21. // Get UUID (Easy way as stored onJoin) (Does not contain dashes)
    22. String s = prp.getStringUUID();
    23.  
    24. // Get his current rank
    25. Rank rank = prp.getCurrentRank();
    26.  
    27. // Force the player to rankup, taking money when it is performed
    28. prp.rankup();
    29.  
    30. // Set the players rank
    31. prp.setRank(getRank("name"));


    GalaxyPrisonMc
    Trading plugins for money is not allowed on the Bukkit Forums. By the way, if you're new to Java, you should learn it before going into the Bukkit API. If you want your answer, its to subtract the amount of money they have (through vault), by the price of the next rank.

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

    GalaxyPrisonMc

    ok and i didn't know that it was against the rules

    @mazentheamazin just how do you subtract it ?

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

    mazentheamazin

  5. Offline

    JordyPwner

    mazentheamazin can you help me? i have a scoreboard plugin but its show: NextRankPrice: 50000 but how can i let it show: 50k or 500M or 5B or 1T

    1k= $1000 m=Million b=Billion t=Trillion

    I use vault and prisonrankup
     
Thread Status:
Not open for further replies.

Share This Page