mirror of
https://github.com/Shiewk/SModeration.git
synced 2026-04-28 05:54:16 +02:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
@@ -134,4 +134,52 @@ public final class SModeration extends JavaPlugin {
|
|||||||
public static ObjectArrayList<Player> getVanishedPlayers() {
|
public static ObjectArrayList<Player> getVanishedPlayers() {
|
||||||
return vanishedPlayers.clone();
|
return vanishedPlayers.clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final ObjectArrayList<Player> vanishedPlayers = new ObjectArrayList<>();
|
||||||
|
|
||||||
|
public static void toggleVanish(Player player){
|
||||||
|
final boolean newStatus = !isVanished(player);
|
||||||
|
if (newStatus){
|
||||||
|
vanishedPlayers.add(player);
|
||||||
|
for (CommandSender sender : container.collectBroadcastTargets()) {
|
||||||
|
sender.sendMessage(CHAT_PREFIX.append(
|
||||||
|
player.displayName()
|
||||||
|
.colorIfAbsent(SECONDARY_COLOR)
|
||||||
|
).append(
|
||||||
|
text()
|
||||||
|
.content(" vanished.")
|
||||||
|
.color(PRIMARY_COLOR)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
player.sendMessage(CHAT_PREFIX.append(text("You are now vanished.").color(PRIMARY_COLOR)));
|
||||||
|
player.setVisibleByDefault(false);
|
||||||
|
for (Player onlinePlayer : Bukkit.getOnlinePlayers()) {
|
||||||
|
if (onlinePlayer.hasPermission("smod.vanish.see")){
|
||||||
|
onlinePlayer.showEntity(PLUGIN, player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
vanishedPlayers.remove(player);
|
||||||
|
for (CommandSender sender : container.collectBroadcastTargets()) {
|
||||||
|
sender.sendMessage(CHAT_PREFIX.append(
|
||||||
|
player.displayName()
|
||||||
|
.colorIfAbsent(SECONDARY_COLOR)
|
||||||
|
).append(
|
||||||
|
text()
|
||||||
|
.content(" re-appeared.")
|
||||||
|
.color(PRIMARY_COLOR)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
player.sendMessage(CHAT_PREFIX.append(text("You are no longer vanished.").color(PRIMARY_COLOR)));
|
||||||
|
player.setVisibleByDefault(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isVanished(Player player){
|
||||||
|
return vanishedPlayers.contains(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ObjectArrayList<Player> getVanishedPlayers() {
|
||||||
|
return vanishedPlayers.clone();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user