2018-05-12 00:47:58 +02:00
|
|
|
package com.massivecraft.factions.cmd;
|
|
|
|
|
|
|
|
import com.massivecraft.factions.struct.Permission;
|
|
|
|
import com.massivecraft.factions.zcore.util.TL;
|
|
|
|
|
|
|
|
public class CmdSetBanner extends FCommand {
|
|
|
|
|
2019-09-15 11:15:33 +02:00
|
|
|
public CmdSetBanner() {
|
|
|
|
super();
|
|
|
|
aliases.add("setbanner");
|
2018-05-12 00:47:58 +02:00
|
|
|
|
2019-09-15 11:15:33 +02:00
|
|
|
this.requirements = new CommandRequirements.Builder(Permission.BANNER)
|
|
|
|
.playerOnly()
|
|
|
|
.build();
|
|
|
|
}
|
2018-05-12 00:47:58 +02:00
|
|
|
|
2019-09-15 11:15:33 +02:00
|
|
|
@Override
|
|
|
|
public void perform(CommandContext context) {
|
|
|
|
if (!context.player.getItemInHand().getType().toString().contains("BANNER")) {
|
|
|
|
context.msg(TL.COMMAND_SETBANNER_NOTBANNER);
|
|
|
|
return;
|
|
|
|
}
|
2018-05-12 00:47:58 +02:00
|
|
|
|
2019-09-15 11:15:33 +02:00
|
|
|
context.faction.setBannerPattern(context.player.getItemInHand());
|
|
|
|
context.msg(TL.COMMAND_SETBANNER_SUCCESS);
|
2018-05-12 00:47:58 +02:00
|
|
|
|
|
|
|
|
2019-09-15 11:15:33 +02:00
|
|
|
}
|
2018-05-12 00:47:58 +02:00
|
|
|
|
2019-09-15 11:15:33 +02:00
|
|
|
@Override
|
|
|
|
public TL getUsageTranslation() {
|
|
|
|
return TL.COMMAND_SETBANNER_DESCRIPTION;
|
|
|
|
}
|
2018-05-12 00:47:58 +02:00
|
|
|
|
|
|
|
}
|