Kick All Players on Player leave
This commit is contained in:
Generated
+1
-1
@@ -72,7 +72,7 @@
|
|||||||
<updated>1674839030210</updated>
|
<updated>1674839030210</updated>
|
||||||
<workItem from="1674839031467" duration="221000" />
|
<workItem from="1674839031467" duration="221000" />
|
||||||
<workItem from="1674839402490" duration="20380000" />
|
<workItem from="1674839402490" duration="20380000" />
|
||||||
<workItem from="1674897525328" duration="3018000" />
|
<workItem from="1674897525328" duration="3479000" />
|
||||||
</task>
|
</task>
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+40
-18
@@ -106,15 +106,6 @@ public class Room
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 0:
|
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);
|
server.deleteRoom(roomCode);
|
||||||
for(int i = 0; i < threads.size(); i++)
|
for(int i = 0; i < threads.size(); i++)
|
||||||
{
|
{
|
||||||
@@ -125,15 +116,7 @@ public class Room
|
|||||||
|
|
||||||
} catch (IOException e)
|
} 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++)
|
for(int i = 0; i < threads.size(); i++)
|
||||||
{
|
{
|
||||||
threads.get(i).stop();
|
threads.get(i).stop();
|
||||||
@@ -197,4 +180,43 @@ public class Room
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void closeRoom()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
|
players[0].output.write(new byte[]{127, 0, 0, 0, 0, 0, 0, 0, 0, 0});
|
||||||
|
|
||||||
|
} catch (IOException ex)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
|
players[1].output.write(new byte[]{127, 0, 0, 0, 0, 0, 0, 0, 0, 0});
|
||||||
|
|
||||||
|
} catch (IOException ex)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
|
players[2].output.write(new byte[]{127, 0, 0, 0, 0, 0, 0, 0, 0, 0});
|
||||||
|
|
||||||
|
} catch (IOException ex)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
|
players[3].output.write(new byte[]{127, 0, 0, 0, 0, 0, 0, 0, 0, 0});
|
||||||
|
|
||||||
|
} catch (IOException ex)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ public class Server
|
|||||||
|
|
||||||
public void deleteRoom(String code)
|
public void deleteRoom(String code)
|
||||||
{
|
{
|
||||||
|
rooms.get(code).closeRoom();
|
||||||
rooms.remove(code);
|
rooms.remove(code);
|
||||||
System.out.println("Room " + code + " successfully deleted");
|
System.out.println("Room " + code + " successfully deleted");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user