/** * Disbands an mcMMO party. * * @param sender Player or console who requested the disband * @param party Party to disband */ private void disbandParty(CommandSender sender, String party) { Party target = Util.getPartyFromList(party); if (target == null) { sender.sendMessage(L10n.getString("Party.DoesNotExist", party)); return; } // From Party Disband command for (Player member : target.getOnlineMembers()) { if (!PartyManager.handlePartyChangeEvent( member, target.getName(), null, McMMOPartyChangeEvent.EventReason.KICKED_FROM_PARTY)) { sender.sendMessage(L10n.getString("Commands.Disband.Fail", party)); return; } member.sendMessage(L10n.getString("Commands.Disband.ByAdmin")); } // It would be nice to get API to do this. PartyManager.disbandParty(target); sender.sendMessage(L10n.getString("Commands.Disband.Success", party)); }
/** * Adds a player to a party. * * @param sender Player requesting the addition * @param player Player to add to party * @param partyName Party to add player to */ private void addPlayerToParty(CommandSender sender, String player, String partyName) { // Get the OfflinePlayer Player targetPlayer = PartyAdmin.getPlugin().getServer().getPlayerExact(player); Party party = Util.getPartyFromList(partyName); // No party! if (party == null) { sender.sendMessage(L10n.getString("Party.DoesNotExist", partyName)); return; } else if (targetPlayer == null) { sender.sendMessage(L10n.getString("Player.NotOnline", player)); return; } if (PartyAPI.inParty(targetPlayer)) { PartyAPI.removeFromParty(targetPlayer); } // If the player is online, we can add them to the party using the API PartyAPI.addToParty(targetPlayer, partyName); // Check to see that it happened and the event wasn't cancelled. if (PartyAPI.getPartyName(targetPlayer).equals(partyName)) { sender.sendMessage( L10n.getString("Commands.Added.Success", targetPlayer.getName(), partyName)); } else { sender.sendMessage( L10n.getString("Commands.Added.Failed", targetPlayer.getName(), partyName)); } }
public String getShortHelp() { return ChatColor.YELLOW + "/partyadmin rp <party> " + ChatColor.WHITE + "- " + L10n.getString("Description.Disband"); }
public String getShortHelp() { return ChatColor.YELLOW + "/partyadmin apl <player> <party> " + ChatColor.WHITE + "- " + L10n.getString("Description.Add"); }