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


    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.

    • 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)

    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)


    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!

    #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
    /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.

    If you have Permission plugin installed you must add the nodes you need to the config. : 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.

    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 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.


    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 :)


    • 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


    I can't compile it : errors Duplicate nested type LotteryDraw on
        class LotteryDraw extends TimerTask
    in, and many more :(.
  3. Offline


    That worked like a charm thank you!

    I am having another problem though, everyone has bought a ticket 4 times, and the first one, one of my admins won, then i won, then that same admin, then i've just won again.

    It seems really dodgey to the other players and i was wondering if it was just pure chance or somthing else that affects it?
  4. Offline


    As far as I know, it is completely random. How many players were buying tickets? I do agree that it seems a bit odd that two players should win two times each.

    It compiles find here, and the source is up to date.

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


    I will try with the new source.
  6. Offline


    it was always between 8 - 10 players buying. They were all bought a different times aswell. I forced the draw for 3 of them as it was taking ages to draw, would that change anything?
  7. Offline


    what happens if a player that bought a ticket leaves the server? do they get their money back, can they still win? are they told that they won when they log back in?

    also do lottery draws persist through server restarts?

    also I have noticed that when it does takes AGES to do it
  8. Offline


    No, it shouldn't affect it. I will have a look at the code again, but I think (and hope) its just a coincidence.

    1. The player can still win, but will have to check the "/lottery winners" command to find out (if he/she doesn't see that they got some extra cash).

    2. Yes

    3. That's because the server knows the time to draw is past, but if the server have been lagging a bit then it might take a bit until the draw takes place. That is because I use the ingame scheduler, so it follows ingame time (20 ticks per second). If the server is strugling there will be less than 20 ticks each second, and then it takes longer until the draw comes. It is not the code that takes so much time to draw, as you probably realize if you try "/lottery draw". It takes millisecs.
  9. Offline


    Well the next draw is in 8 hours, so i'll let you know the result :)

  10. Offline

    Jonathan Thorpe

    I would hope that BOSEconomy support would be higher priority. BOSEconomy is a very popular plugin these days, not everyone likes iConomy, or can even run it...
  11. Offline


    Is it possible so you add a lottery pot each time it draw?
  12. Offline


    Is there a way to implent auto addtopot? This will make things easier and minimum Player join. That the Lottery just would been paied out when 2 or more would have buyed tickets.
  13. Offline


    for me the lottery gets to its final hour (12hrs) and once the time is up it says "draw will occur soon" and it never does, it has to be force drawn, it was like that for a whole day before, the only way for it to draw is if it is force drawn. any help would be appreciated. :)
  14. Offline


    @fantom1044 : That is weird. Do you have a lot of lag on the server? I can see if I can do anything to shorten down the time.
  15. Offline


    @Erbros not regularly although there will be a day here or there where there will be some lag but a restart will get rid of the lag. There is a regular 5-15 people on at any given time and 80 whitelisted total we pretty much rely on the server backup which is done every morning on picking the lottery because a winner is picked every time the server is restarted.
  16. Offline


    please update to 818 :)
  17. Offline


    Have you tested it? Going to check it now myself, but don't see why it should break.
  18. Offline


    i believe it work on 818, but i cant make longer test now
  19. Offline


    Yeah, I have tested on a live server, and it seems to be working okay. I'll update topic when I'm sure it's working. Thanks for the info! :)
  20. Offline


    I also stopped using iconomy and went to BOS please add support for this

    also does it support permissions 3.1.1?
  21. Offline


    Hopefully icon will be updated so I can put this on our new server. I love this plugin.

    If for some reason icon won't be updated anytime soon.

    This plugin dosen't support bose correct? How hard would it be to add support for it?
  22. Offline


    Does it support Group Manager?
  23. Offline


    Is this working on 819?
  24. Offline


    This doesnt work I get
    "An internal error occurred while attempting to preform this command"
  25. Offline


    What bukkit version? I'm having it running 819, haven't had a chance to test it with 860 yet.
  26. Offline


    I am running 818 i keep getting internal error occured while attempting to preform this command
  27. Offline


    Sorry, but I am unable to reproduce the error. Would you be able to get the server.log info regarding the error and your lottery plugin config?
  28. Offline



    Working fine for me on 860 :)
  29. Offline


    working here, too on 860 and i love it :)

    though i have one request:
    is it possible to make a command like '/lottery nextdraw' for those who disabled the announcement on login? the resulting message is then shown only to the player who runs the command?

    thanks for the plugin!
  30. Offline


    The message you get when you write /lottery is not enough? It tells you time until next draw.
  31. Offline


    ah ok! i didn't recognize this 'cos when i tested i joined the server so...
    well to keep everything stupid and simple for our users we hook every plugin to "triggerCmds" so to buy a lottery ticket users have to trigger a certain lever at the shop > therefore we want the plugins to not spam the console, so we'd never hook the /lottery command to triggerCmds :(

    however thanks 4 reply :)

Share This Page