From 466d6207f7261c6fc1f08aeed382c181ba79e8d9 Mon Sep 17 00:00:00 2001 From: Ceikry Date: Mon, 18 Jul 2022 12:15:37 +0000 Subject: [PATCH] Fixed exploit with command privileges --- Server/src/main/kotlin/api/Commands.kt | 2 +- Server/src/main/kotlin/rs09/game/content/global/shops/Shops.kt | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Server/src/main/kotlin/api/Commands.kt b/Server/src/main/kotlin/api/Commands.kt index 7225c3365..656919a70 100644 --- a/Server/src/main/kotlin/api/Commands.kt +++ b/Server/src/main/kotlin/api/Commands.kt @@ -41,7 +41,7 @@ interface Commands : ContentInterface { * @param name the name of the command. Example: ::example would be just "example" * @param privilege the rights level needed to execute the command. Options are [Privilege.STANDARD], [Privilege.MODERATOR], [Privilege.ADMIN]. Defaults to [Privilege.STANDARD] */ - fun define(name: String, privilege: Privilege = Privilege.STANDARD, usage: String = "", description: String = "", handle: (Player, Array) -> Unit){ + fun define(name: String, privilege: Privilege = Privilege.ADMIN, usage: String = "", description: String = "", handle: (Player, Array) -> Unit){ CommandMapping.register(Command(name, privilege, usage, description, handle)) } diff --git a/Server/src/main/kotlin/rs09/game/content/global/shops/Shops.kt b/Server/src/main/kotlin/rs09/game/content/global/shops/Shops.kt index 4fee8fc9a..48429e103 100644 --- a/Server/src/main/kotlin/rs09/game/content/global/shops/Shops.kt +++ b/Server/src/main/kotlin/rs09/game/content/global/shops/Shops.kt @@ -15,6 +15,7 @@ import rs09.ServerConstants import rs09.game.interaction.InteractionListener import rs09.game.interaction.InterfaceListener import rs09.game.system.SystemLogger +import rs09.game.system.command.Privilege import rs09.tools.END_DIALOGUE import java.io.FileReader @@ -256,7 +257,7 @@ class Shops : StartupListener, TickListener, InteractionListener, InterfaceListe } override fun defineCommands() { - define("openshop") { player, args -> + define("openshop", Privilege.ADMIN) { player, args -> if(args.size < 2) reject(player, "Usage: ::openshop shopId") val shopId = args[1].toInt() shopsById[shopId]?.openFor(player)