Added two new versions (0.2.0 removes the DamageListener and 0.2.1 adds the start of the command /set-chat-color to set the color of the display name
This commit is contained in:
parent
31b233f50a
commit
a381034a8f
@ -12,7 +12,6 @@ Listeners that are implemented by this plugin:
|
||||
- also shows players that are op in the display name
|
||||
- PlayerQuitEvent (print a beautified quit message "<< PlayerName")
|
||||
- PlayerChatEvent (deprecated, but beautify chat messages "PlayerName: message")
|
||||
- EntityDamageEvent (show who got how much damage from whom)
|
||||
|
||||
And all that in beautiful colors!
|
||||
|
||||
|
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>de.privacynerd</groupId>
|
||||
<artifactId>ChatBeautifier</artifactId>
|
||||
<version>0.1.0</version>
|
||||
<version>0.2.1</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>ChatBeautifier</name>
|
||||
|
@ -3,6 +3,8 @@ package de.privacynerd.chatbeautifier;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import de.privacynerd.chatbeautifier.commands.*;
|
||||
import de.privacynerd.chatbeautifier.guis.*;
|
||||
|
||||
|
||||
public final class ChatBeautifier extends JavaPlugin {
|
||||
@ -25,8 +27,8 @@ public final class ChatBeautifier extends JavaPlugin {
|
||||
log("JoinQuitListener has been registered.");
|
||||
pluginManager.registerEvents(new ChatListener(), this);
|
||||
log("ChatListener has been registered.");
|
||||
pluginManager.registerEvents(new DamageListener(), this);
|
||||
log("DamageListener has been registered.");
|
||||
|
||||
Bukkit.getPluginCommand("set-chat-color").setExecutor(new ChatColorCommand());
|
||||
|
||||
log("Plugin enabled.");
|
||||
}
|
||||
|
@ -1,29 +0,0 @@
|
||||
package de.privacynerd.chatbeautifier;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Server;
|
||||
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.EntityDamageEvent;
|
||||
|
||||
public class DamageListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerGetDamage(EntityDamageEvent event) {
|
||||
Entity player1 = event.getEntity();
|
||||
if(!(player1 instanceof Player)){
|
||||
return;
|
||||
}
|
||||
Player player = (Player) player1;
|
||||
Server server = Bukkit.getServer();
|
||||
|
||||
Component message = Component.text(ChatColor.BOLD + "§4[Schaden] " + ChatColor.WHITE + "Der Spieler " + player.getDisplayName() + ChatColor.WHITE + " hat durch \n" + ChatColor.AQUA + event.getCause() + " " + ChatColor.RED + event.getDamage() / 2 + " Herzen " + ChatColor.WHITE + "Schaden bekommen");
|
||||
|
||||
server.broadcast(message);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package de.privacynerd.chatbeautifier.commands;
|
||||
|
||||
import de.privacynerd.chatbeautifier.ChatBeautifier;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class ChatColorCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String alias, @NotNull String[] args) {
|
||||
ChatBeautifier.INSTANCE.log("Command /set-chat-name executed");
|
||||
|
||||
if(!(commandSender instanceof Player)) {
|
||||
ChatBeautifier.INSTANCE.log("Du bist kein Spieler.");
|
||||
return true;
|
||||
}
|
||||
Player player = (Player) commandSender;
|
||||
|
||||
player.sendMessage(Component.text("Dieses Kommando befindet sich noch in der Mache!"));
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
package de.privacynerd.chatbeautifier.guis;
|
||||
|
||||
public class ChooseChatColor {
|
||||
|
||||
}
|
@ -2,3 +2,9 @@ name: ChatBeautifier
|
||||
version: '${project.version}'
|
||||
main: de.privacynerd.chatbeautifier.ChatBeautifier
|
||||
api-version: '1.20'
|
||||
|
||||
commands:
|
||||
set-chat-color:
|
||||
description: Mit diesem Befehl kannst du die Farbe deines Namens setzen.
|
||||
aliases: ["scc"]
|
||||
usage: /set-chat-color
|
BIN
target/ChatBeautifier-0.2.0.jar
Normal file
BIN
target/ChatBeautifier-0.2.0.jar
Normal file
Binary file not shown.
BIN
target/ChatBeautifier-0.2.1.jar
Normal file
BIN
target/ChatBeautifier-0.2.1.jar
Normal file
Binary file not shown.
BIN
target/original-ChatBeautifier-0.2.0.jar
Normal file
BIN
target/original-ChatBeautifier-0.2.0.jar
Normal file
Binary file not shown.
BIN
target/original-ChatBeautifier-0.2.1.jar
Normal file
BIN
target/original-ChatBeautifier-0.2.1.jar
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user