|
|
@ -9,13 +9,14 @@ import org.bukkit.event.player.AsyncPlayerChatEvent; |
|
|
|
|
|
|
|
|
|
|
|
public class ChatListener implements Listener { |
|
|
|
public class ChatListener implements Listener { |
|
|
|
|
|
|
|
|
|
|
|
private static final String format = "%chatPrefix" + ChatColor.DARK_GRAY + "%player: " + ChatColor.WHITE + "%message"; |
|
|
|
private static final String formatLocal = "%chatPrefix" + ChatColor.GREEN + "%player: " + ChatColor.WHITE + "%message"; |
|
|
|
|
|
|
|
private static final String formatGlobl = ChatColor.BOLD + "%chatPrefix" + ChatColor.GOLD + "%player: " + ChatColor.BLUE + "%message"; |
|
|
|
|
|
|
|
|
|
|
|
@EventHandler |
|
|
|
@EventHandler |
|
|
|
public void AsyncPlayerChatEvent(AsyncPlayerChatEvent e) { |
|
|
|
public void AsyncPlayerChatEvent(AsyncPlayerChatEvent e) { |
|
|
|
String message = e.getMessage(); |
|
|
|
String message = e.getMessage(); |
|
|
|
Player player = e.getPlayer(); |
|
|
|
Player player = e.getPlayer(); |
|
|
|
String formated = ChatUtil.translateColorCodes(format); |
|
|
|
String formated = ChatUtil.translateColorCodes(formatLocal); |
|
|
|
Chat chat = message.startsWith("!") ? Chat.LOCAL : Chat.GLOBAL; |
|
|
|
Chat chat = message.startsWith("!") ? Chat.LOCAL : Chat.GLOBAL; |
|
|
|
if (chat == Chat.LOCAL) { |
|
|
|
if (chat == Chat.LOCAL) { |
|
|
|
Bukkit.getOnlinePlayers().stream().filter((p) -> (p.getLocation().distance(player.getLocation()) <= 100)).forEachOrdered((p) -> { |
|
|
|
Bukkit.getOnlinePlayers().stream().filter((p) -> (p.getLocation().distance(player.getLocation()) <= 100)).forEachOrdered((p) -> { |
|
|
@ -34,7 +35,7 @@ public class ChatListener implements Listener { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public enum Chat { |
|
|
|
public enum Chat { |
|
|
|
GLOBAL("§9[§6G§9]§f "), LOCAL(""); |
|
|
|
GLOBAL("§9[§4Кричит§9]§f "), LOCAL(""); |
|
|
|
|
|
|
|
|
|
|
|
private final String prefix; |
|
|
|
private final String prefix; |
|
|
|
|
|
|
|
|
|
|
|