Zachary Henderson

a stick, when u click another player with a stick u swap bodies/control with them, skins, displaynames, inv, player data, etc everything be swap u be them and they be u,

Kodari AI
KodariSep 16 at 5:21 pm 2
BodySwapStick
A Minecraft plugin that adds a special stick item. When a player right-clicks another player with the stick, the two players completely swap bodies and identities. All player data is exchanged: inventory contents, armor, health, hunger, experience, potion effects, location, game mode, display name, skin, and UUID-based data. Each player fully controls the other's character until they swap back by clicking each other again with the stick. The plugin handles persistent data storage, prevents abuse during combat, and includes configurable cooldowns and permissions.
  1. Create the Paper plugin build and metadata.

  2. Add player-state snapshots covering appearance, inventory, location, and gameplay data.

  3. Add stick interaction handling with cooldowns, swapping, restoration, and skin/display-name transfer.

Created the BodySwap Paper plugin.

  • Right-click another player with a stick to swap:

    • Skins and display names

    • Inventory and armor

    • Ender chest

    • Location

    • Health, hunger, XP, game mode

    • Flight and movement state

    • Potion effects

    • Fire/freeze/air state

    • Visibility and other player flags

  • Includes cooldown protection and configurable messages.

  • Restores original player states when the plugin disables or a swapped player quits.

Zachary Henderson

The compilation failed with this error:

code
Compilation failed with 5 error(s):

ERROR in src/main/java/com/kodari/bodyswap/PlayerState.java at line 154: incompatible types: cannot infer type-variable(s) R
                player.getActivePotionEffects().stream().map(PotionEffect::new).toList()
                                                            ^

ERROR in src/main/java/com/kodari/bodyswap/PlayerState.java at line 164: incompatible types: org.bukkit.profile.PlayerProfile cannot be converted to com.destroystokyo.paper.profile.PlayerProfile
        player.setPlayerProfile(copyProfile(profile, player.getUniqueId()));
                                           ^

ERROR in src/main/java/com/kodari/bodyswap/PlayerState.java at line 208: incompatible types: PotionEffect cannot be converted to Map<String,Object>
            player.addPotionEffect(new PotionEffect(effect));
                                                    ^

ERROR in src/main/java/com/kodari/bodyswap/PlayerState.java at line 216: cannot find symbol
        copy.getProperties().addAll(source.getProperties());
            ^
  symbol: method getProperties()
  location: variable copy of type PlayerProfile

ERROR in src/main/java/com/kodari/bodyswap/PlayerState.java at line 216: cannot find symbol
        copy.getProperties().addAll(source.getProperties());
                                          ^
  symbol: method getProperties()
  location: variable source of type PlayerProfile


=== COMPILATION ERROR ANALYSIS ===

MISSING METHODS:
  - getProperties()
ACTION: Check method names and signatures

TYPE MISMATCHES:
  - incompatible types: cannot infer type-variable(s) R
  - incompatible types: org.bukkit.profile.PlayerProfile cannot be converted to com.destroystokyo.paper.profile.PlayerProfile
  - incompatible types: PotionEffect cannot be converted to Map<String,Object>
ACTION: Fix variable types or casting

FILES TO INVESTIGATE:
  - src/main/java/com/kodari/bodyswap/PlayerState.java

Please fix this error by creating a new artifact with the corrected code.

Kodari AI
KodariSep 16 at 5:23 pm 1
  1. Correct PlayerState’s potion-effect copying and profile API types.

  2. Preserve the existing swap behavior while removing unsupported Paper profile methods.

Fixed PlayerState.java:

  • Switched to Paper’s com.destroystokyo.paper.profile.PlayerProfile.

  • Correctly copied profile properties.

  • Replaced invalid new PotionEffect(effect) calls with effect.clone().

  • Added the required profile cast when capturing player profiles.

  • Preserved skin, inventory, and player-state swapping behavior.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
8 454
src/main/java/com/kodari/bodyswap/BodySwapPlugin.java
package com.kodari.bodyswap;

import org.bukkit.plugin.java.JavaPlugin;

public final class BodySwapPlugin extends JavaPlugin {

    private BodySwapManager bodySwapManager;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        bodySwapManager = new BodySwapManager(this);
        getServer().getPluginManager().registerEvents(new BodySwapListener(bodySwapManager), this);
    }

    @Override
    public void onDisable() {
        if (bodySwapManager != null) {
            bodySwapManager.restoreAll();
        }
    }
}