From bd12420edd7d59e5dd36ac3fe276a3f2c13276a9 Mon Sep 17 00:00:00 2001 From: Mike Primm Date: Thu, 3 Jan 2013 21:58:58 -0600 Subject: [PATCH] Add option to hide players on map that have invisibility potion effects --- src/main/java/org/dynmap/bukkit/DynmapPlugin.java | 8 ++++++++ src/main/resources/configuration.txt | 3 +++ 2 files changed, 11 insertions(+) diff --git a/src/main/java/org/dynmap/bukkit/DynmapPlugin.java b/src/main/java/org/dynmap/bukkit/DynmapPlugin.java index a34f6a85..3bf2eaf2 100644 --- a/src/main/java/org/dynmap/bukkit/DynmapPlugin.java +++ b/src/main/java/org/dynmap/bukkit/DynmapPlugin.java @@ -63,6 +63,7 @@ import org.bukkit.plugin.Plugin; import org.bukkit.plugin.PluginDescriptionFile; import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.potion.PotionEffectType; import org.dynmap.DynmapAPI; import org.dynmap.DynmapChunk; import org.dynmap.DynmapCore; @@ -608,6 +609,13 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI { public long getFirstLoginTime() { return offplayer.getFirstPlayed(); } + @Override + public boolean isInvisible() { + if(player != null) { + return player.hasPotionEffect(PotionEffectType.INVISIBILITY); + } + return false; + } } /* Handler for generic console command sender */ public class BukkitCommandSender implements DynmapCommandSender { diff --git a/src/main/resources/configuration.txt b/src/main/resources/configuration.txt index bda05e99..af82274b 100644 --- a/src/main/resources/configuration.txt +++ b/src/main/resources/configuration.txt @@ -42,6 +42,8 @@ components: hideifsneaking: false # If true, player positions/status is protected (login with ID with dynmap.playermarkers.seeall permission required for info other than self) protected-player-info: false + @ If true, hide players with invisibility potion effects active + hide-if-invisiblity-potion: true #- class: org.dynmap.JsonFileClientUpdateComponent # writeinterval: 1 # sendhealth: true @@ -62,6 +64,7 @@ components: # webchat-permissions: false # # Limit length of single chat messages # chatlengthlimit: 256 + # hide-if-invisiblity-potion: true - class: org.dynmap.SimpleWebChatComponent allowchat: true