Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save meta data after setting #138

Merged
merged 1 commit into from
Jan 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,12 @@ public boolean execute(User user, String label, List<String> args) {
if (on) {
user.sendMessage("border.toggle.border-off");
user.putMetaData(BorderShower.BORDER_STATE_META_DATA, new MetaDataValue(false));
addon.getPlayers().savePlayer(user.getUniqueId());
addon.getBorderShower().hideBorder(user);
} else {
user.sendMessage("border.toggle.border-on");
user.putMetaData(BorderShower.BORDER_STATE_META_DATA, new MetaDataValue(true));
addon.getPlayers().savePlayer(user.getUniqueId());
if (island != null) {
addon.getBorderShower().showBorder(user.getPlayer(), island);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import org.bukkit.util.RayTraceResult;
import org.bukkit.util.Vector;

import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.api.events.island.IslandProtectionRangeChangeEvent;
import world.bentobox.bentobox.api.flags.Flag;
import world.bentobox.bentobox.api.metadata.MetaDataValue;
Expand Down Expand Up @@ -121,6 +122,8 @@ public void onPlayerRespawn(PlayerRespawnEvent e) {
private boolean isOn(Player player) {
// Check if border is off
User user = User.getInstance(player);
BentoBox.getInstance().logDebug("Border state meta data = "
+ user.getMetaData(BorderShower.BORDER_STATE_META_DATA).map(mtv -> mtv.asBoolean()).orElse(null));
return user.getMetaData(BorderShower.BORDER_STATE_META_DATA).map(MetaDataValue::asBoolean)
.orElse(addon.getSettings().isShowByDefault());

Expand Down
Loading