What's new
  • This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

VotingPlugin

AssistanceHub

Administrator
Staff member
Joined
Mar 3, 2018
Messages
9
Likes
0
Points
1
#1
VotingPlugin
Download Link

Before you can use this, you will need to make sure you have a plugin that listens for votes Guide here.

If you haven't done so already, download the plugin and add it to your server. Restart the server and let all the files generate, and head to the newly created folder. /plugins/votingplugin

You should see the following:
VotingPlugin_Folder.PNG

Starting with Config.yml, you can edit the format of most of the plugin from here, however the focus will be on the first few lines of the config which is SQL details.

code_language.yaml:
# Valid Options:
# - SQLITE
# - FLAT
# - MYSQL
DataStorage: SQLITE

# Information for mysql
MySQL:
  Host: ''
  # Default port is 3306
  Port: 3306
  Database: ''
  Username: ''
  Password: ''
  # Max number of connections
  MaxConnections: 1
  # Maxium size of caching mysql
  # -1 for no limit
  # Affecting this value may affect performance
  MaxSize: -1
  # Table name prefix, for use with mutliple servers
  Prefix: ''

So, if you are using the database provided by Multicraft, see the following to find the details (Multicraft Database). The default setting is SQLITE, which is perfectly fine for most cases, but if for whatever reason you wanted to use MySQL, it is all fairly straight forward.
All of the information is provided in the link above, however a few things to note.

DataStorage: If you wish to use MySQL, all you need to do is replace SQLITE with MYSQL and enter all the details.
MaxConnections: Leave this at the default of 1 especially if you are on shared hosting, as this can sometimes cause a few unintentional issues.
Prefix: If you are using the Multicraft database, and have multiple plugins running on the same database it is very important to change the prefix to something unique to the plugin using it. If you don't then conflicts can happen corrupting all the information within your database.

If you changed to SQL, restart your server for it to make the connection.


Now to get to a fairly confusing part, this takes a little care to make sure it all goes right first time.

code_language.yaml:
VoteSites:
  # VoteSite name
  ExampleVoteSite:
    # Enable voteSite
    # If false, votesite will not be loaded by plugin
    # Default: false
    Enabled: false
    
    # Display name of voting site
    Name: 'ExampleVoteSite'
          
    # Priority of this site
    # Used for sorted list
    # High prority, higher on the list
    Priority: 5
          
    # The serviceName from the vote, has to be correct to work correctly
    # Gotten from voting on the site (will be in console/log)
    # Usually is the main part of the url(e.g. PlanetMinecraft.com)
    ServiceSite: 'PlanetMinecraft.com'

    # vote url for /vote
    # Format for this can be set in Format.yml
    # Do not include colors here
    VoteURL: 'link to vote URL here, used in /vote'

    # Time between votes in hours (used for /vote next)
    # Most sites are 24 hours
    VoteDelay: 24
    
    # Reset vote delay each day (for certain sites that do this)
    VoteDelayDaily: false
    
    # If true, rewards can be executed offline (requires ForceOffline to be true in the reward)
    # Setting this to true will execute the reward offline, NOT WHEN THE PLAYER IS OFFLINE
    # This basiclly disables offline voting if set to true, don't misinterpret this option
    ForceOffline: false
    
    # VoteSite Material for GUI's
    # Removing this may result in an error, required on each site
    Item:
      Material: 'DIAMOND'
      Amount: 1

    # Rewards to give
    # https://github.com/Ben12345rocks/AdvancedCore/wiki/Rewards
    Rewards:
      Commands:
      - 'say hello'
      Messages:
        Player: 'You voted'

VoteSite name:
Beneath # VoteSite name, you will need to change ExampleVoteSite to the name of the site you are using for that reward.

Enable VoteSite:
If you want to have this reward active, you will need to set this to true, otherwise it will stay inactive.

Display Name of Voting Site:
This will be the name players will see when running the /vote command.

Priority of this site:
This determines where in the list the voting site will be, the higher the number, the higher it is on the list.

serviceSite:
You will need to put the main portion of the voting site here, some examples are below
  • planetminecraft.com
  • minecraftservers.org
  • minecraft-mp.com
  • minecraft-tracker.com
VoteURL:
This is the full link needed to vote, you would just need to copy and paste the link in the address bar when on your voting page.

VoteDelay:
You shouldn't need to touch this as most voting sites use a 24 hour vote anyway.

VoteDelayDaily:
Again, this is something that shouldn't need to be changed.

ForceOffline:
Leave this as false, as it can cause rewards to occasionally not be given if offline is true.

VoteSite Material:
The item that will be shown in the gui when using /vote. It using the name of the item, don't use their ID's.

Rewards to Give:
If you follow the format of the rewards shown, you can add as many commands or messages as you want.
The main placeholder used is %player% as this will replace it with the name of the voter.
code_language.yaml:
 Rewards:
#Commands ran once voted
      Commands:
      - 'give %player% diamond 10'
#This works if using an economy plugin like essentials and vault
      - 'eco give %player% 1000'
#Messages sent.
      Messages:
        Player: 'You voted'
        Broadcast: '%player% just voted!
If you look in /plugins/votingplugin/rewards there are some files that hold a more indepth reward system, it is advised you give them a read if you wish to use, as they contain a lot of information within.
code_language.yaml:
Rewards:
- 'RewardFile1'
- 'RewardFile2'
You would use the above (Replacing the names accordingly) if you wanted to use the files.