diff --git a/build.gradle b/build.gradle index 560ace9..fecdbbb 100644 --- a/build.gradle +++ b/build.gradle @@ -22,6 +22,12 @@ group = mod_group_id repositories { mavenLocal() + maven { + url "https://cursemaven.com" + content { + includeGroup "curse.maven" + } + } } base { @@ -134,6 +140,8 @@ dependencies { // For more info: // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html // http://www.gradle.org/docs/current/userguide/dependency_management.html + + implementation "curse.maven:luckperms-431733:${luckperms_version}" } diff --git a/gradle.properties b/gradle.properties index 5a7459b..4f71f36 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,13 +13,13 @@ parchment_mappings_version=2024.07.28 ## Environment Properties # You can find the latest versions here: https://projects.neoforged.net/neoforged/neoforge # The Minecraft version must agree with the Neo version to get a valid artifact -minecraft_version=1.21 +minecraft_version=1.21.1 # The Minecraft version range can use any release version of Minecraft as bounds. # Snapshots, pre-releases, and release candidates are not guaranteed to sort properly # as they do not follow standard versioning conventions. -minecraft_version_range=[1.21,1.21.1) +minecraft_version_range=[1.21.1,1.21.4) # The Neo version must agree with the Minecraft version to get a valid artifact -neo_version=21.0.167 +neo_version=21.1.115 # The Neo version range can use any version of Neo as bounds neo_version_range=[21.0.0-beta,) # The loader version range can only use the major version of FML as bounds @@ -47,3 +47,5 @@ mod_description=A reimplementation of some of the features of the old Essentials issue_tracker_url=https://github.com/OblivionMC/bare-essentials/issues update_json_url=https://raw.githubusercontent.com/OblivionMC/bare-essentials/dev/update.json display_url=https://curseforge.com/minecraft/mc-mods/bare-essentials + +luckperms_version=5654227 diff --git a/settings.gradle b/settings.gradle index ada876e..a9158ec 100644 --- a/settings.gradle +++ b/settings.gradle @@ -3,7 +3,9 @@ pluginManagement { mavenLocal() gradlePluginPortal() maven { url = 'https://maven.neoforged.net/releases' } + } + } plugins { diff --git a/src/main/java/uk/gemwire/bareessentials/BareEssentials.java b/src/main/java/uk/gemwire/bareessentials/BareEssentials.java index 1c9f84e..74aafce 100644 --- a/src/main/java/uk/gemwire/bareessentials/BareEssentials.java +++ b/src/main/java/uk/gemwire/bareessentials/BareEssentials.java @@ -1,7 +1,7 @@ /* * MIT License * Bare Essentials - https://github.com/OblivionMC/bare-essentials/ - * Copyright (C) 2022-2023 Curle + * Copyright (C) 2022-2025 Curle * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -23,6 +23,7 @@ */ package uk.gemwire.bareessentials; +import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.level.GameRules; import net.neoforged.bus.api.IEventBus; @@ -33,15 +34,78 @@ import net.neoforged.neoforge.event.entity.player.PlayerEvent; import net.neoforged.neoforge.event.server.ServerStartedEvent; import net.neoforged.neoforge.event.tick.ServerTickEvent; +import net.neoforged.neoforge.server.permission.PermissionAPI; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import uk.gemwire.bareessentials.commands.BareCommands; +import uk.gemwire.bareessentials.commands.PermissionNodes; import uk.gemwire.bareessentials.data.Bank; import uk.gemwire.bareessentials.data.Homes; + +/** + * Provides the following commands + * + * For OP: + * setspawn + * editsign set/clear + * repair + * tp random/all/offline/toggle/here + * bank set/value set + * speed + * move top/up/down/bottom/forward + * editbook title/author/name/text + * more + * sleep + * warp set/remove + * break + * broadcast + * lightning + * invsee ender + * enchant + * fly + * vanish + * pos + * god + * infinite + * item lore/name + * burn + * xp get/set/give + * feed + * heal + * kittycannon + * beezooka + * tempban + * tempbanip + * unbanip + * + * + * For players: + * bank get/value get/top/pay get/offer/toggle/accept/deny + * nick set/get + * whois + * condense + * mail read/clear/send/sendtemp + * home set/get/goto + * warp list/goto + * near + * tp back/deny/accept auto/ask cancel + * seen + * pos + * ping + * afk + * list + * r/reply + * playtime + * spawn + */ + @Mod("bareessentials") public class BareEssentials { + // Bank is enabled by default, but we'll set it off if we recognize an economy mod loading alongside us *cough* OblivionEconomy + public static GameRules.Key BANK_ENABLED = GameRules.register("be.bankEnabled", GameRules.Category.PLAYER, GameRules.BooleanValue.create(true)); + public static GameRules.Key CURRENCY_SYMBOL = GameRules.register("be.currencySymbol", GameRules.Category.CHAT, GameRules.IntegerValue.create(0)); public static GameRules.Key STARTING_BALANCE = GameRules.register("be.bankStartingBalance", GameRules.Category.PLAYER, GameRules.IntegerValue.create(500)); public static GameRules.Key DAILY_INCOME = GameRules.register("be.bankDailyIncome", GameRules.Category.PLAYER, GameRules.IntegerValue.create(10)); @@ -59,6 +123,7 @@ public class BareEssentials { public BareEssentials() { IEventBus forge = NeoForge.EVENT_BUS; forge.addListener(BareCommands::registerCommands); + forge.addListener(PermissionNodes::registerPermissions); } @EventBusSubscriber(modid = "bareessentials", bus = EventBusSubscriber.Bus.MOD) @@ -68,6 +133,7 @@ public static void started(ServerStartedEvent e) { // Load bank details into the static map. Bank accts = Bank.getOrCreate(e.getServer().overworld()); LOGGER.info("Loaded " + accts.accounts.size() + " bank accounts."); + Homes homes = Homes.getOrCreate(e.getServer().overworld()); LOGGER.info("Loaded " + homes.homes.size() + " user homes."); } diff --git a/src/main/java/uk/gemwire/bareessentials/commands/BareCommands.java b/src/main/java/uk/gemwire/bareessentials/commands/BareCommands.java index d6b91ec..596825a 100644 --- a/src/main/java/uk/gemwire/bareessentials/commands/BareCommands.java +++ b/src/main/java/uk/gemwire/bareessentials/commands/BareCommands.java @@ -1,7 +1,7 @@ /* * MIT License * Bare Essentials - https://github.com/OblivionMC/bare-essentials/ - * Copyright (C) 2022-2023 Curle + * Copyright (C) 2022-2025 Curle * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -25,31 +25,54 @@ import com.mojang.brigadier.arguments.IntegerArgumentType; import com.mojang.brigadier.arguments.StringArgumentType; +import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; import net.minecraft.commands.arguments.EntityArgument; import net.minecraft.core.BlockPos; import net.neoforged.neoforge.event.RegisterCommandsEvent; +import net.neoforged.neoforge.server.permission.PermissionAPI; +import net.neoforged.neoforge.server.permission.nodes.PermissionDynamicContext; +import net.neoforged.neoforge.server.permission.nodes.PermissionDynamicContextKey; +import net.neoforged.neoforge.server.permission.nodes.PermissionNode; import uk.gemwire.bareessentials.invsee.Inventory; +import java.util.Arrays; +import java.util.function.Consumer; +import java.util.function.Predicate; + import static net.minecraft.commands.Commands.LEVEL_ADMINS; import static net.minecraft.commands.Commands.literal; public class BareCommands { + private static Predicate hasPermissionNode(PermissionNode... node) { + return (CommandSourceStack s) -> !s.isPlayer() || Arrays.stream(node).allMatch(p -> PermissionAPI.getPermission(s.getPlayer(), p, null)); + } + public static void registerCommands(RegisterCommandsEvent event) { event.getDispatcher().register( - literal("setspawn") - .requires(s -> s.hasPermission(Commands.LEVEL_ADMINS)) - .executes((s) -> CmdSetWorldSpawn.execute(s.getSource(), - BlockPos.containing(s.getSource().getPosition()), 0.0F)) + literal("spawn") + .then(Commands.literal("set") + .requires(hasPermissionNode(PermissionNodes.SPAWN_SET)) + .executes((s) -> CmdSetWorldSpawn.execute(s.getSource(), + BlockPos.containing(s.getSource().getPosition()), 0.0F)) + ) + .then(Commands.literal("find") + .requires(hasPermissionNode(PermissionNodes.SPAWN_FIND)) + .executes(s -> CmdSpawnFind.execute(s.getSource())) + ) + .requires(hasPermissionNode(PermissionNodes.SPAWN_GOTO)) + .executes((s) -> CmdSpawn.execute(s.getSource())) ); event.getDispatcher().register( literal("tpa") .then(Commands.argument("user", EntityArgument.player()) + .requires(hasPermissionNode(PermissionNodes.TPA)) .executes(CmdTeleportRequest::tpa) ) .then(Commands.literal("accept") + .requires(hasPermissionNode(PermissionNodes.TPA_ACCEPT)) .executes(CmdTeleportRequest::accept) ) .then(Commands.literal("deny") @@ -64,10 +87,6 @@ public static void registerCommands(RegisterCommandsEvent event) { ) ); - event.getDispatcher().register( - literal("spawn") - .executes((s) -> CmdSpawn.execute(s.getSource())) - ); event.getDispatcher().register( literal("fly") diff --git a/src/main/java/uk/gemwire/bareessentials/commands/CmdSpawn.java b/src/main/java/uk/gemwire/bareessentials/commands/CmdSpawn.java index 53dbd2e..fd0c03d 100644 --- a/src/main/java/uk/gemwire/bareessentials/commands/CmdSpawn.java +++ b/src/main/java/uk/gemwire/bareessentials/commands/CmdSpawn.java @@ -1,7 +1,7 @@ /* * MIT License * Bare Essentials - https://github.com/OblivionMC/bare-essentials/ - * Copyright (C) 2022-2023 Curle + * Copyright (C) 2022-2025 Curle * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -35,10 +35,9 @@ public class CmdSpawn { - //TODO Check for lava or things that can cause harm public static int execute(CommandSourceStack player) { - ServerLevel level = player.getServer().getLevel(Level.OVERWORLD); if (player.getPlayer() != null) { + ServerLevel level = player.getServer().getLevel(Level.OVERWORLD); if (level == null) { return 0; } @@ -47,7 +46,7 @@ public static int execute(CommandSourceStack player) { Bank bk = Bank.getOrCreate(level); if (cd.isCooldownExpired(player.getPlayer(), "spawn")) { - if (!bk.chargePlayer(player.getPlayer(), level.getGameRules().getInt(BareEssentials.SPAWN_COST))) + if (!bk.playerHasEnough(player.getPlayer(), level.getGameRules().getInt(BareEssentials.SPAWN_COST))) return 0; player.sendSystemMessage(Component.translatable(Language.getInstance() .getOrDefault("bareessentials.spawn.tospawn"))); @@ -55,6 +54,7 @@ public static int execute(CommandSourceStack player) { if (!player.getPlayer().randomTeleport(level.getSharedSpawnPos().getX() + 0.5, level.getSharedSpawnPos().getY(), level.getSharedSpawnPos().getZ() + 0.5, false)) player.sendSystemMessage(Component.translatable(Language.getInstance().getOrDefault("bareessentials.teleport.unsafe"))); + bk.chargePlayer(player.getPlayer(), level.getGameRules().getInt(BareEssentials.SPAWN_COST)); cd.setCooldownFor(player.getPlayer(), "spawn", level.getGameTime() + player.getLevel().getGameRules().getInt(BareEssentials.SPAWN_COOLDOWN)); } else { player.sendSystemMessage(Component.translatable(Language.getInstance().getOrDefault("bareessentials.cooldown.active"), cd.getRemainingTimeFor(player.getPlayer(), "spawn")/20)); diff --git a/src/main/java/uk/gemwire/bareessentials/commands/PermissionNodes.java b/src/main/java/uk/gemwire/bareessentials/commands/PermissionNodes.java new file mode 100644 index 0000000..50d7076 --- /dev/null +++ b/src/main/java/uk/gemwire/bareessentials/commands/PermissionNodes.java @@ -0,0 +1,274 @@ +package uk.gemwire.bareessentials.commands; + +import net.minecraft.commands.Commands; +import net.neoforged.neoforge.server.permission.events.PermissionGatherEvent; +import net.neoforged.neoforge.server.permission.nodes.PermissionNode; +import net.neoforged.neoforge.server.permission.nodes.PermissionTypes; + +public class PermissionNodes { + + private static final String MODID = "bareessentials"; + + public static final PermissionNode REPAIR = new PermissionNode<>(MODID, "cmd.repair", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_GAMEMASTERS)); + public static final PermissionNode REPAIR_OTHERS = new PermissionNode<>(MODID, "cmd.repair.others", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_GAMEMASTERS)); + public static final PermissionNode SPEED = new PermissionNode<>(MODID, "cmd.speed", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_GAMEMASTERS)); + public static final PermissionNode MORE = new PermissionNode<>(MODID, "cmd.more", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_GAMEMASTERS)); + public static final PermissionNode SLEEP = new PermissionNode<>(MODID, "cmd.sleep", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_GAMEMASTERS)); + public static final PermissionNode SLEEP_OTHERS = new PermissionNode<>(MODID, "cmd.sleep.others", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_GAMEMASTERS)); + public static final PermissionNode BREAK = new PermissionNode<>(MODID, "cmd.break", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_GAMEMASTERS)); + public static final PermissionNode BROADCAST = new PermissionNode<>(MODID, "cmd.broadcast", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_GAMEMASTERS)); + public static final PermissionNode LIGHTNING = new PermissionNode<>(MODID, "cmd.lightning", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_GAMEMASTERS)); + public static final PermissionNode ENCHANT = new PermissionNode<>(MODID, "cmd.enchant", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_GAMEMASTERS)); + public static final PermissionNode FLY = new PermissionNode<>(MODID, "cmd.fly", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_GAMEMASTERS)); + public static final PermissionNode FLY_OTHERS = new PermissionNode<>(MODID, "cmd.fly.others", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_GAMEMASTERS)); + public static final PermissionNode VANISH = new PermissionNode<>(MODID, "cmd.vanish", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_GAMEMASTERS)); + public static final PermissionNode POS_OTHERS = new PermissionNode<>(MODID, "cmd.pos.others", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_GAMEMASTERS)); + public static final PermissionNode GOD = new PermissionNode<>(MODID, "cmd.god", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_GAMEMASTERS)); + public static final PermissionNode GOD_OTHERS = new PermissionNode<>(MODID, "cmd.god.others", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_GAMEMASTERS)); + + public static final PermissionNode INFINITE = new PermissionNode<>(MODID, "cmd.infinite", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_GAMEMASTERS)); + public static final PermissionNode BURN = new PermissionNode<>(MODID, "cmd.burn", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_GAMEMASTERS)); + public static final PermissionNode BURN_OTHERS = new PermissionNode<>(MODID, "cmd.burn.others", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_GAMEMASTERS)); + public static final PermissionNode FEED = new PermissionNode<>(MODID, "cmd.feed", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_GAMEMASTERS)); + public static final PermissionNode FEED_OTHERS = new PermissionNode<>(MODID, "cmd.feed.others", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_GAMEMASTERS)); + public static final PermissionNode HEAL = new PermissionNode<>(MODID, "cmd.heal", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_GAMEMASTERS)); + public static final PermissionNode HEAL_OTHERS = new PermissionNode<>(MODID, "cmd.heal.others", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_GAMEMASTERS)); + public static final PermissionNode KITTYCANNON = new PermissionNode<>(MODID, "cmd.fun.kittycannon", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_GAMEMASTERS)); + public static final PermissionNode BEEZOOKA = new PermissionNode<>(MODID, "cmd.fun.beezooka", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_GAMEMASTERS)); + public static final PermissionNode TEMPBAN = new PermissionNode<>(MODID, "cmd.ban.temp", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_GAMEMASTERS)); + public static final PermissionNode TEMPBAN_IP = new PermissionNode<>(MODID, "cmd.ban.ip.temp", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_GAMEMASTERS)); + public static final PermissionNode BAN_IP = new PermissionNode<>(MODID, "cmd.ban.ip", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_GAMEMASTERS)); + public static final PermissionNode UNBAN_IP = new PermissionNode<>(MODID, "cmd.unban.ip", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_GAMEMASTERS)); + public static final PermissionNode EDITSIGN = new PermissionNode<>(MODID, "cmd.editsign", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_GAMEMASTERS)); + public static final PermissionNode EDITSIGN_SET = new PermissionNode<>(MODID, "cmd.editsign.setcontent", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_GAMEMASTERS)); + public static final PermissionNode EDITSIGH_CLEAR = new PermissionNode<>(MODID, "cmd.editsign.clearcontent", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_GAMEMASTERS)); + public static final PermissionNode TP_SELF = new PermissionNode<>(MODID, "cmd.tp.self", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_GAMEMASTERS)); + public static final PermissionNode TP_OTHERS = new PermissionNode<>(MODID, "cmd.tp.others", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_GAMEMASTERS)); + public static final PermissionNode TP_RANDOM = new PermissionNode<>(MODID, "cmd.tp.random", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_GAMEMASTERS)); + public static final PermissionNode TP_ALL = new PermissionNode<>(MODID, "cmd.tp.all", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_GAMEMASTERS)); + public static final PermissionNode TP_OFFLINE = new PermissionNode<>(MODID, "cmd.tp.offline_players", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_GAMEMASTERS)); + public static final PermissionNode TP_HERE = new PermissionNode<>(MODID, "cmd.tp.here", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_GAMEMASTERS)); + public static final PermissionNode BANK_SET = new PermissionNode<>(MODID, "cmd.bank.account.set", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_GAMEMASTERS)); + public static final PermissionNode BANK_CLEAR = new PermissionNode<>(MODID, "cmd.bank.account.clear", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_GAMEMASTERS)); + public static final PermissionNode BANK_VALUE_SET = new PermissionNode<>(MODID, "cmd.bank.value.set", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_GAMEMASTERS)); + public static final PermissionNode BANK_VALUE_CLEAR = new PermissionNode<>(MODID, "cmd.bank.value.clear", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_GAMEMASTERS)); + public static final PermissionNode MOVE = new PermissionNode<>(MODID, "cmd.move", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_GAMEMASTERS)); + public static final PermissionNode MOVE_TOP = new PermissionNode<>(MODID, "cmd.move.top", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_GAMEMASTERS)); + public static final PermissionNode MOVE_UP = new PermissionNode<>(MODID, "cmd.move.up", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_GAMEMASTERS)); + public static final PermissionNode MOVE_DOWN = new PermissionNode<>(MODID, "cmd.move.down", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_GAMEMASTERS)); + public static final PermissionNode MOVE_BOTTOM = new PermissionNode<>(MODID, "cmd.move.bottom", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_GAMEMASTERS)); + public static final PermissionNode MOVE_FORWARD = new PermissionNode<>(MODID, "cmd.move.forward", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_GAMEMASTERS)); + public static final PermissionNode EDITBOOK = new PermissionNode<>(MODID, "cmd.editbook", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_GAMEMASTERS)); + public static final PermissionNode EDITBOOK_TITLE = new PermissionNode<>(MODID, "cmd.editbook.title", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_GAMEMASTERS)); + public static final PermissionNode EDITBOOK_AUTHOR = new PermissionNode<>(MODID, "cmd.editbook.author", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_GAMEMASTERS)); + public static final PermissionNode EDITBOOK_TEXT = new PermissionNode<>(MODID, "cmd.editbook.text", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_GAMEMASTERS)); + public static final PermissionNode WARP = new PermissionNode<>(MODID, "cmd.warp", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_GAMEMASTERS)); + public static final PermissionNode WARP_SET = new PermissionNode<>(MODID, "cmd.warp.set", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_GAMEMASTERS)); + public static final PermissionNode WARP_REMOVE = new PermissionNode<>(MODID, "cmd.warp.remove", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_GAMEMASTERS)); + public static final PermissionNode INVSEE = new PermissionNode<>(MODID, "cmd.invsee", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_GAMEMASTERS)); + public static final PermissionNode INVSEE_ENDER = new PermissionNode<>(MODID, "cmd.invsee.ender", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_GAMEMASTERS)); + public static final PermissionNode ITEM_LORE = new PermissionNode<>(MODID, "cmd.item.lore", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_GAMEMASTERS)); + public static final PermissionNode ITEM_NAME = new PermissionNode<>(MODID, "cmd.item.name", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_GAMEMASTERS)); + public static final PermissionNode ITEM_GIVE = new PermissionNode<>(MODID, "cmd.item.give", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_GAMEMASTERS)); + public static final PermissionNode XP = new PermissionNode<>(MODID, "cmd.xp", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_GAMEMASTERS)); + public static final PermissionNode XP_SET = new PermissionNode<>(MODID, "cmd.xp.set", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_GAMEMASTERS)); + public static final PermissionNode XP_GIVE = new PermissionNode<>(MODID, "cmd.xp.give", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_GAMEMASTERS)); + public static final PermissionNode XP_CLEAR = new PermissionNode<>(MODID, "cmd.xp.clear", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_GAMEMASTERS)); + public static final PermissionNode SPAWN_SET = new PermissionNode<>(MODID, "cmd.spawn.set", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_GAMEMASTERS)); + + public static final PermissionNode BANK = new PermissionNode<>(MODID, "cmd.bank", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_ALL)); + public static final PermissionNode LIST = new PermissionNode<>(MODID, "cmd.list", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_ALL)); + public static final PermissionNode BANK_GET = new PermissionNode<>(MODID, "cmd.bank.account.get", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_ALL)); + public static final PermissionNode BANK_VALUE_GET = new PermissionNode<>(MODID, "cmd.bank.value.get", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_ALL)); + public static final PermissionNode BANK_TOP = new PermissionNode<>(MODID, "cmd.bank.top", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_ALL)); + public static final PermissionNode BANK_PAY = new PermissionNode<>(MODID, "cmd.bank.pay", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_ALL)); + public static final PermissionNode BANK_OFFER = new PermissionNode<>(MODID, "cmd.bank.pay.offer", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_ALL)); + public static final PermissionNode BANK_OFFER_TOGGLE = new PermissionNode<>(MODID, "cmd.bank.pay.offer.toggle", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_ALL)); + public static final PermissionNode BANK_OFFER_ACCEPT = new PermissionNode<>(MODID, "cmd.bank.pay.offer.accept", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_ALL)); + public static final PermissionNode BANK_OFFER_DENY = new PermissionNode<>(MODID, "cmd.bank.pay.offer.deny", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_ALL)); + public static final PermissionNode NICK = new PermissionNode<>(MODID, "cmd.nick", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_ALL)); + public static final PermissionNode NICK_SET = new PermissionNode<>(MODID, "cmd.nick.set", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_ALL)); + public static final PermissionNode NICK_SET_OTHERS = new PermissionNode<>(MODID, "cmd.nick.set.others", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_ALL)); + public static final PermissionNode WHOIS = new PermissionNode<>(MODID, "cmd.whois", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_ALL)); + public static final PermissionNode MAIL = new PermissionNode<>(MODID, "cmd.mail", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_ALL)); + public static final PermissionNode MAIL_READ = new PermissionNode<>(MODID, "cmd.mail.read", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_ALL)); + public static final PermissionNode MAIL_CLEAR = new PermissionNode<>(MODID, "cmd.mail.clear", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_ALL)); + public static final PermissionNode MAIL_SEND = new PermissionNode<>(MODID, "cmd.mail.send", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_ALL)); + public static final PermissionNode MAIL_SEND_TEMPORARY = new PermissionNode<>(MODID, "cmd.mail.send.temporary", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_ALL)); + public static final PermissionNode HOME = new PermissionNode<>(MODID, "cmd.home", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_ALL)); + public static final PermissionNode HOME_SET = new PermissionNode<>(MODID, "cmd.home.set", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_ALL)); + public static final PermissionNode HOME_GET = new PermissionNode<>(MODID, "cmd.home.get", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_ALL)); + public static final PermissionNode HOME_GOTO = new PermissionNode<>(MODID, "cmd.home.goto", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_ALL)); + public static final PermissionNode WARP_LIST = new PermissionNode<>(MODID, "cmd.warp.list", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_ALL)); + public static final PermissionNode WARP_GOTO = new PermissionNode<>(MODID, "cmd.warp.goto", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_ALL)); + public static final PermissionNode NEAR = new PermissionNode<>(MODID, "cmd.near", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_ALL)); + public static final PermissionNode TP_BACK = new PermissionNode<>(MODID, "cmd.tp.back", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_ALL)); + public static final PermissionNode TPA = new PermissionNode<>(MODID, "cmd.tpa", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_ALL)); + public static final PermissionNode TPA_DENY = new PermissionNode<>(MODID, "cmd.tpa.deny", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_ALL)); + public static final PermissionNode TPA_ACCEPT = new PermissionNode<>(MODID, "cmd.tpa.accept", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_ALL)); + public static final PermissionNode TPA_ACCEPT_AUTO = new PermissionNode<>(MODID, "cmd.tpa.toggle", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_ALL)); + public static final PermissionNode TPA_CANCEL = new PermissionNode<>(MODID, "cmd.tpa.cancel", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_ALL)); + public static final PermissionNode SEEN = new PermissionNode<>(MODID, "cmd.seen", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_ALL)); + public static final PermissionNode POS = new PermissionNode<>(MODID, "cmd.pos.self", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_ALL)); + public static final PermissionNode PING = new PermissionNode<>(MODID, "cmd.ping", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_ALL)); + public static final PermissionNode AFK = new PermissionNode<>(MODID, "cmd.afk", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_ALL)); + public static final PermissionNode REPLY = new PermissionNode<>(MODID, "cmd.reply", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_ALL)); + public static final PermissionNode PLAYTIME = new PermissionNode<>(MODID, "cmd.playtime", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_ALL)); + public static final PermissionNode PLAYTIME_OTHERS = new PermissionNode<>(MODID, "cmd.playtime.others", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_ALL)); + public static final PermissionNode SPAWN_FIND = new PermissionNode<>(MODID, "cmd.spawn.get", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_ALL)); + public static final PermissionNode SPAWN_GOTO = new PermissionNode<>(MODID, "cmd.spawn.goto", + PermissionTypes.BOOLEAN, (player, uuid, contexts) -> player != null && player.hasPermissions(Commands.LEVEL_ALL)); + + + public static void registerPermissions(PermissionGatherEvent.Nodes event) { + event.addNodes( + REPAIR, REPAIR_OTHERS, + SPEED, + MORE, + SLEEP, SLEEP_OTHERS, + BREAK, + BROADCAST, + LIGHTNING, + ENCHANT, + FLY, FLY_OTHERS, + GOD, GOD_OTHERS, + VANISH, + INFINITE, + BURN, BURN_OTHERS, + FEED, FEED_OTHERS, + HEAL, HEAL_OTHERS, + POS, POS_OTHERS, + KITTYCANNON, + BEEZOOKA, + TEMPBAN, TEMPBAN_IP, + BAN_IP, UNBAN_IP, + EDITSIGN, EDITSIGN_SET, EDITSIGH_CLEAR, + EDITBOOK, EDITBOOK_AUTHOR, EDITBOOK_TITLE, EDITBOOK_TEXT, + TP_SELF, TP_OTHERS, TP_ALL, TP_RANDOM, TP_HERE, TP_OFFLINE, + TP_BACK, TPA, TPA_ACCEPT, TPA_ACCEPT_AUTO, TPA_DENY, TPA_CANCEL, + BANK, BANK_GET, BANK_VALUE_GET, BANK_PAY, BANK_OFFER, BANK_OFFER_ACCEPT, BANK_OFFER_DENY, BANK_OFFER_TOGGLE, BANK_TOP, + BANK_SET, BANK_VALUE_SET, BANK_VALUE_CLEAR, BANK_CLEAR, + LIST, + NEAR, + NICK, NICK_SET, NICK_SET_OTHERS, WHOIS, + MAIL, MAIL_READ, MAIL_SEND, MAIL_SEND_TEMPORARY, MAIL_CLEAR, + HOME, HOME_SET, HOME_GET, HOME_GOTO, + WARP, WARP_LIST, WARP_SET, WARP_GOTO, WARP_REMOVE, + SEEN, + PING, + AFK, + REPLY, + PLAYTIME, PLAYTIME_OTHERS, + SPAWN_FIND, SPAWN_GOTO, SPAWN_SET, + INVSEE, INVSEE_ENDER, + ITEM_GIVE, ITEM_LORE, ITEM_NAME, + XP, XP_SET, XP_GIVE, XP_CLEAR, + MOVE, MOVE_BOTTOM, MOVE_DOWN, MOVE_UP, MOVE_TOP, MOVE_FORWARD + ); + } +}