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

    Phantom Index

    Does this support iConomy?
  3. Offline


    does this support iconomy?
    phantom index beat me to it>.<
  4. Offline


    Looks really nice. Iconomy support is not needed but would be cool.

    Question, what happens if 3 players for example enter the lottery and before the drawing the server restarts. will this reset the lottery or anything like that?
  5. Offline


    Yes. Will update first post.

    The lottery will not be reset. Drawing will be at the same time as if the server had been online, and if the server was offline while the drawing should have been, the drawing will be as soon as the server gets online.

    Users that have paid for ticket is also remembered.
  6. Offline


    may i ask what the commands are?
  7. Offline


    Its in the features list, but "/lottery" for basic info and "/lottery buy" to buy a ticket. :)
  8. Offline


    thanks bud
  9. Offline

    tha d0ctor

    cool plugin, Ill be adding this to my server real soon.

    how about a feature that adds to and continues to add to the jackpot as long as there fails to be a winner for that given iteration, this could look back at how many drawings there have been since a winner, count the number of tickets purchased in each drawing and calculate the new winnings off of that
  10. Offline


    sorry about so many questions but when u buy it what do u win?if you win money how can i change the amount u win?if u dont win money what do u win?and how can i configure it?
    also 1 more thing do i gotto give permission or no its global everyone can use without permission nodes?
  11. Offline


    If 1 person has bought a ticket, that person wins. There is always a winner if somebody bought a ticket.

    The players win money, and the amount they win is based on buyprice * tickets sold. So if 10 players buy tickets to 5 coins a piece, the winner will get 5 * 10 = 50 coins.

    As of now, there are no permissions, and everybody can use it.
  12. Offline


    else {      sender.sendMessage("[LOTTERY] Hoy, I don't recognize that command!");
    *hey :) In

    Very nice job. An option to set the jackpot and not add the users money in [i.e. set it to 4000 and even if 100 people buy a ticket, it wouldn't change ;)].

    I might take a look a further your code and add it in. If i do, I'll post it here and you can use it yourself ;)

    edit: Looked through it. I'm too lazy. I'm sure you know what to do but if you want an idea to start with, pm me ;)
  13. Offline


    thanks man for the answers now 1 last questions:) how do we know who won???lets say i bought a ticket and when it does the lottery im offline how will i know or if im online how will i know?
  14. Offline


    The server announces who won when the drawing is, but I plan on adding the 3 last winners to the /lottery command, and perhaps optionally admins can enable it so people gets notified about the latest winner when they login.

    The "Hoy" is actually a sad attempt to be cool, and not a spelling mistake :p

    The thing about the jackpot is really something I could think about adding if you don't :)

    Thanks for checking out my source, its always nice to get constructive feedback :)
  15. Offline


    I'm not familiar with the bukkit "language" , but I would add something like "jackpotDefault" in your config file, then set the default... string(?) in it to be none, and create an else if statement under "if(players.isEmpty() == true) {" in the getWinner boolean to set the jackpot to the input number, or if its "none", to ignore it ;)
    Edit: wtf is going on with the text and size. Also, a static jar would be nice :)
  16. Offline


    hey im having a weird problem....

    hours: '12'
    nextexec: 1300217949209
    cost: '50'

    so i put 12 hours for ever lottery just..umm ingame it says 24 hours something left...any idea?
  17. Offline


    Thats because the countdown already started the first time you started the server. Next time it starts a countdown, it will be 12 hours. You can force this with setting "nextexec: 1"

    So the idea is that if nobody bought a ticket one round, it would add a jackpot next round as an incentive for the players to buy tickets? Would be quite easy, I think..

    Static jar is a good suggestion. Added to first post.
  18. Offline


    I second what "tha d0ctor" said would love the addition of a "chance to win" (could be a percent or ratio) as in 1/100 or .1% chance at winning or maybe a number range that users could pick (range of 1-1000 and user picks 528) and the option of carrying over the pot if no one wins. Also now that you have a static jar you could post your link to CraftBukkitUpToDate
  19. Offline


    Thats a really good idea, I'll add that one to my todo list.

    Submitted plugin to CraftBukkitUpToDate :)

    Yay, I got my Plugin Developer sign. Awesome, I now got the same sign as some truly amazing java coders! Incredible.
    dak393 likes this.
  20. Offline


    Just making sure. Can you use this with normal gold ingots? For the servers that don't use iConomy.

    So it just takes 1 gold ingot from your inventory.
  21. Offline


    That could be an option. Will add it to my todo list. :)
  22. Offline


    Thanks! :) Will keep watching this thread.
  23. Offline


    Cool, Saw something like this in SAMP servers.
  24. Offline


    I have edited the hour or w/e to 6 instead of 24 and it doesnt apply.
  25. Nice Plugin
    Erbros likes this.
  26. Offline


    I would also love the ability to configure the prize to be items instead and permissions support. awesome plugin been using it since you posted it!!
  27. Offline


    Can you make it so that not every time there is a winner. I would like something like a REAL Lottery where they buy a ticket and can chose a number from like 1 - 1000. If they dont get it right then the money rolls over. If they get atleast the first 3 numbers right or like any of the 3 numbers right they get 40% of the pot. etc etc. Then allow for multiple winners to split the pot as well.

    the pot is 500 coins
    winning numbers are 2 1 3 4 7 8

    player A has 2 0 4 4 8 8 - 3 numbers right...
    Player B has 9 3 3 4 7 0 - also 3 numbers
    3 numbers ios 40% 2 winners = both get 20% of the pot. the rest is rolled over.

    And say 3 is 50% 4 is 75% and 6 is 100%

    This way not every time is a winner its more liek a real lottery
    Also have it set so players can buy a configurable number of tickets.
    Also maybe a base prize ammount that we can set. So even if no one buys anything the Jackpot will always have a set ammount in it to roll over
  28. Offline


    While that's a good idea, my question was if you could add an option input the jackpot of your choice (for example, if someone typed /setjackpot 500000, it would set the jackpot to 500,000) and any tickets bought after wouldn't change the jackpot.
  29. Offline


    Could you make it have a saying when you first log in "18 hours till next lottery. Buy your tickets now!" or some sort
  30. Offline


    When i type /lottery i got this ..
    21:29:48 [INFO] [LOTTERY] Pulling winner in23 hours, 41 minutes and 12 seconds.
    21:29:48 [WARNING] Unexpected exception while parsing console command
    org.bukkit.command.CommandException: Unhandled exception executing command 'lott
    ery' in plugin Lottery v0.1
    at org.bukkit.command.PluginCommand.execute(
    at org.bukkit.command.SimpleCommandMap.dispatch(
    at org.bukkit.craftbukkit.CraftServer.dispatchCommand(
    at net.minecraft.server.MinecraftServer.b(
    at net.minecraft.server.MinecraftServer.h(
    Caused by: java.lang.NoClassDefFoundError: com/nijiko/coelho/iConomy/iConomy
    at net.erbros.Lottery.Lottery$1.onCommand(
    at org.bukkit.command.PluginCommand.execute(
    ... 6 more
    And i have lattest version of bukkit ( i download bukkit yesterday on here : )

Share This Page