Merge pull request #4015 from JurgenKuyper/v3.0

implemented hide if spectator
This commit is contained in:
mikeprimm 2023-12-01 14:42:45 -06:00 committed by GitHub
commit b181607e5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
48 changed files with 269 additions and 69 deletions

View File

@ -12,6 +12,7 @@ public class ClientUpdateComponent extends Component {
private int hideifshadow;
private int hideifunder;
private boolean hideifsneaking;
private boolean hideifspectator;
private boolean hideifinvisiblepotion;
private boolean is_protected;
public static boolean usePlayerColors;
@ -24,6 +25,7 @@ public class ClientUpdateComponent extends Component {
hideifshadow = configuration.getInteger("hideifshadow", 15);
hideifunder = configuration.getInteger("hideifundercover", 15);
hideifsneaking = configuration.getBoolean("hideifsneaking", false);
hideifspectator = configuration.getBoolean("hideifspectator", false);
hideifinvisiblepotion = configuration.getBoolean("hide-if-invisiblity-potion", true);
is_protected = configuration.getBoolean("protected-player-info", false);
usePlayerColors = configuration.getBoolean("use-name-colors", false);
@ -100,6 +102,9 @@ public class ClientUpdateComponent extends Component {
if((!hide) && hideifsneaking && p.isSneaking()) {
hide = true;
}
if((!hide) && hideifspectator && p.isSpectator()) {
hide = true;
}
if((!hide) && is_protected && (!see_all)) {
if(e.user != null) {
hide = !core.testIfPlayerVisibleToPlayer(e.user, p.getName());

View File

@ -44,6 +44,12 @@ public interface DynmapPlayer extends DynmapCommandSender {
* @return true if sneaking
*/
public boolean isSneaking();
/**
* get spectator gamemode
* @return true if gamemode spectator
*/
public boolean isSpectator();
/**
* Get health
* @return health points

View File

@ -191,12 +191,18 @@ public class FabricPlayer extends FabricCommandSender implements DynmapPlayer {
@Override
public boolean isInvisible() {
if (player != null) {
if(player != null) {
return player.isInvisible();
}
return false;
}
@Override
public boolean isSpectator() {
if(player != null) {
return player.isSpectator();
}
return false;
}
@Override
public int getSortWeight() {
return plugin.getSortWeight(getName());

View File

@ -80,6 +80,8 @@ components:
# hideifundercover: 14
# # (Optional) if true, players that are crouching/sneaking will be hidden
hideifsneaking: false
# optional, if true, players that are in spectator mode will be hidden
hideifspectator: 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

View File

@ -191,12 +191,18 @@ public class FabricPlayer extends FabricCommandSender implements DynmapPlayer {
@Override
public boolean isInvisible() {
if (player != null) {
if(player != null) {
return player.isInvisible();
}
return false;
}
@Override
public boolean isSpectator() {
if(player != null) {
return player.isSpectator();
}
return false;
}
@Override
public int getSortWeight() {
return plugin.getSortWeight(getName());

View File

@ -80,6 +80,8 @@ components:
# hideifundercover: 14
# # (Optional) if true, players that are crouching/sneaking will be hidden
hideifsneaking: false
# optional, if true, players that are in spectator mode will be hidden
hideifspectator: 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

View File

@ -191,12 +191,18 @@ public class FabricPlayer extends FabricCommandSender implements DynmapPlayer {
@Override
public boolean isInvisible() {
if (player != null) {
if(player != null) {
return player.isInvisible();
}
return false;
}
@Override
public boolean isSpectator() {
if(player != null) {
return player.isSpectator();
}
return false;
}
@Override
public int getSortWeight() {
return plugin.getSortWeight(getName());

View File

@ -80,6 +80,8 @@ components:
# hideifundercover: 14
# # (Optional) if true, players that are crouching/sneaking will be hidden
hideifsneaking: false
# optional, if true, players that are in spectator mode will be hidden
hideifspectator: 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

View File

@ -194,12 +194,18 @@ public class FabricPlayer extends FabricCommandSender implements DynmapPlayer {
@Override
public boolean isInvisible() {
if (player != null) {
if(player != null) {
return player.isInvisible();
}
return false;
}
@Override
public boolean isSpectator() {
if(player != null) {
return player.isSpectator();
}
return false;
}
@Override
public int getSortWeight() {
return plugin.getSortWeight(getName());

View File

@ -80,6 +80,8 @@ components:
# hideifundercover: 14
# # (Optional) if true, players that are crouching/sneaking will be hidden
hideifsneaking: false
# optional, if true, players that are in spectator mode will be hidden
hideifspectator: 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

View File

@ -194,12 +194,18 @@ public class FabricPlayer extends FabricCommandSender implements DynmapPlayer {
@Override
public boolean isInvisible() {
if (player != null) {
if(player != null) {
return player.isInvisible();
}
return false;
}
@Override
public boolean isSpectator() {
if(player != null) {
return player.isSpectator();
}
return false;
}
@Override
public int getSortWeight() {
return plugin.getSortWeight(getName());

View File

@ -80,6 +80,8 @@ components:
# hideifundercover: 14
# # (Optional) if true, players that are crouching/sneaking will be hidden
hideifsneaking: false
# optional, if true, players that are in spectator mode will be hidden
hideifspectator: 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

View File

@ -194,12 +194,18 @@ public class FabricPlayer extends FabricCommandSender implements DynmapPlayer {
@Override
public boolean isInvisible() {
if (player != null) {
if(player != null) {
return player.isInvisible();
}
return false;
}
@Override
public boolean isSpectator() {
if(player != null) {
return player.isSpectator();
}
return false;
}
@Override
public int getSortWeight() {
return plugin.getSortWeight(getName());

View File

@ -80,6 +80,8 @@ components:
# hideifundercover: 14
# # (Optional) if true, players that are crouching/sneaking will be hidden
hideifsneaking: false
# optional, if true, players that are in spectator mode will be hidden
hideifspectator: 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

View File

@ -194,12 +194,18 @@ public class FabricPlayer extends FabricCommandSender implements DynmapPlayer {
@Override
public boolean isInvisible() {
if (player != null) {
if(player != null) {
return player.isInvisible();
}
return false;
}
@Override
public boolean isSpectator() {
if(player != null) {
return player.isSpectator();
}
return false;
}
@Override
public int getSortWeight() {
return plugin.getSortWeight(getName());

View File

@ -80,6 +80,8 @@ components:
# hideifundercover: 14
# # (Optional) if true, players that are crouching/sneaking will be hidden
hideifsneaking: false
# optional, if true, players that are in spectator mode will be hidden
hideifspectator: 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

View File

@ -194,12 +194,18 @@ public class FabricPlayer extends FabricCommandSender implements DynmapPlayer {
@Override
public boolean isInvisible() {
if (player != null) {
if(player != null) {
return player.isInvisible();
}
return false;
}
@Override
public boolean isSpectator() {
if(player != null) {
return player.isSpectator();
}
return false;
}
@Override
public int getSortWeight() {
return plugin.getSortWeight(getName());

View File

@ -80,6 +80,8 @@ components:
# hideifundercover: 14
# # (Optional) if true, players that are crouching/sneaking will be hidden
hideifsneaking: false
# optional, if true, players that are in spectator mode will be hidden
hideifspectator: 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

View File

@ -194,12 +194,18 @@ public class FabricPlayer extends FabricCommandSender implements DynmapPlayer {
@Override
public boolean isInvisible() {
if (player != null) {
if(player != null) {
return player.isInvisible();
}
return false;
}
@Override
public boolean isSpectator() {
if(player != null) {
return player.isSpectator();
}
return false;
}
@Override
public int getSortWeight() {
return plugin.getSortWeight(getName());

View File

@ -80,6 +80,8 @@ components:
# hideifundercover: 14
# # (Optional) if true, players that are crouching/sneaking will be hidden
hideifsneaking: false
# optional, if true, players that are in spectator mode will be hidden
hideifspectator: 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

View File

@ -201,6 +201,13 @@ public class FabricPlayer extends FabricCommandSender implements DynmapPlayer {
}
return false;
}
@Override
public boolean isSpectator() {
if(player != null) {
return player.isSpectator();
}
return false;
}
@Override
public int getSortWeight() {

View File

@ -80,6 +80,8 @@ components:
# hideifundercover: 14
# # (Optional) if true, players that are crouching/sneaking will be hidden
hideifsneaking: false
# optional, if true, players that are in spectator mode will be hidden
hideifspectator: 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

View File

@ -196,12 +196,18 @@ public class FabricPlayer extends FabricCommandSender implements DynmapPlayer {
@Override
public boolean isInvisible() {
if (player != null) {
if(player != null) {
return player.isInvisible();
}
return false;
}
@Override
public boolean isSpectator() {
if(player != null) {
return player.isSpectator();
}
return false;
}
@Override
public int getSortWeight() {
return plugin.getSortWeight(getName());

View File

@ -80,6 +80,8 @@ components:
# hideifundercover: 14
# # (Optional) if true, players that are crouching/sneaking will be hidden
hideifsneaking: false
# optional, if true, players that are in spectator mode will be hidden
hideifspectator: 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

View File

@ -1327,10 +1327,17 @@ public class DynmapPlugin
}
@Override
public boolean isInvisible() {
if(player != null) {
return player.isInvisible();
}
return false;
if(player != null) {
return player.isInvisible()
}
return false;
}
@override
public boolean isSpectator() {
if(player != null) {
return player.isSpectator()
}
return false;
}
@Override
public int getSortWeight() {

View File

@ -68,6 +68,8 @@ components:
# hideifundercover: 14
# # (Optional) if true, players that are crouching/sneaking will be hidden
hideifsneaking: false
# optional, if true, players that are in spectator mode will be hidden
hideifspectator: 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

View File

@ -1286,10 +1286,17 @@ public class DynmapPlugin
}
@Override
public boolean isInvisible() {
if(player != null) {
return player.isInvisible();
}
return false;
if(player != null) {
return player.isInvisible();
}
return false;
}
@Override
public boolean isSpectator() {
if(player != null) {
return player.isSpectator();
}
return false;
}
@Override
public int getSortWeight() {

View File

@ -80,6 +80,8 @@ components:
# hideifundercover: 14
# # (Optional) if true, players that are crouching/sneaking will be hidden
hideifsneaking: false
# optional, if true, players that are in spectator mode will be hidden
hideifspectator: 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

View File

@ -1295,10 +1295,17 @@ public class DynmapPlugin
}
@Override
public boolean isInvisible() {
if(player != null) {
return player.isInvisible();
}
return false;
if(player != null) {
return player.isInvisible();
}
return false;
}
@Override
public boolean isSpectator() {
if(player != null) {
return player.isSpectator();
}
return false;
}
@Override
public int getSortWeight() {

View File

@ -80,6 +80,8 @@ components:
# hideifundercover: 14
# # (Optional) if true, players that are crouching/sneaking will be hidden
hideifsneaking: false
# optional, if true, players that are in spectator mode will be hidden
hideifspectator: 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

View File

@ -1313,10 +1313,17 @@ public class DynmapPlugin
}
@Override
public boolean isInvisible() {
if(player != null) {
return player.isInvisible();
}
return false;
if(player != null) {
return player.isInvisible();
}
return false;
}
@Override
public boolean isSpectator() {
if(player != null) {
return player.isSpectator();
}
return false;
}
@Override
public int getSortWeight() {

View File

@ -80,6 +80,8 @@ components:
# hideifundercover: 14
# # (Optional) if true, players that are crouching/sneaking will be hidden
hideifsneaking: false
# optional, if true, players that are in spectator mode will be hidden
hideifspectator: 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

View File

@ -1293,10 +1293,17 @@ public class DynmapPlugin
}
@Override
public boolean isInvisible() {
if(player != null) {
return player.isInvisible();
}
return false;
if(player != null) {
return player.isInvisible();
}
return false;
}
@Override
public boolean isSpectator() {
if(player != null) {
return player.isSpectator();
}
return false;
}
@Override
public int getSortWeight() {

View File

@ -80,6 +80,8 @@ components:
# hideifundercover: 14
# # (Optional) if true, players that are crouching/sneaking will be hidden
hideifsneaking: false
# optional, if true, players that are in spectator mode will be hidden
hideifspectator: 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

View File

@ -1300,10 +1300,17 @@ public class DynmapPlugin
}
@Override
public boolean isInvisible() {
if(player != null) {
return player.isInvisible();
}
return false;
if(player != null) {
return player.isInvisible();
}
return false;
}
@Override
public boolean isSpectator() {
if(player != null) {
return player.isSpectator();
}
return false;
}
@Override
public int getSortWeight() {

View File

@ -80,6 +80,8 @@ components:
# hideifundercover: 14
# # (Optional) if true, players that are crouching/sneaking will be hidden
hideifsneaking: false
# optional, if true, players that are in spectator mode will be hidden
hideifspectator: 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

View File

@ -1300,10 +1300,17 @@ public class DynmapPlugin
}
@Override
public boolean isInvisible() {
if(player != null) {
return player.isInvisible();
}
return false;
if(player != null) {
return player.isInvisible();
}
return false;
}
@Override
public boolean isSpectator() {
if(player != null) {
return player.isSpectator();
}
return false;
}
@Override
public int getSortWeight() {

View File

@ -80,6 +80,8 @@ components:
# hideifundercover: 14
# # (Optional) if true, players that are crouching/sneaking will be hidden
hideifsneaking: false
# optional, if true, players that are in spectator mode will be hidden
hideifspectator: 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

View File

@ -1302,10 +1302,17 @@ public class DynmapPlugin
}
@Override
public boolean isInvisible() {
if(player != null) {
return player.isInvisible();
}
return false;
if(player != null) {
return player.isInvisible();
}
return false;
}
@Override
public boolean isSpectator() {
if(player != null) {
return player.isSpectator();
}
return false;
}
@Override
public int getSortWeight() {

View File

@ -80,6 +80,8 @@ components:
# hideifundercover: 14
# # (Optional) if true, players that are crouching/sneaking will be hidden
hideifsneaking: false
# optional, if true, players that are in spectator mode will be hidden
hideifspectator: 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

View File

@ -1300,10 +1300,17 @@ public class DynmapPlugin
}
@Override
public boolean isInvisible() {
if(player != null) {
return player.isInvisible();
}
return false;
if(player != null) {
return player.isInvisible();
}
return false;
}
@Override
public boolean isSpectator() {
if(player != null) {
return player.isSpectator();
}
return false;
}
@Override
public int getSortWeight() {

View File

@ -80,6 +80,8 @@ components:
# hideifundercover: 14
# # (Optional) if true, players that are crouching/sneaking will be hidden
hideifsneaking: false
# optional, if true, players that are in spectator mode will be hidden
hideifspectator: 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

View File

@ -1308,6 +1308,13 @@ public class DynmapPlugin
return false;
}
@Override
public boolean isSpectator() {
if(player != null) {
return player.isSpectator();
}
return false;
}
@Override
public int getSortWeight() {
Integer wt = sortWeights.get(getName());
if (wt != null)

View File

@ -80,6 +80,8 @@ components:
# hideifundercover: 14
# # (Optional) if true, players that are crouching/sneaking will be hidden
hideifsneaking: false
# optional, if true, players that are in spectator mode will be hidden
hideifspectator: 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

View File

@ -1302,10 +1302,17 @@ public class DynmapPlugin
}
@Override
public boolean isInvisible() {
if(player != null) {
return player.isInvisible();
}
return false;
if(player != null) {
return player.isInvisible();
}
return false;
}
@Override
public boolean isSpectator() {
if(player != null) {
return player.isSpectator();
}
return false;
}
@Override
public int getSortWeight() {

View File

@ -80,6 +80,8 @@ components:
# hideifundercover: 14
# # (Optional) if true, players that are crouching/sneaking will be hidden
hideifsneaking: false
# optional, if true, players that are in spectator mode will be hidden
hideifspectator: 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

View File

@ -22,14 +22,7 @@ import org.bstats.bukkit.Metrics;
import org.bstats.charts.CustomChart;
import org.bstats.json.JsonObjectBuilder;
import org.bstats.json.JsonObjectBuilder.JsonObject;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Chunk;
import org.bukkit.ChunkSnapshot;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.OfflinePlayer;
import org.bukkit.World;
import org.bukkit.*;
import org.bukkit.attribute.Attribute;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
@ -109,7 +102,6 @@ import org.dynmap.common.chunk.GenericMapChunkCache;
import org.dynmap.hdmap.HDMap;
import org.dynmap.markers.MarkerAPI;
import org.dynmap.modsupport.ModSupportImpl;
import org.dynmap.renderer.DynmapBlockState;
import org.dynmap.utils.MapChunkCache;
import org.dynmap.utils.Polygon;
import org.dynmap.utils.VisibilityLimit;
@ -768,6 +760,13 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
return false;
}
@Override
public boolean isSpectator() {
if(player != null) {
return player.getGameMode() == GameMode.SPECTATOR;
}
return false;
}
@Override
public int getSortWeight() {
Integer wt = sortWeights.get(getName());
if (wt != null)

View File

@ -80,6 +80,8 @@ components:
# hideifundercover: 14
# # (Optional) if true, players that are crouching/sneaking will be hidden
hideifsneaking: false
# optional, if true, players that are in spectator mode will be hidden
hideifspectator: 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