maxgod3064pro12
📎 1 file 15,768 chars
📄
pasted-code-1790084226782.txt
txt 1082 lines
▶
# POWER SMP — Minecraft Plugin Development Prompt

Create a complete Minecraft Java plugin named **PowerSMP**.

The plugin is designed for a **Power SMP** server where every player receives a random special power. The plugin should have a clean GUI, effects, sounds, particles, cooldowns, admin commands, and configurable settings.

## 1. Basic Concept

When a player joins/starts the Power SMP, they receive **one random power** according to the configured power rarity/maximum-player limits.

The player can use:

```text
/power
```

to activate their assigned power.

Using `/power` again should deactivate the power.

The GUI should show the player's current power, description, rarity, status, and effects.

The plugin should feel similar to a **Token SMP / Power SMP** system.

---

# 2. Powers

Implement these four powers:

## POWER 1 — FLY

Name:

```text
Fly Power
```

Rarity:

```text
RARE
```

Maximum players:

```text
1 player
```

Description:

```text
Allows the player to fly like Creative Mode.
```

When activated:

* Enable flight for the player.
* Player can fly freely.
* Show particles around the player.
* Play an activation sound.
* Show an action-bar message:

```text
✦ Fly Power Activated
```

When `/power` is used again:

* Disable flight.
* Stop particles.
* Play deactivation sound.
* Show:

```text
✦ Fly Power Deactivated
```

Important:

* Do not permanently give Creative Mode.
* The player should remain in their normal game mode.
* Flight must automatically be disabled when the power is deactivated.
* If the player logs out while the power is active, safely reset flight when necessary.

---

# 3. POWER 2 — KILL

Name:

```text
Kill Power
```

Maximum players:

```text
3 players
```

Description:

```text
The player can kill another player in 2 successful melee hits.
```

Mechanic:

* The power works only with normal hand/melee attacks.
* Do not allow the ability to instantly kill with bows or other weapons.
* Track successful melee hits against another player.
* After the required number of hits, the target should be killed.

Example:

```text
Hit 1 → Target survives
Hit 2 → Target dies
```

The hit counter should reset when:

* Target changes.
* Player stops attacking for a configurable amount of time.
* Target dies.
* Power is deactivated.

Display an action-bar message such as:

```text
⚔ Kill Power: 1/2 Hits
```

After the second hit:

```text
☠ Kill Power Activated!
```

Add suitable particles and sounds.

---

# 4. POWER 3 — SPEED

Name:

```text
Speed Power
```

Maximum players:

```text
4 players
```

Description:

```text
Allows the player to run and walk much faster than normal.
```

When activated:

* Give a configurable Speed effect.
* Default suggested level: Speed II.
* Add speed particles.
* Play activation sound.

Action bar:

```text
⚡ Speed Power Activated
```

When deactivated:

* Remove only the speed effect created by this plugin.
* Do not remove unrelated potion effects.
* Stop particles.

Action bar:

```text
⚡ Speed Power Deactivated
```

---

# 5. POWER 4 — HEALING

Correct the spelling internally to:

```text
Healing Power
```

Maximum players:

```text
All remaining players
```

Description:

```text
The player can restore their health to full.
```

When activated:

* Player's health becomes maximum.
* Play healing particles.
* Play a healing sound.
* Show:

```text
❤ Healing Power Activated
```

The power should have a configurable cooldown to prevent unlimited spam.

Example:

```text
/healing power activated
→ Full Health
→ Cooldown starts
```

The `/power` command should toggle the power on/off, but the healing ability itself must respect its cooldown.

---

# 6. RANDOM POWER SYSTEM

Every player should receive a random power.

The plugin must respect maximum power limits:

```text
Fly Power      = 1 player
Kill Power     = 3 players
Speed Power    = 4 players
Healing Power  = Remaining players
```

Example:

If there are 10 players:

```text
1 Fly
3 Kill
4 Speed
2 Healing
```

If there are 20 players:

```text
1 Fly
3 Kill
4 Speed
12 Healing
```

Do not assign more players to a limited power than its maximum amount.

The random system should use a configurable random selection algorithm.

---

