Solved Vault API PLEASE Help [WEIRD] [NO IDEA]

Discussion in 'Plugin Development' started by jbman223, Dec 31, 2012.

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

    jbman223

    IF YOU HAVE ANY IDEA WHAT SO EVER, PLEASE HELP! 144 PEOPLE HAVE SEEN THIS, ONE HAS POSTED.

    I am having some trouble with the Vault API. There is no error or anything, the Plugin starts up, I see the default enabled message (11:32:54 [INFO] [JBRanks] Enabling JBRanks v2.0) But that is it. After that, just nothing. No errors, none of the other console logs from the plugin. The commands don't work, it is just weird. I am using the latest version of iConomy, Vault, PermissionsEx and Bukkit. Any help would be appreciated. Here is the code:

    Code:java
    1.  
    2. package test;
    3.  
    4. import java.util.ArrayList;
    5.  
    6. import net.milkbowl.vault.chat.Chat;
    7. import net.milkbowl.vault.economy.Economy;
    8. import net.milkbowl.vault.permission.Permission;
    9.  
    10. import org.bukkit.Bukkit;
    11. import org.bukkit.ChatColor;
    12. import org.bukkit.command.Command;
    13. import org.bukkit.command.CommandSender;
    14. import org.bukkit.entity.Player;
    15. import org.bukkit.event.Listener;
    16. import org.bukkit.plugin.RegisteredServiceProvider;
    17. import org.bukkit.plugin.java.JavaPlugin;
    18.  
    19. public class test extends JavaPlugin implements Listener {
    20.  
    21. public static Permission perms = null;
    22. public static Economy econ = null;
    23. public static Chat chat = null;
    24. private ArrayList<String> track = new ArrayList<String>();
    25. private int[] cost = {0, 200, 20000, 100000, 200000};
    26.  
    27. @Override
    28. public void onDisable() {
    29. getLogger().info(String.format("[%s] Disabled Version %s", getDescription().getName(), getDescription().getVersion()));
    30. }
    31.  
    32. @Override
    33. public void onEnable() {
    34. setupChat();
    35. track.add("Addict");
    36. track.add("Grower");
    37. track.add("Dealer");
    38. track.add("Dealer+");
    39. if (setupEconomy() && setupPermissions()) {
    40. getLogger().info("[JBRank]Using permissions plugin "+perms.getName());
    41. getLogger().info("[JBRank] Registered Permissions and Economy, we are good! Here are the tracks: "+track.toString());
    42. } else
    43. Bukkit.getPluginManager().disablePlugin(this);
    44. }
    45.  
    46. private boolean setupPermissions()
    47. {
    48. RegisteredServiceProvider<Permission> permissionProvider = getServer().getServicesManager().getRegistration(net.milkbowl.vault.permission.Permission.class);
    49. if (permissionProvider != null) {
    50. perms = permissionProvider.getProvider();
    51. }
    52. return (perms != null);
    53. }
    54.  
    55. private boolean setupChat()
    56. {
    57. RegisteredServiceProvider<Chat> chatProvider = getServer().getServicesManager().getRegistration(net.milkbowl.vault.chat.Chat.class);
    58. if (chatProvider != null) {
    59. chat = chatProvider.getProvider();
    60. }
    61.  
    62. return (chat != null);
    63. }
    64.  
    65. private boolean setupEconomy()
    66. {
    67. RegisteredServiceProvider<Economy> economyProvider = getServer().getServicesManager().getRegistration(net.milkbowl.vault.economy.Economy.class);
    68. if (economyProvider != null) {
    69. econ = economyProvider.getProvider();
    70. }
    71.  
    72. return (econ != null);
    73. }
    74.  
    75.  
    76. public boolean onCommand(CommandSender sender, Command command, String commandLabel, String[] args) {
    77. if(!(sender instanceof Player)) {
    78. getLogger().info("Only players are supported for this Example Plugin, but you should not do this!!!");
    79. return true;
    80. }
    81.  
    82. Player player = (Player) sender;
    83. player.sendMessage("You did a command that is handeled by JBRank");
    84.  
    85. if(command.getLabel().equalsIgnoreCase("rankup")) {
    86. double balance = econ.getBalance(player.getName());
    87. String[] a = perms.getPlayerGroups(player);
    88. int trackNum = track.indexOf(a[0]);
    89.  
    90. if (!(trackNum == track.size()-1 || a[0].equals("VIP"))) {
    91. String next = track.get(trackNum+1);
    92. //they can get ranked up.
    93. if (balance > cost[trackNum+1]) {
    94. //they have the cash
    95.  
    96. econ.withdrawPlayer(player.getName(), cost[trackNum+1]);
    97.  
    98. //rank them up
    99. Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "pex user "+player.getName()+" group set "+next);
    100.  
    101. player.sendMessage(ChatColor.GREEN + "[JBRanks] Changed you to the group \""+next+"\" from the group \""+a[0]+"\". Your balance is now "+econ.getBalance(player.getName())+".");
    102. } else {
    103. player.sendMessage(ChatColor.RED + "[JBRanks] You are short on cash dude, you have "+balance+" coins and "+next+" costs "+cost[trackNum+1]+" coins.");
    104. }
    105. } else {
    106. player.sendMessage(ChatColor.RED + "[JBRanks] You don't need to rank up!");
    107. }
    108.  
    109. return true;
    110. } else {
    111. return false;
    112. }
    113. }
    114. }
    115.  
     
  2. Offline

    fireblast709

    Are you getting this message: "[JBRank] Registered Permissions and Economy, we are good! Here are the tracks: "+track.toString()"
     
  3. Offline

    jbman223

    No, that is the odd thing.

    And I should be getting some sort of error from line 41 but I am not.
     
  4. Offline

    fireblast709

    not if economy is the part that fails ;3
     
  5. Offline

    jbman223

    No I should be getting an error on line 41 no matter what because the variable perms is null until line 42...
     
  6. Offline

    fireblast709

  7. Offline

    jbman223

    Any ideas for a fix anyone?
     
  8. Offline

    HappyPikachu

    Post startup log?
     
  9. Offline

    CeramicTitan

    Logger().getLogger("minecraft") is outdated... Use getLogger().info(stringgoesinhere)
     
  10. Offline

    jbman223

    Did this, nothing. Here is the startup log as somebody requested.
    Code:
    08:57:37 [INFO] [iConomy] Loading iConomy v7.0
    08:57:37 [INFO] [JBRanks] Loading JBRanks v2.0
    08:57:37 [INFO] [WorldGuard] Loading WorldGuard v747-e3dfc6a
    08:57:37 [INFO] [ChestShop] Loading ChestShop v3.46
    08:57:37 [INFO] [ChatManager] Loading ChatManager v1.19.1
    08:57:37 [INFO] [SimpleRegionMarket] Loading SimpleRegionMarket v3.2.0
    08:57:37 [INFO] [Vault] Enabling Vault v1.2.22-b277
    08:57:37 [WARNING] iConomy - If you are using Flatfile storage be aware that versions 6, 7 and 8 have a CRITICAL bug which can wipe ALL iconomy data.
    08:57:37 [WARNING] if you're using Votifier, or any other plugin which handles economy data in a threaded manner your server is at risk!
    08:57:37 [WARNING] it is highly suggested to use SQL with iCo6 or to use an alternative economy plugin!
    08:57:37 [INFO] ----- Bukkit Auto Updater -----
    08:57:37 [INFO] It appears that you're running a Development Build, when you've specified in bukkit.yml that you prefer to run Recommended Builds.
    08:57:37 [INFO] [Vault][Economy] iConomy 6 found: Waiting
    08:57:37 [INFO] If you would like to be kept informed about new Development Build releases, it is recommended that you change 'preferred-channel' in your bukkit.yml to 'dev'.
    08:57:37 [INFO] With that set, you will be told whenever a new version is available for download, so that you can always keep up to date and secure with the latest fixes.
    08:57:37 [INFO] If you would like to disable this warning, simply set 'suggest-channels' to false in bukkit.yml.
    08:57:37 [INFO] ----- ------------------- -----
    08:57:37 [INFO] [Vault][Permission] PermissionsEx found: Waiting
    08:57:37 [INFO] [Vault][Permission] SuperPermissions loaded as backup permission system.
    08:57:37 [INFO] [Vault][Chat] PermissionsEx found: Waiting
    08:57:37 [INFO] [Vault] Enabled Version 1.2.22-b277
    08:57:37 [INFO] Preparing level "world"
    08:57:37 [INFO] Preparing start region for level 0 (Seed: 1214963280860842077)
    08:57:38 [INFO] Preparing spawn area: 32%
    08:57:39 [INFO] Preparing start region for level 1 (Seed: 1214963280860842077)
    08:57:39 [INFO] Preparing spawn area: 48%
    08:57:40 [INFO] Preparing start region for level 2 (Seed: 1214963280860842077)
    08:57:40 [INFO] [Temp MOTD] Enabling Temp MOTD v1.0
    08:57:40 [INFO] [SignEdit] Enabling SignEdit v3.2.2
    08:57:40 [INFO] [PotionLogin] Enabling PotionLogin v1.0
    08:57:40 [INFO] [PermissionsEx] Enabling PermissionsEx v1.19.5
    08:57:40 [INFO] [PermissionsEx] Superperms support enabled.
    08:57:40 [INFO] [PermissionsEx] v1.19.5 enabled
    08:57:40 [INFO] [Vault][Permission] PermissionsEx hooked.
    08:57:40 [INFO] [Vault][Chat] PermissionsEx_Chat hooked.
    08:57:40 [INFO] [WorldEdit] Enabling WorldEdit v12-3c580aa
    08:57:40 [INFO] WEPIF: PermissionsEx detected! Using PermissionsEx for permissions.
    08:57:40 [INFO] [SignEdit] ยง5SignEdit is up to date
    08:57:41 [INFO] [iConomy] Enabling iConomy v7.0
    08:57:41 [INFO] [iConomy - April Fools] Enabled (57 ms)
    08:57:41 [INFO] [iConomy] Hello, I'm Nijikokun. Yes, this is an April Fools joke, but '/money top' was fixed! Enjoy :) - Rare Version!
    08:57:41 [INFO] [Vault][Economy] iConomy 7 hooked.
    08:57:41 [INFO] [iConomy - April Fools] Purged accounts with default balance.
    08:57:41 [INFO] [JBRanks] Enabling JBRanks v2.0
    08:57:41 [INFO] [WorldGuard] Enabling WorldGuard v747-e3dfc6a
    08:57:41 [INFO] [WorldGuard] (world) TNT ignition is PERMITTED.
    08:57:41 [INFO] [WorldGuard] (world) Lighters are PERMITTED.
    08:57:41 [INFO] [WorldGuard] (world) Lava fire is blocked.
    08:57:41 [INFO] [WorldGuard] (world) Fire spread is UNRESTRICTED.
    08:57:41 [INFO] [WorldGuard] Loaded configuration for world 'world'
    08:57:41 [INFO] [WorldGuard] (world_nether) TNT ignition is PERMITTED.
    08:57:41 [INFO] [WorldGuard] (world_nether) Lighters are PERMITTED.
    08:57:41 [INFO] [WorldGuard] (world_nether) Lava fire is blocked.
    08:57:41 [INFO] [WorldGuard] (world_nether) Fire spread is UNRESTRICTED.
    08:57:41 [INFO] [WorldGuard] Loaded configuration for world 'world_nether'
    08:57:41 [INFO] [WorldGuard] (world_the_end) TNT ignition is PERMITTED.
    08:57:41 [INFO] [WorldGuard] (world_the_end) Lighters are PERMITTED.
    08:57:41 [INFO] [WorldGuard] (world_the_end) Lava fire is blocked.
    08:57:41 [INFO] [WorldGuard] (world_the_end) Fire spread is UNRESTRICTED.
    08:57:41 [INFO] [WorldGuard] Loaded configuration for world 'world_the_end'
    08:57:41 [INFO] [WorldGuard] 1 regions loaded for 'world'
    08:57:41 [INFO] [WorldGuard] 0 regions loaded for 'world_nether'
    08:57:41 [INFO] [WorldGuard] 0 regions loaded for 'world_the_end'
    08:57:41 [INFO] [ChestShop] Enabling ChestShop v3.46
    08:57:41 [INFO] [ChestShop] Vault loaded - using iConomy 7
    08:57:41 [INFO] [ChatManager] Enabling ChatManager v1.19.1
    08:57:41 [INFO] [ChatManager] ChatManager enabled!
    08:57:41 [INFO] [SimpleRegionMarket] Enabling SimpleRegionMarket v3.2.0
    08:57:41 [INFO] [SimpleRegionMarket] Loaded 4 template(s), 0 world(s) and 0 region(s).
    08:57:41 [INFO] [SimpleRegionMarket] The check took 0ms
    08:57:41 [INFO] [SimpleRegionMarket] Permissions loaded (PermissionsEx)
    08:57:41 [INFO] [SimpleRegionMarket] SimpleRegionMarket enabled.
    08:57:41 [INFO] Server permissions file permissions.yml is empty, ignoring it
    08:57:42 [INFO] Done (4.722s)! For help, type "help" or "?"
    08:57:42 [INFO] Starting GS4 status listener
    08:57:42 [INFO] Query running on 192.168.3.5:25566
    
     
  11. Offline

    fireblast709

    its like silently failing...
     
  12. Offline

    jbman223

    I know, that's why it is so weird... is there ANYONE that has ANYTHING to suggest????

    Bumping this again, PLEASE help me out!!!

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 30, 2016
  13. Offline

    Comphenix

    Have you added "depend: Vault" to your plugin.yml?
     
  14. Offline

    jbman223

    Yes.

    Code:
    name: JBRanks
    main: test.test
    description: PaidRanks but better and it works.
    version: 2.0
    author: jbman223
    commands:
      rankup:
       description: Ranks the player up.
    depend: [Vault]
    
     
  15. Offline

    Comphenix

    Strange, but it looks like some plugin (or Bukkit mod) might be gobbling up your exceptions. I got the following error when I ran the code on my test server:
    Code:
    2013-01-03 04:13:49 [SEVERE] Error occurred while enabling ExamplePlugin v1.0.0 (Is it up to date?)
    java.lang.NullPointerException
        at com.comphenix.example.ExampleMod.onEnable(ExampleMod.java:56)
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:217)
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:457)
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:381)
        at org.bukkit.craftbukkit.v1_4_6.CraftServer.loadPlugin(CraftServer.java:278)
        at org.bukkit.craftbukkit.v1_4_6.CraftServer.enablePlugins(CraftServer.java:260)
        at net.minecraft.server.v1_4_6.MinecraftServer.j(MinecraftServer.java:321)
        at net.minecraft.server.v1_4_6.MinecraftServer.e(MinecraftServer.java:300)
        at net.minecraft.server.v1_4_6.MinecraftServer.a(MinecraftServer.java:259)
        at net.minecraft.server.v1_4_6.DedicatedServer.init(DedicatedServer.java:149)
        at net.minecraft.server.v1_4_6.MinecraftServer.run(MinecraftServer.java:399)
        at net.minecraft.server.v1_4_6.ThreadServerApplication.run(SourceFile:849)
    So ... the solution is to simply comment out/remove the following line:
    Code:java
    1. log.info("[JBRank]Using permissions plugin "+perms.getName());
     
  16. Offline

    fireblast709

    jbman223 in your case: move it down, inside the if-statement
     
  17. Offline

    jbman223

    Yup, and the weird thing is that when I added another plugin I made to the server that I am running this plugin on, it also didn't log anything to the console. I will have to investigate that; meantime, I will move that line and hopefully run the plugin.
    [hr]
    EDIT: Moved that line, still nothing.
    I will update to the most current code in the OP.
     
  18. Offline

    Sparta

    iConomy has been out of date for a long time, why are you using it (no wonder why you have issues)? Use Essentials economy.
     
  19. Offline

    fireblast709

    Use Vault
     
  20. Offline

    jbman223

    Just because it is out of date does not mean it does not work.
     
    jimuskin likes this.
  21. Offline

    Sparta

    ....IT IS OUT OF DATE, THAT IS WHY IT WON'T WORK. I am putting that in caps so you will understand. iConomy has been out of date for months, and I don't get at all why you are using it. The Bukkit API changes, and if you are using an out of date plugin's API, OBVIOUSLY it won't work. That is why you are getting problems. :eek:
     
  22. Offline

    Dpasi314

    I use iConomy for my plugins. It works absolutely fine. Dunno what you're talking aboot.
     
    jimuskin and chasechocolate like this.
  23. Offline

    tommycake50

    erm you are talking shit i am afraid.
    the API hasn't changed much.
     
    chasechocolate likes this.
  24. Offline

    jbman223

    I have been coding with the 1.3 API since 1.3 came out, there have been minimal changes. Any more suggestions from anybody? The latest code is in the OP.
     
  25. Offline

    fireblast709

    jbman223 do you get the 2 messages in the if-statement with the current code.
     
  26. Offline

    jbman223

    Still none at all.
     
  27. Offline

    fireblast709

    jbman223 debug the setup*() methods
     
  28. Offline

    Comphenix

    What?

    Okay, something is terribly wrong with your setup. Try testing your plugin on a freshly installed test server with no other plugins installed.
     
  29. Offline

    jbman223

  30. Offline

    fireblast709

    jbman223 add messages to see what it returns, to see if the permissions and/or economy fails to register
    (Like: System.out.println("Permissions: "+(perms == null ? " failed to register" : "registered"))); before 'returns perms != null')
     
Thread Status:
Not open for further replies.

Share This Page