From a68d39a784de99e13b0ee90fdff24c0a71b284b8 Mon Sep 17 00:00:00 2001 From: alisolarflare Date: Sat, 5 Nov 2016 14:28:23 -0400 Subject: [PATCH] Started coding up IDLE commands --- src/alisolarflare/uhc/idle/AddToUHC.java | 135 ++++++++++++----------- src/alisolarflare/uhc/idle/JoinUHC.java | 106 +++++++++++------- 2 files changed, 140 insertions(+), 101 deletions(-) diff --git a/src/alisolarflare/uhc/idle/AddToUHC.java b/src/alisolarflare/uhc/idle/AddToUHC.java index 0f92cb3..0af6b88 100644 --- a/src/alisolarflare/uhc/idle/AddToUHC.java +++ b/src/alisolarflare/uhc/idle/AddToUHC.java @@ -1,62 +1,73 @@ -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; - } - -} +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"); + } + + switch(match.getMatchState()){ + case IDLE: + case WAITING: + case SETUP: + case INTRO: + case PEACE: + case TENSION: + case POWER: + case END: + } + + // 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 index 190b285..5ebcb69 100644 --- a/src/alisolarflare/uhc/idle/JoinUHC.java +++ b/src/alisolarflare/uhc/idle/JoinUHC.java @@ -1,39 +1,67 @@ -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; - } - -} +package alisolarflare.uhc.idle; + +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +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) { + if (!(sender instanceof Player)) + return false; + Player player = (Player) sender; + player.sendMessage("Adding you to the UltraHardcore match!"); + switch(match.getMatchState()){ + + //Before the game + case IDLE: + case WAITING: + case SETUP: + case INTRO: + player.sendMessage("Adding you to the UltraHardcore match!"); + match.playerList.add(player.getName()); + break; + + //During the game + case PEACE: + case TENSION: + case POWER: + player.sendMessage("There is currently an UltraHardcore match going on! #POINTTOSPECTATORMODE, tell Ali asap if you see this"); + + //After the game + case END: + player.sendMessage("There is currently an ending ceremony going on! #POINTTOCEREMONY, tell Ali ASAP if you see this"); + + } + + return false; + } + + @Override + public boolean GetPlayerOnly() { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean GetModOnly() { + // TODO Auto-generated method stub + return false; + } + +}