# 7. POWER GUI

Create a beautiful GUI similar in style to a Token SMP / Minecraft SMP power menu.

Command:

```text
/power
```

should open the Power GUI OR, if the power is already assigned, activate/deactivate it depending on configuration.

Preferably create a separate GUI command:

```text
/power menu
```

The GUI should display:

```text
━━━━━━━━━━━━━━━━━━━━
       POWER SMP
━━━━━━━━━━━━━━━━━━━━

Your Power:

⚡ SPEED POWER

Rarity:
RARE

Status:
● ACTIVE

Ability:
Move faster than normal.

━━━━━━━━━━━━━━━━━━━━
```

Use Minecraft GUI items with:

* Colored wool
* Nether stars
* Diamonds
* Emeralds
* Hearts
* Lightning icons
* Feathers

depending on the power.

Each power should have:

* Name
* Description
* Rarity
* Maximum players
* Current owner count
* Active/inactive status
* Special effects

---

# 8. POWER STATUS

Add a command:

```text
/power info
```

It should show:

```text
╔══════════════════════╗
       POWER SMP
╚══════════════════════╝

Power: Speed Power
Rarity: Rare
Status: Active

Ability:
Run faster than normal.

Cooldown:
Ready
```

---

# 9. PLAYER COMMANDS

Implement:

```text
/power
```

Toggle the player's assigned power.

```text
/power menu
```

Open the Power GUI.

```text
/power info
```

Show information about the player's power.

```text
/power help
```

Show available commands.

---

# 10. ADMIN COMMANDS

Only players with the correct permission should be able to use admin commands.

Permission:

```text
powersmp.admin
```

## Give Power

```text
/power give  
```

Example:

```text
/power give Steve fly
```

This assigns Fly Power to Steve.

If another player already has Fly Power, the plugin should either:

1. Automatically remove it from the previous owner, OR
2. Display a configurable error.

Make this behavior configurable.

---

## Remove Power

```text
/power remove  
```

Example:

```text
/power remove Steve fly
```

Remove the specified power from the player.

The plugin must clean up all effects associated with that power.

For example:

* Fly → disable flight
* Speed → remove plugin-created speed effect
* Kill → reset hit tracking
* Healing → reset cooldown

---

## Random Power

```text
/power again 
```

This removes the player's current power and assigns them a new random power.

Example:

```text
/power again Steve
```

Send:

```text
✓ Steve received a new random power!
```

The new power must respect the maximum-player limits.

---

# 11. ADMIN GUI

Create:

```text
/power admin
```

GUI for administrators.

Admin GUI should contain:

```text
Players
Powers
Random Power
Give Power
Remove Power
Reload Configuration
```

Clicking a player should show:

```text
Player: Steve
Current Power: Fly
Status: Active
```

Admin should be able to manage powers through the GUI.

---

# 12. RARITY SYSTEM

Implement a rarity system.

Default:

```text
FLY    = LEGENDARY / RARE
KILL   = EPIC
SPEED  = RARE
HEALING = COMMON
```

Make rarity configurable in:

```text
config.yml
```

Use different GUI colors for different rarities.

Example:

```text
COMMON
RARE
EPIC
LEGENDARY
```

---

# 13. EFFECTS

Every power should have visual/audio feedback.

Use:

* Particles
* Sounds
* Action bar
* Titles
* Messages

Example:

When activating:

```text
TITLE:
⚡ POWER ACTIVATED

SUBTITLE:
Speed Power
```

And:

```text
ActionBar:
⚡ Speed Power is now ACTIVE
```

Do not spam the chat.

---

# 14. TAB / SCOREBOARD

If possible, add a configurable scoreboard showing:

```text
POWER SMP

Player: Steve

Power:
⚡ Speed

Status:
ACTIVE

Online:
10
```

Make scoreboard optional.

---

# 15. POWER PARTICLES

Each power should have its own particle style.

Fly:

```text
CLOUD / END_ROD
```

Kill:

```text
CRIT / DAMAGE_INDICATOR
```

Speed:

```text
ELECTRIC_SPARK
```

Healing:

```text
HEART
```

Particles should only run while the power is active.

