Search in sources :

Example 91 with PartyPlayerEntity

use of com.alessiodp.parties.players.objects.PartyPlayerEntity in project Parties by AlessioDP.

the class CommandDesc method preRequisites.

@Override
public boolean preRequisites(CommandData commandData) {
    Player player = (Player) commandData.getSender();
    PartyPlayerEntity pp = plugin.getPlayerManager().getPlayer(player.getUniqueId());
    /*
		 * Checks for command prerequisites
		 */
    if (!player.hasPermission(PartiesPermission.DESC.toString())) {
        pp.sendNoPermission(PartiesPermission.DESC);
        return false;
    }
    PartyEntity party = pp.getPartyName().isEmpty() ? null : plugin.getPartyManager().getParty(pp.getPartyName());
    if (party == null) {
        pp.sendMessage(Messages.PARTIES_COMMON_NOTINPARTY);
        return false;
    }
    if (!PartiesUtils.checkPlayerRankAlerter(pp, PartiesPermission.PRIVATE_EDIT_DESC))
        return false;
    if (commandData.getArgs().length < 2) {
        pp.sendMessage(Messages.ADDCMD_DESC_WRONGCMD);
        return false;
    }
    commandData.setPlayer(player);
    commandData.setPartyPlayer(pp);
    commandData.setParty(party);
    return true;
}
Also used : Player(org.bukkit.entity.Player) PartyPlayerEntity(com.alessiodp.parties.players.objects.PartyPlayerEntity) PartyEntity(com.alessiodp.parties.parties.objects.PartyEntity)

Example 92 with PartyPlayerEntity

use of com.alessiodp.parties.players.objects.PartyPlayerEntity in project Parties by AlessioDP.

the class CommandHelp method preRequisites.

@Override
public boolean preRequisites(CommandData commandData) {
    Player player = (Player) commandData.getSender();
    PartyPlayerEntity pp = plugin.getPlayerManager().getPlayer(player.getUniqueId());
    /*
		 * Checks for command prerequisites
		 */
    if (!player.hasPermission(PartiesPermission.HELP.toString())) {
        pp.sendNoPermission(PartiesPermission.HELP);
        return false;
    }
    commandData.setPlayer(player);
    commandData.setPartyPlayer(pp);
    return true;
}
Also used : Player(org.bukkit.entity.Player) PartyPlayerEntity(com.alessiodp.parties.players.objects.PartyPlayerEntity)

Aggregations

PartyPlayerEntity (com.alessiodp.parties.players.objects.PartyPlayerEntity)92 PartyEntity (com.alessiodp.parties.parties.objects.PartyEntity)56 Player (org.bukkit.entity.Player)53 EventHandler (org.bukkit.event.EventHandler)13 PartyPlayer (com.alessiodp.partiesapi.objects.PartyPlayer)9 UUID (java.util.UUID)8 ArrayList (java.util.ArrayList)6 PartiesPartyPostDeleteEvent (com.alessiodp.partiesapi.events.PartiesPartyPostDeleteEvent)4 PartiesPartyPreDeleteEvent (com.alessiodp.partiesapi.events.PartiesPartyPreDeleteEvent)4 OfflinePlayer (org.bukkit.OfflinePlayer)4 Status (com.alessiodp.partiesapi.enums.Status)3 PartiesPlayerLeaveEvent (com.alessiodp.partiesapi.events.PartiesPlayerLeaveEvent)3 PartiesPlaceholder (com.alessiodp.parties.addons.internal.PartiesPlaceholder)2 ChatTask (com.alessiodp.parties.tasks.ChatTask)2 PartiesChatEvent (com.alessiodp.partiesapi.events.PartiesChatEvent)2 PartiesFriendlyFireBlockedEvent (com.alessiodp.partiesapi.events.PartiesFriendlyFireBlockedEvent)2 PartiesPlayerJoinEvent (com.alessiodp.partiesapi.events.PartiesPlayerJoinEvent)2 Rank (com.alessiodp.partiesapi.interfaces.Rank)2 Matcher (java.util.regex.Matcher)2 Result (com.alessiodp.parties.addons.external.GriefPreventionHandler.Result)1