2021-02-16 21:58:31 +01:00
|
|
|
package net.knarcraft.stargate.command;
|
|
|
|
|
|
|
|
import net.knarcraft.stargate.Stargate;
|
|
|
|
import org.bukkit.ChatColor;
|
|
|
|
import org.bukkit.command.Command;
|
|
|
|
import org.bukkit.command.CommandExecutor;
|
|
|
|
import org.bukkit.command.CommandSender;
|
|
|
|
import org.jetbrains.annotations.NotNull;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This command represents any command which starts with stargate
|
|
|
|
*
|
|
|
|
* <p>This prefix command should only be used for commands which are certain to collide with others and which relate to
|
|
|
|
* the plugin itself, not commands for functions of the plugin.</p>
|
|
|
|
*/
|
|
|
|
public class CommandStarGate implements CommandExecutor {
|
|
|
|
|
2021-09-09 15:25:08 +02:00
|
|
|
private final Stargate plugin;
|
2021-02-16 21:58:31 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Instantiates the stargate command
|
2021-02-20 13:57:04 +01:00
|
|
|
*
|
2021-02-16 21:58:31 +01:00
|
|
|
* @param plugin <p>A reference to the calling plugin object</p>
|
|
|
|
*/
|
|
|
|
public CommandStarGate(Stargate plugin) {
|
|
|
|
this.plugin = plugin;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean onCommand(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String s,
|
|
|
|
@NotNull String[] strings) {
|
|
|
|
if (strings.length > 0) {
|
|
|
|
if (strings[0].equalsIgnoreCase("about")) {
|
|
|
|
return new CommandAbout().onCommand(commandSender, command, s, strings);
|
|
|
|
} else if (strings[0].equalsIgnoreCase("reload")) {
|
|
|
|
return new CommandReload(plugin).onCommand(commandSender, command, s, strings);
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
} else {
|
|
|
|
commandSender.sendMessage(ChatColor.GOLD + "Stargate version " + ChatColor.GREEN + Stargate.getPluginVersion());
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|