mirror of
https://github.com/zoriya/PluginSDG.git
synced 2025-12-06 06:46:09 +00:00
Implement DeathMatch class
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package moe.sdg.PluginSDG;
|
||||
|
||||
import moe.sdg.PluginSDG.games.DeathMatch;
|
||||
import moe.sdg.PluginSDG.Commands.HubCommand;
|
||||
import moe.sdg.PluginSDG.Commands.SetHubCommand;
|
||||
import org.apache.commons.lang.NotImplementedException;
|
||||
@@ -26,21 +27,24 @@ public class GameManager extends JavaPlugin
|
||||
|
||||
getCommand("hub").setExecutor(new HubCommand(config));
|
||||
getCommand("sethub").setExecutor(new SetHubCommand(config));
|
||||
_games = new ArrayList<MiniGame>();
|
||||
_games = new ArrayList<>();
|
||||
getLogger().info("Game manager loaded.");
|
||||
}
|
||||
|
||||
public Location getHubLocation()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable()
|
||||
{
|
||||
super.onDisable();
|
||||
}
|
||||
|
||||
|
||||
//! @brief return hub location
|
||||
//! @return return a Location containing the server hub
|
||||
public Location getHubLocation()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
//! @brief factory for creating new game
|
||||
//! @param type The type of game to create
|
||||
//! @param map the name of the map to use
|
||||
@@ -48,7 +52,10 @@ public class GameManager extends JavaPlugin
|
||||
public MiniGame createGame(GameType type, String map)
|
||||
{
|
||||
switch (type) {
|
||||
// TODO: create a new game and add it the array list
|
||||
case DeathMatch:
|
||||
DeathMatch match = new DeathMatch(this);
|
||||
this._games.add(match);
|
||||
return match;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
package moe.sdg.PluginSDG;
|
||||
|
||||
public enum GameType {
|
||||
MINIGAME
|
||||
DeathMatch
|
||||
}
|
||||
|
||||
41
src/main/java/moe/sdg/PluginSDG/games/DeathMatch.java
Normal file
41
src/main/java/moe/sdg/PluginSDG/games/DeathMatch.java
Normal file
@@ -0,0 +1,41 @@
|
||||
package moe.sdg.PluginSDG.games;
|
||||
|
||||
import moe.sdg.PluginSDG.GameManager;
|
||||
import moe.sdg.PluginSDG.GameType;
|
||||
import moe.sdg.PluginSDG.MiniGame;
|
||||
|
||||
public class DeathMatch extends MiniGame {
|
||||
|
||||
private int _maxPlayer = 4;
|
||||
private boolean enforceMaxPlayer = false;
|
||||
|
||||
public DeathMatch(GameManager gameManager)
|
||||
{
|
||||
super(gameManager);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GameType getType() {
|
||||
return GameType.DeathMatch;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxPlayers() {
|
||||
if (enforceMaxPlayer)
|
||||
return _maxPlayer;
|
||||
return 0;
|
||||
}
|
||||
|
||||
//! @brief Start the game.
|
||||
@Override
|
||||
public void start() {
|
||||
|
||||
}
|
||||
|
||||
//! @brief End the game.
|
||||
@Override
|
||||
public void end() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user