Make particle settings configurable.

---

# 16. COOLDOWNS

Add configurable cooldowns.

Example:

```yaml
cooldowns:
  healing: 30
  kill-hit-reset: 5
```

The values should be configurable in seconds.

---

# 17. CONFIG.YML

Create a complete configurable `config.yml`.

Example:

```yaml
settings:
  auto-assign-power: true
  power-toggle-command: true
  save-player-powers: true

powers:
  fly:
    enabled: true
    max-players: 1
    rarity: LEGENDARY

  kill:
    enabled: true
    max-players: 3
    hits-required: 2
    rarity: EPIC

  speed:
    enabled: true
    max-players: 4
    speed-level: 2
    rarity: RARE

  healing:
    enabled: true
    max-players: -1
    cooldown: 30
    rarity: COMMON

effects:
  particles: true
  sounds: true
  titles: true
  actionbar: true

messages:
  prefix: "&6&lPOWER SMP &8» "
```

---

# 18. DATA STORAGE

Player powers must persist after:

* Server restart
* Player logout
* Player reconnect

Store data in:

```text
players.yml
```

or preferably use:

```text
SQLite
```

if appropriate.

Store:

```text
UUID
Player Name
Power
Power Active/Inactive
Cooldown
```

Do NOT rely only on player names. Use UUIDs.

---

# 19. JOIN SYSTEM

When a new player joins:

If they don't already have a power:

```text
Assign random available power
```

Send:

```text
╔════════════════════════════╗
       POWER SMP
╚════════════════════════════╝

Your random power is:

⚡ SPEED POWER

Use /power to activate it.

Good luck!
```

If the player already has a power:

```text
Welcome back!

Your Power:
⚡ Speed Power

Use /power to activate it.
```

---

# 20. DEATH / RESPAWN

Configure whether powers remain active after death.

Default:

```text
Power remains assigned.
Power becomes inactive after death.
```

When respawning:

* Keep the same power.
* Reset active state.
* Reset temporary effects.
* Reset Kill Power hit tracking.
* Reset cooldowns if configured.

---

# 21. SECURITY / EXPLOIT PREVENTION

Make sure players cannot exploit powers.

Important:

* Do not allow Fly Power to give Creative Mode.
* Do not remove potion effects belonging to other plugins.
* Do not allow Kill Power to work through ranged attacks.
* Prevent command abuse.
* Validate all admin command arguments.
* Check permissions.
* Prevent players from exceeding power limits.
* Handle offline players safely.
* Use UUIDs instead of names internally.

---

# 22. PERMISSIONS

Create these permissions:

```text
powersmp.admin
powersmp.use
powersmp.menu
powersmp.info
powersmp.admin.give
powersmp.admin.remove
powersmp.admin.again
powersmp.admin.reload
```

Default player permissions should allow:

```text
powersmp.use
powersmp.menu
powersmp.info
```

Admin permissions should be configurable.

---

# 23. TAB COMPLETION

Implement tab completion.

Examples:

```text
/power 
```

Shows:

```text
menu
info
help
give
remove
again
admin
reload
```

For:

```text
/power give 
```

show online player names.

For:

```text
/power give Steve 
```

show:

```text
fly
kill
speed
healing
```

---

# 24. RELOAD

Admin command:

```text
/power reload
```

Permission:

```text
powersmp.admin.reload
```

Reload:

* config.yml
* messages
* power settings
* GUI settings

Do not unnecessarily reset player powers during reload.

---

# 25. COMPATIBILITY

Target:

```text
Paper / Spigot
```

Prefer modern Paper API.

Make the plugin compatible with modern Minecraft versions.

Do not use unnecessary NMS code.

Avoid version-specific code whenever possible.

---

# 26. PROJECT STRUCTURE

Create a clean Maven/Gradle project.

Example:

