From 289afdc171366047ac9cf20070439fc690f5bb69 Mon Sep 17 00:00:00 2001 From: zrdzn Date: Mon, 14 Aug 2023 20:19:52 +0200 Subject: [PATCH] GH-44 Fix drop switching (Closes #44) --- .../zrdzn/minecraft/lovelydrop/menu/MenuFacade.java | 8 ++++---- .../zrdzn/minecraft/lovelydrop/user/UserSetting.java | 5 ++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/plugin/src/main/java/io/github/zrdzn/minecraft/lovelydrop/menu/MenuFacade.java b/plugin/src/main/java/io/github/zrdzn/minecraft/lovelydrop/menu/MenuFacade.java index aa2807a..120326a 100644 --- a/plugin/src/main/java/io/github/zrdzn/minecraft/lovelydrop/menu/MenuFacade.java +++ b/plugin/src/main/java/io/github/zrdzn/minecraft/lovelydrop/menu/MenuFacade.java @@ -174,9 +174,9 @@ public void open(Player player) { return; } else if (action == MenuAction.SWITCH_DROP) { if (userSetting.hasDisabledDrop(menuSlotItemKey)) { - userSetting.addDisabledDrop(menuSlotItemKey); - } else { userSetting.removeDisabledDrop(menuSlotItemKey); + } else { + userSetting.addDisabledDrop(menuSlotItemKey); } this.messageFacade.sendMessage(player, messageConfig.getDropSwitched(), "{DROP}", menuSlotItemKey); @@ -192,9 +192,9 @@ public void open(Player player) { return; } else if (action == MenuAction.SWITCH_DROP) { if (userSetting.hasDisabledDrop(menuSlotItemKey)) { - userSetting.addDisabledDrop(menuSlotItemKey); - } else { userSetting.removeDisabledDrop(menuSlotItemKey); + } else { + userSetting.addDisabledDrop(menuSlotItemKey); } this.messageFacade.sendMessage(player, messageConfig.getDropSwitched(), "{DROP}", menuSlotItemKey); diff --git a/plugin/src/main/java/io/github/zrdzn/minecraft/lovelydrop/user/UserSetting.java b/plugin/src/main/java/io/github/zrdzn/minecraft/lovelydrop/user/UserSetting.java index 4d31ea0..38faa30 100644 --- a/plugin/src/main/java/io/github/zrdzn/minecraft/lovelydrop/user/UserSetting.java +++ b/plugin/src/main/java/io/github/zrdzn/minecraft/lovelydrop/user/UserSetting.java @@ -1,6 +1,5 @@ package io.github.zrdzn.minecraft.lovelydrop.user; -import java.util.Collections; import java.util.Map; import java.util.Set; import java.util.UUID; @@ -30,7 +29,7 @@ public boolean hasDisabledDrop(String dropKey) { } public Set getDisabledDrops() { - return Collections.unmodifiableSet(this.disabledDrops); + return this.disabledDrops; } public void removeDisabledDrop(String dropKey) { @@ -50,7 +49,7 @@ public boolean hasDropToInventory(String dropKey) { } public Map getDropsToInventory() { - return Collections.unmodifiableMap(this.dropsToInventory); + return this.dropsToInventory; } }