Skip to content

Commit b181607

Browse files
authored
Merge pull request #4015 from JurgenKuyper/v3.0
implemented hide if spectator
2 parents bb1438b + bc0117a commit b181607

File tree

48 files changed

+269
-69
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+269
-69
lines changed

DynmapCore/src/main/java/org/dynmap/ClientUpdateComponent.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ public class ClientUpdateComponent extends Component {
1212
private int hideifshadow;
1313
private int hideifunder;
1414
private boolean hideifsneaking;
15+
private boolean hideifspectator;
1516
private boolean hideifinvisiblepotion;
1617
private boolean is_protected;
1718
public static boolean usePlayerColors;
@@ -24,6 +25,7 @@ public ClientUpdateComponent(final DynmapCore core, ConfigurationNode configurat
2425
hideifshadow = configuration.getInteger("hideifshadow", 15);
2526
hideifunder = configuration.getInteger("hideifundercover", 15);
2627
hideifsneaking = configuration.getBoolean("hideifsneaking", false);
28+
hideifspectator = configuration.getBoolean("hideifspectator", false);
2729
hideifinvisiblepotion = configuration.getBoolean("hide-if-invisiblity-potion", true);
2830
is_protected = configuration.getBoolean("protected-player-info", false);
2931
usePlayerColors = configuration.getBoolean("use-name-colors", false);
@@ -100,6 +102,9 @@ else if(pw.isNether() == false) { /* Not nether */
100102
if((!hide) && hideifsneaking && p.isSneaking()) {
101103
hide = true;
102104
}
105+
if((!hide) && hideifspectator && p.isSpectator()) {
106+
hide = true;
107+
}
103108
if((!hide) && is_protected && (!see_all)) {
104109
if(e.user != null) {
105110
hide = !core.testIfPlayerVisibleToPlayer(e.user, p.getName());

DynmapCore/src/main/java/org/dynmap/common/DynmapPlayer.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ public interface DynmapPlayer extends DynmapCommandSender {
4444
* @return true if sneaking
4545
*/
4646
public boolean isSneaking();
47+
48+
/**
49+
* get spectator gamemode
50+
* @return true if gamemode spectator
51+
*/
52+
public boolean isSpectator();
4753
/**
4854
* Get health
4955
* @return health points

fabric-1.14.4/src/main/java/org/dynmap/fabric_1_14_4/FabricPlayer.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,12 +191,18 @@ public void sendMessage(String msg) {
191191

192192
@Override
193193
public boolean isInvisible() {
194-
if (player != null) {
194+
if(player != null) {
195195
return player.isInvisible();
196196
}
197197
return false;
198198
}
199-
199+
@Override
200+
public boolean isSpectator() {
201+
if(player != null) {
202+
return player.isSpectator();
203+
}
204+
return false;
205+
}
200206
@Override
201207
public int getSortWeight() {
202208
return plugin.getSortWeight(getName());

fabric-1.14.4/src/main/resources/configuration.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ components:
8080
# hideifundercover: 14
8181
# # (Optional) if true, players that are crouching/sneaking will be hidden
8282
hideifsneaking: false
83+
# optional, if true, players that are in spectator mode will be hidden
84+
hideifspectator: false
8385
# If true, player positions/status is protected (login with ID with dynmap.playermarkers.seeall permission required for info other than self)
8486
protected-player-info: false
8587
# If true, hide players with invisibility potion effects active

fabric-1.15.2/src/main/java/org/dynmap/fabric_1_15_2/FabricPlayer.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,12 +191,18 @@ public void sendMessage(String msg) {
191191

192192
@Override
193193
public boolean isInvisible() {
194-
if (player != null) {
194+
if(player != null) {
195195
return player.isInvisible();
196196
}
197197
return false;
198198
}
199-
199+
@Override
200+
public boolean isSpectator() {
201+
if(player != null) {
202+
return player.isSpectator();
203+
}
204+
return false;
205+
}
200206
@Override
201207
public int getSortWeight() {
202208
return plugin.getSortWeight(getName());

fabric-1.15.2/src/main/resources/configuration.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ components:
8080
# hideifundercover: 14
8181
# # (Optional) if true, players that are crouching/sneaking will be hidden
8282
hideifsneaking: false
83+
# optional, if true, players that are in spectator mode will be hidden
84+
hideifspectator: false
8385
# If true, player positions/status is protected (login with ID with dynmap.playermarkers.seeall permission required for info other than self)
8486
protected-player-info: false
8587
# If true, hide players with invisibility potion effects active

fabric-1.16.4/src/main/java/org/dynmap/fabric_1_16_4/FabricPlayer.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,12 +191,18 @@ public void sendMessage(String msg) {
191191

192192
@Override
193193
public boolean isInvisible() {
194-
if (player != null) {
194+
if(player != null) {
195195
return player.isInvisible();
196196
}
197197
return false;
198198
}
199-
199+
@Override
200+
public boolean isSpectator() {
201+
if(player != null) {
202+
return player.isSpectator();
203+
}
204+
return false;
205+
}
200206
@Override
201207
public int getSortWeight() {
202208
return plugin.getSortWeight(getName());

fabric-1.16.4/src/main/resources/configuration.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ components:
8080
# hideifundercover: 14
8181
# # (Optional) if true, players that are crouching/sneaking will be hidden
8282
hideifsneaking: false
83+
# optional, if true, players that are in spectator mode will be hidden
84+
hideifspectator: false
8385
# If true, player positions/status is protected (login with ID with dynmap.playermarkers.seeall permission required for info other than self)
8486
protected-player-info: false
8587
# If true, hide players with invisibility potion effects active

fabric-1.17.1/src/main/java/org/dynmap/fabric_1_17_1/FabricPlayer.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,12 +194,18 @@ public void sendMessage(String msg) {
194194

195195
@Override
196196
public boolean isInvisible() {
197-
if (player != null) {
197+
if(player != null) {
198198
return player.isInvisible();
199199
}
200200
return false;
201201
}
202-
202+
@Override
203+
public boolean isSpectator() {
204+
if(player != null) {
205+
return player.isSpectator();
206+
}
207+
return false;
208+
}
203209
@Override
204210
public int getSortWeight() {
205211
return plugin.getSortWeight(getName());

fabric-1.17.1/src/main/resources/configuration.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ components:
8080
# hideifundercover: 14
8181
# # (Optional) if true, players that are crouching/sneaking will be hidden
8282
hideifsneaking: false
83+
# optional, if true, players that are in spectator mode will be hidden
84+
hideifspectator: false
8385
# If true, player positions/status is protected (login with ID with dynmap.playermarkers.seeall permission required for info other than self)
8486
protected-player-info: false
8587
# If true, hide players with invisibility potion effects active

0 commit comments

Comments
 (0)