Search in sources :

Example 1 with Status

use of com.alessiodp.partiesapi.enums.Status in project Parties by AlessioDP.

the class ApiHandler method deleteParty.

@Override
public Status deleteParty(Party paramParty) {
    Status ret = Status.NOEXIST;
    PartyEntity party = new PartyEntity(paramParty, plugin);
    if (party != null) {
        party.removeParty();
        ret = Status.SUCCESS;
    }
    return ret;
}
Also used : Status(com.alessiodp.partiesapi.enums.Status) PartyEntity(com.alessiodp.parties.parties.objects.PartyEntity)

Example 2 with Status

use of com.alessiodp.partiesapi.enums.Status in project Parties by AlessioDP.

the class ApiHandler method addPlayerIntoParty.

@Override
public Status addPlayerIntoParty(PartyPlayer paramPartyPlayer, Party paramParty) {
    Status ret = Status.ALREADYINPARTY;
    if (!paramPartyPlayer.getPartyName().isEmpty()) {
        if (paramParty != null) {
            if (ConfigParties.GENERAL_MEMBERSLIMIT < 0 || paramParty.getMembers().size() < ConfigParties.GENERAL_MEMBERSLIMIT) {
                PartyEntity party = new PartyEntity(paramParty, plugin);
                party.getMembers().add(paramPartyPlayer.getPlayerUUID());
                paramPartyPlayer.setPartyName(party.getName());
                party.refreshPlayers();
                party.updateParty();
                updatePartyPlayer(paramPartyPlayer);
                party.callChange();
                ret = Status.SUCCESS;
            } else
                ret = Status.PARTYFULL;
        } else
            ret = Status.NOEXIST;
    }
    return ret;
}
Also used : Status(com.alessiodp.partiesapi.enums.Status) PartyEntity(com.alessiodp.parties.parties.objects.PartyEntity)

Example 3 with Status

use of com.alessiodp.partiesapi.enums.Status in project Parties by AlessioDP.

the class ApiHandler method broadcastPartyMessage.

@Override
public Status broadcastPartyMessage(Party paramParty, PartyPlayer paramPartyPlayer, String paramMessage) {
    Status ret = Status.NOEXIST;
    PartyEntity party = new PartyEntity(paramParty, plugin);
    if (party != null) {
        party.sendBroadcast(new PartyPlayerEntity(paramPartyPlayer, plugin), paramMessage);
        ret = Status.SUCCESS;
    }
    return ret;
}
Also used : Status(com.alessiodp.partiesapi.enums.Status) PartyPlayerEntity(com.alessiodp.parties.players.objects.PartyPlayerEntity) PartyEntity(com.alessiodp.parties.parties.objects.PartyEntity)

Example 4 with Status

use of com.alessiodp.partiesapi.enums.Status in project Parties by AlessioDP.

the class ApiHandler method removePlayerFromParty.

@Override
public Status removePlayerFromParty(PartyPlayer paramPartyPlayer) {
    Status ret = Status.NOPARTY;
    if (!paramPartyPlayer.getPartyName().isEmpty()) {
        PartyPlayerEntity player = new PartyPlayerEntity(paramPartyPlayer, plugin);
        PartyEntity party = plugin.getPartyManager().getParty(player.getPartyName());
        if (party != null) {
            if (player.getPlayerUUID().equals(party.getLeader())) {
                party.removeParty();
            } else {
                if (party.getMembers().contains(player.getPlayerUUID())) {
                    party.getMembers().remove(player.getPlayerUUID());
                    party.updateParty();
                    party.callChange();
                }
                player.cleanupPlayer(true);
            }
            ret = Status.SUCCESS;
        }
    }
    return ret;
}
Also used : Status(com.alessiodp.partiesapi.enums.Status) PartyPlayerEntity(com.alessiodp.parties.players.objects.PartyPlayerEntity) PartyEntity(com.alessiodp.parties.parties.objects.PartyEntity)

Example 5 with Status

use of com.alessiodp.partiesapi.enums.Status in project Parties by AlessioDP.

the class ApiHandler method createParty.

@Override
public Status createParty(PartyPlayer paramPartyPlayer, String paramPartyName) {
    Status ret = Status.ALREADYINPARTY;
    // Get an instance of PartyPlayerEntity, used to save same player
    PartyPlayerEntity player = null;
    if (paramPartyPlayer instanceof PartyPlayerEntity) {
        player = (PartyPlayerEntity) paramPartyPlayer;
    } else {
        player = (PartyPlayerEntity) getPartyPlayer(paramPartyPlayer.getPlayerUUID());
    }
    if (player.getPartyName().isEmpty()) {
        if (!plugin.getPartyManager().existParty(paramPartyName)) {
            PartyEntity party = new PartyEntity(paramPartyName, plugin);
            party.getMembers().add(player.getPlayerUUID());
            Player p = player.getPlayer();
            if (p != null)
                party.getOnlinePlayers().add(p);
            party.setLeader(player.getPlayerUUID());
            plugin.getPartyManager().getListParties().put(party.getName().toLowerCase(), party);
            player.setRank(ConfigParties.RANK_SET_HIGHER);
            player.setPartyName(party.getName());
            party.updateParty();
            player.updatePlayer();
            party.callChange();
            return Status.SUCCESS;
        } else
            ret = Status.ALREADYEXISTPARTY;
    }
    return ret;
}
Also used : Status(com.alessiodp.partiesapi.enums.Status) PartyPlayerEntity(com.alessiodp.parties.players.objects.PartyPlayerEntity) Player(org.bukkit.entity.Player) PartyPlayer(com.alessiodp.partiesapi.objects.PartyPlayer) PartyEntity(com.alessiodp.parties.parties.objects.PartyEntity)

Aggregations

PartyEntity (com.alessiodp.parties.parties.objects.PartyEntity)5 Status (com.alessiodp.partiesapi.enums.Status)5 PartyPlayerEntity (com.alessiodp.parties.players.objects.PartyPlayerEntity)3 PartyPlayer (com.alessiodp.partiesapi.objects.PartyPlayer)1 Player (org.bukkit.entity.Player)1