From 37c7b97fe8aee0a5a5059fc313aba5e9b08f7068 Mon Sep 17 00:00:00 2001 From: Phoenix616 Date: Wed, 1 Mar 2023 17:57:31 +0100 Subject: [PATCH] Improve protection type mapping This will return if a non-compatible type is used instead of using private. --- .../Plugins/LightweightChestProtection.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/Acrobot/ChestShop/Plugins/LightweightChestProtection.java b/src/main/java/com/Acrobot/ChestShop/Plugins/LightweightChestProtection.java index 2c56e6b..0545f14 100644 --- a/src/main/java/com/Acrobot/ChestShop/Plugins/LightweightChestProtection.java +++ b/src/main/java/com/Acrobot/ChestShop/Plugins/LightweightChestProtection.java @@ -162,8 +162,11 @@ public class LightweightChestProtection implements Listener { return; } - Protection.Type type = Protection.Type.PRIVATE; + Protection.Type type; switch (event.getType()) { + case PRIVATE: + type = Protection.Type.PRIVATE; + break; case PUBLIC: type = Protection.Type.PUBLIC; break; @@ -173,8 +176,14 @@ public class LightweightChestProtection implements Listener { case DISPLAY: try { type = Protection.Type.valueOf("DISPLAY"); - } catch (IllegalArgumentException ignored) {} + } catch (IllegalArgumentException e) { + // Not supported + return; + } break; + default: + // Not supported + return; } Protection protection = null;