ReferIO

A mod where you can can get rewards for inviting other players to the server.

ReferIO

Quick links:

Development Builds (Jenkins) 
Souce Code (GitLab)

User Guide

ReferIO has only one simple command: /refer [my|new|clear|key].

You want to invite someone

Just use /refer or /refer new. If all works fine you'll get this response:

Referal added. Give this hash to your friend: AABBC

Depending on the server settings you might get:

Maximum pending referals reached!

That means that you'll either have to wait until one of your keys will be used or you can clear the pending requests with /refer clear.

You can check all your referals with /refer my

 

You want to use a key

Just use /refer <your hash> to use your key and you're done. After that a time counter starts and checks for your playtime. If you have played long enough the rewards will be unlocked.

You can check your time counter with /refer my

Config

ReferIO creates the config file ReferIO.cfg in your config folder.

ReferIO has multiple Config options:

referTimeout

The time a pending referal exists in seconds.
Default is 604800 seconds = one week.
Set to 0 do disable timeouts.

maxPendings

The maximum amount of pending requests a player can have.
Default is 5.
Set to 0 if you want do disable this limit.

maxRefers

The maximum amount of requests a player can generate overall.
Default is 10.
Set to 0 if you want do disable this limit.

playTimeUntilReward

The timespan in seconds the referred player has to be online until rewards get unlocked.
Default is 1800 seconds = 30 minutes.

rewardCommands

A list of commands that will be executed ("the reward"). Put your rewarding commands in here. The commands will be executed as the server. You can use %referer for the user that invited the new player and %referred for the new player. It doesn't matter if you use a slash at the beginning of a command or not.

Example:

S:rewardCommands <
 give %referred minecraft:steak 1
 ?/msg %referer %referred got his reward, thank you for increasing the community!
 >

When the commands will be triggered you can be sure that the referred player is online. The referer on the other hand might be offline. If you want a command to be run when the the referer is online for sure, use ? in front of your command. Keep in mind that the referred player might be offline at that time.

keyLength

The length of the generated alphanumeric referal key.
Default is 5 letters.

The key is alphanumeric, meaning that there are in total 62 letters to be used.
Therefore your amount of keys is 62n with n as the key length.
Used keys will be re-used.

Keep in mind that you should always have enough keys so calculate with a buffer.
If you run out of keys the mod will crash!

 

Example Config

# Configuration file

general {
 # The length of the generated key [range: 1 ~ 2147483647, default: 5]
 I:keyLength=5

 # The maximum amount of pending requests a player can have [range: 0 ~ 2147483647, default: 5]
 I:maxPendings=5

 # The maximum amount of requests a player can generate [range: 0 ~ 2147483647, default: 10]
 I:maxRefers=10

 # The timespan the player has to be online until rewards get unlocked [range: 0 ~ 2147483647, default: 1800]
 I:playTimeUntilReward=1800

 # The time a pending referal exists [range: 0 ~ 2147483647, default: 604800]
 I:referTimeout=604800

 # List of commands that will be executed as reward. [default: [give %referred minecraft:steak 1], [msg %referer %referred got his reward, thank you for increasing the community!]]
 S:rewardCommands <
 give %referred minecraft:steak 1
 msg %referer %referred got his reward, thank you for increasing the community!
 >
}