[ADMN/MISC] LoginBonus v0.6 - Reward Loyal Players When They Login. [1185]

Discussion in 'Inactive/Unsupported Plugins' started by BeerHuntor, Sep 10, 2011.

  1. [​IMG]



    LoginBonus - Reward Loyal Players
    Version: v0.6

    <font color="rgb(255, 0, 0)">Now on bukkitdev </font>http://dev.bukkit.org/server-mods/loginbonus/

    This is one of my first plugins that I have built, nothing special, quite simple really, but I thought
    I would share this anyway.

    Features:
    * Rewards players on login with a diamond.
    * Automatically goes into the players inventory
    * Permissions Supported
    * Now only activates every 24hours.
    * Reward is configurable.
    * Time is configurable.

    Permission Nodes:

    LoginBonus.true

    <Edit by Moderator: Redacted mediafire url>


    Show Spoiler
    Code:
    package me.beerhuntor.LoginBonus;
    
    import java.util.logging.Logger;
    
    import me.beerhuntor.LoginBonus.LoginBonus;
    
    import org.bukkit.event.Event;
    import org.bukkit.event.Event.Priority;
    
    import org.bukkit.plugin.PluginDescriptionFile;
    import org.bukkit.plugin.PluginManager;
    import org.bukkit.plugin.java.JavaPlugin;
    
    public class LoginBonus extends JavaPlugin{
    
        LoginBonusPlayerListener playerListener = new LoginBonusPlayerListener(this);
        private Logger log = Logger.getLogger("Minecraft");
    
        public void onEnable() {
            PluginManager pm = this.getServer().getPluginManager();
    
            pm.registerEvent(Event.Type.PLAYER_JOIN, playerListener, Priority.Normal, this);
            this.logMessage(" Has been enabled.");
        }
    
        public void onDisable() {
    
            this.logMessage(" Has been disabled.");
        }
    
        protected void logMessage(String msg){
            PluginDescriptionFile pdFile = this.getDescription();
            this.log.info("[" + pdFile.getName() + "]" + " " + pdFile.getVersion() + ": " + msg);
        }
    
    }
    
    Code:
    package me.beerhuntor.LoginBonus;
    
    import org.bukkit.ChatColor;
    import org.bukkit.Material;
    
    import org.bukkit.entity.Player;
    
    import org.bukkit.event.player.PlayerJoinEvent;
    import org.bukkit.event.player.PlayerListener;
    
    import org.bukkit.inventory.ItemStack;
    
    public class LoginBonusPlayerListener extends PlayerListener{
    
        public LoginBonus plugin;
    
        public LoginBonusPlayerListener(LoginBonus instance){
            this.plugin=instance;
        }
    
        public void onPlayerJoin(PlayerJoinEvent event){
    
            Player p = event.getPlayer();
            ItemStack i = new ItemStack(Material.DIAMOND,1);
    
            if(p.hasPermission("loginbonus.true")){
    
            p.getInventory().addItem(i);
    
            p.sendMessage(ChatColor.AQUA + "You have recieved a Login Bonus of a Diamond! ");
            }
        }
    
    }
    



    To Do.

    * Add Config File to allow more configuration - Added v0.3

    * Add a timer so it can only be used every 24hours? - Added v0.2 (Thanks @tips48)
    * Add iConomy Support (WIP)

    ChangeLog:

    version 0.6 -
    Fixed the configuration syntax error when creating the config file


    version 0.5 -
    Simplified the time configuration from milliseconds to hours


    Show Spoiler
    version 0.4 -
    Made the time as a configurable option.

    version 0.3 -
    Added config file. Reward is now configurable.

    version 0.2 -
    Added the source to only allow the bonus to be given once every 24 hours - Thanks to @tips48

    version 0.1 -
    Released LoginBonus
     
    Last edited by a moderator: Nov 12, 2016
  2. Offline

    Andre_9796

    2nd to do is REALLY important because otherwise they could login/logout x times and would always get a diamond
     
  3. Thats why I released it with permissions enabled.. That way you could limit it somewhat. Its more of finding the code that will enable me to do that. That is the problem I am currently having.
     
  4. Offline

    Andre_9796

    yeah i want my players to have a bonus but not unlimited. if you make a config file it will be great. anyways, nice plugin!
     
  5. Thanks for the feedback :)

    Updated to v0.2!

    Added the timer so only gives out every 24hours.

    Now have a bukkitdev page -- http://dev.bukkit.org/server-mods/loginbonus/

    EDIT: Should of been in the previous post... oooops :p

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

    loki4321

    Please add iconomy support ;)
     
  7. Offline

    Unset

  8. Ill fix it thanks for the heads up :)

    @loki4321
    Im planning on adding it at some point. Cant give an exact time frame yet tho.
     
  9. Offline

    Smidds

    Would there be a way to config the timer, and the bonus? Because if so, I'd certainly download this plugin! It would be a good way to keep my users coming back for more!
     
  10. This is one thing im looking to implement. First the config for the prize, then I will add a configurable timer.
     
  11. Offline

    Smidds

    @BeerHunter
    Horray! I'll keep a look out for this plugin till then! :D
     
  12. Could be very cool with an iConomy reward !
     
  13. Thats on my todo list :)

    Firstly I need to create the config file :D

    Updated with a config file, can only configure the reward as of yet.

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

    jeroende2e

    Looks like a nice plugin!
    If you need any help with iConomy just mention/pm me.
    It's really easy.
     
  15. @jeroende2e Awesome, I definitely will as I have not got a clue how to use the iConomy API lol.
     
  16. Offline

    Krazy


    Can u add config for, example player need stay logged 2min for win bonus? and custom bonus is nice.

    please i'm waiting for it :(
     
  17. Offline

    jeroende2e

    @BeerHuntor

    The set up is very easy.
    and using it also.
    all you have to do is make a ServerListner class.
    put 1 thing in your main class. and then you can use all API
    here is the link to iConomy API/connect

    if you can't figure something out just say me :)
     

  18. To Stay Logged In??? Hmmm im not sure how that would work. Let me get back to you on that :)

    Awesome. Ill do that. Thanks :)

    Updated to 0.4 With a configurable time option.

    Updated to 0.5

    Simplified the time configuration.

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

    Krazy

    I LOVE YOU!

    good option is,
    VIP,NORMAL, etc

    permissions:
    loginbonus.VIP
    loginbonus.FREE

    config file:
    ##VIP CONFIG
    login bonus amount= 10
    login bonus type=Diamond_block
    message = Hello VIP today your bonus login %AMOUNT% %ITEM ID%


    ##FREE CONFIG
    login bonus amount:1
    login bonus type:Diamond_block
    message = Hello USER today your bonus login %AMOUNT% %ITEM ID%
     

  20. Ill add that to my notes :) And look into it :)

    Thanks for the feedback.
     
  21. Offline

    pyrobryant

    The SECOND you release iConomy support im on the bandwagon.
     
  22. Im currently working on that now :) So should be pretty soon :)
     
  23. Offline

    pyrobryant

    Good, just make sure to add a lot of customization, I really hate most default settings.
     
  24. Such as? .. The current config it has atm is, prize, time, and price (once i hook into iConomy) not really sure how much more customization i can get .
     
  25. Offline

    S4h4rk

    The default config file it generates has a syntax error.
     

  26. Ill get that sorted now.

    @S4h4rk Ive fixed the bug mate. Re download it from the OP, and it should work fine :)

    Updated OP.

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

    S4h4rk

    Cool. Thank you for the quick updated to fix this! :)
     
  28. Offline

    thernztrom

    Awesome! When iConomy 6 support is added it will be even more awesome ;)
     
  29. No problem.

    I am currently working on this but as i have never used iConomy before it proving to be harder than anticipated. But nevertheless, onward and upward :)
     

Share This Page