This commit is contained in:
Piecuuu 2026-02-21 20:55:50 +01:00
commit 0611c3c2bd
4 changed files with 86 additions and 0 deletions

4
.gitignore vendored Normal file
View file

@ -0,0 +1,4 @@
build/
bin/
.gradle/
.vscode/

37
build.gradle Normal file
View file

@ -0,0 +1,37 @@
plugins {
id 'java'
id 'maven-publish'
}
group = 'pl.piecuu.invisninja'
version = '1.0'
java {
toolchain.languageVersion = JavaLanguageVersion.of(21)
withSourcesJar()
}
repositories {
mavenCentral()
mavenLocal()
maven {
url = 'https://repo.extendedclip.com/releases/'
}
}
dependencies {
compileOnly "pl.piecuu.jajoptak:leaf-api:1.21.11-R0.1-SNAPSHOT"
compileOnly "me.clip:placeholderapi:2.11.7"
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}
}

View file

@ -0,0 +1,40 @@
package pl.piecuu.invisninja;
import org.bukkit.Bukkit;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.potion.PotionEffectType;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.TextReplacementConfig;
import net.kyori.adventure.text.format.TextDecoration;
public class InvisNinja extends JavaPlugin implements Listener {
@Override
public void onEnable() {
Bukkit.getPluginManager().registerEvents(this, this);
}
@EventHandler
public void onPlayerDeath(PlayerDeathEvent e) {
Entity en = e.getDamageSource().getCausingEntity();
if(!(en instanceof Player p)) return;
if(!isPlayerInvisible(p)) return;
Component newMessage = e.deathMessage()
.replaceText(TextReplacementConfig.builder()
.match(p.getName())
.replacement(Component.text("aaaaaaaaaaaaa").decoration(TextDecoration.OBFUSCATED, true))
.build()
);
e.deathMessage(newMessage);
}
public static boolean isPlayerInvisible(Player p) {
return p.hasPotionEffect(PotionEffectType.INVISIBILITY);
}
}

View file

@ -0,0 +1,5 @@
name: invisninja
version: 1.0
author: Piecuu
main: pl.piecuu.invisninja.InvisNinja
api-version: '1.21.11'