Smooth Camera and Room Exist check

This commit is contained in:
brausjonas
2023-01-28 11:32:12 +01:00
parent cf9a17a8ff
commit fc84f233ec
18 changed files with 172 additions and 83 deletions
+18
View File
@@ -111,6 +111,15 @@ public class Room
}
break;
case 0:
try
{
for (int i = 0; i < players.length; i++)
{
players[player].output.write(new byte[]{127, 0, 0, 0, 0, 0, 0, 0, 0, 0});
}
} catch (IOException ex)
{
}
server.deleteRoom(roomCode);
for(int i = 0; i < threads.size(); i++)
{
@@ -121,6 +130,15 @@ public class Room
} catch (IOException e)
{
try
{
for (int i = 0; i < players.length; i++)
{
players[player].output.write(new byte[]{127, 0, 0, 0, 0, 0, 0, 0, 0, 0});
}
} catch (IOException ex)
{
}
for(int i = 0; i < threads.size(); i++)
{
threads.get(i).stop();
+10 -2
View File
@@ -64,9 +64,17 @@ public class Server
input.read(readData);
String roomCode = new String(readData, StandardCharsets.US_ASCII);
Client client1 = new Client(output, input, client);
rooms.get(roomCode).addClient(client1);
if(rooms.containsKey(roomCode))
{
Client client1 = new Client(output, input, client);
rooms.get(roomCode).addClient(client1);
}
else
{
output.write(new byte[]{127, 0, 0, 0, 0, 0, 0, 0, 0, 0});
}
break;
}