Search in sources :

Example 16 with PartyPlayerEntity

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

the class CommandNotify method onCommand.

@Override
public void onCommand(CommandData commandData) {
    PartyPlayerEntity pp = commandData.getPartyPlayer();
    /*
		 * Command starts
		 */
    boolean toggleNotify = !pp.isPreventNotify();
    pp.setPreventNotify(toggleNotify);
    pp.updatePlayer();
    if (toggleNotify) {
        pp.sendMessage(Messages.ADDCMD_NOTIFY_ON);
        LoggerManager.log(LogLevel.MEDIUM, Constants.DEBUG_CMD_NOTIFY_ON.replace("{player}", pp.getName()), true);
    } else {
        pp.sendMessage(Messages.ADDCMD_NOTIFY_OFF);
        LoggerManager.log(LogLevel.MEDIUM, Constants.DEBUG_CMD_NOTIFY_OFF.replace("{player}", pp.getName()), true);
    }
}
Also used : PartyPlayerEntity(com.alessiodp.parties.players.objects.PartyPlayerEntity)

Example 17 with PartyPlayerEntity

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

the class CommandNotify 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.NOTIFY.toString())) {
        pp.sendNoPermission(PartiesPermission.NOTIFY);
        return false;
    }
    commandData.setPlayer(player);
    commandData.setPartyPlayer(pp);
    return true;
}
Also used : Player(org.bukkit.entity.Player) PartyPlayerEntity(com.alessiodp.parties.players.objects.PartyPlayerEntity)

Example 18 with PartyPlayerEntity

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

the class CommandMotd 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.MOTD.toString())) {
        pp.sendNoPermission(PartiesPermission.MOTD);
        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_MOTD))
        return false;
    if (commandData.getArgs().length < 2) {
        pp.sendMessage(Messages.ADDCMD_MOTD_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 19 with PartyPlayerEntity

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

the class CommandAccept 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.ACCEPT.toString())) {
        pp.sendNoPermission(PartiesPermission.ACCEPT);
        return false;
    }
    if (!pp.getPartyName().isEmpty()) {
        pp.sendMessage(Messages.MAINCMD_ACCEPT_ALREADYINPARTY);
        return false;
    }
    if (pp.getLastInvite().isEmpty()) {
        pp.sendMessage(Messages.MAINCMD_ACCEPT_NOINVITE);
        return false;
    }
    commandData.setPlayer(player);
    commandData.setPartyPlayer(pp);
    return true;
}
Also used : Player(org.bukkit.entity.Player) PartyPlayerEntity(com.alessiodp.parties.players.objects.PartyPlayerEntity)

Example 20 with PartyPlayerEntity

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

the class CommandAccept method onCommand.

@Override
public void onCommand(CommandData commandData) {
    PartyPlayerEntity pp = commandData.getPartyPlayer();
    PartyEntity party = plugin.getPartyManager().getParty(pp.getLastInvite());
    if (party == null) {
        pp.sendMessage(Messages.MAINCMD_ACCEPT_NOEXISTS);
        return;
    }
    if ((ConfigParties.GENERAL_MEMBERSLIMIT != -1) && (party.getMembers().size() >= ConfigParties.GENERAL_MEMBERSLIMIT)) {
        pp.sendMessage(Messages.PARTIES_COMMON_PARTYFULL);
        return;
    }
    /*
		 * Command starts
		 */
    party.acceptInvite(pp.getPlayerUUID());
    LoggerManager.log(LogLevel.MEDIUM, Constants.DEBUG_CMD_ACCEPT.replace("{player}", pp.getName()).replace("{party}", party.getName()), true);
}
Also used : PartyPlayerEntity(com.alessiodp.parties.players.objects.PartyPlayerEntity) PartyEntity(com.alessiodp.parties.parties.objects.PartyEntity)

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