Skip to content

Commit

Permalink
Merge pull request webbukkit#4015 from JurgenKuyper/v3.0
Browse files Browse the repository at this point in the history
implemented hide if spectator
  • Loading branch information
mikeprimm authored Dec 1, 2023
2 parents bb1438b + bc0117a commit b181607
Show file tree
Hide file tree
Showing 48 changed files with 269 additions and 69 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -24,6 +25,7 @@ public ClientUpdateComponent(final DynmapCore core, ConfigurationNode configurat
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);
Expand Down Expand Up @@ -100,6 +102,9 @@ else if(pw.isNether() == false) { /* Not nether */
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());
Expand Down
6 changes: 6 additions & 0 deletions DynmapCore/src/main/java/org/dynmap/common/DynmapPlayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,18 @@ public void sendMessage(String msg) {

@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());
Expand Down
2 changes: 2 additions & 0 deletions fabric-1.14.4/src/main/resources/configuration.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,18 @@ public void sendMessage(String msg) {

@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());
Expand Down
2 changes: 2 additions & 0 deletions fabric-1.15.2/src/main/resources/configuration.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,18 @@ public void sendMessage(String msg) {

@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());
Expand Down
2 changes: 2 additions & 0 deletions fabric-1.16.4/src/main/resources/configuration.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,18 @@ public void sendMessage(String msg) {

@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());
Expand Down
2 changes: 2 additions & 0 deletions fabric-1.17.1/src/main/resources/configuration.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,18 @@ public void sendMessage(String msg) {

@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());
Expand Down
2 changes: 2 additions & 0 deletions fabric-1.18.2/src/main/resources/configuration.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,18 @@ public void sendMessage(String msg) {

@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());
Expand Down
2 changes: 2 additions & 0 deletions fabric-1.19.1/src/main/resources/configuration.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,18 @@ public void sendMessage(String msg) {

@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());
Expand Down
2 changes: 2 additions & 0 deletions fabric-1.19.3/src/main/resources/configuration.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,18 @@ public void sendMessage(String msg) {

@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());
Expand Down
2 changes: 2 additions & 0 deletions fabric-1.19.4/src/main/resources/configuration.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,18 @@ public void sendMessage(String msg) {

@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());
Expand Down
2 changes: 2 additions & 0 deletions fabric-1.19/src/main/resources/configuration.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,13 @@ public boolean isInvisible() {
}
return false;
}
@Override
public boolean isSpectator() {
if(player != null) {
return player.isSpectator();
}
return false;
}

@Override
public int getSortWeight() {
Expand Down
2 changes: 2 additions & 0 deletions fabric-1.20.2/src/main/resources/configuration.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,18 @@ public void sendMessage(String msg) {

@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());
Expand Down
2 changes: 2 additions & 0 deletions fabric-1.20/src/main/resources/configuration.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1327,10 +1327,17 @@ public void sendMessage(String msg)
}
@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() {
Expand Down
2 changes: 2 additions & 0 deletions forge-1.12.2/src/main/resources/configuration.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading

0 comments on commit b181607

Please sign in to comment.