diff --git a/src/main/java/cactusServer/resources/CharactersRest.java b/src/main/java/cactusServer/resources/CharactersRest.java index de4d5f7..9e87709 100644 --- a/src/main/java/cactusServer/resources/CharactersRest.java +++ b/src/main/java/cactusServer/resources/CharactersRest.java @@ -22,7 +22,7 @@ @Path("/instances/{instanceId}/characters") public class CharactersRest { - + @Path("/{characterId}") @GET @Produces(MediaType.APPLICATION_JSON) @@ -36,7 +36,13 @@ } return null; } - + + @GET + @Produces(MediaType.APPLICATION_JSON) + public HashMap getCharacters(@PathParam("instanceId") String instanceId) { + return Instances.getInstance().getInstance(instanceId).getCharacters(); + } + @POST @Produces(MediaType.APPLICATION_JSON) public HashMap createCharacter(@PathParam("instanceId") String instanceId, @@ -44,7 +50,8 @@ @FormParam("position") Position3D position, @FormParam("angle") Quaternion3D angle, @FormParam("modelID") int modelID) { Instance instance = Instances.getInstance().getInstance(instanceId); - HashMap idMap = instance.createCharacter(instanceId, accountURI, name, position, angle, modelID); + HashMap idMap = instance.createCharacter(instanceId, accountURI, name, position, angle, + modelID); HashMap uriMap = new HashMap<>(); for (String id : idMap.keySet()) { String uri = (InstancesRest.INSTANCES_URI + "/" + instanceId + "/characters/") + id; @@ -52,12 +59,13 @@ } return uriMap; } - + @Path("/{characterId}") @PUT @Produces(MediaType.APPLICATION_JSON) - public Character updateCharacter(@FormParam("characterId") String characterId, - @FormParam("position") Position3D position, @FormParam("angle") Quaternion3D angle, @FormParam("modelID") String modelID) { + public Character updateCharacter(@FormParam("characterId") String characterId, + @FormParam("position") Position3D position, @FormParam("angle") Quaternion3D angle, + @FormParam("modelID") String modelID) { Character character = updateCharacter(characterId, position, angle, modelID); if (character != null) { throw new WebApplicationException(200); @@ -65,7 +73,5 @@ throw new WebApplicationException(400); } } - - }