Solved Vault: Paying an offline player.

Discussion in 'Plugin Development' started by Twisted_Panda, Jan 19, 2014.

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

    Twisted_Panda

    So, I cant seem to be able to pay an offline player, but only online players.

    My code:

    Code:
    if (Bukkit.getServer().getPlayer(playerSeller[0]) != null)  {
                        Player online = Bukkit.getPlayer(playerSeller[0]);
                        online.sendMessage(ChatColor.GOLD + "A user has bought " + amount + " " + itemName + " from you for " + cost[1] + " gold.");
                        mEconomy.econ.depositPlayer(online.getName(), Double.parseDouble(cost[1]));
                       
                    }else {
                        OfflinePlayer offline = Bukkit.getOfflinePlayer(playerSeller[0]);
                        mEconomy.econ.depositPlayer(offline.getName(), Double.parseDouble(cost[1]));
                    }
    Not sure if i'm being stupid or...
     
  2. Offline

    Maurdekye

    That's likely due to mEconomy functionality. You might have to create a workaround with a payment buffer of sorts by making a file that saves all payments to players that are currently offline, and then whenever someone logs on it checks the file to see if they have any pending payments due to them, and then pays them from the file.
     
  3. Offline

    Twisted_Panda

    Maurdekye

    Though of the same thing, im going to try it out.
     
  4. Offline

    Henzz

  5. Offline

    Twisted_Panda

  6. Offline

    Sleaker

    if you use Vault it contains methods to pay players by their Name, rather than Player object.
     
  7. Offline

    Twisted_Panda

    Whats the method?
     
  8. Offline

    Sleaker

    Twisted_Panda likes this.
  9. Offline

    Twisted_Panda

    It's my own economy plugin that uses gold for money, thanks for that but I figured it was my mEconomy that wasn't paying offline players.
     
Thread Status:
Not open for further replies.

Share This Page