From dd2dca05441117a0f0d2d14e52d979287a354e80 Mon Sep 17 00:00:00 2001 From: alisolarflare Date: Sat, 5 Nov 2016 06:57:10 -0400 Subject: [PATCH] Started work on UHC Staging --- src/alisolarflare/minigames/GameState.java | 5 +++ .../minigames/MinigameModule.java | 6 ++-- .../minigames/commands/JoinMinigame.java | 12 +++---- .../minigames/commands/LeaveMinigame.java | 16 ++++----- .../minigames/commands/ListFighters.java | 4 +-- .../uhc/commands/ConfigureMatch.java | 33 +++++++++++++++++++ .../uhc/commands/ScheduleMatch.java | 33 +++++++++++++++++++ .../uhc/commands/StartMatch.java | 4 ++- src/alisolarflare/uhc/memory/MatchState.java | 9 ++++- src/alisolarflare/uhc/memory/UHCMatch.java | 1 + 10 files changed, 101 insertions(+), 22 deletions(-) create mode 100644 src/alisolarflare/minigames/GameState.java create mode 100644 src/alisolarflare/uhc/commands/ConfigureMatch.java create mode 100644 src/alisolarflare/uhc/commands/ScheduleMatch.java diff --git a/src/alisolarflare/minigames/GameState.java b/src/alisolarflare/minigames/GameState.java new file mode 100644 index 0000000..5c63bf3 --- /dev/null +++ b/src/alisolarflare/minigames/GameState.java @@ -0,0 +1,5 @@ +package alisolarflare.minigames; + +public enum GameState { + Idle, FreeForAll, Heroes; +} diff --git a/src/alisolarflare/minigames/MinigameModule.java b/src/alisolarflare/minigames/MinigameModule.java index 72827b3..fe8712c 100644 --- a/src/alisolarflare/minigames/MinigameModule.java +++ b/src/alisolarflare/minigames/MinigameModule.java @@ -13,8 +13,8 @@ import alisolarflare.minigames.data.SpawnSet; public class MinigameModule extends Module{ public SpawnSet spawnSet; - private int GameState; public List 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;} } diff --git a/src/alisolarflare/minigames/commands/JoinMinigame.java b/src/alisolarflare/minigames/commands/JoinMinigame.java index f0afa6f..fc194cd 100644 --- a/src/alisolarflare/minigames/commands/JoinMinigame.java +++ b/src/alisolarflare/minigames/commands/JoinMinigame.java @@ -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; diff --git a/src/alisolarflare/minigames/commands/LeaveMinigame.java b/src/alisolarflare/minigames/commands/LeaveMinigame.java index 844ed07..f234a32 100644 --- a/src/alisolarflare/minigames/commands/LeaveMinigame.java +++ b/src/alisolarflare/minigames/commands/LeaveMinigame.java @@ -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!"); diff --git a/src/alisolarflare/minigames/commands/ListFighters.java b/src/alisolarflare/minigames/commands/ListFighters.java index 209d9f8..6dda457 100644 --- a/src/alisolarflare/minigames/commands/ListFighters.java +++ b/src/alisolarflare/minigames/commands/ListFighters.java @@ -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; } diff --git a/src/alisolarflare/uhc/commands/ConfigureMatch.java b/src/alisolarflare/uhc/commands/ConfigureMatch.java new file mode 100644 index 0000000..d85e01a --- /dev/null +++ b/src/alisolarflare/uhc/commands/ConfigureMatch.java @@ -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; + } + +} diff --git a/src/alisolarflare/uhc/commands/ScheduleMatch.java b/src/alisolarflare/uhc/commands/ScheduleMatch.java new file mode 100644 index 0000000..0bf2662 --- /dev/null +++ b/src/alisolarflare/uhc/commands/ScheduleMatch.java @@ -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; + } + +} diff --git a/src/alisolarflare/uhc/commands/StartMatch.java b/src/alisolarflare/uhc/commands/StartMatch.java index 901fccf..753edda 100644 --- a/src/alisolarflare/uhc/commands/StartMatch.java +++ b/src/alisolarflare/uhc/commands/StartMatch.java @@ -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: diff --git a/src/alisolarflare/uhc/memory/MatchState.java b/src/alisolarflare/uhc/memory/MatchState.java index 83aadaf..bf6d77d 100644 --- a/src/alisolarflare/uhc/memory/MatchState.java +++ b/src/alisolarflare/uhc/memory/MatchState.java @@ -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 } diff --git a/src/alisolarflare/uhc/memory/UHCMatch.java b/src/alisolarflare/uhc/memory/UHCMatch.java index 8338edd..42b0484 100644 --- a/src/alisolarflare/uhc/memory/UHCMatch.java +++ b/src/alisolarflare/uhc/memory/UHCMatch.java @@ -24,4 +24,5 @@ public class UHCMatch { matchState = newMS; fileConfiguration.set("UHCMatchState", newMS.toString()); } + }