mirror of
https://github.com/plexusorg/Plex.git
synced 2024-12-22 17:17:37 +00:00
Move mute into its own class
This commit is contained in:
parent
117852e6d0
commit
580f87f28b
@ -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)
|
||||
|
21
src/main/java/dev/plex/listener/impl/MuteListener.java
Normal file
21
src/main/java/dev/plex/listener/impl/MuteListener.java
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user