RA-Streak

A daily login streak plugin for Paper 1.21.x with duo streak pairing, tiered money rewards via Vault, SQLite storage, and PlaceholderAPI support.

Author: RajaAditya Website: rajaaditya.my.id Version: 1.0.0 API: Paper 1.21.x


Features

Daily Login Streak

  • Streak increases by 1 each time a player logs in within a configurable window (default: 24–48 hours since last login)
  • Logging in again too soon (within min-hours) does not affect the streak — prevents relog abuse
  • Logging in too late (past max-hours) resets the streak back to 1
  • Streak count is colored by tier automatically (config.yml → streak.colors), fully configurable thresholds and color codes

Duo Streak

  • Two players can pair up (/duo invite, /duo accept) to track a shared streak alongside their individual ones
  • Duo streak only increments once per day per pair, regardless of which partner logs in first — fixes a double-count issue present in the original Skript version
  • If either partner misses the login window, the duo pairing is automatically broken and both players are notified
  • Breaking up manually (/duo breakup) requires confirmation (/duo yes / /duo no) within a configurable time window

Custom Command Rewards

  • Reach configurable streak milestones (default: 15/30/50/60/70 days) to trigger a list of console commands automatically
  • Not limited to money — each milestone can run any number of commands (eco give, say, broadcast, permission grants, etc.), each fully configurable in config.yml
  • %player% and %days% placeholders are available inside every reward command
  • Reaching the top-tier "legendary" milestone triggers a server-wide broadcast instead of a private message, in addition to running its commands

Flex/Pamer Commands

  • /streakpamer and /streakpamerduo broadcast the player's (or duo's) current streak to the whole server
  • Shared cooldown to prevent spam, configurable in config.yml

Leaderboard

  • /streaktop shows both the individual streak leaderboard and the duo streak leaderboard side by side
  • Optional OP-hiding toggle (/adminstreak op toggle), persisted independently of config.yml so it survives reloads/restarts
  • Leaderboard size configurable

Admin Tools

  • Set, add to, disable, or enable any player's streak directly (/adminstreak set|add|disable|enable)
  • Full server-wide reset (/adminstreak resetall)
  • /adminstreaks shows a full help menu for every admin sub-command

Fully External Messages

  • Zero hardcoded strings — every player-facing message lives in messages.yml, including prefixes
  • config.yml only holds logic/data (timers, reward amounts, color tiers, cooldowns)

PlaceholderAPI Support

  • Exposes streak/duo data as placeholders for use in scoreboard/tab plugins
  • Identifier: rastreak

Async by Design

  • All database reads/writes run off the main thread (join handling, leaderboard queries, inactive-player cleanup)
  • Auto-clear of inactive player data runs on a scheduled async task — no main-thread loop/lag, unlike the original Skript version

Dependencies

PluginRequiredPurpose
VaultNo (softdepend)Reserved for future use — not required by the reward system, which now runs raw console commands (e.g. eco give) that work with any compatible economy plugin
PlaceholderAPINo (softdepend)Enables %rastreak_*% placeholders

No hard dependencies — the plugin runs standalone with SQLite storage; placeholders simply stay inactive if PlaceholderAPI isn't installed. Reward commands work with whatever plugin provides the commands you configure (e.g. EssentialsX for eco give).


Installation

  1. Place RA-Streak.jar into your plugins/ folder
  2. Restart the server
  3. Edit config.yml / messages.yml in plugins/RA-Streak/ to your liking
  4. Install an economy plugin (e.g. EssentialsX) if your reward commands include economy commands like eco give
  5. Restart or reload the server to apply changes

File Structure

text
1
plugins/RA-Streak/
├── config.yml       # Timers, reward tiers, color thresholds, cooldowns, leaderboard, toggles
├── messages.yml      # All plugin messages and prefixes — nothing is hardcoded in the plugin
├── data.db           # SQLite database (player streak/duo data + settings)
└── plugin.yml         # Plugin metadata

Configuration

config.yml

yaml
1
database:
  file: "data.db"

