42 lines
1.6 KiB
Java
42 lines
1.6 KiB
Java
package xyz.etztech.minecraftmanager.command;
|
|
|
|
import org.bukkit.ChatColor;
|
|
import org.bukkit.command.Command;
|
|
import org.bukkit.command.CommandExecutor;
|
|
import org.bukkit.command.CommandSender;
|
|
import org.bukkit.entity.Player;
|
|
import xyz.etztech.minecraftmanager.MinecraftManager;
|
|
|
|
public class CommandApply implements CommandExecutor {
|
|
|
|
MinecraftManager plugin;
|
|
|
|
public CommandApply(MinecraftManager plugin) {
|
|
this.plugin = plugin;
|
|
}
|
|
|
|
@Override
|
|
public boolean onCommand(CommandSender sender, Command command, String base, String[] args) {
|
|
if (!(sender instanceof Player)) {
|
|
sender.sendMessage(ChatColor.RED + "The console cannot fill out an application.");
|
|
return true;
|
|
}
|
|
Player player = (Player) sender;
|
|
if (sender.hasPermission("minecraftmanager.apply")) {
|
|
boolean inApplyMode = MinecraftManager.inApplyMode(player.getUniqueId().toString());
|
|
if (!inApplyMode) {
|
|
MinecraftManager.setApplyMode(player.getUniqueId().toString(), true);
|
|
sender.sendMessage(ChatColor.GREEN + "Entering apply mode. Say \"stop\" in chat to pause your application, or say \"last\" in chat to go to the previous question.");
|
|
sender.sendMessage(ChatColor.GREEN + MinecraftManager.getApplyQuestion(player.getUniqueId().toString()).getQuestion());
|
|
} else {
|
|
sender.sendMessage(ChatColor.RED + "You are already applying. Say \"stop\" in chat to pause your application.");
|
|
}
|
|
} else {
|
|
sender.sendMessage(ChatColor.RED + "You do not have permission to apply.");
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
}
|