Started work on UHC Staging

This commit is contained in:
alisolarflare 2016-11-05 06:57:10 -04:00
parent 2756c00f37
commit dd2dca0544
10 changed files with 101 additions and 22 deletions

View file

@ -0,0 +1,5 @@
package alisolarflare.minigames;
public enum GameState {
Idle, FreeForAll, Heroes;
}

View file

@ -13,8 +13,8 @@ import alisolarflare.minigames.data.SpawnSet;
public class MinigameModule extends Module{
public SpawnSet spawnSet;
private int GameState;
public List<String> fighters;
private GameState gameState;
@Override
public void register(JavaPlugin plugin) {
@ -26,8 +26,8 @@ public class MinigameModule extends Module{
}
public int getGameState() {return GameState;}
public void setGameState(int gameState) {GameState = gameState;}
public GameState getGameState() {return gameState;}
public void setGameState(GameState gameState) {this.gameState = gameState;}
}

View file

@ -7,10 +7,10 @@ import alisolarflare.minigames.MinigameModule;
import buttondevteam.lib.chat.TBMCCommandBase;
public class JoinMinigame extends TBMCCommandBase {
private MinigameModule minigame;
private MinigameModule module;
public JoinMinigame(MinigameModule minigame) {
this.minigame = minigame;
public JoinMinigame(MinigameModule module) {
this.module = module;
}
@Override
@ -21,14 +21,14 @@ public class JoinMinigame extends TBMCCommandBase {
}
String name = sender.getName();
if (minigame.fighters.contains(name)) {
if (module.fighters.contains(name)) {
sender.sendMessage("You are already in the minigame!");
return false;
}
minigame.fighters.add(name);
module.fighters.add(name);
if (minigame.fighters.contains(name)) {
if (module.fighters.contains(name)) {
sender.sendMessage("You have joined the minigame!");
}
return false;

View file

@ -8,26 +8,26 @@ import buttondevteam.lib.chat.TBMCCommandBase;
public class LeaveMinigame extends TBMCCommandBase {
private MinigameModule lobby;
private MinigameModule module;
public LeaveMinigame(MinigameModule lobby) {
this.lobby = lobby;
public LeaveMinigame(MinigameModule module) {
this.module = module;
}
@Override
public boolean OnCommand(CommandSender sender, String arg2, String[] arg3) {
if(!(sender instanceof Player)){
if(!(sender instanceof Player))
sender.sendMessage("You must be a player to use this command!");
}
String name = sender.getName();
if (!(lobby.fighters.contains(name))) {
if (!(module.fighters.contains(name))) {
sender.sendMessage("You are not fighting!");
return false;
}
while(lobby.fighters.contains(name)){
lobby.fighters.remove(name);
while(module.fighters.contains(name)){
module.fighters.remove(name);
}
sender.sendMessage("You have left the fighters category!");

View file

@ -1,7 +1,5 @@
package alisolarflare.minigames.commands;
import java.util.stream.Collectors;
import org.bukkit.command.CommandSender;
import alisolarflare.minigames.MinigameModule;
@ -16,7 +14,7 @@ public class ListFighters extends TBMCCommandBase {
@Override
public boolean OnCommand(CommandSender sender, String arg2, String[] arg3) {
sender.sendMessage(lobby.fighters.stream().map(Object::toString).collect(Collectors.joining(", ")));
sender.sendMessage(lobby.fighters.toString());
return false;
}

View file

@ -0,0 +1,33 @@
package alisolarflare.uhc.commands;
import org.bukkit.command.CommandSender;
import buttondevteam.lib.chat.TBMCCommandBase;
public class ConfigureMatch extends TBMCCommandBase{
@Override
public String[] GetHelpText(String alias) {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean OnCommand(CommandSender sender, String alias, String[] args) {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean GetPlayerOnly() {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean GetModOnly() {
// TODO Auto-generated method stub
return false;
}
}

View file

@ -0,0 +1,33 @@
package alisolarflare.uhc.commands;
import org.bukkit.command.CommandSender;
import buttondevteam.lib.chat.TBMCCommandBase;
public class ScheduleMatch extends TBMCCommandBase{
@Override
public String[] GetHelpText(String alias) {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean OnCommand(CommandSender sender, String alias, String[] args) {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean GetPlayerOnly() {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean GetModOnly() {
// TODO Auto-generated method stub
return false;
}
}

View file

@ -2,6 +2,7 @@ package alisolarflare.uhc.commands;
import org.bukkit.command.CommandSender;
import alisolarflare.uhc.memory.MatchState;
import alisolarflare.uhc.memory.UHCMatch;
import buttondevteam.lib.chat.TBMCCommandBase;
@ -23,6 +24,7 @@ public class StartMatch extends TBMCCommandBase {
switch(match.getMatchState()){
case IDLE:
sender.sendMessage("There is currently a match ready... Activating...");
match.setMatchState(MatchState.INTRO);
break;
case WAITING:
@ -30,7 +32,7 @@ public class StartMatch extends TBMCCommandBase {
break;
case END:
sender.sendMessage("The match has ended! Would you like to restart?");
sender.sendMessage("The match has ended! Would you like to restart using current settings?");
break;
default:

View file

@ -1,5 +1,12 @@
package alisolarflare.uhc.memory;
public enum MatchState {
IDLE, WAITING, SETUP, INTRO, PEACE, TENSION, POWER, END
IDLE, //Idle: Configure Match, Wait: Schedule Match, Intro: Start Match
WAITING, //SETUP: Scheduled Time, INTRO: No Setup
SETUP, //INTRO: Done
INTRO, //Peace: Done, and players ready
PEACE, //Tension: Timer, End: All dead
TENSION, //Power: Timer, End: All dead
POWER, //End: All dead
END//IDLE: Ceremony over
}

View file

@ -24,4 +24,5 @@ public class UHCMatch {
matchState = newMS;
fileConfiguration.set("UHCMatchState", newMS.toString());
}
}