diff --git a/src/main/java/cactusServer/entities/Instance.java b/src/main/java/cactusServer/entities/Instance.java index 930931d..54ed46b 100644 --- a/src/main/java/cactusServer/entities/Instance.java +++ b/src/main/java/cactusServer/entities/Instance.java @@ -2,6 +2,8 @@ import java.util.HashMap; import java.util.HashSet; +import java.util.Iterator; +import java.util.Map; import org.ntlab.radishforandroidstudio.framework.model3D.BaseObject3D; import org.ntlab.radishforandroidstudio.framework.model3D.Object3D; @@ -255,6 +257,24 @@ } return null; } + + public void removeDeadBullets() { + Iterator> playersBulletsIt = bulletMap.values().iterator(); + while (playersBulletsIt.hasNext()) { + Map playersBullets = playersBulletsIt.next(); + Iterator> bulletEntryIt = playersBullets.entrySet().iterator(); + while (bulletEntryIt.hasNext()) { + Map.Entry bulletEntry = bulletEntryIt.next(); + Bullet bullet = bulletEntry.getValue(); + if (!bullet.isAlive()) { + String bulletId = bulletEntry.getKey(); + bulletEntryIt.remove(); + universe.displace(bullet.getPlaceable()); + System.out.println(bulletId + "�폜"); + } + } + } + } public static enum State { AVAILABLE, MAINTENANCE;