Skip to content

Commit

Permalink
Create Game::queue() function
Browse files Browse the repository at this point in the history
  • Loading branch information
lscgh committed Feb 9, 2024
1 parent 4579231 commit d97d05d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public boolean onCommand(CommandSender sender, Command command, String label, St
Game.lostGames.remove((Player)sender);
Game.lostGames.remove(configOfReturnMatch.opponentPlayer);

new Game(configOfReturnMatch, this.plugin, true);
new Game(configOfReturnMatch, this.plugin).queue(true);
return true;
}
}
Expand Down Expand Up @@ -128,7 +128,7 @@ public boolean onCommand(CommandSender sender, Command command, String label, St
// Show the confirmation to the player
sender.sendMessage("You've just asked " + ChatColor.AQUA + ChatColor.BOLD + config.opponentPlayer.getName() + ChatColor.RESET + " to play a game of tic-tac-toe with you!");

new Game(config, this.plugin, false);
new Game(config, this.plugin).queue(false);

return true;
}
Expand Down
8 changes: 5 additions & 3 deletions mavenmcserver/src/main/java/mavenmcserver/game/Game.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,7 @@ public static void cancelAllGames() {
private HashMap<Location, BlockData> beforeGameBlocks = new HashMap<Location, BlockData>();


public Game(GameConfig config, Plugin plugin, boolean isReturnMatch) {
this.registerQueued();

public Game(GameConfig config, Plugin plugin) {
this.plugin = plugin;

this.config = config;
Expand Down Expand Up @@ -147,6 +145,10 @@ public void run() {

};

}

public void queue(boolean isReturnMatch) {
this.registerQueued();
this.inviteOpponent(isReturnMatch);
}

Expand Down
3 changes: 2 additions & 1 deletion mavenmcserver/src/main/resources/classes.uml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ class FieldPoint {
-HashMap<Location, BlockData> beforeGameBlocks

.. Methods ..
+Game(GameConfig config, Plugin plugin, boolean isReturnMatch)
+Game(GameConfig config, Plugin plugin)
+void queue(boolean isReturnMatch)
-void registerQueued()
-Location generateGameLocation() /' Based on the main player's facing '/
-CubicBlockArea generateGameArea() /' Based on the game's size and the main player's location '/
Expand Down

0 comments on commit d97d05d

Please sign in to comment.