From 009ddaaee113d41bff4882f919e14b40d50ef887 Mon Sep 17 00:00:00 2001 From: NewGarbo Date: Thu, 26 Nov 2015 13:16:50 +0000 Subject: [PATCH] stop players in tutorial from receiving/sending chat. --- .../tutorials/types/TutorialGettingStarted.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/types/TutorialGettingStarted.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/types/TutorialGettingStarted.java index 882631dd6..5ff1aca60 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/types/TutorialGettingStarted.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/tutorials/types/TutorialGettingStarted.java @@ -3,6 +3,7 @@ package mineplex.game.clans.tutorials.types; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; +import org.bukkit.event.player.AsyncPlayerChatEvent; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; @@ -66,6 +67,21 @@ public class TutorialGettingStarted extends Tutorial } } + @EventHandler(priority = EventPriority.LOWEST) + public void handlePlayerChat(AsyncPlayerChatEvent event) + { + for (TutorialClient player : _inTutorial.values()) + { + if (event.getPlayer().equals(player.getPlayer())) + { + event.setCancelled(true); + continue; + } + + event.getRecipients().remove(player.getPlayer()); + } + } + @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onClansCommand(ClansCommandExecutedEvent event) {