From 64080eaf42e1b41e90e31fa049b3b649e4ed8335 Mon Sep 17 00:00:00 2001 From: alisolarflare Date: Sat, 5 Nov 2016 13:46:13 -0400 Subject: [PATCH] Worked on the IDLE phase of UHC --- src/alisolarflare/uhc/UHCModule.java | 10 +- .../uhc/{commands => idle}/AddToUHC.java | 124 ++++++++-------- src/alisolarflare/uhc/idle/JoinUHC.java | 39 +++++ .../{commands => intro}/ConfigureMatch.java | 76 +++++----- .../{commands => intro}/ScheduleMatch.java | 76 +++++----- .../uhc/{commands => intro}/StartMatch.java | 140 +++++++++--------- 6 files changed, 253 insertions(+), 212 deletions(-) rename src/alisolarflare/uhc/{commands => idle}/AddToUHC.java (82%) create mode 100644 src/alisolarflare/uhc/idle/JoinUHC.java rename src/alisolarflare/uhc/{commands => intro}/ConfigureMatch.java (90%) rename src/alisolarflare/uhc/{commands => intro}/ScheduleMatch.java (90%) rename src/alisolarflare/uhc/{commands => intro}/StartMatch.java (93%) diff --git a/src/alisolarflare/uhc/UHCModule.java b/src/alisolarflare/uhc/UHCModule.java index 3ddfd0a..a27aa14 100644 --- a/src/alisolarflare/uhc/UHCModule.java +++ b/src/alisolarflare/uhc/UHCModule.java @@ -3,10 +3,11 @@ package alisolarflare.uhc; import org.bukkit.plugin.java.JavaPlugin; import alisolarflare.Module; -import alisolarflare.uhc.commands.AddToUHC; -import alisolarflare.uhc.commands.ConfigureMatch; -import alisolarflare.uhc.commands.ScheduleMatch; -import alisolarflare.uhc.commands.StartMatch; +import alisolarflare.uhc.idle.AddToUHC; +import alisolarflare.uhc.idle.JoinUHC; +import alisolarflare.uhc.intro.ConfigureMatch; +import alisolarflare.uhc.intro.ScheduleMatch; +import alisolarflare.uhc.intro.StartMatch; import alisolarflare.uhc.memory.MatchState; import alisolarflare.uhc.memory.UHCMatch; @@ -23,6 +24,7 @@ public class UHCModule extends Module { } registerCommand(plugin, new AddToUHC(match)); + registerCommand(plugin, new JoinUHC(match)); registerCommand(plugin, new StartMatch(match)); registerCommand(plugin, new ConfigureMatch(match)); registerCommand(plugin, new ScheduleMatch(match)); diff --git a/src/alisolarflare/uhc/commands/AddToUHC.java b/src/alisolarflare/uhc/idle/AddToUHC.java similarity index 82% rename from src/alisolarflare/uhc/commands/AddToUHC.java rename to src/alisolarflare/uhc/idle/AddToUHC.java index ab31de7..0f92cb3 100644 --- a/src/alisolarflare/uhc/commands/AddToUHC.java +++ b/src/alisolarflare/uhc/idle/AddToUHC.java @@ -1,62 +1,62 @@ -package alisolarflare.uhc.commands; - -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -import alisolarflare.uhc.memory.UHCMatch; -import buttondevteam.lib.chat.TBMCCommandBase; - -/** - * This class handles the specific command /addToUHC which, in-game, adds a player to a specific UltraHardcore match, that is defined by the constructor: {@linkplain #AddToUHC(UHCMatch)} - * - * @author Alisolarflare - */ -public class AddToUHC extends TBMCCommandBase { - private UHCMatch match; - - public AddToUHC(UHCMatch match) { - this.match = match; - } - - @Override - public boolean OnCommand(CommandSender sender, String label, String[] args) { - // INPUT SANITATION - Player player = (Player) sender; - if (player.getName() != "alisolarflare") { - sender.sendMessage("You must be Ali to use this command, send her a message to change the permissions"); - return false; - } - if (args.length <= 1) { - sender.sendMessage("You must supply at least one playername"); - } - - // Adds players to memory - for (int i = 0; i > args.length; i++) { - match.playerList.add(player.getName()); - } - return false; - } - - @Override - public String[] GetHelpText(String alias) { - // TODO Auto-generated method stub - return null; - } - - @Override - public String GetCommandPath() { - return "addtouhc"; - } - - @Override - public boolean GetPlayerOnly() { - return true; - } - - @Override - public boolean GetModOnly() { - // TODO Auto-generated method stub - return false; - } - -} +package alisolarflare.uhc.idle; + +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import alisolarflare.uhc.memory.UHCMatch; +import buttondevteam.lib.chat.TBMCCommandBase; + +/** + * This class handles the specific command /addToUHC which, in-game, adds a player to a specific UltraHardcore match, that is defined by the constructor: {@linkplain #AddToUHC(UHCMatch)} + * + * @author Alisolarflare + */ +public class AddToUHC extends TBMCCommandBase { + private UHCMatch match; + + public AddToUHC(UHCMatch match) { + this.match = match; + } + + @Override + public boolean OnCommand(CommandSender sender, String label, String[] args) { + // INPUT SANITATION + Player player = (Player) sender; + if (!player.getName().equalsIgnoreCase("alisolarflare") && !player.getName().equalsIgnoreCase("Arsen_Derby_FTW")) { + sender.sendMessage("You must be Ali to add someone else to a UHC, send her a message to change the permissions"); + return false; + } + if (args.length <= 1) { + sender.sendMessage("You must supply at least one playername"); + } + + // Adds players to memory + for (int i = 0; i > args.length; i++) { + match.playerList.add(player.getName()); + } + return false; + } + + @Override + public String[] GetHelpText(String alias) { + // TODO Auto-generated method stub + return null; + } + + @Override + public String GetCommandPath() { + return "addtouhc"; + } + + @Override + public boolean GetPlayerOnly() { + return true; + } + + @Override + public boolean GetModOnly() { + // TODO Auto-generated method stub + return false; + } + +} diff --git a/src/alisolarflare/uhc/idle/JoinUHC.java b/src/alisolarflare/uhc/idle/JoinUHC.java new file mode 100644 index 0000000..190b285 --- /dev/null +++ b/src/alisolarflare/uhc/idle/JoinUHC.java @@ -0,0 +1,39 @@ +package alisolarflare.uhc.idle; + +import org.bukkit.command.CommandSender; + +import alisolarflare.uhc.memory.UHCMatch; +import buttondevteam.lib.chat.TBMCCommandBase; + +public class JoinUHC extends TBMCCommandBase{ + + private UHCMatch match; + + public JoinUHC(UHCMatch match) { + this.match = match; + } + + @Override + public String[] GetHelpText(String alias) { + // TODO Auto-generated method stub + return null; + } + + @Override + public boolean OnCommand(CommandSender sender, String alias, String[] args) { + 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/ConfigureMatch.java b/src/alisolarflare/uhc/intro/ConfigureMatch.java similarity index 90% rename from src/alisolarflare/uhc/commands/ConfigureMatch.java rename to src/alisolarflare/uhc/intro/ConfigureMatch.java index c696b87..6f383bb 100644 --- a/src/alisolarflare/uhc/commands/ConfigureMatch.java +++ b/src/alisolarflare/uhc/intro/ConfigureMatch.java @@ -1,38 +1,38 @@ -package alisolarflare.uhc.commands; - -import org.bukkit.command.CommandSender; - -import alisolarflare.uhc.memory.UHCMatch; -import buttondevteam.lib.chat.TBMCCommandBase; - -public class ConfigureMatch extends TBMCCommandBase{ - - public ConfigureMatch(UHCMatch match) { - // TODO Auto-generated constructor stub - } - - @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; - } - -} +package alisolarflare.uhc.intro; + +import org.bukkit.command.CommandSender; + +import alisolarflare.uhc.memory.UHCMatch; +import buttondevteam.lib.chat.TBMCCommandBase; + +public class ConfigureMatch extends TBMCCommandBase{ + + public ConfigureMatch(UHCMatch match) { + // TODO Auto-generated constructor stub + } + + @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/intro/ScheduleMatch.java similarity index 90% rename from src/alisolarflare/uhc/commands/ScheduleMatch.java rename to src/alisolarflare/uhc/intro/ScheduleMatch.java index 455c2fb..6e292c2 100644 --- a/src/alisolarflare/uhc/commands/ScheduleMatch.java +++ b/src/alisolarflare/uhc/intro/ScheduleMatch.java @@ -1,38 +1,38 @@ -package alisolarflare.uhc.commands; - -import org.bukkit.command.CommandSender; - -import alisolarflare.uhc.memory.UHCMatch; -import buttondevteam.lib.chat.TBMCCommandBase; - -public class ScheduleMatch extends TBMCCommandBase{ - - public ScheduleMatch(UHCMatch match) { - // TODO Auto-generated constructor stub - } - - @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; - } - -} +package alisolarflare.uhc.intro; + +import org.bukkit.command.CommandSender; + +import alisolarflare.uhc.memory.UHCMatch; +import buttondevteam.lib.chat.TBMCCommandBase; + +public class ScheduleMatch extends TBMCCommandBase{ + + public ScheduleMatch(UHCMatch match) { + // TODO Auto-generated constructor stub + } + + @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/intro/StartMatch.java similarity index 93% rename from src/alisolarflare/uhc/commands/StartMatch.java rename to src/alisolarflare/uhc/intro/StartMatch.java index 753edda..0b96652 100644 --- a/src/alisolarflare/uhc/commands/StartMatch.java +++ b/src/alisolarflare/uhc/intro/StartMatch.java @@ -1,70 +1,70 @@ -package alisolarflare.uhc.commands; - -import org.bukkit.command.CommandSender; - -import alisolarflare.uhc.memory.MatchState; -import alisolarflare.uhc.memory.UHCMatch; -import buttondevteam.lib.chat.TBMCCommandBase; - -public class StartMatch extends TBMCCommandBase { - private UHCMatch match; - - public StartMatch(UHCMatch match) { - this.match = match; - } - - @Override - public boolean OnCommand(CommandSender sender, String label, String[] args) { - - if (!sender.hasPermission("moderator") && !(sender.getName() == "")) - sender.sendMessage("You must be a moderator or Arsenalis to use this command! " - + "Contact a TBMC dev if you think this is wrong"); - - //ACTIVATES MATCH - switch(match.getMatchState()){ - case IDLE: - sender.sendMessage("There is currently a match ready... Activating..."); - match.setMatchState(MatchState.INTRO); - break; - - case WAITING: - sender.sendMessage("There currently a match planned for: TIME:TIME:TIME"); - break; - - case END: - sender.sendMessage("The match has ended! Would you like to restart using current settings?"); - break; - - default: - sender.sendMessage("You cannot start a match now, one is already in progress!"); - - - } - - return false; - - - } - - @Override - public String[] GetHelpText(String alias) { - // TODO Auto-generated method stub - return null; - } - - @Override - public String GetCommandPath() { - return "startmatch"; - } - - @Override - public boolean GetPlayerOnly() { - return true; - } - - @Override - public boolean GetModOnly() { - // TODO Auto-generated method stub - return false; - } -} +package alisolarflare.uhc.intro; + +import org.bukkit.command.CommandSender; + +import alisolarflare.uhc.memory.MatchState; +import alisolarflare.uhc.memory.UHCMatch; +import buttondevteam.lib.chat.TBMCCommandBase; + +public class StartMatch extends TBMCCommandBase { + private UHCMatch match; + + public StartMatch(UHCMatch match) { + this.match = match; + } + + @Override + public boolean OnCommand(CommandSender sender, String label, String[] args) { + + if (!sender.hasPermission("moderator") && !(sender.getName() == "")) + sender.sendMessage("You must be a moderator or Arsenalis to use this command! " + + "Contact a TBMC dev if you think this is wrong"); + + //ACTIVATES MATCH + switch(match.getMatchState()){ + case IDLE: + sender.sendMessage("There is currently a match ready... Activating..."); + match.setMatchState(MatchState.INTRO); + break; + + case WAITING: + sender.sendMessage("There currently a match planned for: TIME:TIME:TIME"); + break; + + case END: + sender.sendMessage("The match has ended! Would you like to restart using current settings?"); + break; + + default: + sender.sendMessage("You cannot start a match now, one is already in progress!"); + + + } + + return false; + + + } + + @Override + public String[] GetHelpText(String alias) { + // TODO Auto-generated method stub + return null; + } + + @Override + public String GetCommandPath() { + return "startmatch"; + } + + @Override + public boolean GetPlayerOnly() { + return true; + } + + @Override + public boolean GetModOnly() { + // TODO Auto-generated method stub + return false; + } +}