Package com.gmail.nossr50.util

Examples of com.gmail.nossr50.util.Permissions


     */
    public static boolean changeOrJoinParty(McMMOPlayer mcMMOPlayer, String newPartyName) {
        Player player = mcMMOPlayer.getPlayer();

        if (mcMMOPlayer.inParty()) {
            Party oldParty = mcMMOPlayer.getParty();

            if (!handlePartyChangeEvent(player, oldParty.getName(), newPartyName, EventReason.CHANGED_PARTIES)) {
                return false;
            }

            removeFromParty(mcMMOPlayer);
        }
View Full Code Here


     * @param firstPlayer The first player
     * @param secondPlayer The second player
     * @return true if they are in the same party, false otherwise
     */
    public static boolean inSameParty(Player firstPlayer, Player secondPlayer) {
        Party firstParty = UserManager.getPlayer(firstPlayer).getParty();
        Party secondParty = UserManager.getPlayer(secondPlayer).getParty();

        if (firstParty == null || secondParty == null) {
            return false;
        }

View Full Code Here

        return firstParty.equals(secondParty);
    }

    public static boolean areAllies(Player firstPlayer, Player secondPlayer) {
        Party firstParty = UserManager.getPlayer(firstPlayer).getParty();
        Party secondParty = UserManager.getPlayer(secondPlayer).getParty();

        if (firstParty == null || secondParty == null || firstParty.getAlly() == null || secondParty.getAlly() == null) {
            return false;
        }

        return firstParty.equals(secondParty.getAlly()) && secondParty.equals(firstParty.getAlly());
    }
View Full Code Here

     * @param mcMMOPlayer The player to check
     * @return the near party members
     */
    public static List<Player> getNearMembers(McMMOPlayer mcMMOPlayer) {
        List<Player> nearMembers = new ArrayList<Player>();
        Party party = mcMMOPlayer.getParty();

        if (party != null) {
            Player player = mcMMOPlayer.getPlayer();
            double range = Config.getInstance().getPartyShareRange();

            for (Player member : party.getOnlineMembers()) {
                if (!player.equals(member) && member.isValid() && Misc.isNear(player.getLocation(), member.getLocation(), range)) {
                    nearMembers.add(member);
                }
            }
        }
View Full Code Here

     *
     * @param player The player to check
     * @return all the players in the player's party
     */
    public static LinkedHashMap<UUID, String> getAllMembers(Player player) {
        Party party = getParty(player);

        return party == null ? new LinkedHashMap<UUID, String>() : party.getMembers();
    }
View Full Code Here

     * @param password The password for this party, null if there was no password
     */
    public static void createParty(McMMOPlayer mcMMOPlayer, String partyName, String password) {
        Player player = mcMMOPlayer.getPlayer();

        Party party = new Party(new PartyLeader(player.getUniqueId(), player.getName()), partyName.replace(".", ""), password);

        if (password != null) {
            player.sendMessage(LocaleLoader.getString("Party.Password.Set", password));
        }

        parties.add(party);

        player.sendMessage(LocaleLoader.getString("Commands.Party.Create", party.getName()));
        addToParty(mcMMOPlayer, party);
    }
View Full Code Here

     * Accept a party invitation
     *
     * @param mcMMOPlayer The player to add to the party
     */
    public static void joinInvitedParty(McMMOPlayer mcMMOPlayer) {
        Party invite = mcMMOPlayer.getPartyInvite();

        // Check if the party still exists, it might have been disbanded
        if (!parties.contains(invite)) {
            mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Party.Disband"));
            return;
        }

        mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Commands.Party.Invite.Accepted", invite.getName()));
        mcMMOPlayer.removePartyInvite();
        addToParty(mcMMOPlayer, invite);
    }
View Full Code Here

     * Accept a party alliance invitation
     *
     * @param mcMMOPlayer The player who accepts the alliance invite
     */
    public static void acceptAllianceInvite(McMMOPlayer mcMMOPlayer) {
        Party invite = mcMMOPlayer.getPartyAllianceInvite();
        Player player = mcMMOPlayer.getPlayer();

        // Check if the party still exists, it might have been disbanded
        if (!parties.contains(invite)) {
            player.sendMessage(LocaleLoader.getString("Party.Disband"));
            return;
        }

        if (!handlePartyChangeAllianceEvent(player, mcMMOPlayer.getParty().getName(), invite.getName(), McMMOPartyAllianceChangeEvent.EventReason.FORMED_ALLIANCE)) {
            return;
        }

        player.sendMessage(LocaleLoader.getString("Commands.Party.Alliance.Invite.Accepted", invite.getName()));
        mcMMOPlayer.removePartyAllianceInvite();

        createAlliance(mcMMOPlayer.getParty(), invite);
    }
View Full Code Here

     *
     * @param partyName The party name
     * @return the leader of the party
     */
    public static String getPartyLeaderName(String partyName) {
        Party party = getParty(partyName);

        return party == null ? null : party.getLeader().getPlayerName();
    }
View Full Code Here

     * Check if a player can invite others to his party.
     *
     * @return true if the player can invite
     */
    public static boolean canInvite(McMMOPlayer mcMMOPlayer) {
        Party party = mcMMOPlayer.getParty();

        return !party.isLocked() || party.getLeader().getUniqueId().equals(mcMMOPlayer.getPlayer().getUniqueId());
    }
View Full Code Here

TOP

Related Classes of com.gmail.nossr50.util.Permissions

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.