Minor adjustments

This commit is contained in:
Video 2023-04-05 18:13:40 -06:00
parent 5ba81de118
commit 39b9147484
2 changed files with 6 additions and 12 deletions

View File

@ -1,7 +1,6 @@
package me.totalfreedom.totalfreedommod; package me.totalfreedom.totalfreedommod;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import io.papermc.paper.chat.ChatRenderer;
import io.papermc.paper.event.player.AsyncChatEvent; import io.papermc.paper.event.player.AsyncChatEvent;
import me.totalfreedom.totalfreedommod.admin.Admin; import me.totalfreedom.totalfreedommod.admin.Admin;
import me.totalfreedom.totalfreedommod.api.event.AdminChatEvent; import me.totalfreedom.totalfreedommod.api.event.AdminChatEvent;
@ -9,7 +8,6 @@ import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.player.FPlayer; import me.totalfreedom.totalfreedommod.player.FPlayer;
import me.totalfreedom.totalfreedommod.rank.Displayable; import me.totalfreedom.totalfreedommod.rank.Displayable;
import me.totalfreedom.totalfreedommod.util.FUtil; import me.totalfreedom.totalfreedommod.util.FUtil;
import net.kyori.adventure.audience.Audience;
import net.kyori.adventure.key.Key; import net.kyori.adventure.key.Key;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.TextComponent; import net.kyori.adventure.text.TextComponent;
@ -24,7 +22,6 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.jetbrains.annotations.NotNull;
import java.util.Arrays; import java.util.Arrays;
@ -142,11 +139,13 @@ public class ChatManager extends FreedomService
public void onAdminChat(AdminChatEvent event) public void onAdminChat(AdminChatEvent event)
{ {
Displayable display = event.getDisplayable(); Displayable display = event.getDisplayable();
String flatAbv = FUtil.miniMessage(display.getAbbr());
Component defaultFormat = FUtil.miniMessage("<prefix><dark_gray>[<aqua>ADMIN<dark_gray>] <dark_red><name> <dark_gray><tag><dark_gray>]<white>: <gold><message>", Component defaultFormat = FUtil.miniMessage("<prefix><dark_gray>[<aqua>ADMIN<dark_gray>] <dark_red><name> <dark_gray>[<rankcolor><rank></rankcolor>]</dark_gray><white>: <gold><message>",
Placeholder.component("prefix", event.getPrefix()), Placeholder.component("prefix", event.getPrefix()),
Placeholder.component("name", event.getName()), Placeholder.component("name", event.getName()),
Placeholder.component("tag", getColoredTag(display)), Placeholder.unparsed("rank", flatAbv),
TagResolver.resolver("rankcolor", Tag.styling(getColor(display))),
Placeholder.component("message", event.getMessage())); Placeholder.component("message", event.getMessage()));
plugin.getComponentLogger().info(defaultFormat); plugin.getComponentLogger().info(defaultFormat);
@ -157,7 +156,6 @@ public class ChatManager extends FreedomService
if (!Strings.isNullOrEmpty(admin.getAcFormat())) if (!Strings.isNullOrEmpty(admin.getAcFormat()))
{ {
String format = admin.getAcFormat(); String format = admin.getAcFormat();
String flatAbv = FUtil.miniMessage(display.getAbbr());
player.sendMessage(FUtil.miniMessage(format, player.sendMessage(FUtil.miniMessage(format,
Placeholder.component("prefix", event.getPrefix()), Placeholder.component("prefix", event.getPrefix()),
@ -178,11 +176,6 @@ public class ChatManager extends FreedomService
return display.getColor(); return display.getColor();
} }
public Component getColoredTag(Displayable display)
{
return display.getColoredTag();
}
public void adminChat(Component name, Displayable displayable, Component message, boolean async) public void adminChat(Component name, Displayable displayable, Component message, boolean async)
{ {
AdminChatEvent event = new AdminChatEvent(name, displayable, message, async); AdminChatEvent event = new AdminChatEvent(name, displayable, message, async);

View File

@ -1,5 +1,6 @@
package me.totalfreedom.totalfreedommod; package me.totalfreedom.totalfreedommod;
import io.papermc.paper.event.player.AsyncChatEvent;
import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.player.FPlayer; import me.totalfreedom.totalfreedommod.player.FPlayer;
import me.totalfreedom.totalfreedommod.util.FLog; import me.totalfreedom.totalfreedommod.util.FLog;
@ -27,7 +28,7 @@ public class Muter extends FreedomService
} }
@EventHandler(priority = EventPriority.HIGHEST) @EventHandler(priority = EventPriority.HIGHEST)
public void onAsyncPlayerChatEvent(AsyncPlayerChatEvent event) public void onAsyncPlayerChatEvent(AsyncChatEvent event)
{ {
Player player = event.getPlayer(); Player player = event.getPlayer();