Improve protection type mapping

This will return if a non-compatible type is used instead of using private.
This commit is contained in:
Phoenix616 2023-03-01 17:57:31 +01:00
parent 0d8d37eb85
commit 37c7b97fe8
No known key found for this signature in database
GPG Key ID: 40E2321E71738EB0
1 changed files with 11 additions and 2 deletions

View File

@ -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;