H

Add the command /swordU that gives you an item called the sword of undying. This sword, when right-clicked, opens a INVENTORY GUI, and in that INVENTORY GUI, it shows all people who are in spectator, and when you click a player in that INVENTORY GUI, it puts that player in survival and does totem particle effects around them and plays the totem sound effect for all players. make it so there are only 3 uses per sword. This sword also has wind burst 1, density 2 and sharpness 5.

Kodari AI
KodariFeb 13 at 12:20 am 9,241 (v2)

I’ll create a plugin with a special Sword of Undying item that can revive spectator players.

SwordOfUndying
A powerful sword that opens a GUI to select spectator players and revive them to survival mode with totem effects. The sword has Wind Burst 1, Density 2, and Sharpness 5 enchantments, with only 3 uses before it breaks. Features visual totem particle effects and sounds when reviving players.

All files created! The plugin features:

Functionality:

  • /swordu command gives the Sword of Undying

  • Right-click sword to open GUI with all spectator players

  • Click a player’s head to revive them to survival mode

  • Totem particle effects spawn around revived player

  • Totem sound plays for all online players

  • Sword has 3 uses (tracked with NBT), then disappears

  • Broadcast message when player is revived

Enchantments:

  • Sharpness 5

  • Wind Burst 1

  • Density 2

The sword uses PersistentDataContainer to track uses, updates its lore with remaining uses, and automatically removes itself when depleted.

H

Make the sword sense people who have been banned instead of people in spectator. make it unban them and when they join it plays the totem sound effect for all player on the server

Kodari AI
KodariFeb 17 at 1:19 am 11,157 (v2)

I’ll modify the plugin to sense banned players, unban them, and play the totem sound for all players when they join.

Modified the plugin to sense banned players instead of spectators. The sword now opens a GUI showing all banned players, unbans the selected player, and plays the totem sound effect for all online players when the unbanned player joins the server.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
10 527
src/main/java/com/swordofundying/SwordOfUndying.java
package com.swordofundying;

import com.swordofundying.commands.SwordUCommand;
import com.swordofundying.listeners.GUIListener;
import com.swordofundying.listeners.PlayerJoinListener;
import com.swordofundying.listeners.SwordListener;
import com.swordofundying.managers.SwordManager;
import lombok.Getter;
import org.bukkit.plugin.java.JavaPlugin;

import java.util.HashSet;
import java.util.Set;
import java.util.UUID;

@Getter
public class SwordOfUndying extends JavaPlugin {
    
    private SwordManager swordManager;
    private Set<UUID> unbanedPlayers;
    
    @Override
    public void onEnable() {
        this.swordManager = new SwordManager(this);
        this.unbanedPlayers = new HashSet<>();
        
        getCommand("swordu").setExecutor(new SwordUCommand(this));
        
        getServer().getPluginManager().registerEvents(new SwordListener(this), this);
        getServer().getPluginManager().registerEvents(new GUIListener(this), this);
        getServer().getPluginManager().registerEvents(new PlayerJoinListener(this), this);
        
        getLogger().info("SwordOfUndying has been enabled!");
    }
    
    @Override
    public void onDisable() {
        getLogger().info("SwordOfUndying has been disabled!");
    }
}