Tutorial

 

Installation

Installing Lottery+ is as simple as any other plugin. Simply download the latest file, and drop it into the plugins folder, then restart your server. You must also have at least Java 1.8 installed. When the plugin loads and is enabled, 6 files should be created:

  1. 'lotteries.yml' - This where the lotteries are created. To learn how to do so, continue on the tutorial to the Lottery section.
  2. 'config.yml' - The main config of the plugin.
  3. 'lang.properties' - In this file, you can edit the messages that are in this plugin.
  4. 'items.yml' - This file contains all the items you can use in the item rewards for lotteries
  5. 'enchantments.yml' - This file contains all the enchantments that you can you add to the item rewards.
  6. 'colors.yml' - This file contains all the chat colors that you can use with their codes.

Lottery

Hello my name is Randude14, the fine Arthur of this plugin. I have made creating these lotteries as easy as possible. Which is what we will be going over first. If you enter the command '/l list' you will notice that there are no lotteries. This is because we haven't created any yet.

Creating

Now there are to ways of creating your lotteries; You can either continue on with this tutorial and do it "manually" or you can use the all new light weight GUI which can open current lotteries or create new ones. The first thing that what you want to do is open the 'lotteries.yml', that was created when you first installed the plugin, with a text editor (I recommend Notepad++ if you have Windows). You will notice that an example is laid at the bottom explaining some of the values that you normally use with your lottery. Now we could make our lotteries manually, but thankfully there is a command we can use that will do this for us.

Quote:
lotteries:

#lotteries:
#   MAIN:
#       pot: 10000.00 - starting pot
#       time: 3 - time between drawings (x hours)
#       ticket-cost: 100.00 - cost of a ticket   
#       repeat: true - whether lottery should repeat
#       max-tickets: 10 - max tickets a player can buy
#       min-players: 2 - min players for lottery to draw
#       max-players: 10 - max players that can be in the lottery

We can call our lottery anything we want, but for this tutorial we are going to call it 'Diamond'. Note that when naming your lottery It cannot contain any special characters such as "*", ".", "&", ect... Now type and issue the command '/l create Diamond' into the console. Now if we go back and open the 'lotteries.yml' again, you will notice that there was a section created, titled 'Diamond' along with some pre-defined values. If you look at the example, it will explain some of the values and their purpose. For a more detailed explination and complete list of the options that are available, look at the defaults section of the config. In which now I will be explaining their exact purpose.

Quote:
# 
#   MAIN:
#       pot: 10000.00 - starting pot
#       time: 3 - time between drawings (x hours)
#       ticket-cost: 100.00 - cost of a ticket   
#       repeat: true - whether lottery should repeat
#       max-tickets: 10 - max tickets a player can buy
#       min-players: 2 - min players for lottery to draw
#       max-players: 10 - max players that can be in the lottery
lotteries:
  Diamond:
    ticket-cost: 10.0
    pot: 1000.0
    time: 48.0
    max-tickets: -1
    min-players: 2
    max-players: 10
    ticket-tax: 0.0
    pot-tax: 0.0

Now you may be wondering what happens when you don't declare a value in your lottery, which is where the defaults come in. Whenever a value is not declared on a lottery, it loads in the value from the defaults. This is useful in case you have a repitive value in all your lotteries. For instance you may want to provide different lotteries with different rewards but you want values such as the time, ticket cost, pot; to remain the same. Now to continue on with setting up and finishing up our lottery.

Now to comes to the reason that I named our lottery 'Diamond'. In this example I'm going to set up my lottery to have diamonds used as the currency. To accomplish this, we have to set up our lottery not to load the economy from Vault. If we look at our defaults section you should see a value called "use-vault" which is by default to true. We want this to be set to false. So in our lottery, declare "use-vault" and set it to false. Then set the material name to "Diamond". Now we have to set the name of our currency. Declare yet another value called "material-name" and set it to "Diamond". The values "material" and "material-name" are not to be confused with each other. The value "material" is used for the actual name of the block/item in coding, "material-name" is simply there so that you can change the currency name to whatever you want. Anyways back on topic. Since diamonds are so rare, I will lower down the ticket cost, pot, and the time of the drawing.

Quote:
# 
#   MAIN:
#       pot: 10000.00 - starting pot
#       time: 3 - time between drawings (x hours)
#       ticket-cost: 100.00 - cost of a ticket   
#       repeat: true - whether lottery should repeat
#       max-tickets: 10 - max tickets a player can buy
#       min-players: 2 - min players for lottery to draw
#       max-players: 10 - max players that can be in the lottery
lotteries:
  Diamond:
    ticket-cost: 2.0
    pot: 10.0
    time: 6
    max-tickets: -1
    min-players: 2
    max-players: 10
    ticket-tax: 0.0
    pot-tax: 0.0
    use-vault: false
    material: Diamond
    material-name: 'Diamond'

If would like more examples, check out my example 'lotteries.yml' on github.

Loading

Now that we have our lottery set to what we like, it's time to load it. You could reload the server and it would load our lottery that way, but thankfully once again there is a command we can use. Type '/l load Diamond' into the console to load our lottery. Now if you type in '/l list', you will notice that our lottery has been loaded into the plugin. If you also type in '/l info Diamond' you can see some of the info about our lottery we just created and loaded. You can also now see that our lottery is in fact using diamonds as it's currency.


Getting Tickets

Getting tickets for lotteries is relatively easy, and getting as many as you possibly can will increase your chances of winning them. There are 3 ways of obtaining them:

  1. Buying them through '/l buy <lottery name> <x tickets>'
  2. Rewarded by an admin through '/l reward <player> <lottery name> <x tickets>'
  3. Through signs

Signs

Signs can be used in Lottery+ for buying tickets. Setting up a sign only requires you to use the first two lines. On the first line put the sign tag that you defined in the config ("[Lottery+]" by default), note that you DO NOT need the color codes. Then on the second type the name of the lottery that would like to register this sign to (NOT case sensitive).




Then click "done" and the sign will be registered to the lottery:



The cool thing about these signs is that the time will regularly update. To buy tickets from the sign, right click the sign and type the number of tickets you would like to buy:



To remove the sign, sneak and right-click it and it will break and be unregistered: