From 141bf2f6fc61950c6eb51339067da56b50633b60 Mon Sep 17 00:00:00 2001 From: Magnus Ulf Date: Tue, 2 Mar 2021 22:15:54 +0100 Subject: [PATCH] Also sethome --- .../factions/cmd/CmdFactions.java | 4 +- .../factions/cmd/CmdFactionsSethome.java | 37 +++++++++++++++++++ .../factions/cmd/CmdFactionsUnsethome.java | 37 +++++++++++++++++++ 3 files changed, 76 insertions(+), 2 deletions(-) create mode 100644 src/com/massivecraft/factions/cmd/CmdFactionsSethome.java create mode 100644 src/com/massivecraft/factions/cmd/CmdFactionsUnsethome.java diff --git a/src/com/massivecraft/factions/cmd/CmdFactions.java b/src/com/massivecraft/factions/cmd/CmdFactions.java index 5c30e973..d77c8b09 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactions.java +++ b/src/com/massivecraft/factions/cmd/CmdFactions.java @@ -29,6 +29,8 @@ public class CmdFactions extends FactionsCommand public CmdFactionsLeave cmdFactionsLeave = new CmdFactionsLeave(); public CmdFactionsWarp cmdFactionsWarp = new CmdFactionsWarp(); public CmdFactionsHome cmdFactionsHome = new CmdFactionsHome(); + public CmdFactionsSethome cmdFactionsSethome = new CmdFactionsSethome(); + public CmdFactionsUnsethome cmdFactionsUnsethome = new CmdFactionsUnsethome(); public CmdFactionsVote cmdFactionsVote = new CmdFactionsVote(); public CmdFactionsMap cmdFactionsMap = new CmdFactionsMap(); public CmdFactionsCreate cmdFactionsCreate = new CmdFactionsCreate(); @@ -79,8 +81,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.cmdFactionWarpAdd, "sethome")); - this.addChild(new MassiveCommandDeprecated(this.cmdFactionsWarp.cmdFactionWarpRemove, "unsethome")); } // -------------------------------------------- // diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsSethome.java b/src/com/massivecraft/factions/cmd/CmdFactionsSethome.java new file mode 100644 index 00000000..65d8fb3b --- /dev/null +++ b/src/com/massivecraft/factions/cmd/CmdFactionsSethome.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 CmdFactionsSethome extends FactionsCommandWarp +{ + // -------------------------------------------- // + // CONSTRUCT + // -------------------------------------------- // + + public CmdFactionsSethome() + { + // 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.cmdFactionWarpAdd.execute(me, args); + } + +} diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsUnsethome.java b/src/com/massivecraft/factions/cmd/CmdFactionsUnsethome.java new file mode 100644 index 00000000..00edce4c --- /dev/null +++ b/src/com/massivecraft/factions/cmd/CmdFactionsUnsethome.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 CmdFactionsUnsethome extends FactionsCommandWarp +{ + // -------------------------------------------- // + // CONSTRUCT + // -------------------------------------------- // + + public CmdFactionsUnsethome() + { + // 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.cmdFactionWarpRemove.execute(me, args); + } + +}