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,
Create the Paper plugin build and metadata.
Add player-state snapshots covering appearance, inventory, location, and gameplay data.
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.
The compilation failed with this error:
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.
Correct
PlayerState’s potion-effect copying and profile API types.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 witheffect.clone().Added the required profile cast when capturing player profiles.
Preserved skin, inventory, and player-state swapping behavior.
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();
}
}
}