diff --git a/.gitignore b/.gitignore index 84932c9a..13b38826 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,7 @@ out/ .settings/ plugin/bin/ api/bin/ +.eclipse/ # Compiled class file *.class diff --git a/common/src/main/java/xyz/jpenilla/squaremap/common/config/PlayerVisibility.java b/common/src/main/java/xyz/jpenilla/squaremap/common/config/PlayerVisibility.java new file mode 100644 index 00000000..65b88089 --- /dev/null +++ b/common/src/main/java/xyz/jpenilla/squaremap/common/config/PlayerVisibility.java @@ -0,0 +1,5 @@ +package xyz.jpenilla.squaremap.common.config; + +public enum PlayerVisibility { + FORCED_HIDDEN, FORCED_SHOWN, PLAYER_SETTING +} diff --git a/common/src/main/java/xyz/jpenilla/squaremap/common/config/WorldConfig.java b/common/src/main/java/xyz/jpenilla/squaremap/common/config/WorldConfig.java index 7f10228b..53dc2400 100644 --- a/common/src/main/java/xyz/jpenilla/squaremap/common/config/WorldConfig.java +++ b/common/src/main/java/xyz/jpenilla/squaremap/common/config/WorldConfig.java @@ -20,6 +20,7 @@ public final class WorldConfig extends AbstractWorldConfig { public int MAX_RENDER_THREADS = -1; public boolean MAP_ITERATE_UP = false; public int MAP_MAX_HEIGHT = -1; + public PlayerVisibility MAP_PLAYER_VISIBILITY = PlayerVisibility.PLAYER_SETTING; private void worldSettings() { this.MAP_ENABLED = this.getBoolean("map.enabled", this.MAP_ENABLED); @@ -29,6 +30,9 @@ private void worldSettings() { this.MAX_RENDER_THREADS = this.getInt("map.max-render-threads", this.MAX_RENDER_THREADS); this.MAP_ITERATE_UP = this.getBoolean("map.iterate-up", this.MAP_ITERATE_UP); this.MAP_MAX_HEIGHT = this.getInt("map.max-height", this.MAP_MAX_HEIGHT); + try { + this.MAP_PLAYER_VISIBILITY = PlayerVisibility.valueOf(this.getString("map.player-visibility", this.MAP_PLAYER_VISIBILITY.name())); + } catch (IllegalArgumentException ignored) {} } public boolean MAP_BIOMES = true; diff --git a/common/src/main/java/xyz/jpenilla/squaremap/common/task/UpdatePlayers.java b/common/src/main/java/xyz/jpenilla/squaremap/common/task/UpdatePlayers.java index d29e1102..90904b0e 100644 --- a/common/src/main/java/xyz/jpenilla/squaremap/common/task/UpdatePlayers.java +++ b/common/src/main/java/xyz/jpenilla/squaremap/common/task/UpdatePlayers.java @@ -24,6 +24,7 @@ import xyz.jpenilla.squaremap.common.AbstractPlayerManager; import xyz.jpenilla.squaremap.common.ServerAccess; import xyz.jpenilla.squaremap.common.config.ConfigManager; +import xyz.jpenilla.squaremap.common.config.PlayerVisibility; import xyz.jpenilla.squaremap.common.config.WorldConfig; import xyz.jpenilla.squaremap.common.httpd.JsonCache; import xyz.jpenilla.squaremap.common.util.Util; @@ -86,7 +87,10 @@ private Map collectData() { if (worldConfig.PLAYER_TRACKER_HIDE_MAP_INVISIBILITY_EQUIPMENT && hasMapInvisibilityItemEquipped(player)) { return; } - if (this.playerManager.hidden(player) || this.playerManager.otherwiseHidden(player)) { + if (worldConfig.MAP_PLAYER_VISIBILITY == PlayerVisibility.FORCED_HIDDEN) { + return; + } + if ((worldConfig.MAP_PLAYER_VISIBILITY == PlayerVisibility.PLAYER_SETTING && this.playerManager.hidden(player)) || this.playerManager.otherwiseHidden(player)) { return; } final Map playerEntry = new HashMap<>();