not_thundrion

Create a Minecraft Paper/Purpur plugin called "YouTubers Only" for Minecraft 1.21.11

Plugin Overview:

This plugin replaces the traditional life system with a Subscriber System. Every player has a Subscriber Count. If a player's subscribers reach 0, they are permanently banned from the server.

========================= CORE FEATURES =========================

  1. Every player has a Subscriber Count.
  1. Admin Commands:

/subscribers set <player> <amount>

  • Sets a player's subscriber count.

/subscribers add <player> <amount>

  • Adds subscribers.

/subscribers remove <player> <amount>

  • Removes subscribers.

/subscribers reset <player>

  • Resets a player's subscribers to the default amount.

========================= SUBSCRIBER BOTTLES =========================

Players can convert their subscribers into throwable XP Bottles.

Command:

/withdraw subscribers <amount>

Example:

Player has 1000 subscribers.

Command: /withdraw subscribers 250

Result:

  • Player now has 750 subscribers.
  • Receives a special Subscriber Bottle worth 250 subscribers.

When the bottle is thrown:

  • The player who picks it up instantly gains the subscribers.
  • Display beautiful gold and sparkle particles.
  • Play the Minecraft level-up sound.
  • Send a title:

+250 Subscribers

  • Send a chat message:

🎉 Congratulations! 250 Subscribers have been added to your account.

========================= ELIMINATION SYSTEM =========================

If a player's subscriber count reaches 0:

Broadcast:

<Player> has lost all of their subscribers!

Immediately permanently ban that player from the server.

========================= SCOREBOARD =========================

Display every player's subscribers.

Example:

⚡ Thunder SMP ⚡

Subscribers

NOT_THUNDRION 15,000

Momo 13,800

Pinu 9,450

========================= PLACEHOLDER SUPPORT =========================

Support PlaceholderAPI.

Placeholder:

%subscribers%

========================= CONFIG =========================

Config options:

default-subscribers: 1000

ban-on-zero: true

particles: true

scoreboard: true

optimization: true

save-interval: 300

withdraw-item: EXPERIENCE_BOTTLE

========================= SERVER OPTIMIZATION =========================

The plugin should also improve server performance by:

  • Using asynchronous data saving.
  • Optimizing scheduled tasks.
  • Keeping memory usage as low as possible.
  • Reducing CPU usage.
  • Optimizing subscriber storage.
  • Never causing TPS drops.
  • Supporting large SMP servers smoothly.

========================= REQUIREMENTS =========================

  • Minecraft 1.21.1
  • Paper/Purpur
  • Java 21
  • Clean and optimized code
  • No memory leaks
  • Configurable messages
  • Reload-safe
  • Professional project structure

The plugin should be optimized for YouTube SMP content and cinematic gameplay.

Kodari AI
KodariJul 17 at 1:52 am 12
YouTubersOnly
YouTubers Only is a Paper/Purpur 1.21.1 subscriber-survival plugin for cinematic YouTube SMP gameplay. It replaces traditional lives with persistent subscriber counts, configurable defaults, admin controls, withdrawals, custom throwable subscriber bottles, celebration effects, titles, chat feedback, zero-subscriber permanent bans, live scoreboards, and PlaceholderAPI support. Asynchronous snapshot saving, lightweight scheduled updates, reload-safe lifecycle handling, compact UUID-based storage, and configurable messages keep the system responsive on large servers.
  1. Create the Gradle project and plugin metadata.

  2. Implement persistent subscriber storage, elimination, commands, withdrawals, bottles, scoreboard, and PlaceholderAPI support.

  3. Add configurable messages and server settings.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
14 1,139
src/main/java/com/kodari/youtubersonly/YouTubersOnlyPlugin.java
package com.kodari.youtubersonly;

import com.kodari.youtubersonly.command.SubscriberCommand;
import com.kodari.youtubersonly.command.WithdrawCommand;
import com.kodari.youtubersonly.listener.SubscriberBottleListener;
import com.kodari.youtubersonly.listener.SubscriberPlayerListener;
import com.kodari.youtubersonly.placeholder.SubscribersExpansion;
import com.kodari.youtubersonly.scoreboard.SubscriberScoreboard;
import com.kodari.youtubersonly.service.MessageService;
import com.kodari.youtubersonly.storage.SubscriberManager;
import org.bukkit.BanList;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;

public class YouTubersOnlyPlugin extends JavaPlugin {
    private SubscriberManager subscriberManager;
    private MessageService messageService;
    private SubscriberScoreboard subscriberScoreboard;
    private SubscribersExpansion subscribersExpansion;

    @Override
    public void onEnable() {
        saveDefaultConfig();

        this.messageService = new MessageService(this);
        this.subscriberManager = new SubscriberManager(this, this::eliminatePlayer);
        this.subscriberManager.load();
        this.subscriberManager.startAutoSave();

        if (getConfig().getBoolean("scoreboard", true)) {
            this.subscriberScoreboard = new SubscriberScoreboard(this, subscriberManager, messageService);
            this.subscriberScoreboard.start();
        }

        SubscriberCommand subscriberCommand = new SubscriberCommand(
                subscriberManager,
                messageService,
                subscriberScoreboard
        );
        WithdrawCommand withdrawCommand = new WithdrawCommand(
                subscriberManager,
                messageService,
                new com.kodari.youtubersonly.service.SubscriberBottleService(this, subscriberManager, messageService)
        );

        getCommand("subscribers").setExecutor(subscriberCommand);
        getCommand("subscribers").setTabCompleter(subscriberCommand);
        getCommand("withdraw").setExecutor(withdrawCommand);
        getCommand("withdraw").setTabCompleter(withdrawCommand);

        Bukkit.getPluginManager().registerEvents(
                new SubscriberBottleListener(this, subscriberManager, messageService),
                this
        );
        Bukkit.getPluginManager().registerEvents(
                new SubscriberPlayerListener(subscriberManager, subscriberScoreboard),
                this
        );

        if (Bukkit.getPluginManager().isPluginEnabled("PlaceholderAPI")) {
            this.subscribersExpansion = new SubscribersExpansion(this, subscriberManager);
            this.subscribersExpansion.register();
        }
    }

    @Override
    public void onDisable() {
        if (subscribersExpansion != null) {
            subscribersExpansion.unregister();
        }
        if (subscriberScoreboard != null) {
            subscriberScoreboard.stop();
        }
        if (subscriberManager != null) {
            subscriberManager.shutdown();
        }
    }

    private void eliminatePlayer(java.util.UUID uniqueId) {
        Player onlinePlayer = Bukkit.getPlayer(uniqueId);
        OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(uniqueId);
        String playerName = onlinePlayer != null
                ? onlinePlayer.getName()
                : offlinePlayer.getName();

        if (playerName == null || playerName.isBlank()) {
            playerName = uniqueId.toString();
        }

        Bukkit.broadcastMessage(messageService.format("eliminated", "player", playerName));

        Bukkit.getBanList(BanList.Type.NAME).addBan(
                playerName,
                "You have lost all of your subscribers.",
                null,
                getName()
        );

        if (onlinePlayer != null) {
            onlinePlayer.kickPlayer(messageService.format("eliminated", "player", playerName));
        }
    }
}