me when
public class MutedChatListener implements Listener {
@EventHandler
public void onChat(AsyncPlayerChatEvent e){
Player player = e.getPlayer();
Profile profile = profileService.getProfile(player.getUniqueId());
if (profile.hasActivePunishment(PunishmentType.MUTE)){
e.setCancelled(true);
if (profile.getMostRecentPunishment(PunishmentType.MUTE).getDuration() == 0){
player.sendMessage(ChatColor.RED + "You cannot speak as you are muted permanently\n You were muted for: " + profile.getMostRecentPunishment(PunishmentType.MUTE).getReason());
} else {
player.sendMessage(ChatColor.RED + "You cannot speak as you are muted for " + TimeUtil.parseTime(System.currentTimeMillis() - profile.getMostRecentPunishment(PunishmentType.MUTE).getDuration()) + ".\n You were muted for " + profile.getMostRecentPunishment(PunishmentType.MUTE).getReason()) + ".");
}
}
}
}
me when
Java:public class MutedChatListener implements Listener { @EventHandler public void onChat(AsyncPlayerChatEvent e){ Player player = e.getPlayer(); Profile profile = profileService.getProfile(player.getUniqueId()); if (profile.hasActivePunishment(PunishmentType.MUTE)){ e.setCancelled(true); if (profile.getMostRecentPunishment(PunishmentType.MUTE).getDuration() == 0){ player.sendMessage(ChatColor.RED + "You cannot speak as you are muted permanently\n You were muted for: " + profile.getMostRecentPunishment(PunishmentType.MUTE).getReason()); } else { player.sendMessage(ChatColor.RED + "You cannot speak as you are muted for " + TimeUtil.parseTime(System.currentTimeMillis() - profile.getMostRecentPunishment(PunishmentType.MUTE).getDuration()) + ".\n You were muted for " + profile.getMostRecentPunishment(PunishmentType.MUTE).getReason()) + "."); } } } }