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

    Erbros

  3. Offline

    Erbros

    @andrewkm : Thanks for the report! :) I have no idea why it should be throwing NPE's on broadcastMessage. I was unable to reproduce the error.. What plugins are you running? I noticed you are using spout, are you using a version that runs on 1.8? How long was it left until draw when this happened? Could you test out 0.6.4 and check if you get the same problem there?

    A lot of questions, I know, but I have no idea as to where to start..
     
  4. Offline

    andrewkm

    @Erbros
    No problem, ill get some testing done around tonight/tomorrow morning (Just gotta throw 1.8 on for my players as Im due for an 8pm est deadline lol)
     
  5. Offline

    monir

    How is it going does it work yet this plugin is so popular please fix it
     
  6. Offline

    Erbros

  7. Offline

    braintumor

    When I use this, tickets cannot be bought. It says an internal error has occurred.
     
  8. Offline

    Erbros

    Using lottery v6?

    It's now working with iConomy v6 :)

    http://dev.bukkit.org/server-mods/lottery/

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

    andrewkm

    @Erbros
    sorry forgot to update you. We are totally fine now, had some issues before but i guess it was a CB issue. I havent used it since the dev 1.8.1 builds, just launched it up now on CB 1221 and did tons of testing. Working very well. (Essentials economy)
    -
    Thank you very much!
     
    Erbros likes this.
  10. Offline

    DiamondFinder55

    hello.
    i have installed the plugin. everything works fine,exept one thing: i cant buy any damn tickets! D:
    still: awesome plugin
     
  11. Offline

    Erbros

    CB version?
    Lottery version?
    Post config.yml to pastebin.org and post link here.
    Post startup log to pastebin.org and post link here.
     
  12. Offline

    crzye8s

  13. Offline

    Erbros

    What happens if you try to update the plugin? Any errors? are you using iconomy? if so, what version?
     
  14. Offline

    Erbros

  15. Offline

    Viralcraftowner

    Hi! I have iConomy and essentials installed. I origionaly was using essen tials, but installed iConomy and recently reinstalled this plugin. Its still using essentialseceonmy. It has the 'Use iConomy' set to true in the config file. Any help?
     
  16. Offline

    Erbros

    There should be possible to do this with register. Try to add the line:

    economy.preferred: 'iconomy'

    to your bukkit.yml. Not sure if that is the correct way as I couldn't find any helpfile for it. If it doesn't work, try to change economy.preferred: 'iCo5' (or whatever version you are running of iConomy).

    Thank you very much for the information! :)

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

    Viralcraftowner

    Added that to my 'Settings' bit in bukkit.yml. Still takes essentials economy.
     
  18. Offline

    Erbros

  19. Offline

    Viralcraftowner

    My hosters said this..
    Hello Lawrence,

    We've tried several fixes around it, but we're not seemingly able to force Lottery to accept iconomy instead of essentials. If you know of a fix, please tell us and we'll fix it as soon as we can.
    -Harry
    Any ideas?
     
  20. Offline

    Erbros

  21. Offline

    Erbros

    @Viralcraftowner sorry, I forgot to tag you in the last post. Please tell me wheter you make it work with the method above. :)
     
  22. I'm having a problem lately with the same player winning the lottery over and over again.
    Have tried re-installing the plugin (aka deleting the whole config folder and letting it re-generate), but it still keeps happening.

    CraftBukkit #1317
    Lottery #0.6.3

    P.S : Perhaps add the possibility to block the last winner from buying lottery tickets ?

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

    Erbros

    Number of players buying tickets?
    Number of tickets the winner buys?
     
    TowelieDOH likes this.
  24. About 50 players buying tickets on average,
    And the winner buys anything from 1 to 10 tickets (10 is the max)
     
  25. Offline

    Erbros

    Okay, then it shouldn't really be possible for one person to win more than max two times in a row. Do the rest of the players only buy 1 ticket and he buys 10? How many times have this player won in a row? Any problems with the server? Lag? Do the winner buy tickets early or late in the lottery?

    Can you add "debug: true" in your lottery config.yml file and tell me what the server.log say the next 3 times a lottery is drawn? (It will provide a "rand: <int>" value, thats the one I'm curious about).

    If you feel that I don't really know what I'm looking for, then you are correct :p I have no clue at all what could be wrong if it's the plugins fault that this is happening. The "rand: <int>" values will give a good clue as to whether this is a plugin error or just good luck.
     
  26. - Other persons usually buy 1 or 10 tickets
    - He is the one buying early into the game
    - The server wasn't lagging, i tried restarting it too and it occured afterwards
    - He won about 4 times in a row before i disabled the plugin
    - Now i am using 0.6.1 and this issue is no longer present
     
  27. Offline

    Erbros

    @TowelieDOH Thank you for the feedback. I'll continue looking for anything that could cause this error.
     
  28. Offline

    Erbros

    New version, 0.7.0. You can now set total amount of available tickets, and if a ticket that isn't bought wins it will go to a jackpot :)
     
  29. Offline

    mindystorm

    do you have to have superperms?
     
  30. Offline

    Tanite

    I upgraded to both 1321 and Lottery 070 and got this on boot-up:

    Code:
    2011-10-19 00:34:38 [SEVERE] Error occurred while enabling Lottery v0.7.0 (Is it up to date?): Cannot store null
    java.lang.IllegalArgumentException: Cannot store null
            at org.bukkit.configuration.MemorySection.prepForStorage(MemorySection.java:526)
            at org.bukkit.configuration.MemorySection.set(MemorySection.java:189)
            at net.erbros.Lottery.Lottery.configReplacePath(Lottery.java:881)
            at net.erbros.Lottery.Lottery.loadConfig(Lottery.java:908)
            at net.erbros.Lottery.Lottery.onEnable(Lottery.java:96)
            at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:170)
            at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:957)
            at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:280)
            at org.bukkit.craftbukkit.CraftServer.loadPlugin(CraftServer.java:171)
            at org.bukkit.craftbukkit.CraftServer.enablePlugins(CraftServer.java:154)
            at net.minecraft.server.MinecraftServer.e(MinecraftServer.java:297)
            at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:284)
            at net.minecraft.server.MinecraftServer.init(MinecraftServer.java:152)
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:348)
            at net.minecraft.server.ThreadServerApplication.run(SourceFile:417)
     
  31. Offline

    Erbros

    It will work without too, but then all players can use lottery commands, and op the lottery admin commands.

    Okay, thats weird. I know about the storing null problem with CB, but this was fixed in Bukkit 943 (http://ci.bukkit.org/job/dev-Bukkit/943/) and CB 1321 is using Bukkit 945... Try 1337 instead, that should work without doubt!

    Thanks for using my plugin :)
     

Share This Page