make it display in the death message
This commit is contained in:
parent
883763e350
commit
da226f55a6
1 changed files with 19 additions and 0 deletions
|
|
@ -3,6 +3,8 @@ package pl.piecuu.killstreak;
|
|||
import net.kyori.adventure.key.Key;
|
||||
import net.kyori.adventure.sound.Sound;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.TextReplacementConfig;
|
||||
import net.kyori.adventure.text.format.Style;
|
||||
import net.kyori.adventure.text.format.TextColor;
|
||||
|
||||
import org.bukkit.entity.Entity;
|
||||
|
|
@ -66,5 +68,22 @@ public class PlayerManager implements Listener {
|
|||
.append(p.displayName());
|
||||
plugin.getServer().broadcast(component);
|
||||
}
|
||||
|
||||
if(killstreak <= 0) return;
|
||||
|
||||
final Component deathMessage = e.deathMessage()
|
||||
.replaceText(TextReplacementConfig.builder()
|
||||
.once()
|
||||
.match(attacker.getName())
|
||||
.replacement(
|
||||
Component.empty()
|
||||
.append(km.getKillstreakComponent(killstreak))
|
||||
.appendSpace()
|
||||
.append(Component.text(attacker.getName()))
|
||||
)
|
||||
.build()
|
||||
);
|
||||
|
||||
e.deathMessage(deathMessage);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue