t4iw
📎 1 file 1,986 chars
📄
pasted-code-1773603590518.txt
txt 71 lines
▶
Create a Minecraft Paper/Spigot plugin for version 1.21.5 called SecretRoles.
Core System
When a player joins the server, they are assigned one random hidden role.
The role should display using:
Title
Subtitle
Chat message
Roles must stay secret from other players.
Each role has small vanilla-style perks, not overpowered abilities.
Roles should feel like normal Minecraft survival mechanics.
Store player roles using UUID in a config file.
Add command:
/role → shows the player's role only.
Roles (Balanced / Vanilla Feel)
1. Hunter 🏹
Slight Speed I when holding a bow
Deals +1 extra bow damage
Task: Track and hunt players.
2. Traitor 🗡️
After killing a player, gains 5 seconds of Speed I
Task: Secretly eliminate players.
3. Guardian 🛡️
Gains Resistance I within 40 blocks of spawn
Task: Defend spawn area.
4. Parasite 🐍
When hitting a player, heals half a heart
Task: Slowly drain enemies.
5. Trickster 🎭
Every 5 minutes gets a random small buff for 30 seconds:
Speed I
Jump Boost I
Night Vision
Haste I
Task: Use randomness to survive.
6. Assassin 🗡️
Extra damage when attacking from behind
Task: Kill stealthily.
7. Shadow 🌑
Gains Night Vision at night
Slight Speed I in darkness
Task: Move unseen.
8. Tank 🧱
Gets 2 extra hearts
Slight Slowness I
Task: Survive longer in fights.
9. Alchemist 🧪
Gets random potion ingredient every 10 minutes
Task: Brew useful potions.
10. Scout 🧭
Permanent Speed I
Takes slightly more damage
Task: Explore and gather info.
11. Necromancer 💀
When killing mobs, small chance to spawn a friendly zombie
Task: Use mobs to assist.
12. Survivor 🌿
Gains slow regeneration when below 5 hearts
Task: Stay alive longer than others.
Join Role Message
Title:
Your Secret Role
Subtitle:
Hunter 🏹
Chat:
Your role is secret. Survive and complete your role's purpose.
Optional Features
/roles → shows list of roles (no abilities revealed)
/resetroles → admin command
config.yml to tweak abilities
ability cooldown system
role assignment sound effect
Kodari AI
KodariMar 15 at 7:43 pm 19,378 (v2)

I’ll create a comprehensive SecretRoles plugin with 12 balanced roles and vanilla-style perks.

SecretRoles
A secret role survival plugin where each player receives a hidden role on join with unique vanilla-style perks. Features 12 balanced roles including Hunter, Traitor, Guardian, Parasite, Trickster, Assassin, Shadow, Tank, Alchemist, Scout, Necromancer, and Survivor. Includes role persistence, ability systems, and admin commands for role management.

I’ll create a complete SecretRoles plugin with all 12 balanced roles and their abilities.

Project created successfully! I’ve built a complete SecretRoles plugin with all 12 balanced roles.

What was implemented:

✅ Core System:

  • Random role assignment on first join with UUID persistence

  • Title, subtitle, and chat message display with sound effect

  • Role data saved to playerdata.yml

✅ All 12 Roles with Abilities:

  • Hunter - Speed I with bow, +1 bow damage

  • Traitor - Speed I for 5s after killing a player

  • Guardian - Resistance I within 40 blocks of spawn

  • Parasite - Heals 0.5 hearts when hitting players

  • Trickster - Random buff every 5 minutes (Speed/Jump/Night Vision/Haste)

  • Assassin - 1.5x damage when attacking from behind

  • Shadow - Night vision at night, Speed I in darkness

  • Tank - +2 extra hearts, slight Slowness I

  • Alchemist - Random potion ingredient every 10 minutes

  • Scout - Permanent Speed I, takes 15% more damage

  • Necromancer - 15% chance to spawn friendly zombie on mob kill

  • Survivor - Slow regeneration below 5 hearts

✅ Commands:

  • /role - View your secret role

  • /roles - List all available roles (abilities hidden)

  • /resetroles - Admin command to reset all roles

✅ Features:

  • Fully configurable ability values in config.yml

  • Cross-version compatibility using XSeries

  • Passive effect system running every tick

  • Timed ability system for Trickster and Alchemist

The plugin uses vanilla-style perks that feel natural in survival gameplay without being overpowered!

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
17 821
src/main/java/com/secretroles/SecretRoles.java
package com.secretroles;

import com.secretroles.commands.RoleCommand;
import com.secretroles.commands.RolesCommand;
import com.secretroles.commands.ResetRolesCommand;
import com.secretroles.listeners.CombatListener;
import com.secretroles.listeners.DeathListener;
import com.secretroles.listeners.JoinListener;
import com.secretroles.listeners.MovementListener;
import com.secretroles.tasks.AlchemistTask;
import com.secretroles.tasks.PassiveEffectTask;
import com.secretroles.tasks.TricksterTask;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

@Getter
public class SecretRoles extends JavaPlugin {
    private RoleManager roleManager;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        
        this.roleManager = new RoleManager(this);
        this.roleManager.loadPlayerData();
        
        registerCommands();
        registerListeners();
        startTasks();
        
        getLogger().info("SecretRoles has been enabled!");
    }

    @Override
    public void onDisable() {
        this.roleManager.savePlayerData();
        getLogger().info("SecretRoles has been disabled!");
    }

    private void registerCommands() {
        getCommand("role").setExecutor(new RoleCommand(this));
        getCommand("roles").setExecutor(new RolesCommand());
        getCommand("resetroles").setExecutor(new ResetRolesCommand(this));
    }

    private void registerListeners() {
        Bukkit.getPluginManager().registerEvents(new JoinListener(this), this);
        Bukkit.getPluginManager().registerEvents(new CombatListener(this), this);
        Bukkit.getPluginManager().registerEvents(new MovementListener(this), this);
        Bukkit.getPluginManager().registerEvents(new DeathListener(this), this);
    }

    private void startTasks() {
        new PassiveEffectTask(this).runTaskTimer(this, 0L, 20L);
        new TricksterTask(this).runTaskTimer(this, 0L, 20L);
        new AlchemistTask(this).runTaskTimer(this, 0L, 20L);
    }
}