diff --git a/src/main/java/com/ntlab/irisserver/entities/Room.java b/src/main/java/com/ntlab/irisserver/entities/Room.java index b160d4b..cf6a1f5 100644 --- a/src/main/java/com/ntlab/irisserver/entities/Room.java +++ b/src/main/java/com/ntlab/irisserver/entities/Room.java @@ -40,14 +40,27 @@ public int gameTimerFirstThinkingTimes; //int gameTimerFirstThinkingTimes; - @JsonProperty("RedMaster") - private Member RedMaster; - @JsonProperty("BlueMaster") - private Member BlueMaster; + @JsonProperty("redMaster") + private Member redMaster; + @JsonProperty("blueMaster") + private Member blueMaster; Map members= new HashMap<>(); Map drawings = new HashMap<>(); + public Room() { + drawingTimer = false; + drawingTimerTimes = 0; + gameTimer = true; + gameTimerTimes = 30; + gameTimerFirstThinkingTimes = 10; + } + + public Room(String rid, String owner) { + this.rid=rid; + ownerName=owner; + } + public List getMembers() { List memberslist = new ArrayList(members.values()) ; @@ -70,15 +83,15 @@ Member m = members.get(nick); //変更先のチームに既に所属している場合は変更なし - if(m.getBelongs() != belongs){ + if(!(m.getBelongs().equals(belongs))) { //1チームの最大人数は8人 //変更先のチームの人数を数える int memberscount = 0; List membersList = new ArrayList(members.values()) ; - for(Member mem :membersList){ - if(mem.getBelongs() == belongs){ + for(Member mem :membersList) { + if(mem.getBelongs().equals(belongs)) { memberscount++; } } @@ -93,28 +106,28 @@ } //マスターを変更 - if(belongs == "r"){ + if(belongs.equals("r")) { //赤チームのマスターをメンバーに変更 - if(RedMaster != null){ - RedMaster.setMaster(false); + if(redMaster != null) { + redMaster.setMaster(false); } //変更対象を赤チームのマスターに変更 m.setMaster(true); - RedMaster = m; + redMaster = m; } - if(belongs == "b"){ + if(belongs.equals("b")) { //青チームのマスターをメンバーに変更 - if(BlueMaster != null){ - BlueMaster.setMaster(false); + if(blueMaster != null) { + blueMaster.setMaster(false); } //変更対象を赤チームのマスターに変更 m.setMaster(true); - BlueMaster = m; + blueMaster = m; } @@ -125,27 +138,16 @@ return m; } - public void addMember(String nick){ + public void addMember(String nick) { Member m=new Member(nick); m.setNickname(nick); members.put(nick,m); } - public int getStateRest(){ + public int getStateRest() { return 0; } - public Room(){ - drawingTimer = false; - drawingTimerTimes = 0; - gameTimer = true; - gameTimerTimes = 30; - gameTimerFirstThinkingTimes = 10; - } - public Room(String rid, String owner) { - this.rid=rid; - ownerName=owner; - } public Drawing getDrawing(int dno) { return drawings.get(dno); }