Skip to content

Souldevhub/PlayTimePulse

Repository files navigation

⏱️ PlayTimePulse

A lightweight, accurate Minecraft plugin that tracks player playtime, integrates seamlessly with PlaceholderAPI, and provides a built-in rewards system with a claimable GUI.


🌟 Main Features

  • Real-time Playtime Tracking - Accurately tracks how long each player has been on your server (updates every second!)
  • 🎁 24+ Playtime Rewards - Milestone-based rewards that players can claim as they play more
  • 📖 Pageable Rewards GUI - Easy-to-navigate interface with multiple pages for all rewards
  • 🧾 Simple Commands - Intuitive /playtime command for players and admin tools
  • 🔌 PlaceholderAPI Support - Integrates with popular plugins through placeholders
  • 🛡️ AFK Protection - Prevents players from cheating by being AFK
  • 💾 Efficient Data Storage - Lightweight flat-file storage with automatic saving
  • High Performance - Optimized code that won't slow down your server
  • 🛡️ Reward Error Handling - Prevents reward spamming even when commands fail
  • ⚙️ Flexible Configuration - Easily customize all rewards, GUI, and settings
  • 🌍 Multi-Language Support - Supports 8 languages including English, Chinese, Russian, German, French, and more
  • 🔧 Admin Tools - Reload configuration and debug mode for easier management
  • 🏆 Leaderboard Support - Track and display top players with leaderboard placeholders

📦 All Features

  • ⏳ Real-time playtime tracking (saved + current session)
  • 🧾 /playtime command:
    • Shows formatted playtime in Xd Yh Zm As
    • Opens a GUI to claim playtime-based rewards
  • 🎁 Reward System:
    • Milestone-based claimable rewards (24 rewards included in current config, with more to be added over time)
    • Supports commands (since most of the things are given by commands)
    • Blocks duplicate claiming with tracked saves
    • Player head support for GUI icons (e.g., custom heads, player skulls)
    • Custom sound effects when claiming rewards
    • Error handling for failed commands to prevent reward spamming
    • Customizable Reward Information Display - Control what information is automatically shown on reward items with disable-default-reward-information config option
  • 📖 Pageable Rewards GUI:
    • Pagination support for large numbers of rewards
    • Customizable slots per page
    • Navigation buttons for moving between pages
    • "More Rewards Coming Soon" item displayed on last page
    • Fixed Navigation Bug - Resolved issue where navigation between pages was not working correctly in some cases
  • 🧭 Navigation System:
    • Previous/Next page buttons
    • Close button to exit the GUI
    • Customizable navigation button materials and names
    • Optional custom head textures for navigation buttons
  • 🛡️ AFK Protection:
    • Prevents AFK farming of playtime
    • Configurable interaction threshold and time window
    • Tracks meaningful player interactions to validate activity
  • ⚠️ Configuration Validation:
    • Detailed error logging for misconfigured rewards
    • Detection and warning of nested reward configurations (indentation errors)
    • Slot conflict detection for rewards on the same page
  • 🔌 Full PlaceholderAPI support
  • 📊 bStats integration for anonymous usage statistics
  • 📁 Flat-file storage with autosave
  • ⚙️ Performance optimized and easy to configure
  • 🌍 Multi-language support:
    • 8 languages supported (English, Chinese, Brazilian Portuguese, Russian, Filipino, German, French, Finnish)
    • Easily extensible with custom language files
    • Language setting in config.yml
  • 🔧 Admin tools:
    • /playtime reload command to reload configuration without restarting
    • Debug mode for troubleshooting with detailed logging
    • /playtime debug command to toggle debug mode

🔧 Commands

Command Description Permission
/playtime Shows playtime and rewards GUI playtime.use
/playtime add <player> <hours>h [<minutes>m] [<seconds>s] Add playtime to player playtime.admin
/playtime reset <player> Reset player's playtime and claimed rewards playtime.admin
/playtime reload Reload plugin configuration playtime.admin
/playtime debug [true/false] Toggle debug mode (shows additional logs) playtime.admin

🧩 PlaceholderAPI Support

PlayTimePulse provides comprehensive PlaceholderAPI integration with various categories of placeholders:

🕒 Basic Playtime Placeholders

Placeholder Description
%playtime_overall_formatted% Total time (saved + current), formatted like 2d 4h 30m 15s
%playtime_formatted% Current session only, formatted
%playtime_overall% Total time in seconds (saved + current)
%playtime_saved% Saved playtime only (in seconds)
%playtime_current% Current online session (in seconds)
%playtime_seconds% Seconds part of total playtime
%playtime_minutes% Minutes part of total playtime
%playtime_hours% Hours part of total playtime
%playtime_days% Days part of total playtime

🎁 Advanced Reward Placeholders

Placeholder Description
%playtime_required% Time required for next logical unclaimed reward (either the next reward in progression or highest qualified unclaimed reward)
%playtime_required_{rewardId}% Status of specific reward (Claimed/Ready/Qualified/Not Qualified)
%playtime_time_left% Time left for next reward
%playtime_time_left_{rewardId}% Time left for specific reward
%playtime_claimable_rewards% Number of rewards that can be claimed right now
%playtime_next_reward_name% Name of the next logical unclaimed reward

🏆 Leaderboard Placeholders

