diff --git a/src/main/java/cactusServer/entities/Instance.java b/src/main/java/cactusServer/entities/Instance.java index 3688f12..e273e3b 100644 --- a/src/main/java/cactusServer/entities/Instance.java +++ b/src/main/java/cactusServer/entities/Instance.java @@ -183,6 +183,18 @@ setState(state); return this; } + + public Bullet updateBullet(String playerId, String bulletId, Position3D position, Quaternion3D angle) { + HashMap map = bulletMap.get(playerId); + if (map != null) { + Bullet bullet = map.get(bulletId); + if (bullet != null) { + bullet.update(position, angle); + } + return bullet; + } + return null; + } public Character destroyCharacter(String characterId) { return characterMap.remove(characterId); @@ -195,6 +207,16 @@ public Object destroyObject(String objId) { return objMap.remove(objId); } + + public Bullet destroyBullet(String playerId, String bulletId) { + HashMap map = bulletMap.get(playerId); + if (map != null) { + Bullet removedBullet = map.remove(bulletId); + this.getUniverse().displace(removedBullet.getPlaceable()); + return removedBullet; + } + return null; + } public static enum State { AVAILABLE, MAINTENANCE;