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