Search in sources :

Example 36 with PartyPlayerEntity

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

the class CommandReload method onCommand.

@Override
public void onCommand(CommandData commandData) {
    PartyPlayerEntity pp = commandData.getPartyPlayer();
    plugin.reloadConfiguration();
    if (pp != null) {
        pp.sendMessage(Messages.PARTIES_COMMON_CONFIGRELOAD);
        LoggerManager.log(LogLevel.BASIC, Constants.DEBUG_CMD_RELOAD.replace("{player}", pp.getName()), true);
    } else {
        LoggerManager.log(LogLevel.BASIC, Constants.DEBUG_CMD_RELOAD_CONSOLE, true, ConsoleColor.GREEN);
    }
}
Also used : PartyPlayerEntity(com.alessiodp.parties.players.objects.PartyPlayerEntity)

Example 37 with PartyPlayerEntity

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

the class CommandSetHome 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.SETHOME.toString())) {
        pp.sendNoPermission(PartiesPermission.SETHOME);
        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_HOME))
        return false;
    if (commandData.getArgs().length > 1 && !commandData.getArgs()[1].equalsIgnoreCase(ConfigMain.COMMANDS_SUB_REMOVE)) {
        pp.sendMessage(Messages.ADDCMD_SETHOME_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 38 with PartyPlayerEntity

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

the class CommandSpy method onCommand.

@Override
public void onCommand(CommandData commandData) {
    PartyPlayerEntity pp = commandData.getPartyPlayer();
    /*
		 * Command starts
		 */
    boolean toggleSpy = !pp.isSpy();
    pp.setSpy(toggleSpy);
    pp.updatePlayer();
    if (toggleSpy) {
        plugin.getSpyManager().addSpy(pp.getPlayerUUID());
        pp.sendMessage(Messages.MAINCMD_SPY_ENABLED);
        LoggerManager.log(LogLevel.MEDIUM, Constants.DEBUG_CMD_SPY_ENABLE.replace("{player}", pp.getName()), true);
    } else {
        plugin.getSpyManager().removeSpy(pp.getPlayerUUID());
        pp.sendMessage(Messages.MAINCMD_SPY_DISABLED);
        LoggerManager.log(LogLevel.MEDIUM, Constants.DEBUG_CMD_SPY_DISABLE.replace("{player}", pp.getName()), true);
    }
}
Also used : PartyPlayerEntity(com.alessiodp.parties.players.objects.PartyPlayerEntity)

Example 39 with PartyPlayerEntity

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

the class CommandSpy 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.ADMIN_SPY.toString())) {
        pp.sendNoPermission(PartiesPermission.ADMIN_SPY);
        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 40 with PartyPlayerEntity

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

the class CommandSuffix 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.SUFFIX.toString())) {
        pp.sendNoPermission(PartiesPermission.SUFFIX);
        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_SUFFIX))
        return false;
    if (commandData.getArgs().length < 2) {
        pp.sendMessage(Messages.ADDCMD_SUFFIX_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)

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