Makes sure only the owner and players with stargate.admin.dye can dye stargate signs

This commit is contained in:
Kristian Knarvik 2022-01-26 14:57:15 +01:00
parent 4cae54e46f
commit 071f1895de
2 changed files with 8 additions and 3 deletions

View File

@ -222,9 +222,10 @@ public class PlayerEventListener implements Listener {
return;
}
//Allow players to apply dye to signs
//Allow players with permissions to apply dye to signs
EquipmentSlot hand = event.getHand();
if (hand != null) {
if (hand != null && (PermissionHelper.hasPermission(player, "stargate.admin.dye") ||
portal.isOwner(player))) {
String itemName = player.getInventory().getItem(hand).getType().toString();
if (itemName.endsWith("DYE") || itemName.endsWith("INK_SAC")) {
event.setUseInteractedBlock(Event.Result.ALLOW);

View File

@ -141,6 +141,9 @@ permissions:
stargate.admin.config:
description: Allows the player to change config values from the chat
default: false
stargate.admin.dye:
description: Allows this player to change the dye of any stargate's sign
default: false
stargate.server:
description: Allows the creation of a BungeeCord stargate going to any server
default: false
@ -152,4 +155,5 @@ permissions:
stargate.admin.hidden: true
stargate.admin.private: true
stargate.admin.bungee: true
stargate.admin.config: true
stargate.admin.config: true
stargate.admin.dye: true