2019-06-30 08:20:17 +02:00
|
|
|
package com.massivecraft.factions.cmd;
|
|
|
|
|
|
|
|
import com.massivecraft.factions.Faction;
|
2019-09-14 21:13:01 +02:00
|
|
|
import com.massivecraft.factions.FactionsPlugin;
|
2019-06-30 08:20:17 +02:00
|
|
|
import com.massivecraft.factions.struct.Permission;
|
|
|
|
import com.massivecraft.factions.zcore.util.TL;
|
|
|
|
|
|
|
|
public class CmdViewChest extends FCommand {
|
|
|
|
|
2019-12-02 20:03:27 +01:00
|
|
|
/**
|
|
|
|
* @author Driftay
|
|
|
|
*/
|
|
|
|
|
2019-09-15 11:19:06 +02:00
|
|
|
public CmdViewChest() {
|
|
|
|
super();
|
2020-01-02 02:59:31 +01:00
|
|
|
this.aliases.addAll(Aliases.viewChest);
|
2019-09-15 11:19:06 +02:00
|
|
|
|
|
|
|
this.requiredArgs.add("faction name");
|
|
|
|
|
|
|
|
this.requirements = new CommandRequirements.Builder(Permission.VIEWCHEST)
|
|
|
|
.playerOnly()
|
|
|
|
.build();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void perform(CommandContext context) {
|
|
|
|
if (!FactionsPlugin.getInstance().getConfig().getBoolean("fchest.Enabled")) {
|
2019-12-03 11:16:37 +01:00
|
|
|
context.msg(TL.GENERIC_DISABLED, "Faction Chests");
|
2019-09-15 11:19:06 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
Faction myFaction = context.fPlayer.getFaction();
|
|
|
|
|
|
|
|
Faction faction = context.argAsFaction(0, context.fPlayer == null ? null : myFaction);
|
|
|
|
if (faction == null) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
context.player.openInventory(context.faction.getChestInventory());
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public TL getUsageTranslation() {
|
|
|
|
return TL.COMMAND_VIEWCHEST_DESCRIPTION;
|
|
|
|
}
|
2019-06-30 08:20:17 +02:00
|
|
|
}
|
|
|
|
|