streak:
  min-hours: 24
  max-hours: 48

  inactive-clear-days: 30
  auto-clear-interval-hours: 6
  auto-clear-batch-size: 50
  auto-clear-batch-wait-ticks: 2

  # format: hari: [list command yang dijalankan lewat console]
  # placeholder yang tersedia di command: %player% (nama player), %days% (hari streak tercapai)
  rewards:
    15:
      - "eco give %player% 50000"
      - "say &e%player% &7mencapai streak 15 hari!"
    30:
      - "eco give %player% 500000"
    50:
      - "eco give %player% 5000000"
    60:
      - "eco give %player% 15000000"
    70:
      - "eco give %player% 50000000"
      - "broadcast &6%player% mencapai streak legendaris!"

  # Hari yang dianggap "legendary" -> broadcast server + emoji khusus
  legendary-day: 70

  # Threshold warna berdasarkan jumlah streak (dicek berurutan dari atas)
  colors:
    - min: 70
      max: -1
      color: "&6&l"
    - min: 50
      max: 69
      color: "&d"
    - min: 30
      max: 49
      color: "&b"
    - min: 15
      max: 29
      color: "&a"
    - min: 1
      max: 14
      color: "&7"

  emoji: "🔥"
  duo-emoji: "✨"

pamer:
  cooldown-seconds: 60

duo:
  breakup-confirm-seconds: 10

leaderboard:
  hide-ops: false
  top-size: 10

placeholder:
  enabled: true

economy:
  enabled: true

Config fields:

FieldDescription
database.fileSQLite file name, stored inside the plugin's data folder
streak.min-hoursMinimum hours since last login before a new login counts toward the streak
streak.max-hoursMaximum hours since last login before the streak resets to 1
streak.inactive-clear-daysPlayers with no login for this many days have their data auto-deleted
streak.auto-clear-interval-hoursHow often the inactive-player cleanup task runs
streak.rewardsMap of day: [commands] — console commands run (with %player%/%days% placeholders) when a player reaches that streak day
streak.legendary-dayStreak day threshold that triggers a server broadcast instead of a private reward message
streak.colorsOrdered list of min/max/color tiers used to colorize streak numbers (max: -1 means "and above")
streak.emoji / streak.duo-emojiEmoji appended after individual / duo streak numbers
pamer.cooldown-secondsCooldown between uses of /streakpamer and /streakpamerduo
duo.breakup-confirm-secondsTime window a player has to confirm a /duo breakup with /duo yes
leaderboard.hide-opsDefault value for hiding OP players from /streaktop (actual runtime value is toggled and persisted via /adminstreak op toggle)
leaderboard.top-sizeNumber of entries shown per leaderboard (individual and duo)
placeholder.enabledMaster toggle for registering the PlaceholderAPI expansion
economy.enabledMaster toggle for giving Vault money rewards

messages.yml

All player-facing text, fully translatable. Supports & color codes. Nothing is hardcoded in the plugin — if a key is missing here, the plugin logs a placeholder warning string instead of failing.

yaml
1
prefix:
  streak: "&6&lꜱᴛʀᴇᴀᴋ &8•&f"
  duo: "&d&lᴅᴜᴏ &8•&f"

streak:
  gained: "%prefix% &e%player% &7ʙᴀʀᴜ ꜱᴀᴊᴀ ᴍᴇɴᴄᴀᴘᴀɪ ꜱᴛʀᴇᴀᴋ %streak_color%"
  reset: "%prefix% &cꜱᴛʀᴇᴀᴋ ʟᴀᴍᴀ ᴋᴀᴍᴜ ᴅɪʜᴀᴘᴜꜱ..."
  reward-claimed: "%prefix% &bꜱᴛʀᴇᴀᴋ %days% ʜᴀʀɪ! &7ʙᴏɴᴜꜱ ʙᴇʀʜᴀꜱɪʟ ᴅɪᴋʟᴀɪᴍ."
  reward-broadcast-legendary: "%prefix% &6&lʟᴇɢᴇɴᴅᴀʀʏ! ..."

duo:
  invite-sent: "%prefix_duo% &7ᴜɴᴅᴀɴɢᴀɴ ᴅᴜᴏ ᴛᴇʀᴋɪʀɪᴍ ᴋᴇ &e%partner%&7."
  # ...full duo.* messages: invite, accept, breakup, streak-up notifications

pamer:
  broadcast-header: "&6&lꜱᴛʀᴇᴀᴋ ꜰʟᴇx &8• &e%player%"
  # ...pamer.* broadcast messages

leaderboard:
  top-header: "&e&lᴛᴏᴘ ꜱᴛʀᴇᴀᴋ &8• &7ɢʟᴏʙᴀʟ"
  # ...leaderboard.* entry formats

admin:
  help-header: "&6&lꜱᴛʀᴇᴀᴋ ᴀᴅᴍɪɴ &8• &7ᴄᴏᴍᴍᴀɴᴅꜱ"
  # ...full admin.* help text and feedback messages

