👻 Option to ignore vanished players

This commit is contained in:
Mykyta 2020-03-22 08:00:14 -07:00
parent dbe2aca371
commit 99d917177c
No known key found for this signature in database
GPG Key ID: C147E30C19EA3570
3 changed files with 6 additions and 2 deletions

View File

@ -6,7 +6,7 @@
Harbor is a plugin that redefines sleep within your Spigot server! Harbor is lightweight and performant, with just the right amount of features for any survival server!
Check it out and download the latest builds [over on the Spigot website!](https://www.spigotmc.org/resources/harbor-a-sleep-enhancement-plugin.60088/)
Check it out and download the latest builds [over on the releases page!](https://github.com/nkomarn/Harbor/releases)
# 🔨 Building from source
Harbor uses Maven to handle dependecies and building! Make sure you have Java 8, Git, and Maven installed, and then run:

View File

@ -6,6 +6,7 @@ import org.bukkit.World;
import org.bukkit.boss.BarColor;
import org.bukkit.entity.Player;
import org.bukkit.metadata.MetadataValue;
import xyz.nkomarn.Harbor.Harbor;
import xyz.nkomarn.Harbor.util.Afk;
import xyz.nkomarn.Harbor.util.Config;
@ -90,7 +91,9 @@ public class Checker implements Runnable {
final boolean excludedByGameMode = Config.getBoolean("features.ignore") && player.getGameMode() != GameMode.SURVIVAL;
final boolean excludedByPermission = Config.getBoolean("features.bypass") && player.hasPermission("harbor.bypass");
final boolean excludedByAfk = Afk.isAfk(player);
if (Config.getBoolean("features.vanish")) {
for (MetadataValue meta : player.getMetadata("vanished")) if (meta.asBoolean()) return true;
}
return excludedByGameMode || excludedByPermission || excludedByAfk;
}
}

View File

@ -21,6 +21,7 @@ features:
phantoms: false # Reset the sleep statistic (practically disables phantom spawns - false = no phantoms | Set the doInsomnia gamerule to false to disable phantoms if you're on 1.15+)
bypass: true # Toggle exclusion of operators/players with permission "harbor.bypass" from sleep count
ignore: true # Toggle exclusion of players in creative and spectator mode
vanish: true # Toggle exclusion of vanished players
afk: true # Detect AFK players and remove them from the sleep count (Essentials API used for detection when possible)
notifier: true # Displays a notification when a new update is released