-
Notifications
You must be signed in to change notification settings - Fork 396
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updates to give the host of a network game 'mod' powers. If the game is a bot, then also give the 'oldest' player 'mod' powers. Mod powers allow: disconnect players ban players (effective until restart of bot) The bot case is interesting since the 'oldest' player can change. For example, two players enter a bot (to the staging screen), first is mod & then leaves. Now the second player needs to become moderator. To achieve this we add a "moderator promoted" message which is sent by the server to inform players of the new moderator.
- Loading branch information
1 parent
09fa340
commit 31479d3
Showing
13 changed files
with
266 additions
and
32 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
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
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
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
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
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
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
30 changes: 30 additions & 0 deletions
30
...e/src/main/java/games/strategy/engine/framework/startup/mc/messages/ModeratorMessage.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,30 @@ | ||
package games.strategy.engine.framework.startup.mc.messages; | ||
|
||
import java.io.Serializable; | ||
import javax.annotation.Nonnull; | ||
import lombok.Value; | ||
|
||
/** Represents a message sent to the server, from a moderator */ | ||
@Value | ||
public class ModeratorMessage implements Serializable { | ||
private static final long serialVersionUID = 1L; | ||
|
||
@Nonnull String action; | ||
@Nonnull String playerName; | ||
|
||
public static ModeratorMessage newDisconnect(String playerName) { | ||
return new ModeratorMessage("disconnect", playerName); | ||
} | ||
|
||
public static ModeratorMessage newBan(String playerName) { | ||
return new ModeratorMessage("ban", playerName); | ||
} | ||
|
||
public boolean isBan() { | ||
return "ban".equalsIgnoreCase(action); | ||
} | ||
|
||
public boolean isDisconnect() { | ||
return "disconnect".equalsIgnoreCase(action); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
.../src/main/java/games/strategy/engine/framework/startup/mc/messages/ModeratorPromoted.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,15 @@ | ||
package games.strategy.engine.framework.startup.mc.messages; | ||
|
||
import java.io.Serializable; | ||
import lombok.Value; | ||
|
||
/** | ||
* This is a message sent to all players to indicate moderator player has changed. For example, in a | ||
* bot game, if there are 3 players - then the bot and oldest joined will be moderators. If the | ||
* oldest joined leaves, then the remaining player become smoderator. | ||
*/ | ||
@Value | ||
public class ModeratorPromoted implements Serializable { | ||
/** The name of the player who is now a moderator. */ | ||
String playerName; | ||
} |
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
Oops, something went wrong.