samutana

create a minecraft plugin where if i type /fuze ( player 1 name ) ( player 2 name ) then the two player gets fused in as one player and 1 can control keyboard and 1 can control the mouse for that 1 player

Kodari AI
KodariApr 26 at 6:21 pm 7,313 (v2)
FuzePlugin
A creative multiplayer fusion plugin. Use /fuze <player1> <player2> to merge two players into one body — player1 controls movement (keyboard/WASD) while player2 controls the camera (mouse/look direction). The eyes player is placed in spectator mode and kept in sync with the body player's position. Both inputs are combined in real-time. Use /unfuze <player> to separate them. Includes permission nodes and proper cleanup on disconnect.

Here’s my plan:

  • FuzePlugin — main class, registers commands/listeners, starts sync task

  • FuzeData — stores body/eyes UUID and saved gamemode

  • FuzeManager — holds active fusions, start/stop logic

  • FuzeListener — PlayerMoveEvent to intercept inputs, disconnect cleanup

  • FuzeCommand — handles /fuze and /unfuze

Here’s how the fusion works:

Role
Player
What they control
Body
(keyboard)
Player 1
WASD movement, jumping, sneaking
Eyes
(mouse)
Player 2
Camera direction (yaw/pitch)

How it works under the hood:

  • The eyes player is set to SPECTATOR mode and teleported to the body every tick — their position changes are blocked in PlayerMoveEvent, but their yaw/pitch updates freely

  • On every body player move event, their look direction is overridden with the eyes player’s current yaw/pitch — so they walk wherever player 1 presses, but face wherever player 2 looks

  • On disconnect of either player, the fusion is automatically dissolved and the eyes player’s original gamemode is restored

Commands: /fuze <keyboard> <mouse> and /unfuze <player> — both require the fuze.use permission (op by default)

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
7 407
src/main/java/com/fuze/FuzePlugin.java
package com.fuze;

import com.fuze.command.FuzeCommand;
import com.fuze.listener.FuzeListener;
import com.fuze.manager.FuzeManager;
import org.bukkit.plugin.java.JavaPlugin;

public class FuzePlugin extends JavaPlugin {

    private FuzeManager fuzeManager;

    @Override
    public void onEnable() {
        fuzeManager = new FuzeManager(this);

        getServer().getPluginManager().registerEvents(new FuzeListener(fuzeManager), this);

        FuzeCommand cmd = new FuzeCommand(fuzeManager);
        getCommand("fuze").setExecutor(cmd);
        getCommand("unfuze").setExecutor(cmd);

        fuzeManager.startSyncTask();
    }

    @Override
    public void onDisable() {
        fuzeManager.dissolveAll();
    }

    public FuzeManager getFuzeManager() {
        return fuzeManager;
    }
}