diff --git a/src/main/java/net/lewmc/essence/Essence.java b/src/main/java/net/lewmc/essence/Essence.java index 6c85dc82..61b352a0 100644 --- a/src/main/java/net/lewmc/essence/Essence.java +++ b/src/main/java/net/lewmc/essence/Essence.java @@ -85,6 +85,11 @@ public class Essence extends JavaPlugin { */ public boolean hasPendingUpdate = false; + /** + * Manages random numbers. + */ + public Random rand = new Random(); + /** * This function runs when Essence is enabled. */ diff --git a/src/main/java/net/lewmc/essence/utils/LocationUtil.java b/src/main/java/net/lewmc/essence/utils/LocationUtil.java index b7375a58..693a5439 100644 --- a/src/main/java/net/lewmc/essence/utils/LocationUtil.java +++ b/src/main/java/net/lewmc/essence/utils/LocationUtil.java @@ -7,8 +7,6 @@ import org.bukkit.WorldBorder; import org.bukkit.entity.Player; -import java.util.Random; - /** * Essence location utility. */ @@ -40,15 +38,14 @@ public void UpdateLastLocation(Player player) { public Location GetRandomLocation(Player player, WorldBorder wb) { World world = player.getWorld(); - Random rand = new Random(); Location center = wb.getCenter(); double maxX = (center.getBlockX() + (wb.getSize()/2)); double minX = (center.getBlockX() - (wb.getSize()/2)); double maxZ = (center.getBlockZ() + (wb.getSize()/2)); double minZ = (center.getBlockZ() - (wb.getSize()/2)); - int x = (int) (minX + (maxX - minX) * rand.nextDouble()); - int z = (int) (minZ + (maxZ - minZ) * rand.nextDouble()); + int x = (int) (minX + (maxX - minX) * this.plugin.rand.nextDouble()); + int z = (int) (minZ + (maxZ - minZ) * this.plugin.rand.nextDouble()); int attempt = 1; int y = GetGroundY(world, x, z);