[TUTORIAL] Setting up PVListener

Discussion in 'Server & Community Management' started by bys1, Jun 20, 2016.

Thread Status:
Not open for further replies.
  1. Hi,

    Since some users had issues setting up my plugin PVListener, I'll create a tutorial now.

    First, make sure you've set up Votifier correctly. PVListener requires Votifier.


    Installation
    Download the latest version of PVListener from Spigot and drop the JAR file in the plugins folder of you server. Restart your server to generate a data folder.
    Done! We can now configure the messages and rewards.


    Configuring
    Now that PVListener is installed and has generated a data folder, we can start configuring it.

    Messages
    PVListener currently supports 3 different message types:
    - Default: The default message. If enabled, this message will be broadcasted each time a player votes.
    - Lucky: The message for lucky votes. If enabled, this message will be broadcasted each time a player is lucky.
    - Permission: The message for permission rewards. If enabled, this message will be broadcasted each time a player gets a permission reward.

    We want a simple default message to let everyone know that someone voted at a service and got 100 dollars. For the player name and service, we'll use two placeholders. PVListener will automatically replace $player with the player's name, and $service with the service name. We can also use color codes.
    Code (YAML):

    messages
    :
      default
    :
        enabled
    : true
        message
    : '&6$player &ehas voted @ &6$service &eand received &6100 dollars&e!'
     
    The lucky message should let everyone know which player was lucky, and which reward(s) he got. We will use two placeholders for it. PVListener will replace $player with the player's name, and $rewardname with the reward name, which we'll specify in the rewards section. We can also use $service name for the service name, and we can use color codes.
    Code (YAML):

      lucky
    :
        enabled
    : true
        message
    : '&6$player &awas lucky and received &6$rewardname&a!'
     
    We want the permission message to say which player got an extra reward, and which reward he has got. We will use the $player and the $rewardname placeholders for this, which will be replaced with the player's name and the reward name which we will specify in the rewards section. We can also use the $service placeholder, and we can use color codes, if we want.
    Code (YAML):

      permission
    :
        enabled
    : true
        message
    : '&6$player &areceived &6$rewardname &a(VIP reward)!'
     
    The final messages section would be:
    Code (YAML):

    messages
    :
      default
    :
        enabled
    : true
        message
    : '&6$player &ehas voted @ &6$service &eand received &6100 dollars&e!'
      lucky
    :
        enabled
    : true
        message
    : '&6$player &awas lucky and received &6$rewardname&a!'
      permission
    :
        enabled
    : true
        message
    : '&6$player &areceived &6$rewardname &a(double rewards)!'
     
    We have now successfully set up all messages.

    Rewards
    You can set an unlimited amount of rewards.
    We want to give a player 100 dollars when voting. We can do that with the /eco command, and the $player placeholder, which will be replaced with the player's name.
    The player is not required to be online, so we'll set the require-online option to false.
    Code (YAML):

    commands
    :
      - command
    : '/eco give $player 100'
        require-online
    : false
     
    We want to give lucky players some extra money. We want to have a 10% chance that a player receives 100 extra dollars. We'll do that using the chance option. By setting chance to 10, there will be a 1/10 chance a the command will execute. We'll also set a rewardname option for the message.
    Code (YAML):

      - command
    : '/eco give $player 100'
        require-online
    : false
        chance
    : 10
        rewardname
    : '100 extra dollars'
     
    Our VIPs should get an extra diamond when voting, so we'll make a permission for that. By setting the permissions option to 'diamond', PVListener will create a pvlistener.reward.diamond permission. We'll then give all VIPs that permission in our permissions plugin. If you don't have a permissions plugin yet, feel free to check out my permissions plugin, PowerPerms. Since we cannot give items to offline players, we'll set the require-online option to true, so the command will execute as soon as the player comes online.
    Code (YAML):

      - command
    : '/give $player diamond 1'
        require-online
    : true
        permission
    : 'diamond'
        rewardname
    : 'an extra diamond'
     
    We'll now have the following rewards section set up:
    Code (YAML):

    rewards
    :
      - command
    : '/eco give $player 100'
        require-online
    : false
      - command
    : '/eco give $player 100'
        require-online
    : false
        chance
    : 10
        rewardname
    : '100 extra dollars'
      - command
    : '/give $player diamond 1'
        require-online
    : true
        permission
    : 'diamond'
        rewardname
    : 'an extra diamond'
     

    We've now successfully set up PVListener. Restart your server, and you're done!
     
    #1 bys1, Jun 20, 2016
    Last edited: Jun 5, 2017
Thread Status:
Not open for further replies.