9
0
mirror of https://github.com/WiIIiam278/HuskSync.git synced 2025-12-26 01:59:20 +00:00

Cancel inventory edits when editing is disabled, tweak listener logic for better compatibility

This commit is contained in:
William
2022-07-11 13:58:03 +01:00
parent b0363d10ed
commit 28c4cfb55f
3 changed files with 19 additions and 15 deletions

View File

@@ -65,7 +65,7 @@ public class DataEditor {
* @param user The online user with an inventory open to check
* @return {@code true} if edits to the inventory or ender chest menu are allowed; {@code false} otherwise, including if they don't have an inventory open
*/
public boolean cancelInventoryEdit(@NotNull OnlineUser user) {
public boolean cancelMenuEdit(@NotNull OnlineUser user) {
if (this.openInventoryMenus.containsKey(user.uuid)) {
return !this.openInventoryMenus.get(user.uuid).canEdit;
}

View File

@@ -165,11 +165,8 @@ public abstract class EventListener {
plugin.getDataEditor().closeInventoryMenu(user, menuInventory);
}
public final boolean cancelMenuClick(@NotNull OnlineUser user) {
if (disabling) {
return true;
}
return plugin.getDataEditor().cancelInventoryEdit(user);
public final boolean cancelInventoryClick(@NotNull OnlineUser user) {
return plugin.getDataEditor().cancelMenuEdit(user) || cancelPlayerEvent(user);
}
public final boolean cancelPlayerEvent(@NotNull OnlineUser user) {