use of com.alessiodp.parties.players.objects.PartyPlayerEntity in project Parties by AlessioDP.
the class CommandClaim method onCommand.
@Override
public void onCommand(CommandData commandData) {
PartyPlayerEntity pp = commandData.getPartyPlayer();
PartyEntity party = commandData.getParty();
/*
* Command handling
*/
if (commandData.getArgs().length != 2) {
pp.sendMessage(Messages.ADDCMD_CLAIM_WRONGCMD);
return;
}
Selection selection = Selection.FAILED_GENERAL;
if (commandData.getArgs()[1].equalsIgnoreCase(ConfigMain.ADDONS_GRIEFPREVENTION_CMD_TRUST))
selection = Selection.TRUST;
else if (commandData.getArgs()[1].equalsIgnoreCase(ConfigMain.ADDONS_GRIEFPREVENTION_CMD_CONTAINER))
selection = Selection.CONTAINER;
else if (commandData.getArgs()[1].equalsIgnoreCase(ConfigMain.ADDONS_GRIEFPREVENTION_CMD_ACCESS))
selection = Selection.ACCESS;
else if (commandData.getArgs()[1].equalsIgnoreCase(ConfigMain.ADDONS_GRIEFPREVENTION_CMD_REMOVE))
selection = Selection.REMOVE;
if (!selection.equals(Selection.FAILED_GENERAL)) {
Result res = GriefPreventionHandler.isManager(commandData.getPlayer());
switch(res) {
case NOEXIST:
selection = Selection.FAILED_NOEXIST;
break;
case NOMANAGER:
selection = Selection.FAILED_NOMANAGER;
break;
default:
// Success, selection it's okay
break;
}
}
if (VaultHandler.payCommand(VaultHandler.VaultCommand.CLAIM, pp, commandData.getCommandLabel(), commandData.getArgs()))
return;
/*
* Command starts
*/
switch(selection) {
case FAILED_NOEXIST:
// Return: No exist claim
pp.sendMessage(Messages.ADDCMD_CLAIM_CLAIMNOEXISTS);
break;
case FAILED_NOMANAGER:
// Return: No manager
pp.sendMessage(Messages.ADDCMD_CLAIM_NOMANAGER);
break;
case FAILED_GENERAL:
// Return: Wrong command
pp.sendMessage(Messages.ADDCMD_CLAIM_WRONGCMD);
break;
default:
GriefPreventionHandler.addPartyPermission(commandData.getPlayer(), party, selection.getGPPermission());
pp.sendMessage(Messages.ADDCMD_CLAIM_CLAIMED);
LoggerManager.log(LogLevel.MEDIUM, Constants.DEBUG_CMD_CLAIM.replace("{player}", pp.getName()).replace("{value}", commandData.getArgs()[1].toLowerCase()), true);
}
}
use of com.alessiodp.parties.players.objects.PartyPlayerEntity in project Parties by AlessioDP.
the class CommandChat 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.CHAT.toString())) {
pp.sendNoPermission(PartiesPermission.CHAT);
return false;
}
if (pp.getPartyName().isEmpty()) {
pp.sendMessage(Messages.PARTIES_COMMON_NOTINPARTY);
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 CommandChat method onCommand.
@Override
public void onCommand(CommandData commandData) {
PartyPlayerEntity pp = commandData.getPartyPlayer();
/*
* Command handling
*/
Boolean chat = pp.isChatParty();
if (commandData.getArgs().length > 1) {
if (commandData.getArgs()[1].equalsIgnoreCase(ConfigMain.COMMANDS_SUB_ON))
chat = true;
else if (commandData.getArgs()[1].equalsIgnoreCase(ConfigMain.COMMANDS_SUB_OFF))
chat = false;
else
chat = null;
} else {
chat = !chat;
}
if (chat == null) {
pp.sendMessage(Messages.MAINCMD_CHAT_WRONGCMD);
return;
}
/*
* Command starts
*/
if (chat)
pp.sendMessage(Messages.MAINCMD_CHAT_ENABLED);
else
pp.sendMessage(Messages.MAINCMD_CHAT_DISABLED);
pp.setChatParty(chat);
LoggerManager.log(LogLevel.MEDIUM, Constants.DEBUG_CMD_CHAT.replace("{player}", pp.getName()).replace("{value}", chat.toString()), true);
}
use of com.alessiodp.parties.players.objects.PartyPlayerEntity in project Parties by AlessioDP.
the class CommandCreate 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.CREATE.toString())) {
pp.sendNoPermission(PartiesPermission.CREATE);
return false;
}
if (!pp.getPartyName().isEmpty()) {
pp.sendMessage(Messages.MAINCMD_CREATE_ALREADYINPARTY);
return false;
}
if (commandData.getArgs().length < 2) {
pp.sendMessage(Messages.MAINCMD_CREATE_WRONGCMD);
return false;
}
commandData.setPlayer(player);
commandData.setPartyPlayer(pp);
commandData.addPermission(PartiesPermission.ADMIN_CREATE_FIXED);
return true;
}
use of com.alessiodp.parties.players.objects.PartyPlayerEntity in project Parties by AlessioDP.
the class CommandDelete 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_DELETE.toString())) {
pp.sendNoPermission(PartiesPermission.ADMIN_DELETE);
return false;
}
if (commandData.getArgs().length < 2 || commandData.getArgs().length > 3) {
pp.sendMessage(Messages.MAINCMD_DELETE_WRONGCMD);
return false;
}
commandData.setPlayer(player);
commandData.setPartyPlayer(pp);
commandData.addPermission(PartiesPermission.ADMIN_DELETE_SILENT);
return true;
}
Aggregations