Make players transparent

This commit is contained in:
Sam 2018-09-08 21:42:46 +01:00 committed by Alexander Meech
parent ee619c0a22
commit 835b50c683
5 changed files with 56 additions and 54 deletions

View File

@ -824,12 +824,6 @@ public class Chat extends MiniPlugin
event.getRecipients().removeIf(recipient -> !_preferencesManager.get(recipient).isActive(Preference.SHOW_CHAT)); 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()) if (message.isEmpty())
{ {
event.setCancelled(true); event.setCancelled(true);
@ -882,6 +876,20 @@ public class Chat extends MiniPlugin
event.getRecipients().forEach(player -> player.spigot().sendMessage(formatted)); 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) @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onSignChange(SignChangeEvent event) public void onSignChange(SignChangeEvent event)
{ {

View File

@ -3,19 +3,17 @@ package mineplex.core.chatsnap;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors; 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.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.MiniPlugin; import mineplex.core.MiniPlugin;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.account.permissions.Permission; import mineplex.core.account.permissions.Permission;
import mineplex.core.account.permissions.PermissionGroup; 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.chatsnap.command.ChatSnapCommand;
import mineplex.core.message.PrivateMessageEvent; import mineplex.core.message.PrivateMessageEvent;
import mineplex.core.punish.Punish; import mineplex.core.punish.Punish;

View File

@ -60,28 +60,26 @@ public class Dropper extends SoloGame
new NightVisionComponent(this); new NightVisionComponent(this);
_scoreboardComponent _scoreboardComponent.setSidebar((player, scoreboard) ->
.setSidebar((player, scoreboard) -> {
{ scoreboard.writeNewLine();
scoreboard.writeNewLine();
List<Player> players = getAllPlayers(); List<Player> players = getAllPlayers();
scoreboard.write(C.cYellowB + "Players"); scoreboard.write(C.cYellowB + "Players");
if (players.size() > 11) if (players.size() > 11)
{ {
scoreboard.write(players.size() + " Playing"); scoreboard.write(players.size() + " Playing");
} }
else else
{ {
players.forEach(other -> scoreboard.write((other.equals(player) ? C.cGreen : (_completed.contains(other) ? C.cYellow : "")) + other.getName())); players.forEach(other -> scoreboard.write((other.equals(player) ? C.cGreen : (_completed.contains(other) ? C.cYellow : "")) + other.getName()));
} }
scoreboard.writeNewLine(); scoreboard.writeNewLine();
scoreboard.draw(); scoreboard.draw();
}) });
.setSetupSettingsConsumer((player, team, scoreboardTeam) -> scoreboardTeam.setCanSeeFriendlyInvisibles(false));
} }
@Override @Override

View File

@ -171,7 +171,7 @@ public class MapCourruptionComponent extends GameComponent<Game>
return Integer.compare(o1.getY(), o2.getY()); 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; _sorted = true;
} }

View File

@ -83,35 +83,33 @@ public class Parkour extends SoloGame
_spectatorComponent.setDeathOut(false); _spectatorComponent.setDeathOut(false);
_scoreboardComponent _scoreboardComponent.setSidebar((player, scoreboard) ->
.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()))) scoreboard.writeNewLine();
{
Player other = place.Parkourer;
String colour = "";
if (other.equals(player)) scoreboard.draw();
{ });
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));
} }
@Override @Override