Package com.gmail.nossr50.datatypes.skills

Examples of com.gmail.nossr50.datatypes.skills.SkillType


     * 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

        YamlConfiguration partiesFile = YamlConfiguration.loadConfiguration(partyFile);

        ArrayList<Party> hasAlly = new ArrayList<Party>();

        for (String partyName : partiesFile.getConfigurationSection("").getKeys(false)) {
            Party party = new Party(partyName);

            String[] leaderSplit = partiesFile.getString(partyName + ".Leader").split("[|]");
            party.setLeader(new PartyLeader(UUID.fromString(leaderSplit[0]), leaderSplit[1]));
            party.setPassword(partiesFile.getString(partyName + ".Password"));
            party.setLocked(partiesFile.getBoolean(partyName + ".Locked"));
            party.setLevel(partiesFile.getInt(partyName + ".Level"));
            party.setXp(partiesFile.getInt(partyName + ".Xp"));

            if (partiesFile.getString(partyName + ".Ally") != null) {
                hasAlly.add(party);
            }

            party.setXpShareMode(ShareMode.getShareMode(partiesFile.getString(partyName + ".ExpShareMode", "NONE")));
            party.setItemShareMode(ShareMode.getShareMode(partiesFile.getString(partyName + ".ItemShareMode", "NONE")));

            for (ItemShareType itemShareType : ItemShareType.values()) {
                party.setSharingDrops(itemShareType, partiesFile.getBoolean(partyName + ".ItemShareType." + itemShareType.toString(), true));
            }

            LinkedHashMap<UUID, String> members = party.getMembers();

            for (String memberEntry : partiesFile.getStringList(partyName + ".Members")) {
                String[] memberSplit = memberEntry.split("[|]");
                members.put(UUID.fromString(memberSplit[0]), memberSplit[1]);
            }

            parties.add(party);
        }
        mcMMO.p.debug("Loaded (" + parties.size() + ") Parties...");

        for (Party party : hasAlly) {
            party.setAlly(PartyManager.getParty(partiesFile.getString(party.getName() + ".Ally")));
        }
    }
View Full Code Here

        }

        ArrayList<Party> hasAlly = new ArrayList<Party>();

        for (String partyName : partiesFile.getConfigurationSection("").getKeys(false)) {
            Party party = new Party(partyName);

            String leaderName = partiesFile.getString(partyName + ".Leader");
            PlayerProfile profile = mcMMO.getDatabaseManager().loadPlayerProfile(leaderName, false);

            if (!profile.isLoaded()) {
                mcMMO.p.getLogger().warning("Could not find UUID in database for party leader " + leaderName + " in party " + partyName);
                continue;
            }

            UUID leaderUniqueId = profile.getUniqueId();

            party.setLeader(new PartyLeader(leaderUniqueId, leaderName));
            party.setPassword(partiesFile.getString(partyName + ".Password"));
            party.setLocked(partiesFile.getBoolean(partyName + ".Locked"));
            party.setLevel(partiesFile.getInt(partyName + ".Level"));
            party.setXp(partiesFile.getInt(partyName + ".Xp"));

            if (partiesFile.getString(partyName + ".Ally") != null) {
                hasAlly.add(party);
            }

            party.setXpShareMode(ShareMode.getShareMode(partiesFile.getString(partyName + ".ExpShareMode", "NONE")));
            party.setItemShareMode(ShareMode.getShareMode(partiesFile.getString(partyName + ".ItemShareMode", "NONE")));

            for (ItemShareType itemShareType : ItemShareType.values()) {
                party.setSharingDrops(itemShareType, partiesFile.getBoolean(partyName + ".ItemShareType." + itemShareType.toString(), true));
            }

            LinkedHashMap<UUID, String> members = party.getMembers();

            for (String memberName : partiesFile.getStringList(partyName + ".Members")) {
                PlayerProfile memberProfile = mcMMO.getDatabaseManager().loadPlayerProfile(memberName, false);

                if (!memberProfile.isLoaded()) {
                    mcMMO.p.getLogger().warning("Could not find UUID in database for party member " + memberName + " in party " + partyName);
                    continue;
                }

                UUID memberUniqueId = memberProfile.getUniqueId();

                members.put(memberUniqueId, memberName);
            }

            parties.add(party);
        }

        mcMMO.p.debug("Loaded (" + parties.size() + ") Parties...");

        for (Party party : hasAlly) {
            party.setAlly(PartyManager.getParty(partiesFile.getString(party.getName() + ".Ally")));
        }

        mcMMO.getUpgradeManager().setUpgradeCompleted(UpgradeType.ADD_UUIDS_PARTY);
    }
View Full Code Here

        super(ChatMode.PARTY);
    }

    @Override
    protected void handleChatSending(CommandSender sender, String[] args) {
        Party party;
        String message;

        if (sender instanceof Player) {
            party = UserManager.getPlayer((Player) sender).getParty();

            if (party == null) {
                sender.sendMessage(LocaleLoader.getString("Commands.Party.None"));
                return;
            }

            if (party.getLevel() < Config.getInstance().getPartyFeatureUnlockLevel(PartyFeature.CHAT)) {
                sender.sendMessage(LocaleLoader.getString("Party.Feature.Disabled.1"));
                return;
            }

            message = buildChatMessage(args, 0);
View Full Code Here

     * @param mcMMOPlayer Player initiating the Xp gain
     * @param skillType Skill being used
     * @return True is the xp has been shared
     */
    public static boolean handleXpShare(float xp, McMMOPlayer mcMMOPlayer, SkillType skillType, XPGainReason xpGainReason) {
        Party party = mcMMOPlayer.getParty();

        if (party.getXpShareMode() != ShareMode.EQUAL) {
            return false;
        }

        List<Player> nearMembers = PartyManager.getNearMembers(mcMMOPlayer);

View Full Code Here

        if (dropType == null) {
            return false;
        }

        Party party = mcMMOPlayer.getParty();

        if (!party.sharingDrops(dropType)) {
            return false;
        }

        ShareMode shareMode = party.getItemShareMode();

        if (shareMode == ShareMode.NONE) {
            return false;
        }
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));
        }

View Full Code Here

TOP

Related Classes of com.gmail.nossr50.datatypes.skills.SkillType

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.