diff --git a/src/main/java/com/ntlab/irisserver/resources/MembersRest.java b/src/main/java/com/ntlab/irisserver/resources/MembersRest.java index e0f0cf9..e56127e 100644 --- a/src/main/java/com/ntlab/irisserver/resources/MembersRest.java +++ b/src/main/java/com/ntlab/irisserver/resources/MembersRest.java @@ -33,8 +33,12 @@ Member info = m.get(i); //Listの0番目と1番目をチームマスターにする - if(i==0 || i==1){ + if(i==0){ info.setMaster(true); + room.changeTeamAndMaster(info.getNickname(), "r", true); + }else if(i==1){ + info.setMaster(true); + room.changeTeamAndMaster(info.getNickname(), "b", true); }else{ info.setMaster(false); } @@ -42,13 +46,10 @@ //Listの偶数番目を"r"(赤)に、奇数番目を"b"(青)にする if(i % 2 == 0){ info.setBelongs("r"); - room.setRedMaster(info); - }else{ info.setBelongs("b"); - room.setBlueMaster(info); - } + } } @@ -82,9 +83,15 @@ public Room postMembers(@PathParam("rid") String rid, @FormParam("nickname") String nickname) { RoomManager rm = RoomManager.getInstance(); Room room = rm.getRoom(rid); + List gm = room.getMembers(); //引数で取ってきたnicknameがListに存在しているか確認 - if(room.getMember(nickname)==null)room.addMember(nickname); + if(room.getMember(nickname)==null && gm.size() < 10 ){ + room.addMember(nickname); + } else { + var response = Response.status(401).entity("満席です"); + throw new WebApplicationException(response.build()); + } return room;