Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ out/
.settings/
plugin/bin/
api/bin/
.eclipse/

# Compiled class file
*.class
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package xyz.jpenilla.squaremap.common.config;

public enum PlayerVisibility {
FORCED_HIDDEN, FORCED_SHOWN, PLAYER_SETTING
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public final class WorldConfig extends AbstractWorldConfig<Config> {
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);
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -86,7 +87,10 @@ private Map<String, Object> 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<String, Object> playerEntry = new HashMap<>();
Expand Down