Skip to content

Commit

Permalink
Allow to spawn backpack for others
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgH93 committed Oct 24, 2023
1 parent 0fc18ac commit bb7776b
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down

0 comments on commit bb7776b

Please sign in to comment.