Renamed 'main' protection options to 'login'.

This commit is contained in:
2022-05-21 17:08:18 +01:00
parent 4ed3487362
commit 0c1e5f74f8
2 changed files with 24 additions and 24 deletions

View File

@ -47,41 +47,41 @@ public class OnKeyPressEventHandler {
private static boolean checkKeyAllowed(Minecraft instance, int key) {
boolean isAllowed = false;
if (key == GLFW.GLFW_KEY_ESCAPE) { isAllowed = Config.Server.MAIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.PAUSE.toString()); }
if (key == GLFW.GLFW_KEY_F3) { isAllowed = Config.Server.MAIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.DEBUG.toString()); }
if (key == instance.options.keyFullscreen.getKey().getValue()) { isAllowed = Config.Server.MAIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.FULLSCREEN.toString()); }
if (key == instance.options.keyTogglePerspective.getKey().getValue()) { isAllowed = Config.Server.MAIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.PERSPECTIVE.toString()); }
if (key == instance.options.keySmoothCamera.getKey().getValue()) { isAllowed = Config.Server.MAIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.SMOOTH_CAMERA.toString()); }
if (key == instance.options.keyScreenshot.getKey().getValue()) { isAllowed = Config.Server.MAIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.SCREENSHOT.toString()); }
if (key == instance.options.keySpectatorOutlines.getKey().getValue()) { isAllowed = Config.Server.MAIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.SPECTATOR_OUTLINES.toString()); }
if (key == instance.options.keyAdvancements.getKey().getValue()) { isAllowed = Config.Server.MAIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.ADVANCEMENTS.toString()); }
if (key == instance.options.keyPlayerList.getKey().getValue()) { isAllowed = Config.Server.MAIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.PLAYER_LIST.toString()); }
if (key == GLFW.GLFW_KEY_ESCAPE) { isAllowed = Config.Server.LOGIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.PAUSE.toString()); }
if (key == GLFW.GLFW_KEY_F3) { isAllowed = Config.Server.LOGIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.DEBUG.toString()); }
if (key == instance.options.keyFullscreen.getKey().getValue()) { isAllowed = Config.Server.LOGIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.FULLSCREEN.toString()); }
if (key == instance.options.keyTogglePerspective.getKey().getValue()) { isAllowed = Config.Server.LOGIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.PERSPECTIVE.toString()); }
if (key == instance.options.keySmoothCamera.getKey().getValue()) { isAllowed = Config.Server.LOGIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.SMOOTH_CAMERA.toString()); }
if (key == instance.options.keyScreenshot.getKey().getValue()) { isAllowed = Config.Server.LOGIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.SCREENSHOT.toString()); }
if (key == instance.options.keySpectatorOutlines.getKey().getValue()) { isAllowed = Config.Server.LOGIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.SPECTATOR_OUTLINES.toString()); }
if (key == instance.options.keyAdvancements.getKey().getValue()) { isAllowed = Config.Server.LOGIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.ADVANCEMENTS.toString()); }
if (key == instance.options.keyPlayerList.getKey().getValue()) { isAllowed = Config.Server.LOGIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.PLAYER_LIST.toString()); }
if (key == instance.options.keyChat.getKey().getValue() ||
key == instance.options.keyCommand.getKey().getValue() ||
key == GLFW.GLFW_KEY_ENTER) {
isAllowed = Config.Server.MAIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.CHAT.toString());
isAllowed = Config.Server.LOGIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.CHAT.toString());
}
if (key == instance.options.keySocialInteractions.getKey().getValue()) { isAllowed = Config.Server.MAIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.SOCIAL_INTERACTIONS.toString()); }
if (key == instance.options.keyLoadHotbarActivator.getKey().getValue()) { isAllowed = Config.Server.MAIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.LOAD_HOTBAR_ACTIVATOR.toString()); }
if (key == instance.options.keySaveHotbarActivator.getKey().getValue()) { isAllowed = Config.Server.MAIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.SAVE_HOTBAR_ACTIVATOR.toString()); }
if (key == instance.options.keySwapOffhand.getKey().getValue()) { isAllowed = Config.Server.MAIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.SWAP_ITEM.toString()); }
if (key == instance.options.keyInventory.getKey().getValue()) { isAllowed = Config.Server.MAIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.INVENTORY.toString()); }
if (key == instance.options.keySocialInteractions.getKey().getValue()) { isAllowed = Config.Server.LOGIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.SOCIAL_INTERACTIONS.toString()); }
if (key == instance.options.keyLoadHotbarActivator.getKey().getValue()) { isAllowed = Config.Server.LOGIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.LOAD_HOTBAR_ACTIVATOR.toString()); }
if (key == instance.options.keySaveHotbarActivator.getKey().getValue()) { isAllowed = Config.Server.LOGIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.SAVE_HOTBAR_ACTIVATOR.toString()); }
if (key == instance.options.keySwapOffhand.getKey().getValue()) { isAllowed = Config.Server.LOGIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.SWAP_ITEM.toString()); }
if (key == instance.options.keyInventory.getKey().getValue()) { isAllowed = Config.Server.LOGIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.INVENTORY.toString()); }
for (int i = 0; i < instance.options.keyHotbarSlots.length; i++) {
if (key == instance.options.keyHotbarSlots[i].getKey().getValue()) { isAllowed = Config.Server.MAIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.HOTBAR.toString()); }
if (key == instance.options.keyHotbarSlots[i].getKey().getValue()) { isAllowed = Config.Server.LOGIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.HOTBAR.toString()); }
}
if (key == instance.options.keyDrop.getKey().getValue()) { isAllowed = Config.Server.MAIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.DROP_ITEM.toString()); }
if (key == instance.options.keyUse.getKey().getValue()) { isAllowed = Config.Server.MAIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.USE_ITEM.toString()); }
if (key == instance.options.keyPickItem.getKey().getValue()) { isAllowed = Config.Server.MAIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.PICK_BLOCK.toString()); }
if (key == instance.options.keyAttack.getKey().getValue()) { isAllowed = Config.Server.MAIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.ATTACK.toString()); }
if (key == instance.options.keyDrop.getKey().getValue()) { isAllowed = Config.Server.LOGIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.DROP_ITEM.toString()); }
if (key == instance.options.keyUse.getKey().getValue()) { isAllowed = Config.Server.LOGIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.USE_ITEM.toString()); }
if (key == instance.options.keyPickItem.getKey().getValue()) { isAllowed = Config.Server.LOGIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.PICK_BLOCK.toString()); }
if (key == instance.options.keyAttack.getKey().getValue()) { isAllowed = Config.Server.LOGIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.ATTACK.toString()); }
if (key == instance.options.keyUp.getKey().getValue() ||
key == instance.options.keyRight.getKey().getValue() ||
key == instance.options.keyDown.getKey().getValue() ||
key == instance.options.keyLeft.getKey().getValue() ||
key == instance.options.keySprint.getKey().getValue()) {
isAllowed = Config.Server.MAIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.MOVE.toString());
isAllowed = Config.Server.LOGIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.MOVE.toString());
}
if (key == instance.options.keyShift.getKey().getValue()) { isAllowed = Config.Server.MAIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.SNEAK.toString()); }
if (key == instance.options.keyJump.getKey().getValue()) { isAllowed = Config.Server.MAIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.JUMP.toString()); }
if (key == instance.options.keyShift.getKey().getValue()) { isAllowed = Config.Server.LOGIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.SNEAK.toString()); }
if (key == instance.options.keyJump.getKey().getValue()) { isAllowed = Config.Server.LOGIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.JUMP.toString()); }
return isAllowed;
}