ChatNotifier: remove recipient instead of cancelling the event
This commit is contained in:
parent
d64f9729a5
commit
bd343888bb
@ -19,10 +19,10 @@ public class ChatNotifier extends Feature {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerChat(AsyncPlayerChatEvent e) {
|
public void onPlayerChat(AsyncPlayerChatEvent e) {
|
||||||
e.setCancelled(true);
|
|
||||||
for (Player p : plugin.getServer().getOnlinePlayers()) {
|
for (Player p : plugin.getServer().getOnlinePlayers()) {
|
||||||
String msg = e.getMessage();
|
String msg = e.getMessage();
|
||||||
if (e.getMessage().toLowerCase().contains(p.getName().toLowerCase()) && p.getPlayer() != e.getPlayer()) {
|
if (e.getMessage().toLowerCase().contains(p.getName().toLowerCase()) && p.getPlayer() != e.getPlayer()) {
|
||||||
|
e.getRecipients().remove(p);
|
||||||
msg = ChatColor.RED + msg;
|
msg = ChatColor.RED + msg;
|
||||||
BountifulAPI.sendActionBar(p, ChatColor.RED + "Byl jsi zminen v chatu!");
|
BountifulAPI.sendActionBar(p, ChatColor.RED + "Byl jsi zminen v chatu!");
|
||||||
p.playSound(p.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1.0F, 3.0F);
|
p.playSound(p.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1.0F, 3.0F);
|
||||||
|
Loading…
Reference in New Issue
Block a user