diff --git a/src/main/java/com/ntlab/irisserver/resources/MemberRest.java b/src/main/java/com/ntlab/irisserver/resources/MemberRest.java index 94157dd..daf1059 100644 --- a/src/main/java/com/ntlab/irisserver/resources/MemberRest.java +++ b/src/main/java/com/ntlab/irisserver/resources/MemberRest.java @@ -11,43 +11,33 @@ @Component @Path("/rooms") public class MemberRest { - //所属チーム(n:無所属, r:赤, b:青) - String belongs = "n"; - //スパイマスターかどうか - boolean is_master = false; - int i = 0; - - /* - @GET - @Path("/{rid}/members/{nickname}") - public String getMember(@FormParam("rid") int rid, @FormParam("nickname") int nickname) { - return "Hello World"; - } - */ - // チーム変更・役職変更のメソッド @Path("/{rid}/members/{nickname}") @PUT - public String putMember(@PathParam("rid") String rid, @FormParam("nickname") String nickname) { + public String putMember(@PathParam("rid") String rid, @PathParam("nickname") String nickname, + @FormParam("belongs") String belongs, @FormParam("is-master") boolean is_master) { RoomManager rm = RoomManager.getInstance(); Room room = rm.getRoom("rid"); List m = room.getMembers(); + room.changeTeamAndMaster(nickname, belongs, is_master); return "変更しました"; } // プレイヤーを退出させるメソッド @Path("/{rid}/members/{nickname}") @DELETE - public String deleteMember(@PathParam("rid") String rid, @FormParam("nickname") String nickname) { + public String deleteMember(@PathParam("rid") String rid, @PathParam("nickname") String nickname, + @FormParam("belongs") String belongs, @FormParam("is-master") boolean is_master) { RoomManager rm = RoomManager.getInstance(); Room room = rm.getRoom("rid"); List m = room.getMembers(); - for( i = 0; i < 10; i++ ) { + for( int i = 0; i < 10; i++ ) { Member name = m.get(i); - if ( nickname == name.getNickname() ) { - nickname = null; + if ( nickname.equals(name.getNickname()) ) { + //room.deleteMember(nickname, belongs, is_master); } } + return "退出しました"; } } \ No newline at end of file