raymc_1
📎 1 file 2,208 chars
📄
pasted-code-1775052141667.txt
txt 81 lines
▶
Create a fully working Minecraft plugin for Paper/Purpur 1.21.x using Java.

Plugin name: StrengthBlocker

Core Features:
- Completely block ALL Strength potions:
  - Drinkable potions
  - Splash potions
  - Lingering potions
  - Tipped arrows with Strength
- Block both Strength I and Strength II
- Cancel usage of these potions
- Prevent the potion effect from being applied
- If a player somehow gets Strength effect, remove it instantly

Toggle System:
- Add command: /strengthblocker toggle
- This enables/disables the plugin functionality without restarting server
- Show message:
  - Enabled: "§aStrength blocking enabled!"
  - Disabled: "§cStrength blocking disabled!"

Permissions:
- strengthblocker.use → allows use of command
- strengthblocker.bypass → players with this are NOT blocked

Config File (config.yml):
- enabled: true
- message: "§cStrength is banned on this server!"
- toggle-broadcast: true

Behavior:
- If disabled in config or toggled OFF → plugin does nothing
- If enabled → fully block strength
- If toggle-broadcast = true → broadcast toggle changes

Technical Requirements:
- Use proper Bukkit/Paper API (no toString checks)
- Use PotionMeta, PotionType, PotionEffectType.INCREASE_DAMAGE
- Use events:
  - PlayerItemConsumeEvent
  - PotionSplashEvent
  - LingeringPotionSplashEvent
  - EntityShootBowEvent
  - EntityPotionEffectEvent
- Clean, optimized, no deprecated methods

Commands:
- /strengthblocker toggle
- /strengthblocker reload (reload config)

Project Output:
- Full Maven or Gradle project
- Include:
  - plugin.yml
  - config.yml
  - main class
  - command handler
  - listener classes
- Must compile without errors
- Target Java 17

plugin.yml:
- name: StrengthBlocker
- version: 1.0
- main: (main class path)
- api-version: 1.21
- commands:
    strengthblocker:
        description: Main command
        usage: /strengthblocker
- permissions:
    strengthblocker.use:
        default: op
    strengthblocker.bypass:
        default: op

Extra:
- Make code modular (separate classes for listener, command, config manager)
- Follow best practices
- Output full file structure clearly
Kodari AI
KodariApr 1 at 2:05 pm 14,401 (v2)

I’ll create a fully functional StrengthBlocker plugin for Paper 1.21.x that blocks all Strength potions with proper Bukkit/Paper API usage and XSeries for cross-version compatibility.

StrengthBlocker
A comprehensive Minecraft plugin that blocks all forms of Strength potions on the server. Prevents usage of drinkable, splash, and lingering strength potions, as well as tipped arrows. Features runtime toggling, permission-based bypass system, and instant effect removal. Includes reload command and broadcast options for administrative control. Fully compatible with Paper/Purpur 1.21.x using proper API practices.

✓ Created StrengthBlocker plugin with complete strength potion blocking, runtime toggle system, bypass permissions, config management, and all required event handlers for Paper 1.21.x.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
7 391
src/main/java/com/strengthblocker/StrengthBlocker.java
package com.strengthblocker;

import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.command.PluginCommand;
import org.bukkit.plugin.java.JavaPlugin;

@Getter
public class StrengthBlocker extends JavaPlugin {
    private ConfigManager configManager;
    private boolean blockingEnabled;

    @Override
    public void onEnable() {
        configManager = new ConfigManager(this);
        configManager.loadConfig();
        blockingEnabled = configManager.isEnabled();

        PluginCommand command = getCommand("strengthblocker");
        if (command != null) {
            StrengthBlockerCommand commandHandler = new StrengthBlockerCommand(this, configManager);
            command.setExecutor(commandHandler);
            command.setTabCompleter(commandHandler);
        }

        Bukkit.getPluginManager().registerEvents(new StrengthBlockerListener(this, configManager), this);

        getLogger().info("StrengthBlocker has been enabled!");
    }

    @Override
    public void onDisable() {
        saveConfig();
        getLogger().info("StrengthBlocker has been disabled!");
    }

    public void setBlockingEnabled(boolean enabled) {
        this.blockingEnabled = enabled;
        getConfig().set("enabled", enabled);
        saveConfig();
    }

    public boolean isBlockingEnabled() {
        return blockingEnabled;
    }

    public void reload() {
        reloadConfig();
        this.blockingEnabled = configManager.isEnabled();
    }
}