Started work on UHC Staging
This commit is contained in:
parent
2756c00f37
commit
dd2dca0544
10 changed files with 101 additions and 22 deletions
5
src/alisolarflare/minigames/GameState.java
Normal file
5
src/alisolarflare/minigames/GameState.java
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
package alisolarflare.minigames;
|
||||||
|
|
||||||
|
public enum GameState {
|
||||||
|
Idle, FreeForAll, Heroes;
|
||||||
|
}
|
|
@ -13,8 +13,8 @@ import alisolarflare.minigames.data.SpawnSet;
|
||||||
|
|
||||||
public class MinigameModule extends Module{
|
public class MinigameModule extends Module{
|
||||||
public SpawnSet spawnSet;
|
public SpawnSet spawnSet;
|
||||||
private int GameState;
|
|
||||||
public List<String> fighters;
|
public List<String> fighters;
|
||||||
|
private GameState gameState;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void register(JavaPlugin plugin) {
|
public void register(JavaPlugin plugin) {
|
||||||
|
@ -26,8 +26,8 @@ public class MinigameModule extends Module{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getGameState() {return GameState;}
|
public GameState getGameState() {return gameState;}
|
||||||
public void setGameState(int gameState) {GameState = gameState;}
|
public void setGameState(GameState gameState) {this.gameState = gameState;}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,10 +7,10 @@ import alisolarflare.minigames.MinigameModule;
|
||||||
import buttondevteam.lib.chat.TBMCCommandBase;
|
import buttondevteam.lib.chat.TBMCCommandBase;
|
||||||
|
|
||||||
public class JoinMinigame extends TBMCCommandBase {
|
public class JoinMinigame extends TBMCCommandBase {
|
||||||
private MinigameModule minigame;
|
private MinigameModule module;
|
||||||
|
|
||||||
public JoinMinigame(MinigameModule minigame) {
|
public JoinMinigame(MinigameModule module) {
|
||||||
this.minigame = minigame;
|
this.module = module;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -21,14 +21,14 @@ public class JoinMinigame extends TBMCCommandBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
String name = sender.getName();
|
String name = sender.getName();
|
||||||
if (minigame.fighters.contains(name)) {
|
if (module.fighters.contains(name)) {
|
||||||
sender.sendMessage("You are already in the minigame!");
|
sender.sendMessage("You are already in the minigame!");
|
||||||
return false;
|
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!");
|
sender.sendMessage("You have joined the minigame!");
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -8,26 +8,26 @@ import buttondevteam.lib.chat.TBMCCommandBase;
|
||||||
|
|
||||||
public class LeaveMinigame extends TBMCCommandBase {
|
public class LeaveMinigame extends TBMCCommandBase {
|
||||||
|
|
||||||
private MinigameModule lobby;
|
private MinigameModule module;
|
||||||
|
|
||||||
public LeaveMinigame(MinigameModule lobby) {
|
public LeaveMinigame(MinigameModule module) {
|
||||||
this.lobby = lobby;
|
this.module = module;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean OnCommand(CommandSender sender, String arg2, String[] arg3) {
|
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!");
|
sender.sendMessage("You must be a player to use this command!");
|
||||||
}
|
|
||||||
|
|
||||||
String name = sender.getName();
|
String name = sender.getName();
|
||||||
if (!(lobby.fighters.contains(name))) {
|
if (!(module.fighters.contains(name))) {
|
||||||
sender.sendMessage("You are not fighting!");
|
sender.sendMessage("You are not fighting!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
while(lobby.fighters.contains(name)){
|
while(module.fighters.contains(name)){
|
||||||
lobby.fighters.remove(name);
|
module.fighters.remove(name);
|
||||||
}
|
}
|
||||||
sender.sendMessage("You have left the fighters category!");
|
sender.sendMessage("You have left the fighters category!");
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package alisolarflare.minigames.commands;
|
package alisolarflare.minigames.commands;
|
||||||
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
import alisolarflare.minigames.MinigameModule;
|
import alisolarflare.minigames.MinigameModule;
|
||||||
|
@ -16,7 +14,7 @@ public class ListFighters extends TBMCCommandBase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean OnCommand(CommandSender sender, String arg2, String[] arg3) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
33
src/alisolarflare/uhc/commands/ConfigureMatch.java
Normal file
33
src/alisolarflare/uhc/commands/ConfigureMatch.java
Normal 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
33
src/alisolarflare/uhc/commands/ScheduleMatch.java
Normal file
33
src/alisolarflare/uhc/commands/ScheduleMatch.java
Normal 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -2,6 +2,7 @@ package alisolarflare.uhc.commands;
|
||||||
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
|
import alisolarflare.uhc.memory.MatchState;
|
||||||
import alisolarflare.uhc.memory.UHCMatch;
|
import alisolarflare.uhc.memory.UHCMatch;
|
||||||
import buttondevteam.lib.chat.TBMCCommandBase;
|
import buttondevteam.lib.chat.TBMCCommandBase;
|
||||||
|
|
||||||
|
@ -23,6 +24,7 @@ public class StartMatch extends TBMCCommandBase {
|
||||||
switch(match.getMatchState()){
|
switch(match.getMatchState()){
|
||||||
case IDLE:
|
case IDLE:
|
||||||
sender.sendMessage("There is currently a match ready... Activating...");
|
sender.sendMessage("There is currently a match ready... Activating...");
|
||||||
|
match.setMatchState(MatchState.INTRO);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WAITING:
|
case WAITING:
|
||||||
|
@ -30,7 +32,7 @@ public class StartMatch extends TBMCCommandBase {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case END:
|
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;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -1,5 +1,12 @@
|
||||||
package alisolarflare.uhc.memory;
|
package alisolarflare.uhc.memory;
|
||||||
|
|
||||||
public enum MatchState {
|
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
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,4 +24,5 @@ public class UHCMatch {
|
||||||
matchState = newMS;
|
matchState = newMS;
|
||||||
fileConfiguration.set("UHCMatchState", newMS.toString());
|
fileConfiguration.set("UHCMatchState", newMS.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue