From 1a0291d517796dab29a4d4e7cc5bd00664200520 Mon Sep 17 00:00:00 2001 From: simon Date: Tue, 2 Jan 2018 18:11:24 -0500 Subject: [PATCH] New players are now scattered around the spawn point --- .../simon987/cubotplugin/event/UserCreationListener.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Plugin Cubot/src/main/java/net/simon987/cubotplugin/event/UserCreationListener.java b/Plugin Cubot/src/main/java/net/simon987/cubotplugin/event/UserCreationListener.java index f787aad..77a8df6 100644 --- a/Plugin Cubot/src/main/java/net/simon987/cubotplugin/event/UserCreationListener.java +++ b/Plugin Cubot/src/main/java/net/simon987/cubotplugin/event/UserCreationListener.java @@ -9,6 +9,7 @@ import net.simon987.server.logging.LogManager; import net.simon987.server.user.User; import java.awt.*; +import java.util.Random; public class UserCreationListener implements GameEventListener { @Override @@ -25,9 +26,11 @@ public class UserCreationListener implements GameEventListener { Cubot cubot = new Cubot(); - cubot.setWorld(GameServer.INSTANCE.getGameUniverse().getWorld( - GameServer.INSTANCE.getConfig().getInt("new_user_worldX"), - GameServer.INSTANCE.getConfig().getInt("new_user_worldY"), true)); + Random random = new Random(); + int spawnX = GameServer.INSTANCE.getConfig().getInt("new_user_worldX") + random.nextInt(5); + int spawnY = GameServer.INSTANCE.getConfig().getInt("new_user_worldY") + random.nextInt(5); + + cubot.setWorld(GameServer.INSTANCE.getGameUniverse().getWorld(spawnX, spawnY, true)); cubot.getWorld().getGameObjects().add(cubot); cubot.getWorld().incUpdatable();