Skip to content

Commit

Permalink
fix waypoint colors not updating on config change
Browse files Browse the repository at this point in the history
  • Loading branch information
thebuildcraft committed Jun 27, 2024
1 parent e994527 commit 8c431fc
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ public UpdateTask() {
private ArrayList<Waypoint> playerWaypointList = null;
private ArrayList<Waypoint> markerWaypointList = null;

private int previousPlayerWaypointColor = 0;
private int previousMarkerWaypointColor = 0;

@Override
public void run() {
try{
Expand Down Expand Up @@ -338,6 +341,14 @@ public void runUpdate() {
}
// Remove any waypoints for players not shown on the map anymore
playerWaypointList.removeIf(waypoint -> !currentPlayerWaypointNames.contains(waypoint.getName()));

int newPlayerWaypointColor = CommonModConfig.Instance.playerWaypointColor();
if (previousPlayerWaypointColor != newPlayerWaypointColor){
previousPlayerWaypointColor = newPlayerWaypointColor;
for (Waypoint waypoint : playerWaypointList){
waypoint.setColor(newPlayerWaypointColor);
}
}
}
else {
playerWaypointList.clear();
Expand Down Expand Up @@ -395,6 +406,14 @@ public void runUpdate() {
// Remove any waypoints for markers not shown on the map anymore
markerWaypointList.removeIf(waypoint -> !currentMarkerWaypointNames.contains(waypoint.getName()));

int newMarkerWaypointColor = CommonModConfig.Instance.markerWaypointColor();
if (previousMarkerWaypointColor != newMarkerWaypointColor){
previousMarkerWaypointColor = newMarkerWaypointColor;
for (Waypoint waypoint : markerWaypointList){
waypoint.setColor(newMarkerWaypointColor);
}
}

if (!markerMessageWasShown && currentMarkerWaypointNames.size() > maxMarkerCountBeforeWarning && !CommonModConfig.Instance.ignoreMarkerMessage()) {
markerMessageWasShown = true;
Utils.sendToClientChat(Text.literal("[" + AbstractModInitializer.MOD_NAME + "]: " +
Expand Down

0 comments on commit 8c431fc

Please sign in to comment.