From 00cb78fd9bf1d5c684d091da2cc64057f5a26f5e Mon Sep 17 00:00:00 2001 From: DroppingAnvil Date: Tue, 21 Apr 2020 16:04:18 -0500 Subject: [PATCH] Set a world for /f wild --- .../java/com/massivecraft/factions/cmd/wild/CmdWild.java | 7 ++++++- .../java/com/massivecraft/factions/cmd/wild/WildGUI.java | 3 +++ .../com/massivecraft/factions/util/wait/WaitExecutor.java | 4 +--- src/main/resources/config.yml | 2 ++ 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/massivecraft/factions/cmd/wild/CmdWild.java b/src/main/java/com/massivecraft/factions/cmd/wild/CmdWild.java index c5d06140..c0b0ba8d 100644 --- a/src/main/java/com/massivecraft/factions/cmd/wild/CmdWild.java +++ b/src/main/java/com/massivecraft/factions/cmd/wild/CmdWild.java @@ -11,6 +11,7 @@ import com.massivecraft.factions.util.wait.WaitedTask; import com.massivecraft.factions.zcore.util.TL; import org.bukkit.Bukkit; import org.bukkit.Location; +import org.bukkit.World; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.entity.Player; import org.bukkit.event.player.PlayerTeleportEvent; @@ -21,10 +22,14 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Random; +/** + * @author DroppingAnvil + */ public class CmdWild extends FCommand implements WaitedTask { public static HashMap teleportRange; public static HashSet teleporting; public static CmdWild instance; + public static final String tpWorld = FactionsPlugin.getInstance().getConfig().getString("Wild.World", "World"); public CmdWild() { super(); @@ -56,7 +61,7 @@ public class CmdWild extends FCommand implements WaitedTask { int z = new Random().nextInt((c.getInt("Range.MaxZ") - c.getInt("Range.MinZ")) + 1) + c.getInt("Range.MinZ"); if (Board.getInstance().getFactionAt(new FLocation(p.getWorld().getName(), x, z)).isWilderness()) { success = true; - FLocation loc = new FLocation(p.getWorld().getName(), x, z); + FLocation loc = new FLocation(tpWorld, x, z); teleportRange.remove(p); if (!FPlayers.getInstance().getByPlayer(p).takeMoney(c.getInt("Cost"))) { p.sendMessage(TL.GENERIC_NOTENOUGHMONEY.toString()); diff --git a/src/main/java/com/massivecraft/factions/cmd/wild/WildGUI.java b/src/main/java/com/massivecraft/factions/cmd/wild/WildGUI.java index 0bb1b842..bbe671cb 100644 --- a/src/main/java/com/massivecraft/factions/cmd/wild/WildGUI.java +++ b/src/main/java/com/massivecraft/factions/cmd/wild/WildGUI.java @@ -20,6 +20,9 @@ import java.util.HashMap; import java.util.List; import java.util.Objects; +/** + * @author DroppingAnvil + */ public class WildGUI implements FactionGUI { Player player; FPlayer fplayer; diff --git a/src/main/java/com/massivecraft/factions/util/wait/WaitExecutor.java b/src/main/java/com/massivecraft/factions/util/wait/WaitExecutor.java index a555794e..8335b068 100644 --- a/src/main/java/com/massivecraft/factions/util/wait/WaitExecutor.java +++ b/src/main/java/com/massivecraft/factions/util/wait/WaitExecutor.java @@ -8,9 +8,7 @@ import org.bukkit.entity.Player; import java.util.concurrent.ConcurrentHashMap; /** - * Factions - Developed by Driftay. - * All rights reserved 2020. - * Creation Date: 4/4/2020 + * @author DroppingAnvil */ public class WaitExecutor { public static ConcurrentHashMap taskMap = new ConcurrentHashMap<>(); diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 59437e69..15b636dd 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -1434,6 +1434,8 @@ Wild: Enabled: true # Time to wait in seconds # Wait: 5 + # World players will be teleported to # + World: 'World' # General GUI Settings # GUI: Name: 'Teleporter'