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

    aidancbrady

    Getting this error with PermissionsEx on 1.2.3:
    05.03 17:10:13 [Server] INFOat net.minecraft.server.ThreadServerApplication.run(SourceFile:490)
    05.03 17:10:13 [Server] INFOat net.minecraft.server.MinecraftServer.run(MinecraftServer.java:452)
    05.03 17:10:13 [Server] INFOat net.minecraft.server.MinecraftServer.w(MinecraftServer.java:520)
    05.03 17:10:13 [Server] INFOat org.bukkit.craftbukkit.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:126)
    05.03 17:10:13 [Server] INFOat net.erbros.lottery.LotteryDraw.run(Unknown Source)
    05.03 17:10:13 [Server] INFOat net.erbros.lottery.Lottery.lotteryDraw(Unknown Source)
    05.03 17:10:13 [Server] INFOat net.erbros.lottery.LotteryGame.getWinner(Unknown Source)
    05.03 17:10:13 [Server] INFOat org.bukkit.Bukkit.broadcastMessage(Bukkit.java:114)
    05.03 17:10:13 [Server] INFOat org.bukkit.craftbukkit.CraftServer.broadcastMessage(CraftServer.java:322)
    05.03 17:10:13 [Server] INFOat org.bukkit.craftbukkit.CraftServer.broadcast(CraftServer.java:950)
    05.03 17:10:13 [Server] INFOat org.bukkit.craftbukkit.entity.CraftHumanEntity.hasPermission(CraftHumanEntity.java:99)
    05.03 17:10:13 [Server] INFOat ru.tehkode.permissions.bukkit.superperms.PermissiblePEX.hasPermission(PermissiblePEX.java:101)
    05.03 17:10:13 [Server] INFOat ru.tehkode.permissions.bukkit.superperms.PermissiblePEX.checkPermission(PermissiblePEX.java:112)
    05.03 17:10:13 [Server] INFOat org.bukkit.permissions.PermissibleBase.hasPermission(PermissibleBase.java:71)
    05.03 17:10:13 [Server] INFOat ru.tehkode.permissions.bukkit.superperms.PermissiblePEX.isPermissionSet(PermissiblePEX.java:199)
    05.03 17:10:13 [Server] INFOat ru.tehkode.permissions.bukkit.PermissionsEx.getUser(PermissionsEx.java:157)
    05.03 17:10:13 [Server] INFOat ru.tehkode.permissions.bukkit.PermissionsEx.getPermissionManager(PermissionsEx.java:150)
    05.03 17:10:13 [Server] INFO java.lang.RuntimeException: Permissions manager is not accessable. Is the PermissionsEx plugin enabled?
    05.03 17:10:13 [Server] WARNING Task of 'Lottery' generated an exception
    05.03 17:10:13 [Server] SEVEREat net.minecraft.server.ThreadServerApplication.run(SourceFile:490)
    05.03 17:10:13 [Server] SEVEREat net.minecraft.server.MinecraftServer.run(MinecraftServer.java:452)
    05.03 17:10:13 [Server] SEVEREat net.minecraft.server.MinecraftServer.w(MinecraftServer.java:520)
    05.03 17:10:13 [Server] SEVEREat org.bukkit.craftbukkit.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:126)
    05.03 17:10:13 [Server] SEVEREat net.erbros.lottery.LotteryDraw.run(Unknown Source)
    05.03 17:10:13 [Server] SEVEREat net.erbros.lottery.Lottery.lotteryDraw(Unknown Source)
    05.03 17:10:13 [Server] SEVEREat net.erbros.lottery.LotteryGame.getWinner(Unknown Source)
    05.03 17:10:13 [Server] SEVEREat org.bukkit.Bukkit.broadcastMessage(Bukkit.java:114)
    05.03 17:10:13 [Server] SEVEREat org.bukkit.craftbukkit.CraftServer.broadcastMessage(CraftServer.java:322)
    05.03 17:10:13 [Server] SEVEREat org.bukkit.craftbukkit.CraftServer.broadcast(CraftServer.java:950)
    05.03 17:10:13 [Server] SEVEREat org.bukkit.craftbukkit.entity.CraftHumanEntity.hasPermission(CraftHumanEntity.java:99)
    05.03 17:10:13 [Server] SEVEREat ru.tehkode.permissions.bukkit.superperms.PermissiblePEX.hasPermission(PermissiblePEX.java:101)
    05.03 17:10:13 [Server] SEVEREat ru.tehkode.permissions.bukkit.superperms.PermissiblePEX.checkPermission(PermissiblePEX.java:109)
    05.03 17:10:13 [Server] SEVEREat ru.tehkode.permissions.bukkit.superperms.PermissiblePEX.performCheck(PermissiblePEX.java:123)
    05.03 17:10:13 [Server] SEVEREat ru.tehkode.permissions.bukkit.PermissionsEx.getUser(PermissionsEx.java:157)
    05.03 17:10:13 [Server] SEVEREat ru.tehkode.permissions.bukkit.PermissionsEx.getPermissionManager(PermissionsEx.java:150)
    05.03 17:10:13 [Server] SEVERE java.lang.RuntimeException: Permissions manager is not accessable. Is the PermissionsEx plugin enabled
     
  3. Offline

    Erbros

    Which lottery version are you running? I know KHobbits have released versions working with 1.2.3, but it looks to me like it could be an error with permissionsEx?
     
  4. Offline

    seney

    How do i make the lottery cost money and not gold ingots?
     
  5. Offline

    Erbros

    useiConomy: true
     
  6. Offline

    iforgot290

    is it updated to 1.2.4?
     
  7. doesnt work for my server :\
     
  8. Offline

    yocally

    Might I suggest a way for players to check who bought tickets and how many each player bought? I believe that this feature would be would be a very good idea, just a suggestion, going to add this to my server once we get going, amazing job, keep up the good work. Also I love the system where you can use items instead of currency, amazing idea.
     
  9. Offline

    W&L-Craft

    I use essentials for Economy, but is it possible to give them money instead of Gold Ingot?
     
  10. Offline

    Evan1998

    i guess

    Nothings coming up in my Lottery folder, it worked before, ill just try an older version

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

    Erbros

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

    Post a new ticket and provide information that can help solve this problem. Thank you.
     
  12. Offline

    Stephen5158

    when i do /lottery it says /lottery. how can i fix this?
     
  13. Offline

    Fighter88

    Lottery Configin German
    the admin message are in English
    do I still have times when I

    message:
    prefix: '&6[LOTTERY]&r'
    Welcome: '%prefix% &fLotterieziehung in: &c%drawLong%'
    ErrorPlugin: '%prefix% Sorry, we haven''t found a money plugin yet..'
    ErrorAccess: '%prefix% Du hast keine Rechte, meld dich bei einem Admin'
    ErrorCommand: '%prefix% Den Befehl giebt es nicht!'
    ErrorConsole: '%prefix% You''re the console, I can''t sell you tickets.'
    ErrorConsole2: '%prefix% You''re the console, you don''t have an inventory.'
    ErrorConsole3: '%prefix% You''re the console, you can''t change that.'
    ErrorNoAvailable: '%prefix% Es giebt nicht mehr genug Karten'
    ErrorAtMax: '%prefix% Du hast bereits das Maximum von %0% %1%.'
    ErrorNotAfford: '%prefix% Du hast nicht genug Geld'
    ErrorNumber: '%prefix% Nehm bitte nur gerade Zahlen'
    ErrorClaim: '%prefix% Du hast noch keine Nieten.'
    TicketCommand: '%prefix% Kauf ein Ticket fuer &c%cost% &rmit &c/lottery buy'
    PotAmount: '%prefix% Gerade sind es &a%pot% &rim Pot.'
    YourTickets: '%prefix% Du hast &c%0% &r%1%'
    TicketRemaining: '%prefix% Es sind noch &c%0% &r%1% uebrig.'
    CommandHelp: '%prefix% &c/lottery help&r um alle Commands zu sehen'
    LastWinner: '%prefix% Letzter Gewinn: %0% %1%'
    CheckClaim: '%prefix% Sieh ob du bei den Gewinner dabei warst &c/lottery claim'
    BoughtTicket: '%prefix% Du hast &c%0% &r%1% fuer &c%2%'
    BoughtTickets: '%prefix% Du hast nun &c%0% &r%1%'
    BoughtAnnounceDraw: '%prefix% &r%0% &rgerade gekauft %1% %2%! es sind jetzt %3%'
    BoughtAnnounce: '%prefix% &r%0% &rhat gerade %1% %2% gekauft!'
    DrawIn: '%prefix% Zeit bis zur Ziehung: &c%0%'
    DrawNow: '%prefix% Lottery wird sofort gezogen werden.'
    DrawSoon: bald
    DrawSoonLong: Ziehung kommt bald!
    PlayerClaim: '%prefix You just claimed %0%'
    MessagesEnabled: '%prefix% Sie erhalten nun Lottery Broadcast Nachrichten.'
    MessagesDisabled: '%prefix% Sie werden keine Lottery Broadcast-Nachrichten mehr
    empfangen.'
    NoWinnerTickets: '%prefix% Keine Tickets verkauft diese Runde. Das ist eine Schande.'
    NoWinnerRollover: '%prefix% Kein Sieger, &a%0% &rgehen an den jackpot!'
    WinnerCongrat: '%prefix% Gluekwunsch Du hast Gewonnen &c%1%.'
    WinnerCongratClaim: '%prefix% Use &c/lottery claim &rto claim the winnings.'
    WinnerSummary: '%prefix% Es gab insgesamt %0% %1% verkauft %2% %3%'
    AddToPot: '%prefix% Added &a%0% &rto pot. Extra total is &a%1%'
    ConfigCost: '%prefix% Cost changed to &c%0%'
    ConfigHours: '%prefix% Hours changed to &c%0%'
    ConfigMax: '%prefix% Max amount of tickets changed to &c%0%'
    ConfigReload: '%prefix% Config reloaded'
    HelpPot: '%prefix% /lottery addtopot <number>'
    Help: '%prefix% &6--Hilfe Menue--%newline%%prefix% &c/lottery&r : Lottery Infos.%newline%%prefix%
    &c/lottery buy <n>&r : Tickets kaufen. %newline%%prefix% &c/lottery claim&r :
    Einforderung ausstehender gewinne.%newline%%prefix% &c/lottery winners&r : Sieh
    den letzten Gewinner.'
    HelpAdmin: '%prefix% &1/lottery draw&r : Draw lottery.%newline%%prefix% &1/lottery
    addtopot&r : Add number to pot. %newline%%prefix% &1/lottery config&r : Edit the
    config.'
    HelpConfig: '%prefix% Edit config commands%newline%%prefix% &c/lottery config cost
    <i>%newline%%prefix% &c/lottery config hours <i> %newline%%prefix% &c/lottery
    config maxTicketsEachUser <i>%newline%%prefix% &c/lottery config reload'
    TimeRemaining: '%prefix% There is &c%0% &r%1% left.'
     

Share This Page