From 835b50c68356465358460be0c0514163341106cb Mon Sep 17 00:00:00 2001 From: Sam Date: Sat, 8 Sep 2018 21:42:46 +0100 Subject: [PATCH] Make players transparent --- .../src/mineplex/core/chat/Chat.java | 20 +++++--- .../core/chatsnap/SnapshotPlugin.java | 6 +-- .../game/nano/game/games/dropper/Dropper.java | 34 +++++++------ .../components/MapCourruptionComponent.java | 2 +- .../game/nano/game/games/parkour/Parkour.java | 48 +++++++++---------- 5 files changed, 56 insertions(+), 54 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java b/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java index 89dd86151..2ceabb9c0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/chat/Chat.java @@ -824,12 +824,6 @@ public class Chat extends MiniPlugin event.getRecipients().removeIf(recipient -> !_preferencesManager.get(recipient).isActive(Preference.SHOW_CHAT)); } - if (customEvent.isFiltered()) - { - message = decapsifyIfNecessary(sender, message); - message = filterMessage(sender, true, message); - } - if (message.isEmpty()) { event.setCancelled(true); @@ -882,6 +876,20 @@ public class Chat extends MiniPlugin event.getRecipients().forEach(player -> player.spigot().sendMessage(formatted)); } + @EventHandler(priority = EventPriority.HIGHEST) + public void filterMessage(FormatPlayerChatEvent event) + { + if (event.isFiltered()) + { + String message = event.getMessage(); + + message = decapsifyIfNecessary(event.getPlayer(), message); + message = filterMessage(event.getPlayer(), true, message); + + event.setMessage(message); + } + } + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onSignChange(SignChangeEvent event) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/chatsnap/SnapshotPlugin.java b/Plugins/Mineplex.Core/src/mineplex/core/chatsnap/SnapshotPlugin.java index da34ad212..a10202f58 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/chatsnap/SnapshotPlugin.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/chatsnap/SnapshotPlugin.java @@ -3,19 +3,17 @@ package mineplex.core.chatsnap; import java.util.Set; import java.util.stream.Collectors; -import mineplex.core.chat.ChatChannel; -import mineplex.core.chat.event.FormatPlayerChatEvent; -import mineplex.core.message.MessageManager; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; -import org.bukkit.event.player.AsyncPlayerChatEvent; import org.bukkit.plugin.java.JavaPlugin; import mineplex.core.MiniPlugin; import mineplex.core.account.CoreClientManager; import mineplex.core.account.permissions.Permission; import mineplex.core.account.permissions.PermissionGroup; +import mineplex.core.chat.ChatChannel; +import mineplex.core.chat.event.FormatPlayerChatEvent; import mineplex.core.chatsnap.command.ChatSnapCommand; import mineplex.core.message.PrivateMessageEvent; import mineplex.core.punish.Punish; diff --git a/Plugins/Mineplex.Game.Nano/src/mineplex/game/nano/game/games/dropper/Dropper.java b/Plugins/Mineplex.Game.Nano/src/mineplex/game/nano/game/games/dropper/Dropper.java index 3434e4eeb..8bf2e9007 100644 --- a/Plugins/Mineplex.Game.Nano/src/mineplex/game/nano/game/games/dropper/Dropper.java +++ b/Plugins/Mineplex.Game.Nano/src/mineplex/game/nano/game/games/dropper/Dropper.java @@ -60,28 +60,26 @@ public class Dropper extends SoloGame new NightVisionComponent(this); - _scoreboardComponent - .setSidebar((player, scoreboard) -> - { - scoreboard.writeNewLine(); + _scoreboardComponent.setSidebar((player, scoreboard) -> + { + scoreboard.writeNewLine(); - List players = getAllPlayers(); - scoreboard.write(C.cYellowB + "Players"); + List players = getAllPlayers(); + scoreboard.write(C.cYellowB + "Players"); - if (players.size() > 11) - { - scoreboard.write(players.size() + " Playing"); - } - else - { - players.forEach(other -> scoreboard.write((other.equals(player) ? C.cGreen : (_completed.contains(other) ? C.cYellow : "")) + other.getName())); - } + if (players.size() > 11) + { + scoreboard.write(players.size() + " Playing"); + } + else + { + players.forEach(other -> scoreboard.write((other.equals(player) ? C.cGreen : (_completed.contains(other) ? C.cYellow : "")) + other.getName())); + } - scoreboard.writeNewLine(); + scoreboard.writeNewLine(); - scoreboard.draw(); - }) - .setSetupSettingsConsumer((player, team, scoreboardTeam) -> scoreboardTeam.setCanSeeFriendlyInvisibles(false)); + scoreboard.draw(); + }); } @Override diff --git a/Plugins/Mineplex.Game.Nano/src/mineplex/game/nano/game/games/microbattle/components/MapCourruptionComponent.java b/Plugins/Mineplex.Game.Nano/src/mineplex/game/nano/game/games/microbattle/components/MapCourruptionComponent.java index 85aee36cd..9ece927ea 100644 --- a/Plugins/Mineplex.Game.Nano/src/mineplex/game/nano/game/games/microbattle/components/MapCourruptionComponent.java +++ b/Plugins/Mineplex.Game.Nano/src/mineplex/game/nano/game/games/microbattle/components/MapCourruptionComponent.java @@ -171,7 +171,7 @@ public class MapCourruptionComponent extends GameComponent return Integer.compare(o1.getY(), o2.getY()); } - return Double.compare(UtilMath.offsetSquared(mid, o1.getLocation().add(0.5, 0.5, 0.5)), UtilMath.offsetSquared(mid, o2.getLocation().add(0.5, 0.5, 0.5))); + return Double.compare(UtilMath.offsetSquared(mid, o2.getLocation().add(0.5, 0.5, 0.5)), UtilMath.offsetSquared(mid, o1.getLocation().add(0.5, 0.5, 0.5))); }); _sorted = true; } diff --git a/Plugins/Mineplex.Game.Nano/src/mineplex/game/nano/game/games/parkour/Parkour.java b/Plugins/Mineplex.Game.Nano/src/mineplex/game/nano/game/games/parkour/Parkour.java index a899b00bc..cbd4da27d 100644 --- a/Plugins/Mineplex.Game.Nano/src/mineplex/game/nano/game/games/parkour/Parkour.java +++ b/Plugins/Mineplex.Game.Nano/src/mineplex/game/nano/game/games/parkour/Parkour.java @@ -83,35 +83,33 @@ public class Parkour extends SoloGame _spectatorComponent.setDeathOut(false); - _scoreboardComponent - .setSidebar((player, scoreboard) -> + _scoreboardComponent.setSidebar((player, scoreboard) -> + { + scoreboard.writeNewLine(); + + scoreboard.write(C.cYellowB + "Players"); + + for (ParkourPlace place : _places.subList(0, Math.min(12, _places.size()))) + { + Player other = place.Parkourer; + String colour = ""; + + if (other.equals(player)) { - scoreboard.writeNewLine(); + colour = C.cGreen; + } + else if (place.FinishedAt > 0) + { + colour = C.cYellow; + } - scoreboard.write(C.cYellowB + "Players"); + scoreboard.write(colour + other.getName()); + } - for (ParkourPlace place : _places.subList(0, Math.min(12, _places.size()))) - { - Player other = place.Parkourer; - String colour = ""; + scoreboard.writeNewLine(); - if (other.equals(player)) - { - colour = C.cGreen; - } - else if (place.FinishedAt > 0) - { - colour = C.cYellow; - } - - scoreboard.write(colour + other.getName()); - } - - scoreboard.writeNewLine(); - - scoreboard.draw(); - }) - .setSetupSettingsConsumer((player, team, scoreboardTeam) -> scoreboardTeam.setCanSeeFriendlyInvisibles(false)); + scoreboard.draw(); + }); } @Override