Skip to content

Commit

Permalink
Merge pull request #4082 from JurgenKuyper/add-configurable-spawnbed-…
Browse files Browse the repository at this point in the history
…hide-on-leave

added configurable on whether to remove spawnbed markers when player leaves the server
  • Loading branch information
mikeprimm authored Jun 2, 2024
2 parents a0effe2 + d80fb25 commit 313933f
Show file tree
Hide file tree
Showing 20 changed files with 31 additions and 9 deletions.
21 changes: 12 additions & 9 deletions DynmapCore/src/main/java/org/dynmap/MarkersComponent.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public class MarkersComponent extends ClientComponent {
private MarkerSet spawnbedset;
private MarkerIcon spawnbedicon;
private String spawnbedformat;
private boolean removebedonplayerleave;
private long maxofflineage;
private boolean showSpawn;
private boolean showBorder;
Expand Down Expand Up @@ -180,23 +181,25 @@ public void playerEvent(DynmapPlayer p) {

spawnbedicon = api.getMarkerIcon(configuration.getString("spawnbedicon", "bed"));
spawnbedformat = configuration.getString("spawnbedformat", "%name%'s bed");

removebedonplayerleave = configuration.getBoolean("spawnbedremoveonplayerleave", true);
/* Add listener for players coming and going */
core.listenerManager.addListener(EventType.PLAYER_JOIN, new PlayerEventListener() {
@Override
public void playerEvent(DynmapPlayer p) {
updatePlayer(p);
}
});
core.listenerManager.addListener(EventType.PLAYER_QUIT, new PlayerEventListener() {
@Override
public void playerEvent(DynmapPlayer p) {
Marker m = spawnbedset.findMarker(p.getName()+"_bed");
if(m != null) {
m.deleteMarker();
if (removebedonplayerleave) {
core.listenerManager.addListener(EventType.PLAYER_QUIT, new PlayerEventListener() {
@Override
public void playerEvent(DynmapPlayer p) {
Marker m = spawnbedset.findMarker(p.getName() + "_bed");
if (m != null) {
m.deleteMarker();
}
}
}
});
});
}
core.listenerManager.addListener(EventType.PLAYER_BED_LEAVE, new PlayerEventListener() {
@Override
public void playerEvent(final DynmapPlayer p) {
Expand Down
1 change: 1 addition & 0 deletions fabric-1.14.4/src/main/resources/configuration.txt
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ components:
spawnbedhidebydefault: true
spawnbedminzoom: 0
spawnbedformat: "%name%'s bed"
spawnbedremoveonplayerleave: true
# (optional) Show world border (vanilla 1.8+)
showworldborder: true
worldborderlabel: "Border"
Expand Down
1 change: 1 addition & 0 deletions fabric-1.15.2/src/main/resources/configuration.txt
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ components:
spawnbedhidebydefault: true
spawnbedminzoom: 0
spawnbedformat: "%name%'s bed"
spawnbedremoveonplayerleave: true
# (optional) Show world border (vanilla 1.8+)
showworldborder: true
worldborderlabel: "Border"
Expand Down
1 change: 1 addition & 0 deletions fabric-1.16.4/src/main/resources/configuration.txt
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ components:
spawnbedhidebydefault: true
spawnbedminzoom: 0
spawnbedformat: "%name%'s bed"
spawnbedremoveonplayerleave: true
# (optional) Show world border (vanilla 1.8+)
showworldborder: true
worldborderlabel: "Border"
Expand Down
1 change: 1 addition & 0 deletions fabric-1.17.1/src/main/resources/configuration.txt
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ components:
spawnbedhidebydefault: true
spawnbedminzoom: 0
spawnbedformat: "%name%'s bed"
spawnbedremoveonplayerleave: true
# (optional) Show world border (vanilla 1.8+)
showworldborder: true
worldborderlabel: "Border"
Expand Down
1 change: 1 addition & 0 deletions fabric-1.18.2/src/main/resources/configuration.txt
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ components:
spawnbedhidebydefault: true
spawnbedminzoom: 0
spawnbedformat: "%name%'s bed"
spawnbedremoveonplayerleave: true
# (optional) Show world border (vanilla 1.8+)
showworldborder: true
worldborderlabel: "Border"
Expand Down
1 change: 1 addition & 0 deletions fabric-1.19.4/src/main/resources/configuration.txt
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ components:
spawnbedhidebydefault: true
spawnbedminzoom: 0
spawnbedformat: "%name%'s bed"
spawnbedremoveonplayerleave: true
# (optional) Show world border (vanilla 1.8+)
showworldborder: true
worldborderlabel: "Border"
Expand Down
1 change: 1 addition & 0 deletions fabric-1.20.2/src/main/resources/configuration.txt
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ components:
spawnbedhidebydefault: true
spawnbedminzoom: 0
spawnbedformat: "%name%'s bed"
spawnbedremoveonplayerleave: true
# (optional) Show world border (vanilla 1.8+)
showworldborder: true
worldborderlabel: "Border"
Expand Down
1 change: 1 addition & 0 deletions fabric-1.20.4/src/main/resources/configuration.txt
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ components:
spawnbedhidebydefault: true
spawnbedminzoom: 0
spawnbedformat: "%name%'s bed"
spawnbedremoveonplayerleave: true
# (optional) Show world border (vanilla 1.8+)
showworldborder: true
worldborderlabel: "Border"
Expand Down
1 change: 1 addition & 0 deletions fabric-1.20/src/main/resources/configuration.txt
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ components:
spawnbedhidebydefault: true
spawnbedminzoom: 0
spawnbedformat: "%name%'s bed"
spawnbedremoveonplayerleave: true
# (optional) Show world border (vanilla 1.8+)
showworldborder: true
worldborderlabel: "Border"
Expand Down
1 change: 1 addition & 0 deletions forge-1.12.2/src/main/resources/configuration.txt
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ components:
spawnbedhidebydefault: true
spawnbedminzoom: 0
spawnbedformat: "%name%'s bed"
spawnbedremoveonplayerleave: true
# (optional) Show world border (vanilla 1.8+)
showworldborder: true
worldborderlabel: "Border"
Expand Down
1 change: 1 addition & 0 deletions forge-1.14.4/src/main/resources/configuration.txt
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ components:
spawnbedhidebydefault: true
spawnbedminzoom: 0
spawnbedformat: "%name%'s bed"
spawnbedremoveonplayerleave: true
# (optional) Show world border (vanilla 1.8+)
showworldborder: true
worldborderlabel: "Border"
Expand Down
1 change: 1 addition & 0 deletions forge-1.15.2/src/main/resources/configuration.txt
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ components:
spawnbedhidebydefault: true
spawnbedminzoom: 0
spawnbedformat: "%name%'s bed"
spawnbedremoveonplayerleave: true
# (optional) Show world border (vanilla 1.8+)
showworldborder: true
worldborderlabel: "Border"
Expand Down
1 change: 1 addition & 0 deletions forge-1.16.5/src/main/resources/configuration.txt
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ components:
spawnbedhidebydefault: true
spawnbedminzoom: 0
spawnbedformat: "%name%'s bed"
spawnbedremoveonplayerleave: true
# (optional) Show world border (vanilla 1.8+)
showworldborder: true
worldborderlabel: "Border"
Expand Down
1 change: 1 addition & 0 deletions forge-1.17.1/src/main/resources/configuration.txt
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ components:
spawnbedhidebydefault: true
spawnbedminzoom: 0
spawnbedformat: "%name%'s bed"
spawnbedremoveonplayerleave: true
# (optional) Show world border (vanilla 1.8+)
showworldborder: true
worldborderlabel: "Border"
Expand Down
1 change: 1 addition & 0 deletions forge-1.18.2/src/main/resources/configuration.txt
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ components:
spawnbedhidebydefault: true
spawnbedminzoom: 0
spawnbedformat: "%name%'s bed"
spawnbedremoveonplayerleave: true
# (optional) Show world border (vanilla 1.8+)
showworldborder: true
worldborderlabel: "Border"
Expand Down
1 change: 1 addition & 0 deletions forge-1.19.3/src/main/resources/configuration.txt
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ components:
spawnbedhidebydefault: true
spawnbedminzoom: 0
spawnbedformat: "%name%'s bed"
spawnbedremoveonplayerleave: true
# (optional) Show world border (vanilla 1.8+)
showworldborder: true
worldborderlabel: "Border"
Expand Down
1 change: 1 addition & 0 deletions forge-1.20.2/src/main/resources/configuration.txt
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ components:
spawnbedhidebydefault: true
spawnbedminzoom: 0
spawnbedformat: "%name%'s bed"
spawnbedremoveonplayerleave: true
# (optional) Show world border (vanilla 1.8+)
showworldborder: true
worldborderlabel: "Border"
Expand Down
1 change: 1 addition & 0 deletions forge-1.20/src/main/resources/configuration.txt
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ components:
spawnbedhidebydefault: true
spawnbedminzoom: 0
spawnbedformat: "%name%'s bed"
spawnbedremoveonplayerleave: true
# (optional) Show world border (vanilla 1.8+)
showworldborder: true
worldborderlabel: "Border"
Expand Down
1 change: 1 addition & 0 deletions spigot/src/main/resources/configuration.txt
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ components:
spawnbedhidebydefault: true
spawnbedminzoom: 0
spawnbedformat: "%name%'s bed"
spawnbedremoveonplayerleave: true
# (optional) show world border (vanilla 1.8+)
showworldborder: true
worldborderlabel: "Border"
Expand Down

0 comments on commit 313933f

Please sign in to comment.