Introduced Brigadier Command System. More Formatting Coming in next commit.
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
package com.massivecraft.factions.cmd.chest;
|
||||
|
||||
import com.massivecraft.factions.P;
|
||||
import com.massivecraft.factions.FactionsPlugin;
|
||||
import com.massivecraft.factions.cmd.CommandContext;
|
||||
import com.massivecraft.factions.cmd.CommandRequirements;
|
||||
import com.massivecraft.factions.cmd.FCommand;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
import com.massivecraft.factions.zcore.fperms.Access;
|
||||
import com.massivecraft.factions.zcore.fperms.PermissableAction;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
|
||||
@@ -14,36 +14,23 @@ public class CmdChest extends FCommand {
|
||||
this.aliases.add("chest");
|
||||
this.aliases.add("pv");
|
||||
|
||||
//this.requiredArgs.add("");
|
||||
|
||||
|
||||
this.permission = Permission.CHEST.node;
|
||||
this.disableOnLock = false;
|
||||
|
||||
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = true;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
this.requirements = new CommandRequirements.Builder(Permission.CHEST)
|
||||
.playerOnly()
|
||||
.memberOnly()
|
||||
.withAction(PermissableAction.CHEST)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
public void perform(CommandContext context) {
|
||||
|
||||
|
||||
if (!P.p.getConfig().getBoolean("fchest.Enabled")) {
|
||||
fme.sendMessage("This command is disabled!");
|
||||
if (!FactionsPlugin.getInstance().getConfig().getBoolean("fchest.Enabled")) {
|
||||
context.fPlayer.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;
|
||||
}
|
||||
}
|
||||
me.openInventory(fme.getFaction().getChestInventory());
|
||||
context.player.openInventory(context.faction.getChestInventory());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user