kkacpero3213
📎 1 file 2,893 chars
📄
pasted-code-1785232738120.txt
txt 173 lines
▶
Create a Minecraft Java Paper 1.21.11 plugin.

Plugin: RoleSMP
Package: me.rolesmp
Language: English
Code must be clean, optimized, Maven-ready, null-safe and without deprecated APIs.

Only players with permission `rolesmp.admin` can use admin commands.

================
ROLE SYSTEM
================

Command:

/rolesmp:setrole  

This command DOES NOT save anything.

It ONLY sends a private Title + Tellraw to the selected player.

Never change nickname, display name, tab name, prefixes, suffixes, permissions, scoreboard, metadata, potion effects or anything else.

Title:
§6YOU HAVE BEEN CHOSEN

Subtitle:
§eYour role: §a

Tellraw:

━━━━━━━━━━━━━━━━━━━━━━
§6You have been chosen!
§7Your role:
§a
§7Keep it secret.
━━━━━━━━━━━━━━━━━━━━━━

Nobody else can see it.

Admin gets:
"Role notification sent successfully."

================
ABILITIES
================

Players use:

/abilityuse

Permission:

rolesmp.use

Admin:

/rolesmp:ability unlock  

/rolesmp:ability remove  

/rolesmp:ability list 

Unlimited abilities.

Every ability has its own Java class, cooldown and activate(Player) method.

================
ANTIROLE
================

Commands:

/antirole add 

/antirole remove 

Permission:

rolesmp.admin

Saved in antirole.yml.

AntiRole members automatically receive AntiRoleDash.

================
ABILITIES
================

SculkAttack
- Sonic Boom
- 20 block range
- 5 hearts damage (10 damage)
- knockback
- particles
- sound
- 20s cooldown

Dash
- Fast forward dash
- No fall damage
- 12s cooldown

AntiRoleDash
- Same as Dash
- 50% weaker
- 10s cooldown

DomainExpansion
- Creates a visible domain around the player
- Lasts 20 seconds
- Particles
- Sounds
- Configurable effects for players inside
- Automatically disappears

Nuke
- Huge explosion effect
- Damages players
- Massive particles
- Strong sounds
- Launches players
- Config option to destroy blocks or not

Disguise
Requires LibsDisguises.

After /abilityuse the player types another player's nickname in private (not public chat).

Copy:
- skin
- name above head
- tab name
- appearance
- armor appearance/trims if LibsDisguises supports it.

ShadowStep
- Teleport behind nearest player within 20 blocks
- Dark particles
- Enderman sound
- 15s cooldown

TimeFreeze
- Freeze players within 12 blocks for 4 seconds
- Particles
- Sounds
- 45s cooldown

================
OTHER
================

Permissions:

rolesmp.admin
rolesmp.use

Commands must support tab completion.

Config:

config.yml
abilities.yml
antirole.yml
plugin.yml

Command:

/rolesmp reload

Reload configs safely.

Everything must fully work on Paper 1.21.11 without console errors.
Kodari AI
KodariJul 28 at 10:05 am 6

I’ll create a Paper 1.21.11 RoleSMP plugin with private role notifications, configurable abilities, cooldowns, AntiRole persistence, LibsDisguises support, admin commands, tab completion, and safe configuration reloads.

RoleSMP
RoleSMP provides a private role assignment system and configurable player abilities for Paper 1.21.11. Administrators can privately assign roles, unlock or remove unlimited abilities, manage AntiRole members, and reload configuration files. Players can activate abilities including SculkAttack, Dash, DomainExpansion, Nuke, Disguise, ShadowStep, TimeFreeze, and AntiRoleDash. Abilities use individual cooldowns, visual effects, sounds, configurable behavior, and permission-based access.
  1. Create the Maven project and plugin resources.

  2. Implement the role, ability, cooldown, disguise, and AntiRole systems.

  3. Add commands, tab completion, listeners, configuration handling, and all ability classes.

kkacpero3213

add /abilityuse command that lets you actually use the abilities. add rolesmp.abilityuse permission so i can let ppl use abilities. make sure the custom abilities are made good like very good

Kodari AI
KodariJul 28 at 11:59 am 33
  1. Wire /abilityuse to require rolesmp.abilityuse and activate unlocked abilities correctly.

  2. Improve the custom ability implementations with polished Paper-compatible behavior, effects, feedback, and cooldown handling.

The command path is now wired to rolesmp.abilityuse, and activation failures no longer consume cooldowns. I’m tightening the ability implementations next: safer teleports, stronger visuals/audio, guarded config timing, and better shockwave/domain behavior.

The permission and command are complete. I’m applying the quality pass to movement, targeting, teleport safety, and configurable area effects so abilities behave reliably in real combat instead of only triggering visuals.