Placeholder Description
%playtime_top_1% 1st place player in playtime leaderboard
%playtime_top_2% 2nd place player in playtime leaderboard
%playtime_top_3% 3rd place player in playtime leaderboard
%playtime_top_4% 4th place player in playtime leaderboard
%playtime_top_5% 5th place player in playtime leaderboard
... ...
%playtime_top_10% 10th place player in playtime leaderboard
%playtime_leaderboard_position% Player's position in the leaderboard

🔍 Placeholder Examples

1. Basic Playtime Display:

  • %playtime_overall_formatted%2d 4h 30m
  • %playtime_days%2

2. Reward Status Tracking:

  • %playtime_required%5h 30m (time for next logical reward)
  • %playtime_required_level_5%Claimed (status of specific reward)
  • %playtime_time_left_level_5%2h 15m (time left for specific reward)
  • %playtime_claimable_rewards%3 (number of claimable rewards)
  • %playtime_next_reward_name%Level 5 (name of next reward)

3. Leaderboard Integration:

  • %playtime_top_1%Notch (12d 4h 30m)
  • %playtime_top_5%Dream (8d 2h 15m)
  • %playtime_leaderboard_position%5 (player's position)

4. Integration Examples:

  • In chat: "You've played for %playtime_overall_formatted%!"
  • In holograms: "Next reward (%playtime_next_reward_name%) in: %playtime_time_left%"
  • In scoreboards: "Leader: %playtime_top_1% | Your rank: #%playtime_leaderboard_position%"
  • In reward lore: "&7Welcome &f%player_name%&7! You have played for &f%playtime_overall_formatted%&7."

📋 Placeholder Examples

  1. Basic Playtime Display:

    • %playtime_overall_formatted%2d 4h 30m
    • %playtime_days%2
  2. Reward Status Tracking:

    • %playtime_required%5h 30m (time for next logical reward)
    • %playtime_required_level_5%Claimed (status of specific reward)
    • %playtime_time_left_level_5%2h 15m (time left for specific reward)
    • %playtime_claimable_rewards%3 (number of claimable rewards)
    • %playtime_next_reward_name%Level 5 (name of next reward)
  3. Leaderboard Integration:

    • %playtime_top_1%Notch (12d 4h 30m)
    • %playtime_top_5%Dream (8d 2h 15m)
    • %playtime_leaderboard_position%5 (player's position)
  4. Integration Examples:

    • In chat: "You've played for %playtime_overall_formatted%!"
    • In holograms: "Next reward (%playtime_next_reward_name%) in: %playtime_time_left%"
    • In scoreboards: "Leader: %playtime_top_1% | Your rank: #%playtime_leaderboard_position%"
    • In reward lore: "&7Welcome &f%player_name%&7! You have played for &f%playtime_overall_formatted%&7."

🛠️ Placeholder Usage Tips

  1. Reward IDs:

    • Use the exact ID from your config.yml
    • Case-sensitive (level_5 ≠ Level_5)
    • Replace spaces with underscores
  2. Formatting:

    • All time values are formatted as Xd Yh Zm Ws
    • Empty values are omitted (e.g., 2h 30s instead of 0d 2h 0m 30s)
  3. Next Reward Logic:

    • %playtime_required% shows either:
      • The next reward in progression (requires more playtime than current)
      • The highest reward player has qualified for but not claimed
    • This provides more intuitive information than simply showing the lowest unclaimed reward

🧪 Future Plans

  • 🎨 Gradient color support for formatted text
  • 🌟 Particle effects for reward claiming
  • 🐛 Debug mode for easier troubleshooting
  • ➕ More features coming soon

📁 Configuration

  • config.yml: Define playtime milestones, rewards (commands), requirements, rewards icon/lore, and sound effects.
    • Each reward can have a custom sound when claimed using the claimSound parameter
    • Choose from over 400 Minecraft sounds (e.g., entity.player.levelup, block.note_block.pling)
    • All sounds play at standard volume (1.0) and pitch (1.0)
    • Custom heads can be added using headId with Base64 texture values
    • Specify which page a reward should appear on using the page parameter (starting from 0)
    • Navigation buttons can use custom player heads with headId parameter
    • GUI slots and slots per page are configurable
    • AFK protection settings:
      • interaction-threshold: Minimum number of interactions required in the time window
      • time-window-minutes: Time window in minutes to check for interactions
    • Language settings:
      • language: Set the plugin language (en, zh, pt_BR, ru, fil, de, fr, fi)
      • Language files automatically copied to plugin directory for customization
    • Debug mode:
      • debug: Enable/disable debug mode for additional logging
    • Configuration validation:
      • Automatic detection of nested reward configurations (indentation errors)
      • Helpful warning messages for fixing configuration issues
      • Slot conflict detection to prevent rewards from overlapping

📥 Installation

  1. Download the latest release
  2. Drop the .jar file into your /plugins folder
  3. Restart the server
  4. Configure config.yml to define rewards / requirements.
  5. (Optional) Install PlaceholderAPI for placeholders

✅ Requirements

  • Minecraft: 1.21 up to 1.21.8
  • Java: 21+
  • Server: Paper / Pufferfish / Purpur (others need testing)
  • (Optional) PlaceholderAPI

📊 Statistics

PlayTimePulse collects anonymous usage statistics through bStats. This helps us understand how the plugin is used and guides future development.

You can view plugin statistics at bStats.

To opt out of statistics collection, set enabled: false in the /plugins/bStats/config.yml file.


💬 Support

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published

Languages