-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sending
PlayerEliminatedMessage
when a player is no longer able to …
…play in a game (whether win or lose)
- Loading branch information
Showing
3 changed files
with
58 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
cardshifter-api/src/main/java/com/cardshifter/api/outgoing/PlayerEliminatedMessage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package com.cardshifter.api.outgoing; | ||
|
||
import com.cardshifter.api.messages.Message; | ||
|
||
/** Informs players that a player has been eliminated, with the status of how that player did. */ | ||
public class PlayerEliminatedMessage extends Message { | ||
|
||
private int id; | ||
private boolean winner; | ||
private int resultPosition; | ||
|
||
/** Constructor. (no params) */ | ||
public PlayerEliminatedMessage() { | ||
this(0, false, 0); | ||
} | ||
|
||
/** | ||
* Creates a new message with the specified values | ||
* | ||
* @param id This entity | ||
* @param winner Whether or not the player is considered a winner | ||
* @param resultPosition The result position of the player | ||
*/ | ||
public PlayerEliminatedMessage(int id, boolean winner, int resultPosition) { | ||
super("elimination"); | ||
this.id = id; | ||
this.winner = winner; | ||
this.resultPosition = resultPosition; | ||
} | ||
|
||
public int getId() { | ||
return id; | ||
} | ||
|
||
public boolean isWinner() { | ||
return winner; | ||
} | ||
|
||
public int getResultPosition() { | ||
return resultPosition; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "PlayerEliminatedMessage [" | ||
+ "id=" + id | ||
+ ", winner=" + winner | ||
+ ", resultPosition=" + resultPosition | ||
+ "]"; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters