2018-05-12 00:47:58 +02:00
|
|
|
package com.massivecraft.factions.cmd;
|
|
|
|
|
2018-10-23 01:42:57 +02:00
|
|
|
import com.massivecraft.factions.SavageFactions;
|
2018-05-12 00:47:58 +02:00
|
|
|
import com.massivecraft.factions.struct.Permission;
|
2018-08-05 03:32:36 +02:00
|
|
|
import com.massivecraft.factions.struct.Role;
|
2018-05-12 00:47:58 +02:00
|
|
|
import com.massivecraft.factions.zcore.fperms.Access;
|
|
|
|
import com.massivecraft.factions.zcore.fperms.PermissableAction;
|
|
|
|
import com.massivecraft.factions.zcore.util.TL;
|
|
|
|
|
|
|
|
public class CmdChest extends FCommand {
|
|
|
|
|
2019-03-03 04:51:21 +01:00
|
|
|
public CmdChest() {
|
|
|
|
this.aliases.add("chest");
|
|
|
|
this.aliases.add("pv");
|
2018-05-12 00:47:58 +02:00
|
|
|
|
2019-03-03 04:51:21 +01:00
|
|
|
//this.requiredArgs.add("");
|
2018-05-12 00:47:58 +02:00
|
|
|
|
|
|
|
|
2019-03-03 04:51:21 +01:00
|
|
|
this.permission = Permission.CHEST.node;
|
|
|
|
this.disableOnLock = false;
|
2018-05-12 00:47:58 +02:00
|
|
|
|
2018-12-21 22:46:10 +01:00
|
|
|
|
2019-03-03 04:51:21 +01:00
|
|
|
senderMustBePlayer = true;
|
|
|
|
senderMustBeMember = true;
|
|
|
|
senderMustBeModerator = false;
|
|
|
|
senderMustBeAdmin = false;
|
|
|
|
}
|
2018-05-12 00:47:58 +02:00
|
|
|
|
2019-03-03 04:51:21 +01:00
|
|
|
@Override
|
|
|
|
public void perform() {
|
2018-05-12 00:47:58 +02:00
|
|
|
|
2018-09-09 19:40:45 +02:00
|
|
|
|
2019-03-03 04:51:21 +01:00
|
|
|
if (!SavageFactions.plugin.getConfig().getBoolean("fchest.Enabled")) {
|
|
|
|
fme.sendMessage("This command is disabled!");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
// This permission check is way too explicit but it's clean
|
|
|
|
if (!fme.isAdminBypassing()) {
|
|
|
|
Access access = myFaction.getAccess(fme, PermissableAction.CHEST);
|
|
|
|
if (access != Access.ALLOW && fme.getRole() != Role.LEADER) {
|
|
|
|
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "access chest");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2018-08-02 19:55:21 +02:00
|
|
|
|
2019-03-03 04:51:21 +01:00
|
|
|
me.openInventory(fme.getFaction().getChestInventory());
|
2018-05-12 00:47:58 +02:00
|
|
|
|
|
|
|
|
2019-03-03 04:51:21 +01:00
|
|
|
}
|
2018-05-12 00:47:58 +02:00
|
|
|
|
2019-03-03 04:51:21 +01:00
|
|
|
@Override
|
|
|
|
public TL getUsageTranslation() {
|
|
|
|
return TL.COMMAND_VAULT_DESCRIPTION;
|
|
|
|
}
|
2018-05-12 00:47:58 +02:00
|
|
|
}
|