How to create playtime reward

Discussion in 'Plugin Development' started by WattMann, Mar 22, 2018.

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

    WattMann

    i was trying
    PHP:
    public void onJoin(PlayerJoinEvent e) {
            
    FileConfiguration cfg Main.plugin.cfg.getCfg();
            
    Player p e.getPlayer();
            
    long mins cfg.getLong("coins.loop-lenght(mins)");
            
    long ticks mins 1200;
            
    Bukkit.getScheduler().scheduleSyncRepeatingTask(new Main(), new Runnable() {
               
               
                @
    Override
                
    public void run() {
                    
    CoinsManager.addCoins(pcfg.getLong("coins.money-per-loop"));
                    
    p.sendMessage("added");            // i was testing it
                
    }
               
            }, 
    1,  ticks);
               
           
        }

    but it wasn't working and no error was showed in console
     
  2. Offline

    timtower Administrator Administrator Moderator

    @WattMann Please post the full class.
    And you can't call new Main(), Bukkit will complain about that.
     
  3. Offline

    TheWizad

    Also when you are doing
    Code:
    onJoin(PlayerJoinEvent e) {
    please use
    Code:
    @EventHandler(priority = EventPriority.HIGHEST)
    on top of it because it's an event. :)

    Good Luck.

    P.S. This also might help you.
    Code:
    public void registerEvents() {
           
            PluginManager pm = Bukkit.getServer().getPluginManager();
            pm.registerEvents(this, this);
        }
     
  4. Offline

    WattMann

    thanks worked, but i already registered (im not that dumb :D)
     
Thread Status:
Not open for further replies.

Share This Page