From d8386fd2a2aa3172dca73ff9c5cf8bd6f5e981c9 Mon Sep 17 00:00:00 2001 From: William Date: Mon, 14 Nov 2022 18:25:44 +0000 Subject: [PATCH] Fix edit nodes not being respected --- .../net/william278/husksync/command/EnderChestCommand.java | 5 +++-- .../net/william278/husksync/command/InventoryCommand.java | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/common/src/main/java/net/william278/husksync/command/EnderChestCommand.java b/common/src/main/java/net/william278/husksync/command/EnderChestCommand.java index 239430c0..5d1bc27c 100644 --- a/common/src/main/java/net/william278/husksync/command/EnderChestCommand.java +++ b/common/src/main/java/net/william278/husksync/command/EnderChestCommand.java @@ -46,9 +46,10 @@ public class EnderChestCommand extends CommandBase implements TabCompletable { "/enderchest [version_uuid]").ifPresent(player::sendMessage); } } else { - // View latest user data + // View (and edit) the latest user data plugin.getDatabase().getCurrentUserData(user).thenAccept(optionalData -> optionalData.ifPresentOrElse( - versionedUserData -> showEnderChestMenu(player, versionedUserData, user, true), + versionedUserData -> showEnderChestMenu(player, versionedUserData, user, + player.hasPermission(Permission.COMMAND_ENDER_CHEST_EDIT.node)), () -> plugin.getLocales().getLocale("error_no_data_to_display") .ifPresent(player::sendMessage))); } diff --git a/common/src/main/java/net/william278/husksync/command/InventoryCommand.java b/common/src/main/java/net/william278/husksync/command/InventoryCommand.java index acb23769..52131b17 100644 --- a/common/src/main/java/net/william278/husksync/command/InventoryCommand.java +++ b/common/src/main/java/net/william278/husksync/command/InventoryCommand.java @@ -46,9 +46,10 @@ public class InventoryCommand extends CommandBase implements TabCompletable { "/inventory [version_uuid]").ifPresent(player::sendMessage); } } else { - // View latest user data + // View (and edit) the latest user data plugin.getDatabase().getCurrentUserData(user).thenAccept(optionalData -> optionalData.ifPresentOrElse( - versionedUserData -> showInventoryMenu(player, versionedUserData, user, true), + versionedUserData -> showInventoryMenu(player, versionedUserData, user, + player.hasPermission(Permission.COMMAND_INVENTORY_EDIT.node)), () -> plugin.getLocales().getLocale("error_no_data_to_display") .ifPresent(player::sendMessage))); }