Need help with Schedule

Discussion in 'Plugin Development' started by rob1998@, Jun 18, 2013.

Thread Status:
Not open for further replies.
  1. hi,

    I want to make a plugin that pays players every 20 minutes.
    but I can not get the schedule right

    Please help

    my code is based on the vault example it's in the spoiler
    Show Spoiler

    Code:java
    1.  
    2. public boolean onCommand(CommandSender sender, Command command, String commandLabel, String[] args) {
    3. if(!(sender instanceof Player)) {
    4. log.info("Only players are supported for this Example Plugin, but you should not do this!!!");
    5. return true;
    6. }
    7.  
    8. Player player = (Player) sender;
    9.  
    10. if(command.getName().equals("PayTime")) {
    11. EconomyResponse r = econ.depositPlayer(player.getName(), 20.00);
    12. if(r.transactionSuccess()) {
    13. sender.sendMessage(String.format("You were given %s and now have %s", econ.format(r.amount), econ.format(r.balance)));
    14. } else {
    15. sender.sendMessage(String.format("An error occured: %s", r.errorMessage));
    16. }
    17. return true;
    18. }
    19. return false;
    20. }
    21. }

     
  2. Offline

    caseif

    First, please don't give us the entire source of your plugin. Try to include only relevant code. To answer your question, do a Google search for "bukkit scheduler" and you may find the solution to your problem. I'd recommend initiating it in the onEnable(), as that would be easiest and most efficient.
     
  3. ok, i edited the my source code, and I already googled, but I don't understand it
     
  4. Offline

    MCForger

Thread Status:
Not open for further replies.

Share This Page