[ECO/FUN] Bonus v1.0 - simple daily login bonus [1060]

Discussion in 'Inactive/Unsupported Plugins' started by codename_B, Aug 24, 2011.

  1. Offline

    codename_B

    Bonus

    a simple daily login bonus - 42 lines

    24/08/2011 - codename_B

    Download Bonus v1

    How to use:
    Requires: iConomy
    Permission node: bonus.get
    Drop the plugin into plugins/
    Edit the generated help.txt
    /reload - look it works!

    Show Spoiler

    Code:
    package de.bananaco.bonus;
    import java.text.SimpleDateFormat;
    import java.util.Calendar;
    import org.bukkit.ChatColor;
    import org.bukkit.event.Event.*;
    import org.bukkit.event.player.*;
    import org.bukkit.plugin.java.JavaPlugin;
    import org.bukkit.util.config.Configuration;
    import com.iConomy.iConomy;
    public class Bonus extends JavaPlugin {
        @Override
        public void onDisable() {
            System.out.println("[Bonus] "+"Disabled");
        }
        @Override
        public void onEnable() {
            getServer().getPluginManager().registerEvent(Type.PLAYER_TELEPORT, new PlayerLoginListener(getConfiguration()), Priority.Monitor, this);
            System.out.println("[Bonus] "+"Enabled");
        }
    }
    class PlayerLoginListener extends PlayerListener {
        private Configuration c;
        public PlayerLoginListener(Configuration c) {
            c.load();
            c.setProperty("bonus", c.getDouble("bonus", 1000));
            c.save();
            this.c = c;
        }
        public void onPlayerTeleport(PlayerTeleportEvent event) {
            String date = new SimpleDateFormat("yy/MM/dd").format(Calendar.getInstance().getTime());
            if(event.getPlayer().hasPermission("bonus.get") && (!c.getString("players."+event.getPlayer().getName(),"").equals(date)))
            try {
            double bonus = c.getDouble("bonus", 1000);
            iConomy.getAccount(event.getPlayer().getName()).getHoldings().add(bonus);
            c.setProperty("players."+event.getPlayer().getName(), date);
            c.save();
            event.getPlayer().sendMessage(ChatColor.AQUA+"--"+ChatColor.GREEN+"You earned "+bonus+" for playing today "+date+ChatColor.AQUA+"--");
            } catch (Exception e) {
            System.err.println("[Bonus] "+"iConomy not installed!");
            }
            }
    }
    


    Changelog:
    24/08/2011 - released awesome plugin

    INB4DAILYBONUSDOESTHISALREADY!

    I tried DailyBonus, it didn't work, the author isn't updating it, and I needed an iConomy dailybonus for my server, so I made one as part of my under 50 lines challenge, and it's pretty good, so I released it!

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

    aPunch

    I don't get it.
     
  3. Offline

    spunkiie

    This plugin, in fact, have sense.

    Will test it asap
     
  4. Offline

    jonassm

    BOSECONOMY!
     
  5. Offline

    Orcem12

    Are you the only one actually doing the challenge? xD
     
  6. Offline

    codename_B

    Lol no
     
  7. Offline

    thernztrom

  8. Offline

    codename_B

    5 for the moment. If/when I move this to BukkitDev it will be 6.
     
  9. Offline

    IProOverKill

    Nice i like it
     
  10. Offline

    streaml1ned

    Thank you! I used the other plugin you were talking about and this is much better. Simple and easy. The way it needs to be!
     
  11. Offline

    Raycrash

    Need this for 6, pretty please ;)
     
  12. Offline

    OZ4RK

    BOSEconomy?
     
  13. Offline

    Jdbye

    Add iConomy 6 support please, and different bonuses for different permissions groups (or based on permission nodes), so my VIP users can get double bonus :)
     
  14. Offline

    8Keep

    ICONOMY6!!!!!!!!
     
  15. Offline

    Pr4w

    codename_B : Doesn't seem to work anymore... Update ? :)
     

Share This Page