I

make a mc plguin that makes it so everytime you are about to die it sets u to half a heart instead of dying, there should be 2 operator chat commands that are /immortal (username) and /mortal (username) everybody should start off as mortal.

Kodari AI
KodariMar 5 at 9:47 pm 6,457 (v2)

I’ll create a plugin that prevents immortal players from dying by setting their health to half a heart.

ImmortalityPlugin
A plugin that grants players immortality, preventing them from dying by setting their health to half a heart when fatal damage occurs. Features operator commands to toggle immortality for specific players, with all players starting as mortal by default. Includes visual and audio feedback when immortality saves a player from death.

Plugin created! When a player with immortality is about to take fatal damage, they’ll be saved with half a heart remaining and see a gold “IMMORTALITY saved you from death!” message with totem particles and a level-up sound. Use /immortal <username> to grant immortality and /mortal <username> to remove it. Only operators can use these commands, and all players start as mortal by default.

I

no it should be secret that their immortal

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
7 251
src/main/java/com/immortality/ImmortalityPlugin.java
package com.immortality;

import com.immortality.commands.ImmortalCommand;
import com.immortality.commands.MortalCommand;
import com.immortality.listeners.ImmortalityListener;
import com.immortality.managers.ImmortalityManager;
import lombok.Getter;
import org.bukkit.plugin.java.JavaPlugin;

@Getter
public class ImmortalityPlugin extends JavaPlugin {
    
    private ImmortalityManager immortalityManager;
    
    @Override
    public void onEnable() {
        immortalityManager = new ImmortalityManager();
        
        registerListeners();
        registerCommands();
        
        getLogger().info("ImmortalityPlugin has been enabled!");
    }
    
    @Override
    public void onDisable() {
        getLogger().info("ImmortalityPlugin has been disabled!");
    }
    
    private void registerListeners() {
        getServer().getPluginManager().registerEvents(new ImmortalityListener(this), this);
    }
    
    private void registerCommands() {
        getCommand("immortal").setExecutor(new ImmortalCommand(this));
        getCommand("mortal").setExecutor(new MortalCommand(this));
    }
}