package com.gmail.nossr50.party.commands;

import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.party.Party;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.Users;

public class PartyDisbandCommand implements CommandExecutor {
    private Player player;
    private Party playerParty;

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if (!Permissions.hasPermission(sender, "mcmmo.commands.party.disband")) {
            sender.sendMessage(command.getPermissionMessage());
            return true;
        }

        player = (Player) sender;
        playerParty = Users.getPlayer(player).getParty();

        if (!playerParty.getLeader().equals(player.getName())) {
            sender.sendMessage(LocaleLoader.getString("Party.NotOwner"));
            return true;
        }

        for (Player member : playerParty.getOnlineMembers()) {
            if (!PartyManager.handlePartyChangeEvent(member, playerParty.getName(), null, EventReason.KICKED_FROM_PARTY)) {
                return true;
            }

            member.sendMessage(LocaleLoader.getString("Party.Disband"));
        }

        PartyManager.disbandParty(playerParty);
        return true;

    }

}

@@ -905,32 +905,85 @@
 ;%0D%0A        %7D%0D%0A%0D%0A
+        switch (args.length) %7B%0D%0A        case 1:%0D%0A    
         player =
@@ -997,24 +997,28 @@
 r) sender;%0D%0A
+    
         play
@@ -1070,24 +1070,28 @@
 %0D%0A%0D%0A        
+   
+ 
 if (!playerP
@@ -1132,24 +1132,28 @@
 Name())) %7B%0D%0A
+    
             
@@ -1219,32 +1219,36 @@
 );%0D%0A            
+   
+ 
 return true;%0D%0A  
@@ -1245,37 +1245,45 @@
  true;%0D%0A        
+    
 %7D%0D%0A%0D%0A
+    
         for (Pla
@@ -1326,24 +1326,28 @@
 mbers()) %7B%0D%0A
+    
             
@@ -1455,24 +1455,28 @@
 _PARTY)) %7B%0D%0A
+    
             
@@ -1497,37 +1497,45 @@
 e;%0D%0A            
+    
 %7D%0D%0A%0D%0A
+    
             memb
@@ -1592,37 +1592,45 @@
 nd%22));%0D%0A        
+    
 %7D%0D%0A%0D%0A
+    
         PartyMan
@@ -1662,32 +1662,36 @@
 arty);%0D%0A        
+ 
+   
 return true;%0D%0A%0D%0A
@@ -1686,24 +1686,188 @@
 rn true;%0D%0A%0D%0A
+        default:%0D%0A            sender.sendMessage(LocaleLoader.getString(%22Commands.Usage.1%22, %22party%22, %22disband%22));%0D%0A            return true;%0D%0A        %7D%0D%0A%0D%0A        %0D%0A
     %7D%0D%0A%0D%0A%7D%0D%0A

Add usage string.