Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.xKishan.Guilds.Guilds;
- import me.xKishan.Guilds.GuildsConfig.GuildsConfigManager;
- import org.bukkit.command.Command;
- import org.bukkit.command.CommandExecutor;
- import org.bukkit.command.CommandSender;
- import org.bukkit.entity.Player;
- public class GuildsCommand implements CommandExecutor {
- public GuildsConfigManager GCM(){
- return GuildsConfigManager.getGCM();
- }
- @Override
- public boolean onCommand(CommandSender sender, Command command, String cmd, String[] args) {
- if (sender instanceof Player) {
- Player player = (Player) sender;
- if(args.length == 2){
- if(args[0].equalsIgnoreCase("create")){
- for(String s : GCM().getAllGuilds()){
- if(GCM().isMember(s, player))
- {
- player.sendMessage("Already in a guild.");
- return true;
- }
- }
- GCM().createGuild(args[1], player);
- player.sendMessage("Guild Created!");
- }
- if(args[0].equalsIgnoreCase("disband")){
- boolean realGuild = false;
- for(String s : GCM().getAllGuilds()){
- if(s.equalsIgnoreCase(args[1])){
- realGuild = true;
- }
- }
- if(realGuild == false) {
- player.sendMessage("Invalid Guild Name!");
- return true;
- }
- if(!GCM().isOwner(args[1], player)){
- player.sendMessage("You are not the owner.");
- return true;
- }
- GCM().disbandGuild(args[1]);
- }
- }
- }
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement