vladi23432

Make me a plugin that when im invis when i kill someone my name wont appeal in chat and when im invis also I dont appear in online people tab

Kodari AI
KodariJun 23 at 7:28 pm 6

I’ll create a stealth plugin that hides invisible players from tab lists and death messages.

StealthMode
Enhances invisibility by completely hiding invisible players from the server. When a player has invisibility, they are hidden from the tab list and their name won't appear in death messages when they kill someone. Perfect for stealth gameplay, admin monitoring, or assassination game modes. Includes configurable death messages and automatic visibility management.

Created StealthMode - a plugin that makes invisibility truly stealthy. When a player has the invisibility effect:

  • They’re completely hidden from the tab list (other players can’t see them online)

  • If they kill someone, the death message shows a mysterious generic message instead of their name

  • Automatically updates every second to detect invisibility changes

  • Handles player joins/leaves properly

The death message is configurable in config.yml - you can customize the text or set it to empty to completely hide death notifications from invisible killers.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
5 155
src/main/java/com/stealthmode/StealthMode.java
package com.stealthmode;

import com.stealthmode.listeners.StealthListener;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.potion.PotionEffectType;

public class StealthMode extends JavaPlugin {

    @Override
    public void onEnable() {
        saveDefaultConfig();
        
        getServer().getPluginManager().registerEvents(new StealthListener(this), this);
        
        long interval = getConfig().getLong("check-interval", 20L);
        Bukkit.getScheduler().runTaskTimer(this, this::updateAllPlayerVisibility, 0L, interval);
        
        getLogger().info("StealthMode enabled! Invisible players will be hidden from tab list and death messages.");
    }

    @Override
    public void onDisable() {
        // Show all players to everyone when plugin disables
        for (Player player : Bukkit.getOnlinePlayers()) {
            for (Player other : Bukkit.getOnlinePlayers()) {
                if (!player.equals(other)) {
                    player.showPlayer(this, other);
                }
            }
        }
        getLogger().info("StealthMode disabled!");
    }

    public void updateAllPlayerVisibility() {
        for (Player player : Bukkit.getOnlinePlayers()) {
            updatePlayerVisibility(player);
        }
    }

    public void updatePlayerVisibility(Player player) {
        boolean hasInvisibility = player.hasPotionEffect(PotionEffectType.INVISIBILITY);
        
        for (Player other : Bukkit.getOnlinePlayers()) {
            if (other.equals(player)) continue;
            
            if (hasInvisibility) {
                other.hidePlayer(this, player);
            } else {
                other.showPlayer(this, player);
            }
        }
    }
}