Introduced Brigadier Command System. More Formatting Coming in next commit.

This commit is contained in:
Driftay
2019-09-14 15:13:01 -04:00
parent b06e6e0f04
commit 3c9b606bb9
207 changed files with 4465 additions and 4017 deletions

View File

@@ -1,7 +1,7 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.P;
import com.massivecraft.factions.FactionsPlugin;
import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.util.TL;
@@ -13,29 +13,29 @@ public class CmdDelFWarp extends FCommand {
this.aliases.add("dw");
this.aliases.add("deletewarp");
this.requiredArgs.add("warp name");
this.senderMustBeMember = true;
this.senderMustBeModerator = true;
this.senderMustBePlayer = true;
this.permission = Permission.SETWARP.node;
this.requirements = new CommandRequirements.Builder(Permission.SETWARP)
.playerOnly()
.memberOnly()
.build();
}
@Override
public void perform() {
String warp = argAsString(0);
if (myFaction.isWarp(warp)) {
if (!transact(fme)) {
public void perform(CommandContext context) {
String warp = context.argAsString(0);
if (context.faction.isWarp(warp)) {
if (!transact(context.fPlayer, context)) {
return;
}
myFaction.removeWarp(warp);
fme.msg(TL.COMMAND_DELFWARP_DELETED, warp);
context.faction.removeWarp(warp);
context.msg(TL.COMMAND_DELFWARP_DELETED, warp);
} else {
fme.msg(TL.COMMAND_DELFWARP_INVALID, warp);
context.msg(TL.COMMAND_DELFWARP_INVALID, warp);
}
}
private boolean transact(FPlayer player) {
return !P.p.getConfig().getBoolean("warp-cost.enabled", false) || player.isAdminBypassing() || payForCommand(P.p.getConfig().getDouble("warp-cost.delwarp", 5), TL.COMMAND_DELFWARP_TODELETE.toString(), TL.COMMAND_DELFWARP_FORDELETE.toString());
private boolean transact(FPlayer player, CommandContext context) {
return !FactionsPlugin.getInstance().getConfig().getBoolean("warp-cost.enabled", false) || player.isAdminBypassing() || context.payForCommand(FactionsPlugin.getInstance().getConfig().getDouble("warp-cost.delwarp", 5), TL.COMMAND_DELFWARP_TODELETE.toString(), TL.COMMAND_DELFWARP_FORDELETE.toString());
}
@Override
@@ -43,3 +43,4 @@ public class CmdDelFWarp extends FCommand {
return TL.COMMAND_DELFWARP_DESCRIPTION;
}
}