Move mute into its own class

This commit is contained in:
Focusvity 2022-03-20 13:13:34 +11:00
parent 117852e6d0
commit 580f87f28b
No known key found for this signature in database
GPG Key ID: 85AD157561ABE94B
2 changed files with 21 additions and 6 deletions

View File

@ -24,12 +24,6 @@ public class ChatListener extends PlexListener
public void onChat(AsyncChatEvent event)
{
PlexPlayer plexPlayer = PlayerCache.getPlexPlayerMap().get(event.getPlayer().getUniqueId());
if (PlayerCache.getPunishedPlayer(event.getPlayer().getUniqueId()).isMuted())
{
event.getPlayer().sendMessage(PlexUtils.messageComponent("muted"));
event.setCancelled(true);
return;
}
Component prefix = plugin.getRankManager().getPrefix(plexPlayer);
if (prefix != null)

View File

@ -0,0 +1,21 @@
package dev.plex.listener.impl;
import dev.plex.cache.PlayerCache;
import dev.plex.listener.PlexListener;
import dev.plex.util.PlexUtils;
import io.papermc.paper.event.player.AsyncChatEvent;
import org.bukkit.event.EventHandler;
public class MuteListener extends PlexListener
{
@EventHandler
public void onChat(AsyncChatEvent event)
{
if (PlayerCache.getPunishedPlayer(event.getPlayer().getUniqueId()).isMuted())
{
event.getPlayer().sendMessage(PlexUtils.messageComponent("muted"));
event.setCancelled(true);
}
}
}