Referral System¶
The Referral System tracks player joins via specific hostnames (e.g., creator.playkaizen.me) and rewards both the new player and the hostname owner.
- Source File:
server_configs/survivalmix/plugins/Skript/scripts/referral.sk - Database:
kaizenmc_ipdata(Handle:referral)
Concepts¶
- First Hostname: When a player joins for the first time, the hostname they used (e.g.,
play.kaizenmc.id) is logged inhnlog_player_first_hostname. - Referral Actions: Specific in-game actions (e.g., "Survival: Reach Level 10") trigger referral rewards if the player joined via a creator's hostname.
- Points: Points are awarded to the hostname owner.
- Daily Cap: A hostname can earn max 250 points/day.
Database Schema¶
referral_actions¶
Logs every successful referral event.
CREATE TABLE referral_actions (
id INT AUTO_INCREMENT PRIMARY KEY,
player_uuid VARCHAR(36),
player_name VARCHAR(16),
first_hostname VARCHAR(64), -- Hostname used by player
action_desc VARCHAR(255), -- Description of action
action_points INT,
action_time BIGINT -- Unix timestamp
);
referral_points¶
Stores the point balance for hostname owners.
CREATE TABLE referral_points (
player_uuid VARCHAR(36),
owned_hostname VARCHAR(64), -- The hostname they own
current_points INT DEFAULT 0,
alltime_earned_points INT DEFAULT 0,
PRIMARY KEY (player_uuid)
);
referral_spending¶
Logs when an owner spends their points.
CREATE TABLE referral_spending (
id INT AUTO_INCREMENT PRIMARY KEY,
player_uuid VARCHAR(36),
player_name VARCHAR(16),
action_desc VARCHAR(255),
points_spent INT,
spent_time BIGINT
);
Internal API¶
insertReferralAction¶
Called by other scripts to award points.
Logic: 1. Lookup player'sfirst_hostname.
2. Check if hostname is valid (contains playkaizen.me or playkaizen.gg).
3. Check daily cap (MAX 250 points/day for that hostname).
4. Check for duplicates (unless desc contains "Global").
5. Insert into referral_actions and update referral_points.
logReferralSpending¶
Called when an owner buys something with points.
Placeholders¶
| Placeholder | Description |
|---|---|
%skreferralpoints_current% |
Current available points |
%skreferralpoints_alltime% |
Total points ever earned |
%skreferralpoints_today% |
Points earned today (capped at 250) |
Commands¶
/myreferrals- View your owned hostname's performance and recent actions./checkreferrals <hostname>- Admin check of a specific hostname./insertreferral <uuid> <name> <points> <desc>- Admin/Console command to manually trigger a referral action.