I am trying to make a local chat plugin, i have tried a few things with the AsyncPlayerChatEvent but none have actually worked, if anyone could help me with some code i would be very grateful, so far this is what i have done, it doesnt work: Code:java @EventHandlerpublic void onPlayerChat(AsyncPlayerChatEvent event) {Player player = event.getPlayer();if (localchat.contains(player.getName())) {List<Entity> near = player.getNearbyEntities(5, 5, 5);for (Player p : getServer().getOnlinePlayers()){if (near.contains(p)) {event.setCancelled(true);}} }} I also dont think canceling the event will work to well, as that would end up in the player not even saying it, would there be a way to only show the message for some people.
One option is to cancel the event, and then send a custom-made message to nearby players. Something like, "[LocalChat]PlayerName: message". bkleinman1 I would get rid of this part: Code: for (Player p : getServer().getOnlinePlayers()){ if (near.contains(p)) { event.setCancelled(true); Just replace that with a loop through all nearby entities. EDIT by Moderator: merged posts, please use the edit button instead of double posting.