1
0
mirror of https://github.com/nkomarn/harbor.git synced 2024-09-27 22:17:31 +02:00

Some work on the command

This commit is contained in:
BuildTools 2019-03-06 21:25:31 -08:00
parent d2431bd56d
commit 2ef2ea9253
2 changed files with 35 additions and 0 deletions

View File

@ -0,0 +1,34 @@
package mykyta.Harbor;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
public class Command implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, org.bukkit.command.Command command, String label, String[] args) {
Config config = new Config();
Util util = new Util();
if (args.length < 1) {
sender.sendMessage(ChatColor.translateAlternateColorCodes('&', config.getString("messages.miscellaneous.prefix") + "&7Version " + util.version + " by TechToolbox."));
return true;
}
// Permission check
if (!sender.hasPermission("harbor.admin")) {
sender.sendMessage(ChatColor.translateAlternateColorCodes('&', config.getString("messages.miscellaneous.prefix") + config.getString("messages.miscellaneous.permission")));
return true;
}
// Command arguments
if (args[0].equalsIgnoreCase("reload")) {
return true;
}
else if (args[0].equalsIgnoreCase("update")) {
return true;
}
return true;
}
}

View File

@ -18,6 +18,7 @@ public class Harbor extends JavaPlugin {
Util util = new Util();
config.setInstance(this);
saveDefaultConfig();
this.getCommand("harbor").setExecutor(new Command());
Bukkit.getPluginManager().registerEvents(new BedEnter(), this);
Bukkit.getPluginManager().registerEvents(new BedLeave(), this);
if (config.getBoolean("features.notifier")) Bukkit.getPluginManager().registerEvents(new PlayerJoin(), this);