Create a plugin for a Minecraft server where players receive rewards for being afk or playing for 8 hours on the server; they will receive specific rewards. only 1 time in a day
I’ll create a plugin that rewards players for reaching 8 hours of playtime each day.
All files created successfully! The plugin tracks player playtime and rewards them once daily for reaching 8 hours. Features include configurable rewards (items, commands, sounds, titles), automatic data saving, admin commands for management, and daily reset system using date-based tracking.
how to use it
I’ll read the project files to understand the plugin’s functionality and then provide usage instructions.
Daily Playtime Rewards - Usage Guide
📦 What This Plugin Does
Tracks player playtime and automatically gives rewards when they reach the required daily playtime (default: 8 hours). Rewards reset daily so players can earn them again the next day.
🚀 Installation
Drop the compiled
.jarfile into your server’splugins/folderRestart or reload your server
Configure
plugins/DailyPlaytimeRewards/config.yml
⚙️ Configuration (config.yml)
prefix: "&7[&aPlaytime&7] "
required-seconds: 28800 # 28800 seconds = 8 hours
auto-save-interval: 5 # Auto-save every 5 minutes
debug: false # Enable debug logging
rewards:
- "give {player} diamond 1" # Give 1 diamond
- "eco give {player} 100" # Give $100 (requires Vault)
- "lp user {player} permission set vip.rank true" # Example permission
messages:
time-remaining: "&aPlaytime: {hours}h {minutes}m. Time remaining: {remaining}"
reward-claimed: "&aYou have received your daily reward!"
already-claimed: "&cYou have already claimed your reward today."
Key Settings:
required-seconds: Playtime needed for rewards (in seconds)3600 = 1 hour
7200 = 2 hours
14400 = 4 hours
28800 = 8 hours
rewards: Console commands executed when player earns rewardUse
{player}placeholder for player name
🎮 Commands
Command | Permission | Description |
|---|---|---|
/playtime | None | Check your daily playtime progress |
/playtime check <player> | dailyplaytimerewards.admin | Check another player’s playtime |
/playtime reset <player> | dailyplaytimerewards.admin | Reset a player’s playtime data |
/playtime reload | dailyplaytimerewards.admin | Reload configuration |
🔒 Permissions
dailyplaytimerewards.admin:
description: Access to admin commands (check, reset, reload)
default: op
💡 How It Works
Player joins → Plugin starts tracking playtime
Every minute → Plugin checks if player reached required time
Reward earned → Automatically executes reward commands
Next day → Player can earn rewards again (resets at midnight)
Auto-save → Data saved every 5 minutes (configurable)
📌 Example Reward Setups
Starter Kit:
rewards:
- "give {player} diamond 5"
- "give {player} golden_apple 3"
- "eco give {player} 500"
VIP Perks:
rewards:
- "lp user {player} permission set vip.kit true"
- "lp user {player} permission set vip.fly true"
- "crates give physical daily 1 {player}"
Experience Boost:
rewards:
- "xp add {player} 1000"
- "give {player} experience_bottle 10"
🛠️ Troubleshooting
Rewards not working?
Check console for errors when reward triggers
Verify you have plugins installed for reward commands (Vault for economy, etc.)
Test commands manually from console:
/give PlayerName diamond 1
Playtime not tracking?
Enable debug mode:
debug: truein configCheck console for “Auto-saved playtime data” messages
Verify players have online time
Rewards given multiple times?
Data is reset daily at midnight (server time)
This is intentional - players earn rewards fresh each day
🎯 Quick Start Example
Set 2-hour requirement:
YAMLrequired-seconds: 7200Add simple rewards:
YAMLrewards: - "give {player} diamond 3" - "say &a{player} earned their daily reward!"Give admin permission:
Plain Text/lp user YourName permission set dailyplaytimerewards.admin trueReload config:
Plain Text/playtime reloadTest it:
Play for 2 hours OR
Use
/playtime check <player>to see progress
The plugin is now ready to use! Players will automatically receive rewards after reaching the daily playtime requirement.
i want to add custom item as a rewards
I’ll read the existing files to understand the current reward system, then add support for custom item rewards.
I’ll add support for custom item rewards with full customization (display name, lore, enchantments, etc.) using XSeries for cross-version compatibility.
Custom item rewards added with full support for material, amount, name, lore, enchantments, flags, and unbreakable properties using XSeries for cross-version compatibility.
how to use it
I’ll read the project files to understand how this plugin works and provide you with usage instructions.
DailyPlaytimeRewards - Usage Guide
🎮 Overview
This plugin rewards players for reaching a daily playtime goal. Players must play for a configured amount of time (default: 8 hours) to receive daily rewards.
📋 Commands
Command | Permission | Description |
|---|---|---|
/playtime | playtime.checkown | Check your own playtime progress |
/playtime reload | playtime.reload | Reload the config |
/playtime check <player> | playtime.check | Check another player’s playtime |
/playtime reset <player> | playtime.reset | Reset a player’s data |
/playtime checkall | playtime.checkall | View all online players’ playtime |
🔧 Configuration (config.yml)
Basic Settings
prefix: "&7[&aPlaytime&7] " # Chat prefix
required-seconds: 28800 # Time needed for reward (8 hours)
auto-save-interval: 5 # Auto-save interval (minutes)
debug: false # Debug mode
Messages
All messages support color codes (&a, &c, etc.) and placeholders:
{player}- Player name{hours}- Hours played{minutes}- Minutes played{remaining}- Time remaining{claimed}- Whether they claimed today
Rewards System
Two reward types are supported:
1. Command Rewards
Executes console commands when player earns reward:
rewards:
economy_reward:
type: command
command: "eco give {player} 1000" # Gives $1000
rank_upgrade:
type: command
command: "lp user {player} parent add VIP"
2. Item Rewards
Gives custom items with enchantments, lore, etc:
rewards:
legendary_sword:
type: item
material: DIAMOND_SWORD # Item type (XSeries compatible)
amount: 1 # Stack size
name: "&b&lLegendary Sword" # Display name
lore: # Item description
- "&7A powerful weapon"
- "&eDaily Reward"
enchantments: # Enchantments
SHARPNESS: 5
UNBREAKING: 3
flags: # Hide item attributes
- HIDE_ATTRIBUTES
unbreakable: true # Make item unbreakable
🎁 How It Works
Players join → Playtime tracking starts automatically
Every second online → Playtime counter increases
Daily goal reached → Rewards are automatically given
Next day → Progress resets, can earn rewards again
Important Notes:
✅ Rewards are once per day (resets at midnight)
✅ Progress is tracked while online only
✅ If inventory is full, items drop at player’s feet
✅ Data auto-saves every 5 minutes (configurable)
💡 Example Configurations
Example 1: 4-Hour Requirement
required-seconds: 14400 # 4 hours
rewards:
daily_cash:
type: command
command: "eco give {player} 500"
daily_kit:
type: command
command: "give {player} diamond 3"
Example 2: VIP Reward Package
required-seconds: 21600 # 6 hours
rewards:
vip_money:
type: command
command: "eco give {player} 2500"
vip_sword:
type: item
material: NETHERITE_SWORD
amount: 1
name: "&d&lVIP Sword"
enchantments:
SHARPNESS: 7
LOOTING: 3
unbreakable: true
golden_apples:
type: item
material: GOLDEN_APPLE
amount: 32
🛠️ Admin Usage
Check Progress
/playtime check Steve
→ Shows Steve's total playtime and if they claimed today
Reset Player
/playtime reset Steve
→ Resets Steve's data (clears playtime & claim status)
View All Players
/playtime checkall
→ Lists all online players with their playtime
Reload Config
/playtime reload
→ Reloads config.yml without restarting
⚙️ Permissions
permissions:
playtime.checkown: true # Check own playtime (default: true)
playtime.check: op # Check others' playtime
playtime.reset: op # Reset player data
playtime.reload: op # Reload config
playtime.checkall: op # View all players
dailyplaytimerewards.admin: op # All admin permissions
📝 Tips
Test rewards first - Use low
required-secondsvalue to test (e.g., 60 seconds)Balance rewards - Don’t make them too OP or players won’t play after claiming
Use Vault - For economy rewards, install Vault + economy plugin
Item compatibility - Uses XSeries for cross-version support (1.8-1.21+)
Monitor performance - Default 5-minute auto-save is balanced for most servers
🐛 Troubleshooting
Issue | Solution |
|---|---|
Rewards not giving | Check console for errors, verify command syntax |
Items not working | |
Economy not working | Install Vault + economy plugin (like EssentialsX) |
Progress not saving | Check file permissions in plugins/DailyPlaytimeRewards/playerdata/ |
Need more help? Enable debug mode (debug: true) and check console for detailed tracking info!
package com.dailyplaytimerewards;
import com.dailyplaytimerewards.commands.MainCommand;
import com.dailyplaytimerewards.rewards.RewardManager;
import com.dailyplaytimerewards.tasks.PlaytimeTask;
import lombok.Getter;
import org.bukkit.plugin.java.JavaPlugin;
@Getter
public class DailyPlaytimeRewards extends JavaPlugin {
private ConfigManager cfg;
private PlaytimeManager playtimeManager;
private PlaytimeTask playtimeTask;
private RewardManager rewardManager;
@Override
public void onEnable() {
cfg = new ConfigManager(this);
playtimeManager = new PlaytimeManager(this);
playtimeTask = new PlaytimeTask(this);
rewardManager = new RewardManager(this);
getCommand("playtime").setExecutor(new MainCommand(this));
playtimeTask.start();
}
@Override
public void onDisable() {
if (playtimeTask != null) {
playtimeTask.stop();
}
playtimeManager.saveData();
}
}