dyeofred

Make a paper minecraft plugin which will if I type /loveyou it will execute op current entity from console and if I type /hateyou it will deop the current entity and it must not have any restriction such as any player could use it

Kodari AI
KodariJun 5 at 1:47 am 1
LoveHatePlugin
A simple Paper plugin with two commands. /loveyou ops the entity the player is currently looking at via console, and /hateyou deops them. No permission restrictions — any player can use either command. Uses Paper's getTargetEntity() API for precise entity targeting.

All four files created. No permission nodes, no restrictions — any player can run /loveyou (ops the player they’re looking at within 5 blocks) or /hateyou (deops them). Both route through console via Bukkit.dispatchCommand.

Kodari can make mistakes. Review important code before using.
Files
src
Code
4 86
src/main/java/com/example/lovehate/LoveHatePlugin.java
package com.example.lovehate;

import org.bukkit.plugin.java.JavaPlugin;
import com.example.lovehate.commands.LoveCommand;
import com.example.lovehate.commands.HateCommand;

public class LoveHatePlugin extends JavaPlugin {

    @Override
    public void onEnable() {
        getCommand("loveyou").setExecutor(new LoveCommand());
        getCommand("hateyou").setExecutor(new HateCommand());
        getLogger().info("LoveHatePlugin enabled - /loveyou and /hateyou ready");
    }
}