diff --git a/src/main/java/cactusServer/resources/BulletsRest.java b/src/main/java/cactusServer/resources/BulletsRest.java index cf6f3e3..74c9da3 100644 --- a/src/main/java/cactusServer/resources/BulletsRest.java +++ b/src/main/java/cactusServer/resources/BulletsRest.java @@ -2,6 +2,7 @@ import java.util.HashMap; +import javax.ws.rs.DELETE; import javax.ws.rs.FormParam; import javax.ws.rs.GET; import javax.ws.rs.POST; @@ -60,4 +61,18 @@ } throw new WebApplicationException(400); } + + @Path("/{playerId}/{bulletId}") + @DELETE + @Produces(MediaType.TEXT_PLAIN) + public String destroyBullet(@PathParam("instanceId") String instanceId, @PathParam("playerId") String playerId, + @PathParam("bulletId") String bulletId) { + Instance instance = Instances.getInstance().getInstance(instanceId); + HashMap map = instance.getBullets().get(playerId); + if (map != null) { + Bullet removedBullet = map.remove(bulletId); + return JSON.encode(removedBullet); + } + throw new WebApplicationException(400); + } }