From e28fb4901504141f92caeb2ef1a69172a59bc7b8 Mon Sep 17 00:00:00 2001 From: N0tMyFaultOG Date: Thu, 8 Oct 2020 19:27:05 +0200 Subject: [PATCH] Add override permission for `/plot music` --- Bukkit/src/main/resources/plugin.yml | 2 ++ .../src/main/java/com/plotsquared/core/command/Music.java | 8 ++++++-- .../java/com/plotsquared/core/permissions/Permission.java | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Bukkit/src/main/resources/plugin.yml b/Bukkit/src/main/resources/plugin.yml index 9db0f1518..91579acdb 100644 --- a/Bukkit/src/main/resources/plugin.yml +++ b/Bukkit/src/main/resources/plugin.yml @@ -214,6 +214,8 @@ permissions: default: false plots.admin.caps.other: default: false + plots.admin.music.other: + default: false plots.admin.destroy.unowned: default: false plots.admin.destroy.groundlevel: diff --git a/Core/src/main/java/com/plotsquared/core/command/Music.java b/Core/src/main/java/com/plotsquared/core/command/Music.java index ffab80dcf..88dd7335f 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Music.java +++ b/Core/src/main/java/com/plotsquared/core/command/Music.java @@ -38,6 +38,7 @@ import com.plotsquared.core.plot.PlotItemStack; import com.plotsquared.core.plot.flag.PlotFlag; import com.plotsquared.core.plot.flag.implementations.MusicFlag; import com.plotsquared.core.util.InventoryUtil; +import com.plotsquared.core.util.Permissions; import com.sk89q.worldedit.world.item.ItemTypes; import net.kyori.adventure.text.minimessage.Template; @@ -71,8 +72,11 @@ public class Music extends SubCommand { player.sendMessage(TranslatableCaption.of("errors.not_in_plot")); return false; } - if (!plot.isAdded(player.getUUID())) { - player.sendMessage(TranslatableCaption.of("permission.no_plot_perms")); + if (!plot.isAdded(player.getUUID()) &&!Permissions + .hasPermission(player, "plots.admin.music.other")) { + player.sendMessage( + TranslatableCaption.of("permission.no_permission"), + Template.of("node", "plots.admin.music.other")); return true; } PlotInventory inv = new PlotInventory(this.inventoryUtil, player, 2, "Plot Jukebox") { diff --git a/Core/src/main/java/com/plotsquared/core/permissions/Permission.java b/Core/src/main/java/com/plotsquared/core/permissions/Permission.java index 27aa9fce8..dc8604c60 100644 --- a/Core/src/main/java/com/plotsquared/core/permissions/Permission.java +++ b/Core/src/main/java/com/plotsquared/core/permissions/Permission.java @@ -53,6 +53,7 @@ public enum Permission { PERMISSION_MERGE_OTHER("plots.merge.other"), PERMISSION_MERGE_KEEP_ROAD("plots.merge.keeproad"), PERMISSION_ADMIN_CAPS_OTHER("plots.admin.caps.other"), + PERMISSION_ADMIN_MUSIC_OTHER("plots.admin.music.other"), PERMISSION_ADMIN_DESTROY_UNOWNED("plots.admin.destroy.unowned"), PERMISSION_ADMIN_DESTROY_GROUNDLEVEL("plots.admin.destroy.groundlevel"), PERMISSION_ADMIN_DESTROY_OTHER("plots.admin.destroy.other"),