File tree 2 files changed +44
-1
lines changed
Kepler-Server/src/main/java/org/alexdev/kepler
2 files changed +44
-1
lines changed Original file line number Diff line number Diff line change 8
8
import org .alexdev .kepler .game .games .player .GameRank ;
9
9
import org .alexdev .kepler .game .player .Player ;
10
10
import org .alexdev .kepler .game .room .models .RoomModel ;
11
+ import org .alexdev .kepler .messages .outgoing .games .GAMEDELETED ;
11
12
import org .alexdev .kepler .util .DateUtil ;
12
13
import org .alexdev .kepler .util .config .GameConfiguration ;
13
14
@@ -67,7 +68,7 @@ public void refreshPlayedGames() {
67
68
var games = this .lastPlayedGames .get (gameType );
68
69
69
70
if (games .size () > GameManager .MAX_HISTORY ) {
70
- games = games .subList (games .size () - GameManager .MAX_HISTORY , games .size ());
71
+ games = games .subList (games .size () - Math . min ( games . size (), GameManager .MAX_HISTORY + 1 ) , games .size ());
71
72
this .lastPlayedGames .put (gameType , games );
72
73
}
73
74
}
Original file line number Diff line number Diff line change
1
+ package org .alexdev .kepler .messages .outgoing .games ;
2
+
3
+ import org .alexdev .kepler .messages .types .MessageComposer ;
4
+ import org .alexdev .kepler .server .netty .streams .NettyResponse ;
5
+
6
+ public class STARTFAILED extends MessageComposer {
7
+ public enum FailedReason {
8
+ MINIMUM_TEAMS_REQUIRED (8 );
9
+
10
+ private final int reasonId ;
11
+
12
+ FailedReason (int reasonId ) {
13
+ this .reasonId = reasonId ;
14
+ }
15
+
16
+ public int getReasonId () {
17
+ return reasonId ;
18
+ }
19
+ }
20
+
21
+ private final FailedReason reason ;
22
+ private final String key ;
23
+
24
+ public STARTFAILED (FailedReason reason , String key ) {
25
+ this .reason = reason ;
26
+ this .key = key ;
27
+ }
28
+
29
+ @ Override
30
+ public void compose (NettyResponse response ) {
31
+ response .writeInt (this .reason .getReasonId ());
32
+
33
+ if (this .key != null ) {
34
+ response .writeString (this .key );
35
+ }
36
+ }
37
+
38
+ @ Override
39
+ public short getHeader () {
40
+ return 242 ;
41
+ }
42
+ }
You can’t perform that action at this time.
0 commit comments