Referrals
Referrals
Referrals
Ever wanted to reward players for directing people to your server? see your server empty most of the time? then Referrals is for you! Referrals is a super-configurable plugin that allows you to award players who bring new people to your server. So, how does this work? basicly, users can generate referral codes using the command /generatecode. these codes can then be used by new players using the command /redeem <code> this will give the player and the referrer configurable prizes in the form of items, economy or even make it run console commands! players can also use the command /referstats to view how many people they have referred or /codes to view their current active codes.
/redeem has be changed to /redeemcode in v0.42 and above!
Features
- super-configurable
- Messages Config
- Give players prizes in the form of money, items or even make it run console commands for referring another player to your server
- help page /help referrals
- configurable number of maximum codes
- configure the required playtime of a player for them to be allowed to generate a code
- create custom codes
- set whether to use player names instead of codes
- code deleted after use
- Checks if players have played before when plugin is started to ensure old players don't refer each other
- Players cannot refer themselves
- Players cannot refer users from the same ip address
- players cannot redeem more than 1 code
- Config auto updates with updates
- log file which logs all records of referrals (turned on by changing value "showReferralsLog" in config to true)
- view stats about how many people you/another player has referred
- config option to only allow players to redeem a code the first time they log in
- config option to deactivate old users codes
- 839,299,365,868,340,224 possible codes, Thats over 839 Quadrillion!
ShowCase by SGTCaze
How to Use
- The player who wants to refer another player types /generatecode to generate a code for the other player to use. They can also use /codes to view their active codes. A maximum amount of codes can be set in the config.
- The player who was referred logs in and is prompted with a message telling them to use the command /redeem <code> to redeem a referral code. The message can be changed in the massages config.
- Both players recieve configurable rewards for referring someone and redeeming a code (to make it worth actually using the /redeem command). You can also add special prizes for when they reach a certain number of referrals.
Commands
Below is a list of commands and what they do
[ ] = Optional < > = Necessary
/redeemcode <code> - The command used to redeem a users code, declaring that they referred you.
(In versions before v0.42 use /redeem)
/generatecode [code] - The command used to generate a code to be used in /redeem <code>, If enabled on server when you type /generatecode with a code after it it will create a code called that.
/codes - The command to view your active codes.
/refertop [page] - Allows you to view who the top referrers are on your server.
/referstats [player] - Allows you to view the referral stats of the given player. defaults to sender if no player is named.
/help referrals - Displays the referrals help page
/fixrefferers - Sets all players play time to 0, used for if you are recieving glitch when players cant use /generatecode because it says they have to play another ridiculous amount of time.
How to Install
To install this plugin simply drag the referrals.jar file into your servers plugins folder and then restart your server!
Permissions
below is a list of permissions along with a brief description on what they do and what they are defaulted to. Do not add the colon ( : ) to after the pemission that is just to show that it is associated with the lines following it.
referrals.fix: description: Allows you to use /fixreferrers default: false referrals.redeem: description: Allows you to redeem someones code in-game default: true referrals.generate: description: Allows you to generate a referral code default: true referrals.stats: description: Allows you to view your referral stats default: true referrals.top: description: Allows you to view the referral top list default: true
Set Rewards for when players reach certain goals
Many people have made it obvious in the comments that they dont know how to set rewards at certain goals. To do it read everything in the config section under Prizes.
Config
Below is the default config along with a list of what all the values do.
showReferralsLog: false loginMessageDelay: 40 usePlayerNames: false allowCustomCodes: false autoUpdate: true checkIpAdress: true onlyAllowReferralsFirstLogin: true requiredPlayTime: 0 maxCodes: 1 useEconomy: false removeOldUsersCodes: 14 Prizes: onRedeem: money: 20 items: - DIAMOND:0:2 commands: onEvery: money: 100 items: - DIAMOND:0:5 commands: on5: money: 500 items: - DIAMOND:0:10 commands: - referstats @p
showReferralsLog: false - sets whether a log should be created with records of all referrals
loginMessageDelay: 40 - sets the delay time for the messageFirstLogin message. counted in ticks (20 ticks = 1 second).
usePlayerNames: false - true or false, sets whether to use player names instead of codes for referring people
onlyAllowReferralsFirstLogin - true or false, sets whether players can only use the command /redeem <code> when they first login.
maxCodes - a number, sets the maximum number of active codes the player can have at any one time.
useEconomy - true or false, sets whether or not to use economy integration for giving money to players when they refer a player or redeem a code.
checkIpAdress - true or false, sets whether to block people being referred by another user using the same ip address. Can be used to stop people using their multiple accounts to get free rewards.
Prizes - the list of all prizes that can be awarded to players. onRedeem will be given to players who redeem a code and onEvery will be given to players who refer someone unless they hit a referrals milestone. on<number> will be given to players when they hit the required number of referrals. Example: "on5" will give players who hit 5 referrals the configured items.
money - a number, sets the amount of money the player will be given when they recieve a prize. Only works if useEconomy is set to true
items - a list of items to be rewarded the the players, it goes NameOfItem:dataValue:amount. for example "DIAMOND:0:50" would give the player 50 diamonds. If you do not want to give the player items just clear everything after items: but do not remove the items:
commands - a list of commands to be executed upon the receiving of a prize. You can use the symbol "@p" to use players names, just type in @p and it will be replaced with the players name or @r and it will be replaced by the player who was referred or if used in onRedeem it will be replaced with the referrers name. Example: "gamemode 1 @p" this would set the gamemode of the player who recieved the prize to 1 or "gamemode @r 1" would set the referred player to gamemode 1.
requiredPlayTime - the required play time of the player to refer someone, counted in minutes.
removeOldUsersCodes - the amount of days before old users codes will be removed, set to 0 if you do not want them to be removed.
Messages
referrals contains a custom config file for messages. Below is the default messages config along with how to use it.
To use colours in your messages simply use the chatcolor numbers/letters with an & sign before them. For example "&cpotato!" would make the text potato! red.
there are also special codes beginning with an @ symbol to include names of players/codes to your message. Note these are only available in some of the messages.
@n - gives a players name, could be who referred you or who redeemed your code.
@c - displays the referral code instead of the @c
@r - displays the number of referrals the player has made
MESSAGE_FIRST_LOGIN: "&aType /redeem <code> to set who referred you and get some &6Free Items!" MESSAGE_INVALID_CODE: "&cThe code you have entered is invalid" MESSAGE_INVALID_PLAYER: "&c unable to find the player @p" MESSAGE_INVALID_PAGE: "&cThere is no page number @n" MESSAGE_NO_PERMISSION: "&cSorry, You do not have the required permissions" MESSAGE_NO_CODES: "&cYou have not generated any codes, /codes to view your codes" MESSAGE_NOT_PLAYER: "&cYou must be a player to run this command" MESSAGE_VIEW_CODES: "&a Below is a list of all your active &6referral codes" MESSAGE_VIEW_CODE: "&a - &6@c" MESSAGE_VIEW_STATS: "&aYou have referred &6@r &apeople" MESSAGE_VIEW_STATS_OTHERS: "&6@n &ahas referred &6@r &apeople" MESSAGE_REFFER_SELF: "&cYou can not refer yourself!" MESSAGE_SAME_IP: "&cYou can not refer someone with the same ip address as you!" MESSAGE_TOP_HEADER: "&aReferrals top, Page &6@p" MESSAGE_TOP: "&a@n - &6@p&a: &6@r" MESSAGE_NOT_NUMBER: "&c@s must be a number" MESSAGE_MAX_CODES_REACHED: "&cYou have already reached the max amount of codes, /codes to view your codes" MESSAGE_REDEEM_REFERRERS_CODE: "&cyou can not have been referred by the person you referred" MESSAGE_REFERRED: "&6@n has redeemed your code" MESSAGE_ALREADY_REDEEMED: "&cYou can only redeem 1 code" MESSAGE_BELOW_REQUIRED_PLAYTIME: "&cyou must play another @t minutes before you can refer someone" MESSAGE_BEEN_REFFERED: "&aYou have been referred by &6@n" MESSAGE_CREATE_CODE: "&aSuccesfully registered code: &6@c" MESSAGE_FIX_REFERRERS: "&cSuccesfully fixed referrers" MESSAGE_USEPLAYERNAME: "&cThere is no need to generate a code, you can just use your username!"
Source
The source for referrals can be found inside the jar, feel free to take a look.
How to use on Bungee Servers
If you were to run this plugin on a bungee server you may find that it will disable you from being able to refer players and it will send you the message "you cannot refer players with the same ip address" or something along those lines.
to fix it simply go to the config and change the value "checkIpAdress: true" to "checkIpAdress: false".
Edit: you can also if you want set it to use the players actual ip address on bungee to ensure people dont refer people on the same ip address. Thanks to theoneofcheese123 for telling me about this.
To set bungee to use players actual ip addresses simply go into you bukkit.yml and spigot.yml (if using spigot) and ensure that you have both you dedicated server/VPs/server IP and 127.0.0.1 under "bungee-proxies:" like this -
bungee-proxies:
- 127.0.0.1
- 198.27.70.213
That will make it so BungeeCord sends real player IP's allowing this plugin to be able to use ip checking
Found an Error?
please post below with this template and i will have a look into it:
version: error description: stacktrace(if any): config:
also please use the code tags for your config and the stack trace to make it easier to read, the code tags can be used by clicking the icon of the three cogs at the very right of the toolbar next to the link and picture icons.
MCStats
This plugin uses metrics to record data. If you wish to turn this off simply go to your plugins folder then into the PluginMetrics folder and then open the file config.yml and change opt-out: false to opt-out: true. Metrics is helpful to see stats about how your plugin is going, like how many servers are using it.
Examples of what data Metrics collects:
- Server Type / Version
- Java Version
- Minecraft Version
- Metrics version!
- Amount of players
- Operating system & version
- Auth mode
What data metrics does not collect:
- IPs
- Nicknames
- Other private informations
Below is the results metrics generates.
Donate
Donating helps me find time to update this plugin! although not necessary donating is greatly appreciated! a donate button can be found in the top right of the page if you would like to help me out!
Official Server
The official server of the plugin referrals is lividiusgaming, play at hub.lividiusgaming.com
@cubby208
yes, every user can only redeem 1 code
This is probably a stupid question to you but every user can only redeem one code right? I don't want cheating.
@InsomniaCraft
you CAN setup a reward players for specific amounts of referrals, read the config section.
Admin commands would definitely be something i will add in the future. i will get work on that soon.
i will add a config option for it as it is a good idea!
I love this plugin, It gives my players a goal on my server. I have 3 suggestions for this to make it ideal for atleast me, possibly others.
Setup a reward for specific amounts of referrals. If a player gets 10 referrals, maybe an auto rank or something.
Add Admin commands. I noticed the referrals file is in some kind of format that I simply can't see. I have players that occasionally abuse this system and would like to remove 1 or all of their redeems.
Finally, possibly even add a message for ops to alert when a referral was redeemed.
@kjburr
I have been unable to reproduce this error so i am guessing an older version has created a null code. i will upload a new file which will fix the codes and remove the null codes.
I switched back to version 0.45 since it worked before and it does the same thing along with the newer versions. Any help on this? Thanks in advance!
One last thing I'd like to note if it helps you. I'm using Spigot along with BungeeCord.
@guerocraft
i have uploaded a new version v0.461 which has this fixed. i am sorry for the inconvenience.
@iPedro2
you have to use the item name. for example when giving a diamond pickaxe you would replace spaces with underscores (_) and make it all capitals. so you would do: "DIAMOND_PICKAXE". if all else fails you can just use the give command /give @p <id> and put it under commands.
@mohawkguy360
there are many options you can turn off/on that make it easier/harder for players to claim they have referred someone. the reason for these options is to stop players logging on, picking a random person and claiming that they referred them. some of the options you can change in the config are: UsePlayerNames - this makes it so instead of the referrer using /generatecode, giving that code to the new player and then that player having to type in the code, they simply have to type /redeemcode <playername>.
allowCustomCodes - this option allows players to pick what they want to call their codes. so if someone wanted to generate a code called Jimmy they would just go "/generatecode Jimmy".
those 2 options make it very easy to claim you were referred by someone.
@ikky52
thank you! without the users this would all be pointless!
Thanks!
How can I give items like tools and weapons to players when someone refers another player? I tried using the item name, the ID but nothing worked...
Bug 1.v0.46 2. 2013-09-29 20:29:24 [SEVERE] null org.bukkit.command.CommandException: Unhandled exception executing command 'redeemcode' in plugin Referrals v0.46 at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46) at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:192) at org.bukkit.craftbukkit.v1_6_R2.CraftServer.dispatchCommand(CraftServer.java:527) at net.minecraft.server.v1_6_R2.PlayerConnection.handleCommand(PlayerConnection.java:971) at net.minecraft.server.v1_6_R2.PlayerConnection.chat(PlayerConnection.java:882) at net.minecraft.server.v1_6_R2.PlayerConnection.a(PlayerConnection.java:829) at net.minecraft.server.v1_6_R2.Packet3Chat.handle(SourceFile:49) at org.spigotmc.netty.NettyNetworkManager.b(NettyNetworkManager.java:230) at net.minecraft.server.v1_6_R2.PlayerConnection.e(PlayerConnection.java:116) at net.minecraft.server.v1_6_R2.ServerConnection.b(SourceFile:37) at org.spigotmc.netty.NettyServerConnection.b(NettyServerConnection.java:132) at net.minecraft.server.v1_6_R2.MinecraftServer.t(MinecraftServer.java:592) at net.minecraft.server.v1_6_R2.DedicatedServer.t(DedicatedServer.java:239) at net.minecraft.server.v1_6_R2.MinecraftServer.s(MinecraftServer.java:481) at net.minecraft.server.v1_6_R2.MinecraftServer.run(MinecraftServer.java:413) at net.minecraft.server.v1_6_R2.ThreadServerApplication.run(SourceFile:582) Caused by: java.lang.NullPointerException at me.sothatsit.referrals.Referrer.registerReferral(Referrer.java:84) at me.sothatsit.referrals.Referrals.onCommand(Referrals.java:116) at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) ... 15 more 3. Someone writes /generatecode. Somebody joins and write /redeemcode code and I have got an error. So, what shall I write if I use usePlayerNames: true? May be you shall simlify this plugin? Only /refer NickOfTheFriend. Also, I am using the latest build of spigot for 1.6.2
I think this plugin has a ton of potential, but it seems a little over-complicated for the player.
@Sothatsit
Ok, I can't wait to use this plugin when you add this feature.
v0.46 is out! it contains an option in the config to allow a log to be created of all referrals. to activate this just set "showReferralsLog" in the config to true.
Also, thanks for 1,000 downloads! that is amazing!
@sigler
why do you have your server in your sig then? also thanks!
@DrinkaChizzz
atm, no. In the future i may add a chat blocker which would stop you from mentioning your codes in chat.
Is it possible to block players from telling new players their codes?
Word of mouth is the best way to promote your server.
Thank you for making this plugin. I look forward to trying it out
@jetstreamLt
yes, this is possible read the config section. Basicly what you would do is add a new section called on100 or on200 and then add the rewards after that.
@xXSlayAllNinjaXx
how this works, is a player types /generatecode and then it will generate a code, this code can then be given to the player they referred and they can use the command /redeem <code> and then the code will be matched to the player who generated it and both players would recieve the configured rewards. you can also set in the config to make it use players names so the referrer doesnt have to use /generatecode and the person can just go /redeem <players name>. I may in the future add that feature but at the moment this is not included.
@xNightCrest
the data stored in the .ref file is serialized so you will not be able to view it. Even if i made it so you could view that currently it does not save who referred who and instead just keeps the amount of times you've referred someone. I may add an option to the config that will create a file every time the plugin saves which will show all referrals that have been done.
Is It possible to just have it so a player uses /refer (player name), and when they join for the first time, the referrer gets the set option? or something like this?
Is there a way I can set it to execute a command when someone reaches a milestone? Such as (Player refers 100 people gets something for it. Player refers 200 people gets something for it. etc... )
Thanks for the speedy fix!
I do have another question though. I'm assuming most if not all of the data is being stored in that .ref file. Is it possible to open and view that data somehow to see who specifically referred whom?
@xNightCrest
thanks for pointing that out, i have uploaded a new version(v0.45) where this should be fixed. i am sorry for the inconvenience
sothatsit