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

@@ -12,54 +12,47 @@ public class CmdMap extends FCommand {
public CmdMap() {
super();
this.aliases.add("map");
//this.requiredArgs.add("");
this.optionalArgs.put("on/off", "once");
this.permission = Permission.MAP.node;
this.disableOnLock = false;
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
this.requirements = new CommandRequirements.Builder(Permission.MAP)
.playerOnly()
.build();
}
@Override
public void perform() {
if (this.argIsSet(0)) {
if (this.argAsBool(0, !fme.isMapAutoUpdating())) {
public void perform(CommandContext context) {
if (context.argIsSet(0)) {
if (context.argAsBool(0, !context.fPlayer.isMapAutoUpdating())) {
// Turn on
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
if (!payForCommand(Conf.econCostMap, "to show the map", "for showing the map")) {
if (!context.payForCommand(Conf.econCostMap, "to show the map", "for showing the map")) {
return;
}
fme.setMapAutoUpdating(true);
msg(TL.COMMAND_MAP_UPDATE_ENABLED);
context.fPlayer.setMapAutoUpdating(true);
context.msg(TL.COMMAND_MAP_UPDATE_ENABLED);
// And show the map once
showMap();
showMap(context);
} else {
// Turn off
fme.setMapAutoUpdating(false);
msg(TL.COMMAND_MAP_UPDATE_DISABLED);
context.fPlayer.setMapAutoUpdating(false);
context.msg(TL.COMMAND_MAP_UPDATE_DISABLED);
}
} else {
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
if (!payForCommand(Conf.econCostMap, TL.COMMAND_MAP_TOSHOW, TL.COMMAND_MAP_FORSHOW)) {
if (!context.payForCommand(Conf.econCostMap, TL.COMMAND_MAP_TOSHOW, TL.COMMAND_MAP_FORSHOW)) {
return;
}
showMap();
showMap(context);
}
}
public void showMap() {
sendFancyMessage(Board.getInstance().getMap(fme, new FLocation(fme), fme.getPlayer().getLocation().getYaw()));
public void showMap(CommandContext context) {
context.sendFancyMessage(Board.getInstance().getMap(context.fPlayer, new FLocation(context.fPlayer), context.player.getLocation().getYaw()));
}
@Override
@@ -67,4 +60,4 @@ public class CmdMap extends FCommand {
return TL.COMMAND_MAP_DESCRIPTION;
}
}
}