推荐系统
一个高度可定制的推荐系统,支持里程碑、奖励、玩家重新加入后才执行奖励、自定义消息、加入提醒、账号加入时间限制、推荐人数上限、循环推荐拦截以及占位符等功能。
配置
所有配置选项均在 config.yml 文件中详细说明。
config.yml
# _____ __ _ _ _
#| __ \ / _| | | | | (_)
#| |__) | ___ | |_ ___ _ __ _ __ __ _ | | _ __ | | _ _ __ _ _ _ __
#| _ / / _ \ | _| / _ \ | '__| | '__| / _` | | | | '_ \ | | | | | | / _` | | | | '_ \
#| | \ \ | __/ | | | __/ | | | | | (_| | | | | |_) | | | | |_| | | (_| | | | | | | |
#|_| \_\ \___| |_| \___| |_| |_| \__,_| |_| | .__/ |_| \__,_| \__, | |_| |_| |_|
# | | __/ |
# |_| |___/
# 前缀
# 在消息中使用的前缀
# 默认值: "&6&l[Referral]"
prefix: "&6&l[Referral]"
# 循环推荐
# 如果玩家1推荐了玩家2,玩家2是否也能推荐玩家1?
# 默认值: false
circular-referrals: false
# 最大推荐数
# 一个玩家可以推荐多少人?
# 设置为 -1 表示无限制
# 默认值: -1
max-referrals: -1
# 最大年龄(游戏时长)
# 用户累计游戏多少秒后便无法通过 /refer 命令来认领其推荐人?
# 设置为 -1 表示无限制
# 默认值: 86400 (24小时)
max-age: 86400
# 被推荐人加入要求
# 被推荐的玩家是否在推荐人之前加入服务器?
# 这有助于防止玩家输入无效的用户名。
# 默认值: true
referree-joined-requirement: true
# 加入时通知
# 如果未超过 max-age 设置的时间,尚未被推荐的玩家在加入服务器时是否应收到关于推荐系统的通知?
# 默认值: true
notify-on-join: true
# 通知延迟
# 在加入时发送通知消息前等待多长时间(毫秒)?
# 这确保消息出现在加入消息之后显示
# 默认值: 1000 (1秒)
notify-delay: 1000
# 消息
# 自定义插件发送的所有消息
# 可用的占位符:
# {prefix} - 上面定义的前缀
# {player} - 玩家的用户名
# {referrer} - 推荐人的用户名
# {claimer} - 领取者的用户名
# {max-age} - 最大有效期(秒)
# {max-age-hours} - 最大有效期(小时)
# {max-referrals} - 最大推荐人数限制
# {hours} - 剩余小时数(用于时间剩余消息)
# {minutes} - 剩余分钟数(用于时间剩余消息)
# {value} - 通用值占位符
messages:
# 命令消息
player-only: "&c此命令只能由玩家使用。"
no-permission: "&c你没有权限使用此命令。"
# /refer 命令消息
refer-usage: "&c用法:/refer <用户名>"
refer-success: "{prefix} &a你已被 {referrer} 推荐!"
already-referred: "{prefix} &c你已经设置过你的推荐人了!"
cannot-refer-self: "{prefix} &c你不能推荐自己!"
referrer-not-joined: "{prefix} &c玩家 '{referrer}' 此前从未加入过服务器!"
account-too-old: "{prefix} &c你的账号存在时间过长,无法设置推荐人!"
account-too-old-details: "&c最大允许年龄:{max-age} 秒({max-age-hours} 小时)"
circular-referral-blocked: "{prefix} &c不允许循环推荐!{referrer} 是由你推荐的。"
max-referrals-reached: "{prefix} &c玩家 '{referrer}' 已达到最大推荐人数限制!"
# /refer 说明(未提供参数时)
refer-explanation-header: "{prefix} &e推荐系统"
refer-explanation-line1: "&e如果有人将你推荐到这个服务器,请使用此命令为他们记录贡献!"
refer-explanation-usage: "&e用法:&a/refer <用户名>"
refer-explanation-current: "&a你的推荐人是:&f{referrer}"
refer-explanation-time-remaining: "&e你还有 &a{hours} 小时 {minutes} 分钟 &e可以领取推荐奖励。"
refer-explanation-expired: "&c你的账号已经过期,无法领取推荐奖励。"
refer-explanation-no-limit: "&e您可以随时领取您的推荐奖励!"
# 加入通知消息
notify-line1: "{prefix} &e你还没有设置是谁推荐你的!"
notify-line2: "&e使用 &a/refer <username> &e来领取你的推荐奖励!"
# /referral 帮助命令
help-header: "{prefix} &e推荐插件命令:"
help-refer: "&a/refer <用户名> &7- 领取推荐你的玩家奖励"
help-referral-help: "&a/referral help &7- 显示此帮助信息"
help-referral-config: "&a/referral config &7- 查看当前配置"
help-referral-reload: "&a/referral reload &7- 重载插件配置"
# /referral 指令消息
referral-usage: "&c用法:/referral <help|config|reload>"
referral-unknown-subcommand: "&c未知子命令。使用 &e/referral help &c查看可用命令。"
reload-start: "{prefix} &e正在重新加载推荐配置..."
reload-complete: "{prefix} &a推荐配置已重新加载。"
# /referral config 消息
config-header: "{prefix} &e当前推荐配置:"
config-circular: "&e循环推荐:&f{value}"
config-max-referrals: "&e最大推荐数:&f{value}"
config-max-age: "&e最大有效期:&f{value}"
config-referree-joined: "&e被推荐人加入要求:&f{value}"
config-notify-on-join: "&e加入时通知:&f{value}"
config-store-offline: "&e离线时存储奖励:&f{value}"
# 奖励
# 当推荐被领取时,给予推荐人和被推荐人的奖励。
rewards:
# 领取者是运行 /refer <username> 的玩家,也就是新玩家
claimer:
# 当推荐被领取时以控制台身份执行的命令
# {player} 会被替换为领取者的用户名
commands:
- "give {player} diamond 5"
# 当推荐被领取时发送给领取者的消息
messages:
- "&a你因为被推荐而获得了 5 颗钻石!"
# 推荐新玩家的玩家,这是传递给 /refer <username> 的 <username>
referrer:
# 存储离线状态的含义是:如果被推荐人在推荐被领取时处于离线状态,则在他们下次上线时执行命令和发送消息
# 默认值: true
store-if-offline: true
# 当推荐被领取时以控制台身份执行的命令
# {player} 会被替换为推荐人的用户名
commands:
- "give {player} emerald 10"
# 当推荐被领取时发送给推荐人的消息
# {claimer} 会被替换为领取者的用户名
messages:
- "&a你因为推荐了 {claimer} 而获得了 10 颗绿宝石!"
# 里程碑奖励
# 当推荐人达到一定数量的推荐次数时给予他们
# 每个里程碑仅触发一次
# 可用的占位符:{player}, {milestone}, {total}
milestones:
# 启用或禁用里程碑奖励
# 默认值: true
enabled: true
# 单个里程碑配置
# 键名(5, 10, 17, 25 等)代表所需的推荐数量
5:
commands:
- "give {player} diamond_block 1"
messages:
- "&6&l达成里程碑!"
- "&e你已经推荐了 &a{total} &e名玩家!"
- "&a你获得了 1 个钻石块!"
10:
commands:
- "give {player} emerald_block 2"
messages:
- "&6&l达成里程碑!"
- "&e你已经推荐了 &a{total} &e名玩家!"
- "&a你获得了 2 个绿宝石块!"
# bStats
# 启用或禁用 bStats 指标收集
# 这有助于我了解插件的使用情况
# 默认值: true
bstats: true
# PlaceholderAPI 集成
# 可用的占位符(需要 PlaceholderAPI):
# %referral_referred_by% - 推荐该玩家的玩家用户名(如果未被推荐则为 "None")
# %referral_has_referrer% - "true" 或 "false"
# %referral_total_referrals% - 该玩家已推荐的人数
# %referral_first_join% - 首次加入的时间戳(如果未知则为 "Unknown")
# %referral_account_age% - 账号年龄(秒)(如果未知则为 "Unknown")
# %referral_account_age_hours% - 账号年龄(小时)(如果未知则为 "Unknown")
# %referral_can_claim% - 如果玩家可以领取推荐奖励则为 "true",否则为 "false"
# %referral_time_remaining% - 推荐领取过期前的剩余秒数("Unlimited", "Expired" 或秒数)
# %referral_time_remaining_hours% - 推荐领取过期前的剩余小时数("Unlimited", "Expired" 或小时数)
# %referral_next_milestone% - 玩家即将达成的下一个里程碑(如果无或已禁用则为 "None"/"Disabled")
# %referral_referrals_until_next% - 距离下一个里程碑还需多少推荐次数(如果无或已禁用则为 "None"/"Disabled")
占位符
如果你安装了 PlaceholderAPI,你可以使用以下占位符:
| 占位符 |
描述 |
%referral_referred_by% |
谁推荐了该玩家,如果未被推荐则为 "None" |
%referral_has_referrer% |
该玩家是否有推荐人,true/false |
%referral_total_referrals% |
该玩家已经推荐了多少名玩家 |
%referral_first_join% |
自插件安装以来玩家首次加入的时间戳(Unix 毫秒) |
%referral_account_age% |
自玩家首次加入以来的秒数 |
%referral_account_age_hours% |
自玩家首次加入以来的小时数 |
%referral_can_claim% |
该玩家是否仍可以领取推荐奖励,检查他们是否已被推荐以及加入时间是否过长 |
%referral_time_remaining% |
直到无法再领取推荐奖励的剩余秒数,或 "Unlimited",或 "Expired" |
%referral_time_remaining_hours% |
直到无法再领取推荐奖励的剩余小时数,或 "Unlimited",或 "Expired" |
%referral_next_milestone% |
距离下一个里程碑总共需要多少推荐次数 |
%referral_referrals_until_next% |
距离获得下一个里程碑还需要多少推荐次数 |
所有占位符也在 config.yml 文件的底部进行了说明
里程碑
奖励邀请更多玩家的推荐人,例如,在第 5 次推荐或第 50 次推荐时给予额外奖励