Common placeholders available in messages:

PlaceholderAvailable In
%prefix% / %prefix_duo%Every message (auto-injected, no need to reference prefix.* manually)
%player%Streak gain, duo invite/accept, reward broadcasts
%partner%All duo.* messages
%streak_color%streak.gained, streakme.individu, leaderboard entries, pamer broadcasts
%duo_color%streakme.duo-line, duo leaderboard entries, duo pamer broadcasts
%days%streak.reward-claimed, streak.reward-broadcast-legendary
%rank%leaderboard.entry*
%max-hours%streak.reset, duo.broken-you-bolos (auto-injected from config)

Commands

CommandDescriptionAccess
/streakShow an overview of all streak-related commandsEveryone
/streakmeShow your own streak status (individual + duo)Player
/streaktopShow the individual and duo streak leaderboardsEveryone
/streakpamerBroadcast your current individual streak to the serverPlayer
/streakpamerduoBroadcast your current duo streak to the serverPlayer
/duo invite <player>Send a duo streak invitePlayer
/duo acceptAccept the most recent pending invitePlayer
/duo breakupRequest to break up your current duo pairingPlayer
/duo yesConfirm a pending breakup requestPlayer
/duo noCancel a pending breakup requestPlayer
/adminstreak set <player> <angka>Set a player's streak to an exact numberAdmin
/adminstreak add <player> <angka>Add to a player's streakAdmin
/adminstreak disable <player>Disable streak tracking for a player (resets to 0)Admin
/adminstreak enable <player>Re-enable streak tracking for a player (resets to 1)Admin
/adminstreak op toggleToggle hiding OP players from /streaktopAdmin
/adminstreak resetallWipe all streak/duo data server-wideAdmin
/adminstreaksShow the full admin command help menuAdmin

Permissions

PermissionDefaultDescription
rastreak.adminopAccess to all /adminstreak and /adminstreaks sub-commands
rastreak.usetrueAccess to player-facing /streak* and /duo commands

Streak Logic

On every player join, the plugin compares the time since their last recorded login against streak.min-hours and streak.max-hours:

Time since last loginResult
< min-hoursNo change — relogging the same day doesn't count twice
>= min-hours and < max-hoursStreak +1, reward check runs, duo streak check runs
>= max-hoursStreak resets to 1, any duo pairing is broken for both players

All of this runs asynchronously on join — the database read/write never blocks the main thread, and only the final chat/broadcast messages are dispatched back to the main thread.


Duo Streak Logic

Two players share a duo streak counter separate from their individual streaks. To prevent the double-count bug present in the original Skript version — where the duo counter could increment twice in a day (once per partner's login) — each player's data stores a duo_last_credit_day marker (an epoch-day value).

When a player's individual streak continues:

  1. The plugin checks whether their duo partner also logged in within the max-hours window
  2. If yes, and today's epoch-day hasn't already been credited for this pair, both partners' duo counters increment together and both get their duo_last_credit_day updated
  3. If the partner hasn't logged in within the window yet, the player is told to wait for their partner instead

If either partner misses their own login window (>= max-hours), the pairing is broken automatically for both players, and each is notified — the active player sees a "you bolos" message, the other (if online) sees a "your partner bolos" message.

Manually breaking up (/duo breakup) requires the initiating player to confirm with /duo yes within duo.breakup-confirm-seconds; letting the window expire or sending /duo no cancels the request.


PlaceholderAPI

Requires PlaceholderAPI to be installed. Identifier: rastreak.

PlaceholderDescription
%rastreak_count%Player's individual streak count (plain number)
%rastreak_count_color%Individual streak count, colorized per streak.colors tier
%rastreak_duo_count%Player's duo streak count (plain number)
%rastreak_duo_color%Duo streak count, colorized per streak.colors tier
%rastreak_duo_partner%Name of the player's duo partner, or - if none
%rastreak_disabled%true/false — whether streak tracking is disabled for this player

Data Storage

Player streak data (individual count, duo pairing/count, last login, disabled flag, pamer cooldown) is stored in a local SQLite database (data.db), accessed through a HikariCP connection pool. A separate streak_settings table stores runtime-toggleable settings — currently just the OP-hiding leaderboard flag — so they persist independently of config.yml across reloads and restarts.

An async task runs every streak.auto-clear-interval-hours to remove data for players inactive longer than streak.inactive-clear-days, keeping the database from growing indefinitely on large servers.


License

Developed by RajaAditya — rajaaditya.my.id