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

    aykutmania

    You're the man! ;-) Thanks!
     
  3. I think the next feature you need to add is the ability to buy multiple tickets, it only makes sense :D
     
  4. Offline

    Erbros

    Actually, it won't take more than about 2-3 lines of code.. :p
     
  5. Sweet if you could add that ASAP so that the pot reflects how many tickets theyve bought that would save my life!

    Maybe by doing /lottery buy <amount> so /lottery buy 10 would be 10 tix and the pot would go up by 10 times the cost of the ticket.

    Thanks in advance, roll this out!
     
  6. Offline

    SeoToX

    Hi!

    How can i set lottery drawing to 10-20 minutes? I have a party server, and i dont want to wait hours :\

    Thank you
     
  7. Offline

    RG_PankO

    @Erbros I use PermissionEX, mysql.
    I add lottery.buy to the user's permissions but they dont have access.
    Any ideas? Does the plugin support PermissionEX?
    The OPs can buy/draw/win in the lottery though, so it's working.
     
  8. Offline

    Kowaman

    just wondering what is the point of nextexec
     
  9. Offline

    Erbros

    Just check the first post :) Every config variable is explained :)

    Any errors? I don't support PermissionEx, but it looked like PermissionEx supports plugins that try to use Permissions 2.x.
     
  10. Offline

    RG_PankO

    @Erbros

    No console errors.
    People just don't hae permission to buy tickets.

    Whe I type as a User /lottery buy it says: [LOTTERY] You don't have access to that command!

    If it was PermissionsEx fault it was goin to be you dont permissions to that command in red and without [LOTTERY] in the begining.
    Is there some settings that I am missing up or idk, please help me!
     
  11. Offline

    Erbros

    If you have given your users the 'lottery.buy' permission, there is really not much I can do to help you. I don't know the permission system that much, and nobody else have been having that problem.

    That is not possible at the moment. Sorry.

    Working on it. Had to change a bit more than 3-4 lines (more like edit/add 50-100 lines), but now I'm nearly finished. ;)

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 12, 2016
  12. Sweet! Let me know when its done Ill be updating right away!

    Disregard that, sweet! thanks for updating quickly!

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

    Bronski

    FYI: The "5" isn't part of the hyperlink :D
     
  14. Offline

    Erbros

    Thanks :D

    Fixed :D
     
  15. Offline

    ScottSpittle

    CB 996
    when using console to try command /lottery

    can we have a perm node for just the ability to see the /lottery information, but not to actually place bets..

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

    crzye8s

    Players can buy negative tickets (for ex. /lottery buy -9999) and it gives them 5 dollars for free per negative ticket. Can you fix this asap.
     
  17. Offline

    Erbros

    Wow, that's not good! Will fix at once!

    Edit: Fixed, 0.5.1 released now!
     
  18. Offline

    RG_PankO

    @Erbros I just wanted to tell you that I got your plugin working.
    The problem in my permissions was that in PermissionsEx on type I wrote 1, while it has to be zero.

    I understood that you are using PermissionsEx too, can you tell me what is type 1/ 0 ?
     
  19. Offline

    ScottSpittle

    Edit: Fixed, 0.5.1 released now![/quote]

    you coulda fixedwhat happens when you use /lottery in console..

     
  20. Offline

    Erbros

    You are correct; I could have.. :p

    But at the moment I am using my time on other projects, and I only used time on this plugin because the error @crzye8 provided was so grave.

    Sorry, I've never used PermissionsEx, you will probably get better support in the PermissionsEx thread. :)

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 12, 2016
  21. Next problem, probably shouldve thought about this before but can there be a config option to set the max amount you can buy?
     
  22. Offline

    ScottSpittle

     
  23. Offline

    Erbros

    I'll implement it when I get time :)
     
  24. can I have the sourcecode datas.
    I will translate it at German
     
  25. Offline

    zaklampje

    Does this support BOSEconomy?
     
  26. Offline

    Kainzo

    Has anyone tested this with 1000 ?
     
  27. Works perfect with 1000
     
  28. Offline

    Erbros

    Thanks for the info :)

    You can find the full source in the first post :)

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 12, 2016
  29. There is no source file :( Can you give me a link
    And you can in the next version also integrate custom texts
     
  30. Offline

    Carbon0x

    I have an idea for this:

    You should be able to define an amount that will be 'extra in the pot' automatically added after each ticket is drawn in the config file :)
     
  31. Offline

    Erbros

    You can do that with the netPayout variable. If the tickets cost 10 coins, and you want to add 5 coins extra, just change netPayout: 150

    Edit: Simple math, as 10 coins * 150% = 15 coins.

    https://github.com/Erbros/Lottery

    As for adding custom texts, that would be too much work. I will keep it in mind for when I'm writing my next plugin tho.
     

Share This Page