Iconomy/vault help

Discussion in 'Plugin Development' started by fauge, Oct 24, 2013.

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

    fauge

    Hello, I am fauge7, partial owner of ftbcraft. I am wondering how do i get an array of players, then use that list to deposit 100$ into their personal holdings not their bank accounts

    Code:java
    1. Player[] onlinePlayerList = Bukkit.getServer().getOnlinePlayers();
    2. for(Player player : onlinePlayerList){
    3. econ.depositPlayer(player.getName(),100);


    that is the snippit of code which would do the function, its giving me a null pointer exception on line 3.
     
  2. Offline

    5pHiNxX

    @fauge:
    did you initialize econ?
     
  3. Offline

    fauge

    Thanks ^_^
    Code:java
    1. RegisteredServiceProvider<Economy> rsp = Bukkit.getServer().getServicesManager().getRegistration(Economy.class);
    that's correct right?
     
  4. Offline

    5pHiNxX

    @fauge:
    yes and then use this to initialize:
    Code:java
    1. if (rsp != null) {
    2. econ = rsp.getProvider();
    3. }


    and before using econ check if it is not null
     
Thread Status:
Not open for further replies.

Share This Page