Cancel plot chat if message event is cancelled to allow for swear block/etc

This commit is contained in:
dordsor21 2018-10-25 10:51:18 +01:00
parent 302051a6ca
commit ea5ffbeb77
3 changed files with 11 additions and 2 deletions

View File

@ -757,8 +757,11 @@ public class PlayerEvents extends PlotListener implements Listener {
}
}
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
@EventHandler(priority = EventPriority.LOW)
public void onChat(AsyncPlayerChatEvent event) {
if (event.isCancelled())
return;
PlotPlayer plotPlayer = BukkitUtil.getPlayer(event.getPlayer());
Location location = plotPlayer.getLocation();
PlotArea area = location.getPlotArea();

View File

@ -553,8 +553,11 @@ public class PlayerEvents extends PlotListener implements Listener {
}
}
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
@EventHandler(priority = EventPriority.LOW)
public void onChat(PlayerChatEvent event) {
if (event.isCancelled())
return;
PlotPlayer plotPlayer = NukkitUtil.getPlayer(event.getPlayer());
Location location = plotPlayer.getLocation();
PlotArea area = location.getPlotArea();

View File

@ -86,6 +86,9 @@ public class MainListener {
@Listener
public void onChat(MessageEvent event) {
// TODO
if (event.isMessageCancelled())
return;
Player player = SpongeUtil.getCause(event.getCause(), Player.class);
if (player == null) {
return;