Make open the default for PlayerShopCommand
This commit is contained in:
parent
5e5d70bf53
commit
db38b93264
|
|
@ -1,17 +1,16 @@
|
|||
package com.alttd.playershops.commands;
|
||||
|
||||
import com.alttd.playershops.commands.subcommands.CheckStockCommand;
|
||||
import com.alttd.playershops.commands.subcommands.OpenCommand;
|
||||
import com.alttd.playershops.commands.subcommands.ReloadCommand;
|
||||
import com.alttd.playershops.commands.subcommands.TransferShopsCommand;
|
||||
import com.google.common.base.Functions;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.alttd.playershops.gui.HomeGui;
|
||||
import com.alttd.playershops.utils.Util;
|
||||
import it.unimi.dsi.fastutil.Pair;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.permissions.Permission;
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
|
|
@ -34,7 +33,6 @@ public class PlayerShopCommand extends Command {
|
|||
|
||||
commands.put(Set.of("reload"), new ReloadCommand());
|
||||
commands.put(Set.of("checkstock"), new CheckStockCommand());
|
||||
commands.put(Set.of("open"), new OpenCommand());
|
||||
commands.put(Set.of("transfershops"), new TransferShopsCommand());
|
||||
|
||||
return commands.entrySet().stream()
|
||||
|
|
@ -104,8 +102,13 @@ public class PlayerShopCommand extends Command {
|
|||
}
|
||||
|
||||
if (args.length == 0) {
|
||||
sender.sendMessage(text("Usage: " + this.usageMessage, RED));
|
||||
return false;
|
||||
if (!(sender instanceof Player player)) {
|
||||
sender.sendMessage(Util.parseMiniMessage("<red>Only players can use this command."));
|
||||
return false;
|
||||
}
|
||||
HomeGui gui = new HomeGui(player.getUniqueId());
|
||||
gui.open();
|
||||
return true;
|
||||
}
|
||||
final @Nullable Pair<String, Subcommand> subCommand = resolveCommand(args[0]);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,25 +0,0 @@
|
|||
package com.alttd.playershops.commands.subcommands;
|
||||
|
||||
import com.alttd.playershops.commands.Subcommand;
|
||||
import com.alttd.playershops.gui.HomeGui;
|
||||
import com.alttd.playershops.utils.Util;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.framework.qual.DefaultQualifier;
|
||||
|
||||
@DefaultQualifier(NonNull.class)
|
||||
public class OpenCommand implements Subcommand {
|
||||
|
||||
@Override
|
||||
public boolean execute(final CommandSender sender, final String subCommand, final String[] args) {
|
||||
if (!(sender instanceof Player player)) {
|
||||
sender.sendMessage(Util.parseMiniMessage("<red>Only players can use this command."));
|
||||
return false;
|
||||
}
|
||||
HomeGui gui = new HomeGui(player.getUniqueId());
|
||||
gui.open();
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user