I found two cleanup issues from the quality pass before finishing: duplicate imports in SculkAttack and stale constructor wiring after removing unused state fields. I’m correcting those compile blockers now, then I’ll do a final reference scan.

Implemented the ability-use system and upgraded the custom abilities.

Ability command

  • /abilityuse

    • Activates the player’s only unlocked ability automatically.

    • Lists unlocked abilities if the player has multiple.

  • /abilityuse <ability>

    • Activates a specific unlocked ability.

  • Added permission:

    • rolesmp.abilityuse

  • Updated tab completion to only show unlocked abilities.

  • Abilities that fail to activate no longer consume their cooldown.

Ability improvements

  • Dash

    • Safer horizontal direction handling.

    • Cloud particles and phantom-flap sound.

    • No-fall protection retained.

  • AntiRoleDash

    • Weaker dash behavior.

    • Smoke particles and sound feedback.

    • No-fall protection retained.

  • SculkAttack

    • Sculk particle trail.

    • Sonic Boom impact effect.

    • Configurable range, damage, and knockback.

    • Improved target ray tracing.

  • DomainExpansion

    • Configurable duration, radius, particle interval, effect interval, and effects.

    • Stronger sculk boundary visuals.

    • Safe handling for invalid effect values.

  • Nuke

    • Configurable explosion power.

    • Configurable launch radius added.

    • Improved player launch behavior.

    • Block destruction remains configurable.

  • ShadowStep

    • Finds the nearest valid player.

    • Safely checks the destination before teleporting.

    • Teleport particles appear at both locations.

    • Fails cleanly if there is no safe space.

  • Disguise

    • LibsDisguises is checked before activation.

    • Chat input is properly intercepted privately.

    • Fixed the previous double-processing issue.

    • Failed activations do not consume cooldowns.

The permission is now configured in plugin.yml as:

YAML
rolesmp.abilityuse:
  description: Allows players to activate unlocked abilities.
  default: false
Kodari can make mistakes. Review important code before using.
Files
src
pom.xml
Code
24 1,621
src/main/java/me/rolesmp/RoleSMP.java
package me.rolesmp;

import me.rolesmp.ability.AbilityManager;
import me.rolesmp.antirole.AntiRoleManager;
import me.rolesmp.command.AbilityUseCommand;
import me.rolesmp.command.AntiRoleCommand;
import me.rolesmp.command.RoleSmpCommand;
import me.rolesmp.config.AbilitiesConfig;
import me.rolesmp.listener.RoleListener;
import org.bukkit.Bukkit;
import org.bukkit.command.PluginCommand;
import org.bukkit.plugin.java.JavaPlugin;

public final class RoleSMP extends JavaPlugin {
    private AbilitiesConfig abilitiesConfig;
    private AbilityManager abilityManager;
    private AntiRoleManager antiRoleManager;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        saveResource("abilities.yml", false);
        saveResource("antirole.yml", false);

        this.abilitiesConfig = new AbilitiesConfig(this);
        this.antiRoleManager = new AntiRoleManager(this);
        this.abilityManager = new AbilityManager(this, abilitiesConfig);

        for (java.util.UUID member : antiRoleManager.getMembers()) {
            abilityManager.unlock(member, "AntiRoleDash");
        }

        registerCommands();
        Bukkit.getPluginManager().registerEvents(
                new RoleListener(this, abilityManager),
                this
        );
    }

    private void registerCommands() {
        PluginCommand roleCommand = getCommand("rolesmp");
        if (roleCommand != null) {
            RoleSmpCommand executor = new RoleSmpCommand(this);
            roleCommand.setExecutor(executor);
            roleCommand.setTabCompleter(executor);
        }

        PluginCommand abilityCommand = getCommand("abilityuse");
        if (abilityCommand != null) {
            AbilityUseCommand executor = new AbilityUseCommand(abilityManager);
            abilityCommand.setExecutor(executor);
            abilityCommand.setTabCompleter(executor);
        }

        PluginCommand antiRoleCommand = getCommand("antirole");
        if (antiRoleCommand != null) {
            AntiRoleCommand executor = new AntiRoleCommand(this);
            antiRoleCommand.setExecutor(executor);
            antiRoleCommand.setTabCompleter(executor);
        }
    }

    public void reloadRoleSmp() {
        reloadConfig();
        abilitiesConfig.reload();
        antiRoleManager.reload();

        for (java.util.UUID member : antiRoleManager.getMembers()) {
            abilityManager.unlock(member, "AntiRoleDash");
        }
    }

    public AbilitiesConfig getAbilitiesConfig() {
        return abilitiesConfig;
    }

    public AbilityManager getAbilityManager() {
        return abilityManager;
    }

    public AntiRoleManager getAntiRoleManager() {
        return antiRoleManager;
    }
}