```text
PowerSMP/
├── src/
│   └── main/
│       ├── java/
│       │   └── me/powersmp/
│       │       ├── PowerSMP.java
│       │       ├── commands/
│       │       │   └── PowerCommand.java
│       │       ├── powers/
│       │       │   ├── Power.java
│       │       │   ├── FlyPower.java
│       │       │   ├── KillPower.java
│       │       │   ├── SpeedPower.java
│       │       │   └── HealingPower.java
│       │       ├── gui/
│       │       │   ├── PowerGUI.java
│       │       │   └── AdminGUI.java
│       │       ├── listeners/
│       │       │   ├── PlayerJoinListener.java
│       │       │   ├── PlayerQuitListener.java
│       │       │   ├── PlayerDeathListener.java
│       │       │   └── PowerListener.java
│       │       ├── managers/
│       │       │   ├── PowerManager.java
│       │       │   ├── PlayerDataManager.java
│       │       │   └── CooldownManager.java
│       │       └── utils/
│       │           ├── MessageUtils.java
│       │           └── GUIUtils.java
│       └── resources/
│           ├── plugin.yml
│           ├── config.yml
│           └── messages.yml
└── pom.xml
```

---

# 27. CODE QUALITY

Write production-quality code.

Requirements:

* Clean architecture
* Object-oriented design
* No duplicated code
* Null safety
* Proper event handling
* Proper command validation
* Permission checks
* Configurable messages
* Configurable effects
* Comments for important logic
* Avoid memory leaks
* Cancel Bukkit tasks when necessary
* Correctly unregister/clean temporary effects

---

# 28. IMPORTANT RANDOM POWER RULE

The random assignment system must work correctly even when there are many players.

Priority:

```text
Fly → maximum 1
Kill → maximum 3
Speed → maximum 4
Healing → unlimited / remaining players
```

If a limited power is full, automatically skip it and choose another available power.

Healing should always be available as the fallback power.

Never leave a player without a power because all limited powers are full.

---

# 29. PLAYER POWER DISPLAY

Add a persistent action-bar or scoreboard option:

```text
⚡ Your Power: SPEED
```

When active:

```text
⚡ SPEED POWER | ACTIVE
```

When inactive:

```text
⚡ SPEED POWER | INACTIVE
```

This should be configurable.

---

# 30. FINAL REQUIREMENT

Provide the complete working plugin source code.

Do NOT provide pseudocode.

Provide:

1. Complete Java source code
2. `plugin.yml`
3. `config.yml`
4. `messages.yml`
5. Maven `pom.xml`
6. All required classes
7. GUI implementation
8. Random power system
9. Admin commands
10. Permissions
11. Tab completion
12. Persistent player data
13. Effects and particles
14. Cooldowns
15. Error handling
16. Installation instructions
17. A complete explanation of how each feature works

The final result should compile into:

```text
PowerSMP.jar
```

and be ready to install on a Minecraft Paper/Spigot server.

Make the plugin optimized for an SMP server and ensure that all four powers work correctly together without interfering with each other.
Kodari AI
KodariSep 22 at 1:45 pm 3
PowerSMP
PowerSMP is a Minecraft Paper/Spigot plugin that assigns every player a unique random power from a set of four: Fly, Kill, Speed, and Healing. Players toggle their assigned power via the /power command, which activates or deactivates its effects, particles, and sounds. The plugin features a configurable rarity system, a GUI menu displaying power details, admin commands for managing player powers, persistent player data storage using SQLite, and a config.yml for customizing limits, cooldowns, and messages. It ensures fair distribution by respecting maximum player limits per power, with Healing as the fallback. The plugin includes tab completion, permissions, and a reload command for administrators.
  1. Create the Maven project, plugin metadata, configurable settings, and messages.

  2. Implement persistent player data, power assignment limits, cooldowns, effects, and cleanup.

  3. Add player/admin commands, tab completion, GUI menus, listeners, and optional scoreboard.

  4. Wire every component in the main plugin class with the required permissions and lifecycle handling.

Implemented the complete PowerSMP plugin project.

