Skip to content

Commit

Permalink
Make map mutable #119
Browse files Browse the repository at this point in the history
  • Loading branch information
bengibbs committed Aug 26, 2024
1 parent e776df7 commit 6de62ae
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package world.bentobox.islandfly.listeners;

import java.util.HashMap;
import java.util.Map;

import org.bukkit.Bukkit;
Expand Down Expand Up @@ -46,8 +47,11 @@ public void onToggleFlight(final PlayerToggleFlightEvent event) {
user.sendMessage("islandfly.not-allowed");
} else {
addon.getIslands().getIslandAt(user.getLocation())
.filter(i -> i.getMemberSet().contains(user.getUniqueId())).ifPresent(is -> user
.setMetaData(Map.of("IslandFly-" + is.getUniqueId(), new MetaDataValue(event.isFlying())))); // Record the fly state for this island
.filter(i -> i.getMemberSet().contains(user.getUniqueId())).ifPresent(is -> {
Map<String, MetaDataValue> metaData = new HashMap<>();
metaData.put("IslandFly-" + is.getUniqueId(), new MetaDataValue(event.isFlying()));
user.setMetaData(metaData); // Record the fly state for this island
});

}
}
Expand Down

0 comments on commit 6de62ae

Please sign in to comment.