From cbf9246981436d6d17c99e04a34a62b2dd10604f Mon Sep 17 00:00:00 2001 From: Magnus Ulf Date: Tue, 2 Mar 2021 22:04:50 +0100 Subject: [PATCH] Readd home command --- .../factions/cmd/CmdFactions.java | 2 +- .../factions/cmd/CmdFactionsHome.java | 37 +++++++++++++++++++ .../massivecraft/factions/entity/MConf.java | 5 ++- 3 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 src/com/massivecraft/factions/cmd/CmdFactionsHome.java diff --git a/src/com/massivecraft/factions/cmd/CmdFactions.java b/src/com/massivecraft/factions/cmd/CmdFactions.java index 8e39577a..5c30e973 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactions.java +++ b/src/com/massivecraft/factions/cmd/CmdFactions.java @@ -28,6 +28,7 @@ public class CmdFactions extends FactionsCommand public CmdFactionsJoin cmdFactionsJoin = new CmdFactionsJoin(); public CmdFactionsLeave cmdFactionsLeave = new CmdFactionsLeave(); public CmdFactionsWarp cmdFactionsWarp = new CmdFactionsWarp(); + public CmdFactionsHome cmdFactionsHome = new CmdFactionsHome(); public CmdFactionsVote cmdFactionsVote = new CmdFactionsVote(); public CmdFactionsMap cmdFactionsMap = new CmdFactionsMap(); public CmdFactionsCreate cmdFactionsCreate = new CmdFactionsCreate(); @@ -78,7 +79,6 @@ public class CmdFactions extends FactionsCommand // Deprecated Commands this.addChild(new MassiveCommandDeprecated(this.cmdFactionsRank, "leader", "owner", "officer", "moderator", "coleader")); - this.addChild(new MassiveCommandDeprecated(this.cmdFactionsWarp, "home")); this.addChild(new MassiveCommandDeprecated(this.cmdFactionsWarp.cmdFactionWarpAdd, "sethome")); this.addChild(new MassiveCommandDeprecated(this.cmdFactionsWarp.cmdFactionWarpRemove, "unsethome")); } diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsHome.java b/src/com/massivecraft/factions/cmd/CmdFactionsHome.java new file mode 100644 index 00000000..bd829096 --- /dev/null +++ b/src/com/massivecraft/factions/cmd/CmdFactionsHome.java @@ -0,0 +1,37 @@ +package com.massivecraft.factions.cmd; + +import com.massivecraft.factions.entity.MConf; +import com.massivecraft.massivecore.MassiveException; +import com.massivecraft.massivecore.command.Visibility; +import com.massivecraft.massivecore.command.requirement.RequirementIsPlayer; +import com.massivecraft.massivecore.util.MUtil; + +import java.util.List; + +public class CmdFactionsHome extends FactionsCommandWarp +{ + // -------------------------------------------- // + // CONSTRUCT + // -------------------------------------------- // + + public CmdFactionsHome() + { + // Requirements + this.addRequirements(RequirementIsPlayer.get()); + + // Visibility + this.setVisibility(Visibility.INVISIBLE); + } + + // -------------------------------------------- // + // OVERRIDE + // -------------------------------------------- // + + @Override + public void perform() throws MassiveException + { + List args = MUtil.list(MConf.get().warpsHomeName); + CmdFactions.get().cmdFactionsWarp.cmdFactionsWarpGo.execute(me, args); + } + +} diff --git a/src/com/massivecraft/factions/entity/MConf.java b/src/com/massivecraft/factions/entity/MConf.java index 9d1fcb70..1579229a 100644 --- a/src/com/massivecraft/factions/entity/MConf.java +++ b/src/com/massivecraft/factions/entity/MConf.java @@ -258,7 +258,10 @@ public class MConf extends Entity // It's usually a wise idea keeping this true. // Otherwise players can set their warps inside enemy territory. public boolean warpsMustBeInClaimedTerritory = true; - + + // And what faction warp should be used when a player types /f home + public String warpsHomeName = "home"; + // These options can be used to limit rights to warp under different circumstances. public boolean warpsTeleportAllowedFromEnemyTerritory = true; public boolean warpsTeleportAllowedFromDifferentWorld = true;