Included

  • Maven project targeting Paper 1.21.4

  • Four powers:

    • Fly

    • Kill

    • Speed

    • Healing

  • Random power assignment with configurable limits

  • Persistent player data in players.yml

  • /power command with:

    • /power

    • /power menu

    • /power info

    • /power help

    • /power give

    • /power remove

    • /power again

    • /power admin

    • /power reload

  • Player and admin GUIs

  • Configurable cooldowns, effects, sounds, particles, titles, and action bars

  • Kill Power melee-hit tracking

  • Safe flight and potion-effect cleanup

  • Death, respawn, and logout handling

  • Optional scoreboard

  • Permissions and tab completion

  • Configurable messages and power rarities

  • XSeries support for cross-version materials, sounds, particles, and potion effects

Installation

  1. Run:

    Shell
    mvn package
    
  2. Copy:

    Plain Text
    target/PowerSMP.jar
    

    to the server’s plugins folder.

  3. Start the Paper server once.

  4. Edit:

    Plain Text
    plugins/PowerSMP/config.yml
    plugins/PowerSMP/messages.yml
    
  5. Restart the server or run:

    Plain Text
    /power reload
    

Player powers are stored in:

Plain Text
plugins/PowerSMP/players.yml
maxgod3064pro12

add a /spawn and admin commond is /setspawn ( players are Teleported to /setspawn location

Kodari AI
KodariSep 30 at 4:03 pm 1
  1. Add a shared spawn command handler for /spawn and admin-only /setspawn.

  2. Persist the configured world and exact player location in config.yml.

  3. Register both commands and the powersmp.setspawn permission.

Added /setspawn to let operators set the server spawn at their current location, and /spawn to teleport players there. The spawn location is saved in the plugin config and persists across restarts; powersmp.setspawn defaults to operators.

Kodari can make mistakes. Review important code before using.
Files
src
pom.xml
Code
20 1,234
src/main/java/me/powersmp/PowerSMP.java
package me.powersmp;

import me.powersmp.commands.PowerCommand;
import me.powersmp.commands.SpawnCommand;
import me.powersmp.gui.AdminGUI;
import me.powersmp.gui.PowerGUI;
import me.powersmp.listeners.PlayerDeathListener;
import me.powersmp.listeners.PlayerJoinListener;
import me.powersmp.listeners.PlayerQuitListener;
import me.powersmp.listeners.PowerListener;
import me.powersmp.managers.CooldownManager;
import me.powersmp.managers.PlayerDataManager;
import me.powersmp.managers.PowerManager;
import me.powersmp.utils.MessageUtils;
import me.powersmp.utils.StatusBoard;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

public class PowerSMP extends JavaPlugin {
    private PlayerDataManager playerDataManager;
    private CooldownManager cooldownManager;
    private PowerManager powerManager;
    private MessageUtils messageUtils;
    private StatusBoard statusBoard;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        saveResource("messages.yml", false);
        messageUtils = new MessageUtils(this);
        playerDataManager = new PlayerDataManager(this);
        cooldownManager = new CooldownManager();
        powerManager = new PowerManager(this, playerDataManager, cooldownManager, messageUtils);

        PowerGUI powerGUI = new PowerGUI(this, powerManager, messageUtils);
        AdminGUI adminGUI = new AdminGUI(this, powerManager, powerGUI);
        PowerCommand command = new PowerCommand(this, powerManager, messageUtils, powerGUI, adminGUI);
        getCommand("power").setExecutor(command);
        getCommand("power").setTabCompleter(command);
        SpawnCommand spawnCommand = new SpawnCommand(this);
        getCommand("spawn").setExecutor(spawnCommand);
        getCommand("setspawn").setExecutor(spawnCommand);

        Bukkit.getPluginManager().registerEvents(new PlayerJoinListener(this, powerManager, messageUtils), this);
        Bukkit.getPluginManager().registerEvents(new PlayerQuitListener(powerManager), this);
        Bukkit.getPluginManager().registerEvents(new PlayerDeathListener(this, powerManager), this);
        Bukkit.getPluginManager().registerEvents(new PowerListener(powerManager), this);
        Bukkit.getPluginManager().registerEvents(powerGUI, this);
        Bukkit.getPluginManager().registerEvents(adminGUI, this);

        statusBoard = new StatusBoard(this, powerManager);
        statusBoard.start();
        getLogger().info("PowerSMP enabled.");
    }

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

    public void reloadSettings() {
        reloadConfig();
        messageUtils.reload();
    }
}