权限
只有 2 个有用的权限
referral.use - 允许玩家运行 /refer <username>,默认启用
referral.admin - 允许使用 /referral reload 和 /referral config,默认为 OP(管理员)
命令
| 命令 |
描述 |
权限 |
默认值 |
/refer <username> |
设置谁推荐了你 |
referral.use |
默认对所有用户启用 |
/referral reload |
重载配置文件 |
referral.reload/referral.admin |
默认为 OP |
/referral config |
显示部分配置值,主要用于调试 |
referral.config/referral.admin |
默认为 OP |
支持
需要帮助吗?在 Discord 上给我发消息,我的用户名是 editid。
Referrals
A very customisable referral system, with support for milestones, rewards, waiting to execute rewards until player joins back, custom messages, reminders on join, account join time limits, referral limits, circular referral blocking, and placeholders.
Config
All config options are explained in the config.yml file
config.yml
# _____ __ _ _ _
#| __ \ / _| | | | | (_)
#| |__) | ___ | |_ ___ _ __ _ __ __ _ | | _ __ | | _ _ __ _ _ _ __
#| _ / / _ \ | _| / _ \ | '__| | '__| / _` | | | | '_ \ | | | | | | / _` | | | | '_ \
#| | \ \ | __/ | | | __/ | | | | | (_| | | | | |_) | | | | |_| | | (_| | | | | | | |
#|_| \_\ \___| |_| \___| |_| |_| \__,_| |_| | .__/ |_| \__,_| \__, | |_| |_| |_|
# | | __/ |
# |_| |___/
# Prefix
# The prefix to use in messages
# default: "&6&l[Referral]"
prefix: "&6&l[Referral]"
# Circlular referrals
# If player1 refers player2, can player 2 also refer player1?
# default: false
circular-referrals: false
# Maximum referrals
# How many players can one player refer?
# Set to -1 for unlimited referrals
# default: -1
max-referrals: -1
# Maximum age
# How many seconds can a user have played before they cannot run /refer to claim their referral?
# Set to -1 for no limit
# default: 86400 (24 hours)
max-age: 86400
# Referree joined requirement
# Does the player that referred the player have to have joined the server before the referree joins?
# This helps prevent players from putting invalid usernames.
# default: true
referree-joined-requirement: true
# Notify on join
# Should players that haven't been referred be notified about the referral system on join, if the max-age hasn't been exceeded?
# default: true
notify-on-join: true
# Notify delay
# How long to wait (in milliseconds) before sending the notify message on join
# This ensures the message appears after the join message
# default: 1000 (1 second)
notify-delay: 1000
# Messages
# Customize all messages sent by the plugin
# Available placeholders:
# {prefix} - The prefix defined above
# {player} - The player's username
# {referrer} - The referrer's username
# {claimer} - The claimer's username
# {max-age} - The max age in seconds
# {max-age-hours} - The max age in hours
# {max-referrals} - The max referrals limit
# {hours} - Hours remaining (for time-remaining message)
# {minutes} - Minutes remaining (for time-remaining message)
# {value} - Generic value placeholder
messages:
# Command messages
player-only: "&cThis command can only be used by players."
no-permission: "&cYou do not have permission to use this command."
# /refer command messages
refer-usage: "&cUsage: /refer <username>"
refer-success: "{prefix} &aYou have been referred by {referrer}!"
already-referred: "{prefix} &cYou have already set your referrer!"
cannot-refer-self: "{prefix} &cYou cannot refer yourself!"
referrer-not-joined: "{prefix} &cThe player '{referrer}' has not joined the server before!"
account-too-old: "{prefix} &cYou cannot set a referrer because your account is too old!"
account-too-old-details: "&cMaximum age: {max-age} seconds ({max-age-hours} hours)"
circular-referral-blocked: "{prefix} &cCircular referrals are not allowed! {referrer} was referred by you."
max-referrals-reached: "{prefix} &cThe player '{referrer}' has reached the maximum number of referrals!"
# /refer explanation (when no args provided)
refer-explanation-header: "{prefix} &eReferral System"
refer-explanation-line1: "&eIf someone referred you to this server, use this command to give them credit!"
refer-explanation-usage: "&eUsage: &a/refer <username>"
refer-explanation-current: "&aYou were referred by: &f{referrer}"
refer-explanation-time-remaining: "&eYou have &a{hours} hours and {minutes} minutes &eto claim your referral."
refer-explanation-expired: "&cYour account is too old to claim a referral."
refer-explanation-no-limit: "&eYou can claim your referral at any time!"
# Join notification messages
notify-line1: "{prefix} &eYou haven't set who referred you yet!"
notify-line2: "&eUse &a/refer <username> &eto claim your referral reward!"
# /referral help command
help-header: "{prefix} &eReferral Plugin Commands:"
help-refer: "&a/refer <username> &7- Claim who referred you to the server"
help-referral-help: "&a/referral help &7- Show this help message"
help-referral-config: "&a/referral config &7- View current configuration"
help-referral-reload: "&a/referral reload &7- Reload the plugin configuration"
# /referral command messages
referral-usage: "&cUsage: /referral <help|config|reload>"
referral-unknown-subcommand: "&cUnknown subcommand. Use &e/referral help &cfor available commands."
reload-start: "{prefix} &eReloading referral configuration..."
reload-complete: "{prefix} &aReferral configuration reloaded."
# /referral config messages
config-header: "{prefix} &eCurrent Referral Configuration:"
config-circular: "&eCircular referrals: &f{value}"
config-max-referrals: "&eMax Referrals: &f{value}"
config-max-age: "&eMax Age: &f{value}"
config-referree-joined: "&eReferree Joined Requirement: &f{value}"
config-notify-on-join: "&eNotify on Join: &f{value}"
config-store-offline: "&eStore Rewards if Offline: &f{value}"
# Rewards
# Rewards to give to the referrer and referree when a referral is claimed.
rewards:
# Claimer is the player who ran /refer <username>, aka the new player
claimer:
# Commands to run as console when a referral is claimed
# {player} is replaced with the claimer's username
commands:
- "give {player} diamond 5"
# Messages to send to the claimer when a referral is claimed
messages:
- "&aYou have received 5 diamonds for being referred!"
# The player who referred the new player, this is the <username> that was passed to /refer <username>
referrer:
# Store if offline means if the referrer is offline when the referral is claimed, the commands and messages will run/send when they next join
# default: true
store-if-offline: true
# Commands to run as console when a referral is claimed
# {player} is replaced with the referrer's username
commands:
- "give {player} emerald 10"
# Messages to send to the referrer when a referral is claimed
# {claimer} is replaced with the claimer's username
messages:
- "&aYou have received 10 emeralds for referring {claimer}!"
# Milestone rewards
# These are given to the referrer when they reach a certain number of referrals
# Milestones are only triggered once per milestone
# Available placeholders: {player}, {milestone}, {total}
milestones:
# Enable or disable milestone rewards
# default: true
enabled: true
# Individual milestone configurations
# The key (5, 10, 17, 25, etc.) is the number of referrals needed
5:
commands:
- "give {player} diamond_block 1"
messages:
- "&6&lMILESTONE REACHED!"
- "&eYou have referred &a{total} &eplayers!"
- "&aYou received 1 Diamond Block!"
10:
commands:
- "give {player} emerald_block 2"
messages:
- "&6&lMILESTONE REACHED!"
- "&eYou have referred &a{total} &eplayers!"
- "&aYou received 2 Emerald Blocks!"
# bStats
# Enable or disable bStats metrics collection
# This helps me understand how the plugin is being used
# default: true
bstats: true
# PlaceholderAPI Integration
# Available placeholders (requires PlaceholderAPI):
# %referral_referred_by% - Username of who referred the player (or "None")
# %referral_has_referrer% - "true" or "false"
# %referral_total_referrals% - Number of players this player has referred
# %referral_first_join% - Timestamp of first join (or "Unknown")
# %referral_account_age% - Account age in seconds (or "Unknown")
# %referral_account_age_hours% - Account age in hours (or "Unknown")
# %referral_can_claim% - "true" or "false" if player can claim a referral
# %referral_time_remaining% - Seconds until referral claim expires ("Unlimited", "Expired", or seconds)
# %referral_time_remaining_hours% - Hours until referral claim expires ("Unlimited", "Expired", or hours)
# %referral_next_milestone% - Next milestone the player will reach (or "None"/"Disabled")
# %referral_referrals_until_next% - How many more referrals until next milestone (or "None"/"Disabled")
Placeholders
If you have PlaceholderAPI installed, you can use the following placeholders:
| Placeholder |
Description |
%referral_referred_by% |
Who referred the player, "None" if not referred |
%referral_has_referrer% |
Does the player have a referrer, true/false |
%referral_total_referrals% |
How many players has this player referred |
%referral_first_join% |
Timestamp in unix millis that the player first joined since the plugin has been installed |
%referral_account_age% |
Seconds since the player joined for the first time |
%referral_account_age_hours% |
Hours since the player joined for the first time |
%referral_can_claim% |
Can the player still claim a referral, checks if they have already been referred, and if they have joined too long ago |
%referral_time_remaining% |
Seconds until they can no longer claim a referral, or "Unlimited", or "Expired" |
%referral_time_remaining_hours% |
How many hours are left until they can't claim a referral, or "Unlimited", or "Expired" |
%referral_next_milestone% |
How many referrals they need to have in total until the next milestone |
%referral_referrals_until_next% |
How many referrals they need until they get the next milestone |
All placeholders are also explained at the bottom of the config.yml file
Milestones
Reward players for inviting more players, for example, give a bonus reward for the 5th referral, or for the 50th

Permissions
There are only 2 useful permissions
referral.use - Allows players to run /refer <username>, defaults to enabled
referral.admin - Allows for /referral reload and /referral config, defaults to OP
Commands
| Command |
Description |
Permission |
Default |
/refer <username> |
Sets who referred you |
referral.use |
Defaults to enabled for all users |
/referral reload |
Reloads the config |
referral.reload/referral.admin |
Defaults to OP |
/referral config |
Shows some of the config values, mainly for debugging |
referral.config/referral.admin |
Defaults to OP |
Support
Need help with the plugin? Send a message to me on discord, my username is editid.
评论 0
登录后参与评分
还没有评论,来抢沙发吧