Starting to implement basic methods for mini game & team mini game

This commit is contained in:
Anonymus Raccoon
2020-10-30 18:58:43 +01:00
parent 8cfb7d9d0a
commit 097e071e48
3 changed files with 2628 additions and 7 deletions

2549
Doxyfile Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,20 +1,43 @@
package moe.sdg.PluginSDG;
public interface MiniGame
import org.bukkit.entity.Player;
import java.util.ArrayList;
public abstract class MiniGame
{
private final ArrayList<Player> _players;
public MiniGame()
{
this._players = new ArrayList<Player>();
}
//! @brief Return the current count of players in the game.
int getCurrentPlayers();
public int getCurrentPlayers()
{
return this._players.size();
}
//! @brief Maximum number of player in the game.
int getMaxPlayers();
public abstract int getMaxPlayers();
///! @brief Method called when a player wants to join the game.
//! @param player The player who will join
//! @return True if the player has joined the game, false otherwise.
boolean join();
public boolean join(Player player)
{
if (this.getMaxPlayers() < this.getCurrentPlayers() + 1)
return false;
this._players.add(player);
return true;
}
//! @brief Method called when a player wants to leave the game.
void leave();
public abstract void leave();
//! @brief Start the game.
void start();
public abstract void start();
//! @brief End the game.
void end();
public abstract void end();
}

View File

@@ -0,0 +1,49 @@
package moe.sdg.PluginSDG;
import org.bukkit.entity.Player;
import java.util.ArrayList;
class Team
{
public String name;
private final ArrayList<Player> _players;
public int maxPlayer;
public Team(String name, int maxPlayer)
{
this.name = name;
this.maxPlayer = maxPlayer;
this._players = new ArrayList<Player>();
}
//! @brief Make a player join the team.
//! @param player The player who will join.
public boolean join(Player player)
{
if (this.playerCount() + 1 > this.maxPlayer)
return false;
this._players.add(player);
return true;
}
public int playerCount()
{
return this._players.size();
}
}
public abstract class TeamMiniGame extends MiniGame
{
private final ArrayList<Team> _teams;
public TeamMiniGame()
{
this._teams = new ArrayList<Team>();
}
//! @brief Get the number of teams.
public int getTeamCount()
{
return this._teams.size();
}
}