From bb7776b0658ac765aa64c9e8ba11a6b815493d00 Mon Sep 17 00:00:00 2001 From: GeorgH93 Date: Tue, 24 Oct 2023 21:57:11 +0200 Subject: [PATCH] Allow to spawn backpack for others --- .../Minepacks/Bukkit/Command/ShortcutCommand.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Command/ShortcutCommand.java b/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Command/ShortcutCommand.java index aa3963a..664203d 100644 --- a/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Command/ShortcutCommand.java +++ b/Minepacks/src/at/pcgamingfreaks/Minepacks/Bukkit/Command/ShortcutCommand.java @@ -23,6 +23,7 @@ import at.pcgamingfreaks.Minepacks.Bukkit.Minepacks; import at.pcgamingfreaks.Minepacks.Bukkit.Permissions; +import org.bukkit.Bukkit; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; @@ -43,7 +44,15 @@ public ShortcutCommand(Minepacks plugin, final @NotNull ItemShortcut itemShortcu @Override public void execute(@NotNull CommandSender sender, @NotNull String mainCommandAlias, @NotNull String alias, @NotNull String[] args) { - itemShortcut.addItem((Player) sender); + if (args.length == 1 && sender.hasPermission(Permissions.OTHERS)) + { + Player p = Bukkit.getPlayer(args[0]); + if (p != null && p.hasPermission(Permissions.USE)) itemShortcut.addItem(p); + } + else + { + itemShortcut.addItem((Player) sender); + } } @Override