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);
}
}
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;
}
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;
}
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;
}
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);
}
Aggregations