From cbde2450fafe1736e927f303b07c361a3b3962b9 Mon Sep 17 00:00:00 2001 From: simon Date: Sun, 11 Mar 2018 16:06:15 -0400 Subject: [PATCH] Bug fixes: maxShield is now set on user creation and vault objectId is set on world generation --- .../src/main/java/net/simon987/cubotplugin/Cubot.java | 8 ++++++++ .../simon987/cubotplugin/event/UserCreationListener.java | 4 +++- .../simon987/npcplugin/event/WorldCreationListener.java | 1 + 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Plugin Cubot/src/main/java/net/simon987/cubotplugin/Cubot.java b/Plugin Cubot/src/main/java/net/simon987/cubotplugin/Cubot.java index b6cdc32..d4bc841 100644 --- a/Plugin Cubot/src/main/java/net/simon987/cubotplugin/Cubot.java +++ b/Plugin Cubot/src/main/java/net/simon987/cubotplugin/Cubot.java @@ -463,4 +463,12 @@ public class Cubot extends GameObject implements Updatable, ControllableUnit, Pr return true; } + + public int getMaxShield() { + return maxShield; + } + + public void setMaxShield(int maxShield) { + this.maxShield = maxShield; + } } 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 a91d32d..18ef2af 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 @@ -29,7 +29,7 @@ public class UserCreationListener implements GameEventListener { cubot.addStatus(CubotStatus.FACTORY_NEW); cubot.setObjectId(GameServer.INSTANCE.getGameUniverse().getNextObjectId()); ServerConfiguration config = GameServer.INSTANCE.getConfig(); - + Point point = null; while (point == null || cubot.getWorld() == null) { int spawnX = config.getInt("new_user_worldX") + random.nextInt(5); @@ -50,6 +50,8 @@ public class UserCreationListener implements GameEventListener { cubot.setMaxEnergy(config.getInt("battery_max_energy")); cubot.setHp(config.getInt("cubot_max_hp")); + cubot.setMaxHp(config.getInt("cubot_max_hp")); + cubot.setMaxShield(config.getInt("cubot_max_hp")); cubot.setParent(user); user.setControlledUnit(cubot); diff --git a/Plugin NPC/src/main/java/net/simon987/npcplugin/event/WorldCreationListener.java b/Plugin NPC/src/main/java/net/simon987/npcplugin/event/WorldCreationListener.java index 8a89772..c1b91d4 100644 --- a/Plugin NPC/src/main/java/net/simon987/npcplugin/event/WorldCreationListener.java +++ b/Plugin NPC/src/main/java/net/simon987/npcplugin/event/WorldCreationListener.java @@ -123,6 +123,7 @@ public class WorldCreationListener implements GameEventListener { } } + vaultDoor.setObjectId(GameServer.INSTANCE.getGameUniverse().getNextObjectId()); world.addObject(vaultDoor); world.incUpdatable(); //In case the Factory & Radio Tower couldn't be spawned. vaultDoor.setWorld(world);