Op Prison Scoreboard

Discussion in 'Archived: Plugin Requests' started by Yoshlind, Jul 1, 2014.

  1. Offline

    Yoshlind

    I'd like a Scoreboard for my upcoming Op Prison server, I will explain what I'd like the Plugin to four fill.

    Permissions: The Plugin won't have any Permissions, everything will be controlled by a Runnable.

    Function: I'd like the Plugin to display the Player's name along with their Prefix as the Objective Title. The scoreboard will feature several simple features that anyone on the Server is able to use, The first Score will be the Player's Balance & the Second and Final Score will display how much is required for the Player to reach their next Rank.

    I'd like this Plugin to be complete as soon as possible, however I have no problem waiting since I respect that people are spending their own time to four fill the Plugin that I requested.
     
  2. Offline

    simolus3

    Yoshlind I could do that. But how do I find out about how much is required for the next level? Do you mean the normal minecraft xp-points or what plugin are your using for economy/ranks?
     
  3. Offline

    GalaxyPrisonMc

    simolus3 he means like prison Rankup by @mazentheamazing and if you ask him he will give you the API for it !!
     
  4. Offline

    Onlineids

  5. Offline

    Yoshlind

    I need it the Required Rank Up price to work of PaidRanks, if that's possible :)

    simolus3

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

    BearstudioMC

    Use SCOREBOARDSTATS
     
  7. Offline

    kxpeep93

    BearstudioMC scoreboard stats don't have what he wants and Yoshlind I don't know if paid ranks has the API needed to do this , prison Rankup is one of the best rank up plugins for a prison server so much that it is the only one I will use on my server. It has a lot of features That some plugins don't have
     
  8. Offline

    Yoshlind

    kxpeep93 I agree, Prison RankUp is great! I'd be using it however every time I attempt to load it I get a really Error.
     
  9. Online

    timtower Administrator Administrator Moderator

  10. Offline

    Yoshlind

    timtower I finally managed to fix the Error, now I can use PrisonRankUp if it's easier for whoever choses to develop this Plugin for me :)

    If someone links be to a documentation of the API I'm possible able to create this myself :)

    timtower

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 9, 2016
  11. Online

    timtower Administrator Administrator Moderator

    Yoshlind Yeah, not gonna search for an api that I won't use myself
     
  12. Offline

    Onlineids

  13. Offline

    kxpeep93

    Yoshlind make sure you use the proper imports for it import his main method static so it can be accessible in code !
     
  14. Offline

    Onlineids

  15. Offline

    Yoshlind

  16. Offline

    simolus3

    If the tutorial was right, this should work...
    Code:java
    1. double moneyToNextRank = economy.getBalance(Player) - rank.getPrice();

    for the scoreboard
    Code:java
    1. public void refreshScoreboard() {
    2. for (Player ap : Bukkit.getOnlinePlayers()) {
    3. Scoreboard s = Bukkit.getScoreboardManager().getNewScoreboard();
    4. Objective o = s.registerNewObjective("money", "dummy");
    5. o.setDisplaySlot(DisplaySlot.SIDEBAR);
    6. o.setDisplayName("Balance");
    7. o.getScore("Money").setScore(economy.getBalance(ap));
    8. o.getScore("To next rank").setScore(economy.getBalance(ap) - rank.getPrice());
    9. ap.setScoreboard(s);
    10. }
     
  17. Offline

    Onlineids

    simolus3 You shouldnt refresh scoreboards like that it will crash large servers, update individual stats
     
  18. Offline

    Yoshlind

    [20:20:58 ERROR]: Could not load 'plugins/PrisonRankup_v2.6.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidPluginException: java.lang.UnsupportedClassVersionError: net/craftservers/prisonrankup/PR : Unsupported major.minor version 51.0
    at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:131) ~[minecraft_server.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:328) ~[minecraft_server.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:251) [minecraft_server.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    at org.bukkit.craftbukkit.v1_7_R3.CraftServer.loadPlugins(CraftServer.java:355) [minecraft_server.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    at org.bukkit.craftbukkit.v1_7_R3.CraftServer.reload(CraftServer.java:797) [minecraft_server.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    at org.bukkit.Bukkit.reload(Bukkit.java:288) [minecraft_server.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:23) [minecraft_server.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:180) [minecraft_server.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    at org.bukkit.craftbukkit.v1_7_R3.CraftServer.dispatchCommand(CraftServer.java:701) [minecraft_server.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    at org.bukkit.craftbukkit.v1_7_R3.CraftServer.dispatchServerCommand(CraftServer.java:688) [minecraft_server.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    at net.minecraft.server.v1_7_R3.DedicatedServer.aB(DedicatedServer.java:296) [minecraft_server.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    at net.minecraft.server.v1_7_R3.DedicatedServer.v(DedicatedServer.java:261) [minecraft_server.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    at net.minecraft.server.v1_7_R3.MinecraftServer.u(MinecraftServer.java:558) [minecraft_server.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    at net.minecraft.server.v1_7_R3.MinecraftServer.run(MinecraftServer.java:469) [minecraft_server.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    at net.minecraft.server.v1_7_R3.ThreadServerApplication.run(SourceFile:628) [minecraft_server.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    Caused by: java.lang.UnsupportedClassVersionError: net/craftservers/prisonrankup/PR : Unsupported major.minor version 51.0
    at java.lang.ClassLoader.defineClass1(Native Method) ~[?:1.6.0_65]
    at java.lang.ClassLoader.defineClassCond(ClassLoader.java:637) ~[?:1.6.0_65]
    at java.lang.ClassLoader.defineClass(ClassLoader.java:621) ~[?:1.6.0_65]
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) ~[?:1.6.0_65]
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:283) ~[?:1.6.0_65]
    at java.net.URLClassLoader.access$000(URLClassLoader.java:58) ~[?:1.6.0_65]
    at java.net.URLClassLoader$1.run(URLClassLoader.java:197) ~[?:1.6.0_65]
    at java.security.AccessController.doPrivileged(Native Method) ~[?:1.6.0_65]
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190) ~[?:1.6.0_65]
    at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:77) ~[minecraft_server.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:62) ~[minecraft_server.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306) ~[?:1.6.0_65]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247) ~[?:1.6.0_65]
    at java.lang.Class.forName0(Native Method) ~[?:1.6.0_65]
    at java.lang.Class.forName(Class.java:249) ~[?:1.6.0_65]
    at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:40) ~[minecraft_server.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]
    at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:127) ~[minecraft_server.jar:git-Bukkit-1.7.9-R0.1-10-g8688bd4-b3092jnks]

    ... 14 more



    @simolous3 When I updated my PrisonRankup I got the Error above, do you know how to solve it?

    simolus3 Onlineids

    simolus3 Rank can't be a resolved type, I used the import importstatic net.craftservers.prisonrankup.PrisonRankup.*;


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

    kxpeep93

    Yoshlind learn basic java before coding a plugin and by the way it's not importstatic it's import static
     
  20. Online

    timtower Administrator Administrator Moderator

    Yoshlind That is an outdated java error
     
  21. Offline

    mazentheamazin

  22. Offline

    kxpeep93

  23. Offline

    mazentheamazin

    kxpeep93
    I'd give him the benefit of the doubt as to what he said earlier without the spacing was a simple error with applying syntax to his text.

    <3 :')
     
  24. Offline

    kxpeep93

  25. Offline

    Yoshlind

    Code:java
    1. package me.Endermite.Test;
    2.  
    3. import java.io.File;
    4. import java.io.IOException;
    5.  
    6. import org.bukkit.Bukkit;
    7. import org.bukkit.command.Command;
    8. import org.bukkit.command.CommandSender;
    9. import org.bukkit.configuration.file.YamlConfiguration;
    10. import org.bukkit.entity.Player;
    11. import org.bukkit.plugin.java.JavaPlugin;
    12.  
    13. public class Main extends JavaPlugin {
    14.  
    15. @Override
    16. public void onEnable() {
    17. getPrisonRankup();
    18. getPrisonRankupData();
    19. Bukkit.getLogger().info("[Test] Succesfully enabled.");
    20. super.onEnable();
    21. }
    22.  
    23. @Override
    24. public void onDisable() {
    25. Bukkit.getLogger().info("[Test] Suffesfuly disabled.");
    26. super.onDisable();
    27. }
    28.  
    29. public void getPrisonRankup() {
    30. if (!(Bukkit.getPluginManager().getPlugin("PrisonRankup").isEnabled())) {
    31. Bukkit.getLogger().info("[Test] Can't find 'PrisonRankup', Disabling.");
    32. }
    33. else {
    34. Bukkit.getLogger().info("[Test] Found 'PrisonRankup', continuing.");
    35. }
    36. }
    37.  
    38. public void saveData(YamlConfiguration data, File file) {
    39. try {
    40. data.save(file);
    41. }
    42. catch (IOException iOException) {
    43. Bukkit.shutdown();
    44. }
    45. }
    46.  
    47. public void getPrisonRankupData() {
    48. File file = new File(Bukkit.getPluginManager().getPlugin("PrisonRankup").getDataFolder(), "data.yml");
    49. YamlConfiguration data = YamlConfiguration.loadConfiguration(file);
    50.  
    51. file = new File(this.getDataFolder(), "data.yml");
    52. try {
    53. data.save(file);
    54. }
    55. catch (IOException iOException) {
    56. Bukkit.shutdown();
    57. }
    58. }
    59.  
    60. public YamlConfiguration getData() {
    61. File file = new File(this.getDataFolder(), "data.yml");
    62. YamlConfiguration data = YamlConfiguration.loadConfiguration(file);
    63.  
    64. return data;
    65. }
    66.  
    67. @Override
    68. public boolean onCommand(CommandSender sender, Command command,
    69. String label, String[] args) {
    70. if (command.getName().equalsIgnoreCase("rank")) {
    71. if (sender instanceof Player) {
    72. Player player = (Player) sender;
    73. if (player.hasPermission("Test.Rank")) {
    74. player.sendMessage(getData().get("users." + player.getUniqueId() + ".group") + " ");
    75. }
    76. }
    77. }
    78. return super.onCommand(sender, command, label, args);
    79. }
    80.  
    81. }


    Can someone please tell me why this is sending them the Message 'Null' even tho, in the Data File. They're the Rank that the actually are.


    Here's what's been stored in the Data file.

    users:
    12b246185b5f4125ba0d6555385f7236:
    group: P
    3c09657448004f909c8e700b7055a6f1:
    group: I
    e0c7278a9dc248868de819474ad5c7f5:
    group: K
    a052ca54810047509a5310061294d74c:
    group: Z
    3f5b1df24bc04a33b349af849979ef14:
    group: H
    fcd3eeed07774fb9ba01f387a916d252:
    group: F
    f9e735db7b2545d9b2df09097d1a3089:
    group: B

    kxpeep93 mazentheamazin

    timtower

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 9, 2016
  26. Online

    timtower Administrator Administrator Moderator

    Yoshlind Try to use the edit button instead of triple posting please.
    Server shutdown on an error? Bit overkill if you ask me.
     
  27. Offline

    mazentheamazin

    Yoshlind
    You really should be using the API...

    Code:java
    1. //Getting the players current rank
    2. PrisonRankup.getPlayer(name).getCurrentRank()
    3.  
    4. //Get the ranks name (string representation)
    5. PrisonRankup.getPlayer(name).getCurrentRank().getName()
     
  28. Offline

    Onlineids

    Yoshlind This should really be moved to plugin development
     
    timtower likes this.
  29. Offline

    kxpeep93

    Yoshlind this is what your code should look like
    Code:java
    1.  
    2. import net.craftservers.prisonrankup.PrisonRankup;
    3.  
    4. import org.bukkit.Bukkit;
    5. import org.bukkit.ChatColor;
    6. import org.bukkit.command.Command;
    7. import org.bukkit.command.CommandSender;
    8. import org.bukkit.entity.Player;
    9. import org.bukkit.plugin.java.JavaPlugin;
    10.  
    11. public class Main extends JavaPlugin {
    12.  
    13. public void onEnable() {
    14. Bukkit.getServer().getConsoleSender().sendMessage(ChatColor.GREEN + "test enabled");
    15. }
    16.  
    17. public void onDisable() {
    18. Bukkit.getServer().getConsoleSender().sendMessage(ChatColor.GREEN + "test disabled");
    19. }
    20.  
    21. @Override
    22. public boolean onCommand(CommandSender sender, Command command,
    23. String label, String[] args) {
    24. if (!(sender instanceof Player)) {
    25. sender.sendMessage(ChatColor.RED + "this command is for players only");
    26. return true;
    27. }
    28. if(label.equalsIgnoreCase("rank")) {
    29. Player player = (Player) sender;
    30. if(player.hasPermission("Test.Rank")) {
    31. String name = player.getName();
    32. player.sendMessage("you current rank is " + PrisonRankup.getPlayer(name).getCurrentRank().getName());
    33. }else{
    34. player.sendMessage(ChatColor.RED + "you don't have permission to perform this command");
    35. }
    36. return true;
    37. }
    38. return true;
    39. }
    40. }
     

Share This Page