diff --git a/core/src/main/java/org/geysermc/floodgate/command/util/Permission.java b/core/src/main/java/org/geysermc/floodgate/command/util/Permission.java new file mode 100644 index 00000000..90f897fb --- /dev/null +++ b/core/src/main/java/org/geysermc/floodgate/command/util/Permission.java @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2019-2022 GeyserMC. http://geysermc.org + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @author GeyserMC + * @link https://github.com/GeyserMC/Floodgate + */ + +package org.geysermc.floodgate.command.util; + +import static org.geysermc.floodgate.command.util.PermissionDefault.OP; +import static org.geysermc.floodgate.command.util.PermissionDefault.TRUE; + +public enum Permission { + COMMAND_MAIN("floodgate.command.floodgate", TRUE), + COMMAND_MAIN_FIREWALL(COMMAND_MAIN, "firewall", OP), + COMMAND_LINK("floodgate.command.linkaccount", TRUE), + COMMAND_UNLINK("floodgate.command.unlinkaccount", TRUE), + COMMAND_WHITELIST("floodgate.command.fwhitelist", OP), + + NEWS_RECEIVE("floodgate.news.receive", OP); + + private final String permission; + private final PermissionDefault defaultValue; + + Permission(String permission, PermissionDefault defaultValue) { + this.permission = permission; + this.defaultValue = defaultValue; + } + + Permission(Permission parent, String child, PermissionDefault defaultValue) { + this(parent.get() + "." + child, defaultValue); + } + + public String get() { + return permission; + } + + public PermissionDefault defaultValue() { + return defaultValue; + } +} diff --git a/core/src/main/java/org/geysermc/floodgate/util/Permissions.java b/core/src/main/java/org/geysermc/floodgate/command/util/PermissionDefault.java similarity index 70% rename from core/src/main/java/org/geysermc/floodgate/util/Permissions.java rename to core/src/main/java/org/geysermc/floodgate/command/util/PermissionDefault.java index 2f51f1f9..a98e1e89 100644 --- a/core/src/main/java/org/geysermc/floodgate/util/Permissions.java +++ b/core/src/main/java/org/geysermc/floodgate/command/util/PermissionDefault.java @@ -23,23 +23,8 @@ * @link https://github.com/GeyserMC/Floodgate */ -package org.geysermc.floodgate.util; +package org.geysermc.floodgate.command.util; -public enum Permissions { - COMMAND_MAIN("floodgate.command.floodgate"), - COMMAND_LINK("floodgate.command.linkaccount"), - COMMAND_UNLINK("floodgate.command.unlinkaccount"), - COMMAND_WHITELIST("floodgate.command.fwhitelist"), - - NEWS_RECEIVE("floodgate.news.receive"); - - private final String permission; - - Permissions(String permission) { - this.permission = permission; - } - - public String get() { - return permission; - } +public enum PermissionDefault { + TRUE, FALSE, OP, NOT_OP } diff --git a/core/src/main/resources/languages b/core/src/main/resources/languages new file mode 160000 index 00000000..38cb4a52 --- /dev/null +++ b/core/src/main/resources/languages @@ -0,0 +1 @@ +Subproject commit 38cb4a52df713cb0bc1738370aa8135c01f0cabc