Skip to content

Commit

Permalink
Merge pull request #52 from utastudents/revert-51-w_lobby
Browse files Browse the repository at this point in the history
Revert "edited App.java so people in the lobby aren't disconnected when a player leaves"
  • Loading branch information
wdn5349 authored Apr 30, 2024
2 parents 19f96b4 + 26dad3b commit 05eb6dc
Show file tree
Hide file tree
Showing 27 changed files with 173 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/main/java/com/cse3310/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public void onClose(WebSocket conn, int code, String reason, boolean remote) {
// Fill list with player data from the game (EXCEPT THE USER THAT IS ABOUT TO
// LEAVE)
for (User user : ActiveUsers) {
if ((gameid == user.GameId) && (thisUser.username != user.username) && (user.GameId != -1)) {
if (gameid == user.GameId && thisUser.username != user.username) {
list.players.add(user.username);
list.playerScores.add(user.wordCount);
}
Expand All @@ -83,7 +83,7 @@ public void onClose(WebSocket conn, int code, String reason, boolean remote) {
// Send completed game list to all users in the specific game
int usersIngame = 0;
for (User user : ActiveUsers) {
if ((gameid == user.GameId) && (thisUser.username != user.username) && (user.GameId != -1)) {
if (gameid == user.GameId && thisUser.username != user.username) {
usersIngame++;
String jsonString = gson.toJson(list);
user.conn.send(jsonString);
Expand All @@ -95,7 +95,6 @@ public void onClose(WebSocket conn, int code, String reason, boolean remote) {

for (int j = 0; j < LobbyUsers.size(); j++) {
if (LobbyUsers.get(j).user.equals(tempName)) {
System.out.println("REMOVING: " + LobbyUsers.get(j).user + " FROM LOBBY");
if (LobbyUsers.get(j).ready == true) {
numReady--;
}
Expand All @@ -107,7 +106,7 @@ public void onClose(WebSocket conn, int code, String reason, boolean remote) {
ActiveUsers.remove(ActiveUsers.indexOf(thisUser));
}

if ((usersIngame < 2) && (list.players.size() != 0)) {
if (usersIngame < 2) {
forceDisconnect(gameid);
for (User u : ActiveUsers) {
if (u.GameId == gameid) {
Expand All @@ -120,8 +119,7 @@ public void onClose(WebSocket conn, int code, String reason, boolean remote) {
}
}
if (LobbyUsers != null) {
ServerEvent sendBack = new ServerEvent(1, LobbyUsers);
String jsonString = gson.toJson(sendBack);
String jsonString = gson.toJson(LobbyUsers);
broadcast(jsonString);
}

Expand Down
Binary file added target/classes/com/cse3310/App$LetterTimer.class
Binary file not shown.
Binary file added target/classes/com/cse3310/App.class
Binary file not shown.
Binary file added target/classes/com/cse3310/Error.class
Binary file not shown.
Binary file added target/classes/com/cse3310/Game.class
Binary file not shown.
Binary file added target/classes/com/cse3310/HttpServer$1.class
Binary file not shown.
Binary file added target/classes/com/cse3310/HttpServer.class
Binary file not shown.
Binary file added target/classes/com/cse3310/Lobby.class
Binary file not shown.
Binary file added target/classes/com/cse3310/PlayerList.class
Binary file not shown.
Binary file added target/classes/com/cse3310/ServerEvent.class
Binary file not shown.
Binary file added target/classes/com/cse3310/User.class
Binary file not shown.
Binary file added target/classes/com/cse3310/UserEvent.class
Binary file not shown.
Binary file added target/classes/com/cse3310/Version.class
Binary file not shown.
Binary file added target/classes/com/cse3310/Winner.class
Binary file not shown.
Binary file added target/classes/com/cse3310/timerEvent.class
Binary file not shown.
Binary file added target/cse3310-wordsearch.jar
Binary file not shown.
4 changes: 4 additions & 0 deletions target/maven-archiver/pom.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#Created by Apache Maven 3.6.3
groupId=com.cse3310_sp24_group26
artifactId=cse3310
version=wordsearch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
com/cse3310/HttpServer.class
com/cse3310/Version.class
com/cse3310/Lobby.class
com/cse3310/timerEvent.class
com/cse3310/App$LetterTimer.class
com/cse3310/Game.class
com/cse3310/Winner.class
com/cse3310/Error.class
com/cse3310/ServerEvent.class
com/cse3310/HttpServer$1.class
com/cse3310/UserEvent.class
com/cse3310/User.class
com/cse3310/App.class
com/cse3310/PlayerList.class
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/mnt/c/Users/verid/OneDrive/Documents/School/Classes/CSE 3310 Software Engineering/cse3310_sp24_group_26/src/main/java/com/cse3310/ServerEvent.java
/mnt/c/Users/verid/OneDrive/Documents/School/Classes/CSE 3310 Software Engineering/cse3310_sp24_group_26/src/main/java/com/cse3310/Winner.java
/mnt/c/Users/verid/OneDrive/Documents/School/Classes/CSE 3310 Software Engineering/cse3310_sp24_group_26/src/main/java/com/cse3310/User.java
/mnt/c/Users/verid/OneDrive/Documents/School/Classes/CSE 3310 Software Engineering/cse3310_sp24_group_26/src/main/java/com/cse3310/PlayerList.java
/mnt/c/Users/verid/OneDrive/Documents/School/Classes/CSE 3310 Software Engineering/cse3310_sp24_group_26/src/main/java/com/cse3310/Version.java
/mnt/c/Users/verid/OneDrive/Documents/School/Classes/CSE 3310 Software Engineering/cse3310_sp24_group_26/src/main/java/com/cse3310/App.java
/mnt/c/Users/verid/OneDrive/Documents/School/Classes/CSE 3310 Software Engineering/cse3310_sp24_group_26/src/main/java/com/cse3310/UserEvent.java
/mnt/c/Users/verid/OneDrive/Documents/School/Classes/CSE 3310 Software Engineering/cse3310_sp24_group_26/src/main/java/com/cse3310/Error.java
/mnt/c/Users/verid/OneDrive/Documents/School/Classes/CSE 3310 Software Engineering/cse3310_sp24_group_26/src/main/java/com/cse3310/HttpServer.java
/mnt/c/Users/verid/OneDrive/Documents/School/Classes/CSE 3310 Software Engineering/cse3310_sp24_group_26/src/main/java/com/cse3310/Game.java
/mnt/c/Users/verid/OneDrive/Documents/School/Classes/CSE 3310 Software Engineering/cse3310_sp24_group_26/src/main/java/com/cse3310/Lobby.java
/mnt/c/Users/verid/OneDrive/Documents/School/Classes/CSE 3310 Software Engineering/cse3310_sp24_group_26/src/main/java/com/cse3310/timerEvent.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
com/cse3310/UserTest.class
com/cse3310/AppTest.class
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/mnt/c/Users/verid/OneDrive/Documents/School/Classes/CSE 3310 Software Engineering/cse3310_sp24_group_26/src/test/java/com/cse3310/UserTest.java
/mnt/c/Users/verid/OneDrive/Documents/School/Classes/CSE 3310 Software Engineering/cse3310_sp24_group_26/src/test/java/com/cse3310/AppTest.java
65 changes: 65 additions & 0 deletions target/surefire-reports/TEST-com.cse3310.AppTest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuite xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://maven.apache.org/surefire/maven-surefire-plugin/xsd/surefire-test-report.xsd" name="com.cse3310.AppTest" time="0.547" tests="5" errors="0" skipped="0" failures="0">
<properties>
<property name="awt.toolkit" value="sun.awt.X11.XToolkit"/>
<property name="exec.mainClass" value="com.cse3310.App"/>
<property name="java.specification.version" value="11"/>
<property name="sun.cpu.isalist" value=""/>
<property name="sun.jnu.encoding" value="UTF-8"/>
<property name="java.class.path" value="/mnt/c/Users/verid/OneDrive/Documents/School/Classes/CSE 3310 Software Engineering/cse3310_sp24_group_26/target/test-classes:/mnt/c/Users/verid/OneDrive/Documents/School/Classes/CSE 3310 Software Engineering/cse3310_sp24_group_26/target/classes:/home/veridion/.m2/repository/junit/junit/4.13.1/junit-4.13.1.jar:/home/veridion/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar:/home/veridion/.m2/repository/com/google/code/gson/gson/2.9.1/gson-2.9.1.jar:/home/veridion/.m2/repository/net/freeutils/jlhttp/2.6/jlhttp-2.6.jar:/home/veridion/.m2/repository/org/java-websocket/Java-WebSocket/1.5.4/Java-WebSocket-1.5.4.jar:/home/veridion/.m2/repository/org/slf4j/slf4j-api/2.0.0-alpha0/slf4j-api-2.0.0-alpha0.jar:"/>
<property name="java.vm.vendor" value="Ubuntu"/>
<property name="sun.arch.data.model" value="64"/>
<property name="java.vendor.url" value="https://ubuntu.com/"/>
<property name="user.timezone" value=""/>
<property name="java.vm.specification.version" value="11"/>
<property name="os.name" value="Linux"/>
<property name="sun.java.launcher" value="SUN_STANDARD"/>
<property name="sun.boot.library.path" value="/usr/lib/jvm/java-11-openjdk-amd64/lib"/>
<property name="sun.java.command" value="/mnt/c/Users/verid/OneDrive/Documents/School/Classes/CSE 3310 Software Engineering/cse3310_sp24_group_26/target/surefire/surefirebooter5503315875287012771.jar /mnt/c/Users/verid/OneDrive/Documents/School/Classes/CSE 3310 Software Engineering/cse3310_sp24_group_26/target/surefire 2024-04-30T17-38-03_956-jvmRun1 surefire16572160997761146670tmp surefire_017606098207458292379tmp"/>
<property name="jdk.debug" value="release"/>
<property name="surefire.test.class.path" value="/mnt/c/Users/verid/OneDrive/Documents/School/Classes/CSE 3310 Software Engineering/cse3310_sp24_group_26/target/test-classes:/mnt/c/Users/verid/OneDrive/Documents/School/Classes/CSE 3310 Software Engineering/cse3310_sp24_group_26/target/classes:/home/veridion/.m2/repository/junit/junit/4.13.1/junit-4.13.1.jar:/home/veridion/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar:/home/veridion/.m2/repository/com/google/code/gson/gson/2.9.1/gson-2.9.1.jar:/home/veridion/.m2/repository/net/freeutils/jlhttp/2.6/jlhttp-2.6.jar:/home/veridion/.m2/repository/org/java-websocket/Java-WebSocket/1.5.4/Java-WebSocket-1.5.4.jar:/home/veridion/.m2/repository/org/slf4j/slf4j-api/2.0.0-alpha0/slf4j-api-2.0.0-alpha0.jar:"/>
<property name="sun.cpu.endian" value="little"/>
<property name="user.home" value="/home/veridion"/>
<property name="user.language" value="en"/>
<property name="java.specification.vendor" value="Oracle Corporation"/>
<property name="java.version.date" value="2023-10-17"/>
<property name="java.home" value="/usr/lib/jvm/java-11-openjdk-amd64"/>
<property name="file.separator" value="/"/>
<property name="basedir" value="/mnt/c/Users/verid/OneDrive/Documents/School/Classes/CSE 3310 Software Engineering/cse3310_sp24_group_26"/>
<property name="java.vm.compressedOopsMode" value="Zero based"/>
<property name="line.separator" value="&#10;"/>
<property name="java.specification.name" value="Java Platform API Specification"/>
<property name="java.vm.specification.vendor" value="Oracle Corporation"/>
<property name="java.awt.graphicsenv" value="sun.awt.X11GraphicsEnvironment"/>
<property name="surefire.real.class.path" value="/mnt/c/Users/verid/OneDrive/Documents/School/Classes/CSE 3310 Software Engineering/cse3310_sp24_group_26/target/surefire/surefirebooter5503315875287012771.jar"/>
<property name="sun.management.compiler" value="HotSpot 64-Bit Tiered Compilers"/>
<property name="java.runtime.version" value="11.0.21+9-post-Ubuntu-0ubuntu122.04"/>
<property name="user.name" value="veridion"/>
<property name="path.separator" value=":"/>
<property name="os.version" value="4.4.0-19041-Microsoft"/>
<property name="java.runtime.name" value="OpenJDK Runtime Environment"/>
<property name="file.encoding" value="UTF-8"/>
<property name="java.vm.name" value="OpenJDK 64-Bit Server VM"/>
<property name="localRepository" value="/home/veridion/.m2/repository"/>
<property name="java.vendor.url.bug" value="https://bugs.launchpad.net/ubuntu/+source/openjdk-lts"/>
<property name="java.io.tmpdir" value="/tmp"/>
<property name="java.version" value="11.0.21"/>
<property name="user.dir" value="/mnt/c/Users/verid/OneDrive/Documents/School/Classes/CSE 3310 Software Engineering/cse3310_sp24_group_26"/>
<property name="os.arch" value="amd64"/>
<property name="java.vm.specification.name" value="Java Virtual Machine Specification"/>
<property name="java.awt.printerjob" value="sun.print.PSPrinterJob"/>
<property name="sun.os.patch.level" value="unknown"/>
<property name="java.library.path" value="/usr/java/packages/lib:/usr/lib/x86_64-linux-gnu/jni:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/lib/jni:/lib:/usr/lib"/>
<property name="java.vm.info" value="mixed mode, sharing"/>
<property name="java.vendor" value="Ubuntu"/>
<property name="java.vm.version" value="11.0.21+9-post-Ubuntu-0ubuntu122.04"/>
<property name="java.specification.maintenance.version" value="2"/>
<property name="sun.io.unicode.encoding" value="UnicodeLittle"/>
<property name="java.class.version" value="55.0"/>
</properties>
<testcase name="testGenerateGrid" classname="com.cse3310.AppTest" time="0.341"/>
<testcase name="testApp" classname="com.cse3310.AppTest" time="0"/>
<testcase name="testGame" classname="com.cse3310.AppTest" time="0"/>
<testcase name="testGetCompletedButtons" classname="com.cse3310.AppTest" time="0.089"/>
<testcase name="testEndIdCase" classname="com.cse3310.AppTest" time="0.078"/>
</testsuite>
62 changes: 62 additions & 0 deletions target/surefire-reports/TEST-com.cse3310.UserTest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuite xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://maven.apache.org/surefire/maven-surefire-plugin/xsd/surefire-test-report.xsd" name="com.cse3310.UserTest" time="0.002" tests="2" errors="0" skipped="0" failures="0">
<properties>
<property name="awt.toolkit" value="sun.awt.X11.XToolkit"/>
<property name="exec.mainClass" value="com.cse3310.App"/>
<property name="java.specification.version" value="11"/>
<property name="sun.cpu.isalist" value=""/>
<property name="sun.jnu.encoding" value="UTF-8"/>
<property name="java.class.path" value="/mnt/c/Users/verid/OneDrive/Documents/School/Classes/CSE 3310 Software Engineering/cse3310_sp24_group_26/target/test-classes:/mnt/c/Users/verid/OneDrive/Documents/School/Classes/CSE 3310 Software Engineering/cse3310_sp24_group_26/target/classes:/home/veridion/.m2/repository/junit/junit/4.13.1/junit-4.13.1.jar:/home/veridion/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar:/home/veridion/.m2/repository/com/google/code/gson/gson/2.9.1/gson-2.9.1.jar:/home/veridion/.m2/repository/net/freeutils/jlhttp/2.6/jlhttp-2.6.jar:/home/veridion/.m2/repository/org/java-websocket/Java-WebSocket/1.5.4/Java-WebSocket-1.5.4.jar:/home/veridion/.m2/repository/org/slf4j/slf4j-api/2.0.0-alpha0/slf4j-api-2.0.0-alpha0.jar:"/>
<property name="java.vm.vendor" value="Ubuntu"/>
<property name="sun.arch.data.model" value="64"/>
<property name="java.vendor.url" value="https://ubuntu.com/"/>
<property name="user.timezone" value=""/>
<property name="java.vm.specification.version" value="11"/>
<property name="os.name" value="Linux"/>
<property name="sun.java.launcher" value="SUN_STANDARD"/>
<property name="sun.boot.library.path" value="/usr/lib/jvm/java-11-openjdk-amd64/lib"/>
<property name="sun.java.command" value="/mnt/c/Users/verid/OneDrive/Documents/School/Classes/CSE 3310 Software Engineering/cse3310_sp24_group_26/target/surefire/surefirebooter5503315875287012771.jar /mnt/c/Users/verid/OneDrive/Documents/School/Classes/CSE 3310 Software Engineering/cse3310_sp24_group_26/target/surefire 2024-04-30T17-38-03_956-jvmRun1 surefire16572160997761146670tmp surefire_017606098207458292379tmp"/>
<property name="jdk.debug" value="release"/>
<property name="surefire.test.class.path" value="/mnt/c/Users/verid/OneDrive/Documents/School/Classes/CSE 3310 Software Engineering/cse3310_sp24_group_26/target/test-classes:/mnt/c/Users/verid/OneDrive/Documents/School/Classes/CSE 3310 Software Engineering/cse3310_sp24_group_26/target/classes:/home/veridion/.m2/repository/junit/junit/4.13.1/junit-4.13.1.jar:/home/veridion/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar:/home/veridion/.m2/repository/com/google/code/gson/gson/2.9.1/gson-2.9.1.jar:/home/veridion/.m2/repository/net/freeutils/jlhttp/2.6/jlhttp-2.6.jar:/home/veridion/.m2/repository/org/java-websocket/Java-WebSocket/1.5.4/Java-WebSocket-1.5.4.jar:/home/veridion/.m2/repository/org/slf4j/slf4j-api/2.0.0-alpha0/slf4j-api-2.0.0-alpha0.jar:"/>
<property name="sun.cpu.endian" value="little"/>
<property name="user.home" value="/home/veridion"/>
<property name="user.language" value="en"/>
<property name="java.specification.vendor" value="Oracle Corporation"/>
<property name="java.version.date" value="2023-10-17"/>
<property name="java.home" value="/usr/lib/jvm/java-11-openjdk-amd64"/>
<property name="file.separator" value="/"/>
<property name="basedir" value="/mnt/c/Users/verid/OneDrive/Documents/School/Classes/CSE 3310 Software Engineering/cse3310_sp24_group_26"/>
<property name="java.vm.compressedOopsMode" value="Zero based"/>
<property name="line.separator" value="&#10;"/>
<property name="java.specification.name" value="Java Platform API Specification"/>
<property name="java.vm.specification.vendor" value="Oracle Corporation"/>
<property name="java.awt.graphicsenv" value="sun.awt.X11GraphicsEnvironment"/>
<property name="surefire.real.class.path" value="/mnt/c/Users/verid/OneDrive/Documents/School/Classes/CSE 3310 Software Engineering/cse3310_sp24_group_26/target/surefire/surefirebooter5503315875287012771.jar"/>
<property name="sun.management.compiler" value="HotSpot 64-Bit Tiered Compilers"/>
<property name="java.runtime.version" value="11.0.21+9-post-Ubuntu-0ubuntu122.04"/>
<property name="user.name" value="veridion"/>
<property name="path.separator" value=":"/>
<property name="os.version" value="4.4.0-19041-Microsoft"/>
<property name="java.runtime.name" value="OpenJDK Runtime Environment"/>
<property name="file.encoding" value="UTF-8"/>
<property name="java.vm.name" value="OpenJDK 64-Bit Server VM"/>
<property name="localRepository" value="/home/veridion/.m2/repository"/>
<property name="java.vendor.url.bug" value="https://bugs.launchpad.net/ubuntu/+source/openjdk-lts"/>
<property name="java.io.tmpdir" value="/tmp"/>
<property name="java.version" value="11.0.21"/>
<property name="user.dir" value="/mnt/c/Users/verid/OneDrive/Documents/School/Classes/CSE 3310 Software Engineering/cse3310_sp24_group_26"/>
<property name="os.arch" value="amd64"/>
<property name="java.vm.specification.name" value="Java Virtual Machine Specification"/>
<property name="java.awt.printerjob" value="sun.print.PSPrinterJob"/>
<property name="sun.os.patch.level" value="unknown"/>
<property name="java.library.path" value="/usr/java/packages/lib:/usr/lib/x86_64-linux-gnu/jni:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/lib/jni:/lib:/usr/lib"/>
<property name="java.vm.info" value="mixed mode, sharing"/>
<property name="java.vendor" value="Ubuntu"/>
<property name="java.vm.version" value="11.0.21+9-post-Ubuntu-0ubuntu122.04"/>
<property name="java.specification.maintenance.version" value="2"/>
<property name="sun.io.unicode.encoding" value="UnicodeLittle"/>
<property name="java.class.version" value="55.0"/>
</properties>
<testcase name="testForDuplicateUsernames" classname="com.cse3310.UserTest" time="0"/>
<testcase name="addFourToScoreAndWins" classname="com.cse3310.UserTest" time="0"/>
</testsuite>
4 changes: 4 additions & 0 deletions target/surefire-reports/com.cse3310.AppTest.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-------------------------------------------------------------------------------
Test set: com.cse3310.AppTest
-------------------------------------------------------------------------------
Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.547 s - in com.cse3310.AppTest
4 changes: 4 additions & 0 deletions target/surefire-reports/com.cse3310.UserTest.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-------------------------------------------------------------------------------
Test set: com.cse3310.UserTest
-------------------------------------------------------------------------------
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.002 s - in com.cse3310.UserTest
Binary file added target/test-classes/com/cse3310/AppTest.class
Binary file not shown.
Binary file added target/test-classes/com/cse3310/UserTest.class
Binary file not shown.

0 comments on commit 05eb6dc

Please sign in to comment.