Inactive [FUN] Lottery 0.6.3 - Let your users buy tickets to a lottery - [superPerms] [1060]

Discussion in 'Inactive/Unsupported Plugins' started by Erbros, Mar 14, 2011.

  1. Offline

    Erbros

    Lottery - The Lottery Plugin:

    I will only be using the BukkitDev website from now on. Please ask for help, submit bugs or enchantments and download the plugin from my page there (LINK).

    This thread is no longer updated - check my page on BukkitDev.


    Beware: Now only supporting superPerms from 0.6.2 and onwards!

    Version: v 0.6.2

    This plugin lets your users buy tickets for a price you decide to a lottery drawing.

    Features:
    • Users buy a ticket and can win the money of everyone that have bought a ticket.
    • Configurable price, material (including money/coins) and hours between lottery drawings.
    • Supports iConomy v4, iConomy v5, iConomy v6, BOSEconomy v6, BOSEconomy v7, Eco Essentials and MultiCurrency. Thanks to @KHobbits
    • Permission nodes supporting superPerms (Bukkits default permission system)
    Download:

    The Lottery Plugin v. 0.6.2

    Old releases:
    Source Code (This is my first project ever in java, so I would appreciate any advice in

    how to improve my coding very much)

    Configuration:

    In the configuration that is made when the plugin is run the first time, you don't get comments about the different options. Here you do!


    Code:
    #How many hours between every lottery drawing? Only whole numbers above 0 (like 1 or 2 or 3.... 24 or 25...)
    hours: '24'
    # The next execution option is really not to be touched. Its time in millisecs since 1. January 1970.
    nextexec: 1300368259883
    # Cost is the amount the buyer got to pay to buy a ticket. This applies both to iConomy coins and material. Only whole numbers. Negative numbers will probably work, but I don't see the point.
    cost: '5'
    #The material setting lets you choose which Material Value your users got to pay with, and get if they win. (its the "dec(imal)", value)
    material: '266'
    # If you want to use iConomy coins, set it to "true". If you want to choose your own material (block or item), set it to false.
    useiConomy: 'false'
    # If broadcastBuying is set to false, there will not be sent a message to every player when somebody buys a ticket.
    broadcastBuying: 'true'
    # welcomeMessage decides if there should be sent a message to the player on join about time until draw.
    welcomeMessage: 'true'
    #extraInPot just holds the amount of extra winnings in the pot has been added with /lottery addtopot
    extraInPot: 0
    #clearExtraInPot decides whether the plugin set extraInPot=0 after lottery draw, or if the same amount will stay until somebody changes it with /lottery addtopot <+/-> <amount>
    clearExtraInPot: true
    #netPayout is the percentage of the total pot that is being paid out to the winner. This can be as large as you wish, but not lower than 1 (one). 100 = 100%, which means the winner will get exactly as much as the players have paid in while buying tickets.
    netPayout: 100
    #maxTicketsEachUser sets the max amount of tickets each player can buy
    maxTicketsEachUser: 1
    #debug - This won't show up by itself, and there is really no reason for you to have this unless there is something wrong with your install of the plugin.
    debug: false
    Commands:
    /lottery : Basic information
    /lottery buy <number> : Buy one or <number> of tickets.
    /lottery help : Help pages
    /lottery winners : List over 10 last winners
    /lottery draw : Force the drawing to happen. Op only if not permission plugin.
    /lottery addtopot : Adds extra money/items to the pot. Op only if not permission plugin.
    /lottery config <cost/hours/max/maxTicketsEachUser/reload> : Change/reload the config ingame.

    Permissions:
    If you have Permission plugin installed you must add the nodes you need to the config.

    lottery.buy : Gives you all the basic rights /lottery (buy, help, winners).
    Given to all players by default, remove from users/groups if you want to deny them.
    lottery.admin.draw : Gives the group/user access to the /lottery draw command.
    Given to OP's.
    lottery.admin.addtopot : Gives the group/user access to the /lottery addtopot command
    Given to OP's.
    lottery.admin.editconfig : Grant access to edit/reload the lottery config ingame NEW
    Given to OP's.

    Changelog:
    Version 0.6.3:
    • Fixed ClassCastException when using commands from console.
    Version 0.6.2:
    • Supporting superPerms.
    • Removed support for any other permission system.
    • Fixing plugin.yml, so even those not using superperms will have basic lottery.buy given to all users by default, and all OP's will get admin commands.
    Version 0.6.1:
    • Removed showing days in time until draw.
    Version 0.6.0:
    • Adding ability to reload config ingame.
    • Edit the config variables cost, hours and maxTicketsEachUser ingame.
    • Debugging information.
    Old Changelogs (open)


    Version 0.5.6:
    • Hopefully fixed lottery not drawing when it should..
    Version 0.5.5:

    • Fixing users able to buy negative amount of tickets (and again... very stupid mistake by me....)
    Version 0.5.4:

    • Fixing users able to buy negative amount of tickets (again since I forgot to re-add it after merge).
    • Giving users the remaining tickets they can buy if they try to buy too many.
    Version 0.5.3:

    • Max number of tickets a user can buy.
    • Typos
    Version 0.5.2:

    • Implemented a lot of changes by @KHobbits
      • Now supporting iConomy4, iConomy5, iConomy6, BOSEconomy6, BOSEconomy6, MultiCurrency, EcoEssentials
      • Code cleanup
    Version 0.5.1:

    • Don't let players buy a negative amount of tickets... Stupid error...
    Version 0.5.0:

    • Users can buy more than one ticket each now.
    Version 0.4.5:
    • Fixed so correct lottery amount is shown everywhere, WinningAmount() implementing netPayout;
    • Ability to let the plugin remember the money that is added to extraInPot.
    • Fixed NPE when "/lottery addtopot" wasn't followed by a number.
    Version 0.4.4:

    • Added payout percentage configuration.
    • Attempt to fix some of the "waiting for draw to occur" on servers with slight lag.
    Version 0.4.3:

    • Updated for iConomy v5. Not working with v4 anymore.
    • Fixed a new system for timers, it shouldn't take that much time to do a draw even on a laggy server.
    • If time is set to lower in config than is remaining on countdown, set to new value.
    Version 0.4.2:

    • Not setting extraInPot to 0 after draw, only saving it to config.
    • Draw in: -51 seconds no longer occur, now its "Draw in: Draw will occur soon"
    Version 0.4.1:

    • Fixed: Not saving config after updating extraInPot.
    Version 0.4:

    • Permission support
    • Command to add extra money in pot.
    Version 0.3.1:

    • Fixed timers not closing properly. Possible memory leak! Important update!
    Version 0.3:

    • Info about pot size in /lottery
    • Choose if you want players to get time until draw message on join.
    Version 0.2.4:

    • Fixed the same problem as in last release, just properly this time.
    Version 0.2.3:

    • Changed from onPluginEnable to PluginEnableEvent.
    Version 0.2.2:

    • Option to broadcast public to the whole server when somebody buys a ticket.
    • Added colors to the lottery chat messages.
    Version 0.2.1:

    • Formatting material names. GOLD_INGOT -> Gold ingot
    Version 0.2

    • Added commands: /lottery (help, winners, claim, draw)
    • Added material support.
    • List over 10 last winners with /lottery winners
    Version 0.1

    • Lottery plugin is released.



    Tutorial:


    Video by @ValBGaming

    PS: The /lottery claim command is used when you are using material and you win, since blocks/items can only be given to online players :)

    Todo:

    • A set number of tickets available, and let the user choose which one to buy. If nobody had the right ticket, add money to jackpot for next drawing. (low)
    • Using configurable array of prize items instead of getting whats in the pot. (low)
    • Show time left when it's 2 hours left, 1 hour left etc. Configurable. (low)
    • Let admins give out free tickets. (normal)
     
  2. Offline

    anonymous

    its been a few days now :/ I'll just wait till 1.5 is stable.
     
  3. Offline

    _Homer_

    is this Plugin 714 ready?
     
  4. Offline

    Erbros

    I'll tell you when I've had the chance to test it. :)
     
  5. Offline

    Ch3st3r

    Works on 733 !
     
  6. Offline

    Erbros

    Thanks for the note! :)
     
  7. Offline

    NEO

    @Erbros

    Getting NPE's when it attempts to draw a winner. CB 733 lottery 0.4.2 Icon 4.6.5

    Code:
    2011-04-27 17:30:31 [SEVERE] java.lang.NullPointerException
    2011-04-27 17:30:31 [SEVERE]     at net.erbros.Lottery.Lottery.getWinner(Lottery.java:323)
    2011-04-27 17:30:31 [SEVERE]     at net.erbros.Lottery.Lottery$LotteryDraw.run(Lottery.java:402)
    2011-04-27 17:30:31 [SEVERE]     at org.bukkit.craftbukkit.scheduler.CraftWorker.run(CraftWorker.java:33)
    2011-04-27 17:30:31 [SEVERE]     at java.lang.Thread.run(Unknown Source)
     
  8. Offline

    Erbros

    Thanks for the heads up, I've found the problem. It seems to occur when the player don't have an account already. I did think that calling the getAccount() in iConomy would create the account, but seems I must be doing something wrong.

    Edit: I will try to fix it tomorrow.
     
  9. Offline

    NEO

    Well i came from version 2 or 3 and it seems letting it recreate the lottery config fixes the issue.
     
  10. Offline

    bradgillap

    Is there a way to do like a 50/50
     
  11. Offline

    imaxorz

    Any future support for buying more than one ticket? With a limit per player?
     
  12. Offline

    Erbros

    No, sorry. You should request it as another plugin, should be very simple.

    At the moment I have way to much to do with school and exams, so I will not add any new features in a while.
     
  13. Offline

    mattzor

    Econ support? please
     
  14. Offline

    imaxorz

    Fair enough. I'm in the same boat, so I understand :)
     
  15. Offline

    imaxorz

    How long does it usually take for the lottery to auto draw after the 24 hour period ends?

    I've let it sit about 3-4 minutes before I just did a manual draw.
     
  16. Offline

    Erbros

    That depends on how much lag the server have had since last restart. The time is measured in server ticks. On a server with 0 lag, there is about 20 ticks each second.

    I am at the moment working on a method to make the time more accurate, but I will also make a auto draw if someone uses the /lottery commands and it says "Draw will occur soon".
     
  17. Offline

    Darktrance

    pls Upgrade for working with iConomy 5
     
    TheRealKANi likes this.
  18. Offline

    TheRealKANi

    I agree, the plugin works with CB:740 but NOT with iConomy V5.
     
  19. Offline

    iiShaun

    Does this support BOSEconomy?
     
  20. Offline

    Erbros

    Oh, I had the 0.4.3 version working with iConomy v5. Are you sure you are using the latest version of this plugin? If you are, give me some info from the console and cb version.

    No, not at the moment.
     
  21. Offline

    AnonymousX

    Whoa, I just got the update via CraftBukkitUpToDate and nearly upgraded the plugin without reading the changelog, lucky for me I came here to check first that you made it support iConomy v5 and it isn't compatible with older versions anymore, since I have many plugins that use iConomy v4, I will have to wait for most of them to update to v5 first.

    Great job on migrating to v5 though! The faster plugin developers migrate to v5, the less time we have to wait :D
     
  22. Offline

    quickclay

    This is great, thanks!
    One feature I'd like to see is a default amount automatically added to the pot each lottery.
     
  23. Offline

    Desmond

    Could You please like add that if not right ticket option just adds money to next lottery cuz i think that would be cool and way more realalistic
     
  24. Offline

    Mike120

    Great plugin. Is there anychance of being able to change the colour of the [LOTTER] announcement in the config file? Would REALLY appreciate that :)
     
  25. Offline

    Erbros

    Thank you :)

    I will see if I can't add one like that, yeah :) Won't be right now tho.

    I'll probably work on something like that, yes. But not right now.

    I'll think about it! :) But as you have the source available, its not much work compiling your own .jar with the colors you want :)
     
  26. Offline

    Mike120

    Ahh i'm no developer though. Its not a huge deal to be honest. One thing thats bugging me, is every time i try and change the hours to draw from 24 to 72, nothing changes. It just still says however many hours left. I even removed the plugin and reinstalled it... Any help?
     
  27. Offline

    Erbros

    Restart server to make sure the new time variable is loaded, then just do a "/lottery draw" and it should use 72 hours next time. :) Hope this fixes your problem.
     
  28. Offline

    Ebbot

    awesome thanks!
     
  29. Offline

    NeatMonster

    Are your sources updated because I saw the old iConomy version nodes ?
     
  30. Offline

    DarkAge

    Hmm, could you maybe add a few more features to make it more like lottery... where not only 1 person gets a prize. I mean if you have 50 people buy a ticket and only 1 person wins then that's a lot of cash and the other people leave sour :p

    Maybe add an option to balance that out where the winner gets a lot but the runner ups get something aswell...
     
  31. Offline

    Erbros

    That might be! I'll push a commit when I get home.
     

Share This Page