package de.fanta.challenges.commands;
import de.fanta.challenges.Challenges;
import de.fanta.challenges.challenges.AllItemsChallenge;
import de.fanta.challenges.utils.ChatUtil;
import de.fanta.challenges.utils.Config;
import de.iani.cubesideutils.bukkit.commands.SubCommand;
import de.iani.cubesideutils.commands.ArgsParser;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class SkipItemCommand extends SubCommand {
private final Challenges plugin;
public SkipItemCommand(Challenges plugin) {
this.plugin = plugin;
}
@Override
public boolean onCommand(CommandSender sender, Command command, String alias, String commandString, ArgsParser args) {
if (!(sender instanceof Player p)) {
ChatUtil.sendErrorMessage(sender, "You are not a Player :>");
return true;
}
if (plugin.getCurrentEditor() != null) {
if (!plugin.isEditor(p) || !p.hasPermission("Challenges.editor.override")) {
ChatUtil.sendErrorMessage(p, "Das kann nur der Editor!");
return true;
}
} else {
ChatUtil.sendErrorMessage(p, "Aktuell gibt es keinen Editor!");
}
if (Config.getBoolean("allitems")) {
AllItemsChallenge.next(p, true);
} else {
ChatUtil.sendErrorMessage(p, "Dies geht nur wenn All Items Aktiv ist!");
}
return true;
}
}