Added Command Argument for F Home command to allow staff in F bypass to go to other faction homes!

Usage: /f home <faction>
This commit is contained in:
Driftay 2019-07-11 03:15:02 -04:00
parent 5f2cc89e2d
commit 126dfe49a1
2 changed files with 36 additions and 2 deletions

View File

@ -24,6 +24,7 @@ public class CmdHome extends FCommand {
super();
this.aliases.add("home");
this.optionalArgs.put("faction", "yours");
//this.requiredArgs.add("");
//this.optionalArgs.put("", "");
@ -32,7 +33,7 @@ public class CmdHome extends FCommand {
senderMustBePlayer = true;
senderMustBeMember = true;
senderMustBeMember = false;
senderMustBeModerator = false;
senderMustBeColeader = false;
senderMustBeAdmin = false;
@ -41,6 +42,8 @@ public class CmdHome extends FCommand {
@Override
public void perform() {
// TODO: Hide this command on help also.
if (!Conf.homesEnabled) {
fme.msg(TL.COMMAND_HOME_DISABLED);
return;
@ -50,6 +53,33 @@ public class CmdHome extends FCommand {
fme.msg(TL.COMMAND_HOME_TELEPORTDISABLED);
return;
}
Faction factionArg = myFaction;
if(argIsSet(0)){
factionArg = argAsFaction(0);
}
if(factionArg == null || factionArg.isWilderness())
return;
if(factionArg.hasHome()){
if(fme.isAdminBypassing()) {
fme.getPlayer().teleport(factionArg.getHome());
fme.msg(TL.COMMAND_HOME_TELEPORT_OTHER, factionArg.getTag());
} else {
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "teleport home");
return;
}
} else {
fme.msg(TL.COMMAND_HOME_OTHER_NOTSET, factionArg.getTag());
return;
}
if(myFaction.isWilderness())
return;
if (!fme.isAdminBypassing()) {
Access access = myFaction.getAccess(fme, PermissableAction.HOME);
if (access != Access.ALLOW && fme.getRole() != Role.LEADER) {
@ -65,6 +95,8 @@ public class CmdHome extends FCommand {
return;
}
if (!Conf.homesTeleportAllowedFromEnemyTerritory && fme.isInEnemyTerritory()) {
fme.msg(TL.COMMAND_HOME_INENEMY);
return;

View File

@ -162,8 +162,10 @@ public enum TL {
COMMAND_ALTKICK_NOTALT("&c&l[!] &7Player is not an alt."),
COMMAND_ALTKICK_NOTMEMBER("&c&l[!] &7This player is not a member of your faction."),
COMMAND_ALTS_LIST_NOALTS("&c&l[!] &7$1%s does not have any alts in their faction!"),
COMMAND_ALTS_LIST_NOALTS("&c&l[!] &7%s does not have any alts in their faction!"),
COMMAND_AUTOHELP_HELPFOR("Help for command \""),
COMMAND_HOME_OTHER_NOTSET("&c&l[!] &7%s does not have their faction home set!"),
COMMAND_HOME_TELEPORT_OTHER("&c&l[!] &7You have teleported to %s's faction home!"),
COMMAND_BAN_DESCRIPTION("Ban players from joining your Faction."),
COMMAND_BAN_TARGET("&c&l[!] &7You were &cbanned &7from &c%1$s"), // banned player perspective