msi_gamerz_

Make practice plugin for StrikePractice on support 1.21.11 paper

Kodari AI
KodariAug 2 at 1:27 pm 1
StrikePractice
StrikePractice is a lightweight Paper practice plugin for Minecraft 1.21.1 and compatible 1.21 releases. It provides player queues, direct duel requests, duel acceptance and decline commands, configurable arena spawns, automatic practice kits, combat protection, death handling, inventory restoration, match cleanup, and graceful player disconnect recovery. Administrators can configure spawn points in-game, while players can quickly join, leave, and manage practice matches through simple commands.
Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
10 888
src/main/java/com/kodari/strikepractice/StrikePracticePlugin.java
package com.kodari.strikepractice;

import com.kodari.strikepractice.command.PracticeCommand;
import com.kodari.strikepractice.listener.PracticeListener;
import com.kodari.strikepractice.manager.PracticeManager;
import org.bukkit.command.PluginCommand;
import org.bukkit.plugin.java.JavaPlugin;

public final class StrikePracticePlugin extends JavaPlugin {

    private PracticeManager practiceManager;

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

        practiceManager = new PracticeManager(this);

        PracticeCommand practiceCommand = new PracticeCommand(practiceManager);
        registerCommand("practice", practiceCommand);
        registerCommand("duel", practiceCommand);
        registerCommand("accept", practiceCommand);
        registerCommand("decline", practiceCommand);
        registerCommand("leave", practiceCommand);

        getServer().getPluginManager().registerEvents(new PracticeListener(practiceManager), this);
        getLogger().info("StrikePractice enabled.");
    }

    @Override
    public void onDisable() {
        if (practiceManager != null) {
            practiceManager.shutdown();
        }
    }

    public PracticeManager getPracticeManager() {
        return practiceManager;
    }

    private void registerCommand(String name, PracticeCommand command) {
        PluginCommand pluginCommand = getCommand(name);
        if (pluginCommand == null) {
            return;
        }

        pluginCommand.setExecutor(command);
        pluginCommand.setTabCompleter(command);
    }
}