mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 13:16:45 +01:00
Cancel plot chat if message event is cancelled to allow for swear block/etc
This commit is contained in:
parent
302051a6ca
commit
ea5ffbeb77
@ -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) {
|
public void onChat(AsyncPlayerChatEvent event) {
|
||||||
|
if (event.isCancelled())
|
||||||
|
return;
|
||||||
|
|
||||||
PlotPlayer plotPlayer = BukkitUtil.getPlayer(event.getPlayer());
|
PlotPlayer plotPlayer = BukkitUtil.getPlayer(event.getPlayer());
|
||||||
Location location = plotPlayer.getLocation();
|
Location location = plotPlayer.getLocation();
|
||||||
PlotArea area = location.getPlotArea();
|
PlotArea area = location.getPlotArea();
|
||||||
|
@ -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) {
|
public void onChat(PlayerChatEvent event) {
|
||||||
|
if (event.isCancelled())
|
||||||
|
return;
|
||||||
|
|
||||||
PlotPlayer plotPlayer = NukkitUtil.getPlayer(event.getPlayer());
|
PlotPlayer plotPlayer = NukkitUtil.getPlayer(event.getPlayer());
|
||||||
Location location = plotPlayer.getLocation();
|
Location location = plotPlayer.getLocation();
|
||||||
PlotArea area = location.getPlotArea();
|
PlotArea area = location.getPlotArea();
|
||||||
|
@ -86,6 +86,9 @@ public class MainListener {
|
|||||||
@Listener
|
@Listener
|
||||||
public void onChat(MessageEvent event) {
|
public void onChat(MessageEvent event) {
|
||||||
// TODO
|
// TODO
|
||||||
|
if (event.isMessageCancelled())
|
||||||
|
return;
|
||||||
|
|
||||||
Player player = SpongeUtil.getCause(event.getCause(), Player.class);
|
Player player = SpongeUtil.getCause(event.getCause(), Player.class);
|
||||||
if (player == null) {
|
if (player == null) {
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user