mirror of
https://github.com/GeorgH93/Minepacks.git
synced 2025-01-08 19:38:17 +01:00
Allow to spawn backpack for others
This commit is contained in:
parent
0fc18aca2b
commit
bb7776b065
@ -23,6 +23,7 @@
|
|||||||
import at.pcgamingfreaks.Minepacks.Bukkit.Minepacks;
|
import at.pcgamingfreaks.Minepacks.Bukkit.Minepacks;
|
||||||
import at.pcgamingfreaks.Minepacks.Bukkit.Permissions;
|
import at.pcgamingfreaks.Minepacks.Bukkit.Permissions;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@ -42,9 +43,17 @@ public ShortcutCommand(Minepacks plugin, final @NotNull ItemShortcut itemShortcu
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(@NotNull CommandSender sender, @NotNull String mainCommandAlias, @NotNull String alias, @NotNull String[] args)
|
public void execute(@NotNull CommandSender sender, @NotNull String mainCommandAlias, @NotNull String alias, @NotNull String[] args)
|
||||||
|
{
|
||||||
|
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);
|
itemShortcut.addItem((Player) sender);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> tabComplete(@NotNull CommandSender sender, @NotNull String mainCommandAlias, @NotNull String alias, @NotNull String[] args)
|
public List<String> tabComplete(@NotNull CommandSender sender, @NotNull String mainCommandAlias, @NotNull String alias, @NotNull String[] args)
|
||||||
|
Loading…
Reference in New Issue
Block a user