Worked on the IDLE phase of UHC

This commit is contained in:
alisolarflare 2016-11-05 13:46:13 -04:00
parent 21fcc3fb65
commit 64080eaf42
6 changed files with 253 additions and 212 deletions

View file

@ -3,10 +3,11 @@ package alisolarflare.uhc;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import alisolarflare.Module; import alisolarflare.Module;
import alisolarflare.uhc.commands.AddToUHC; import alisolarflare.uhc.idle.AddToUHC;
import alisolarflare.uhc.commands.ConfigureMatch; import alisolarflare.uhc.idle.JoinUHC;
import alisolarflare.uhc.commands.ScheduleMatch; import alisolarflare.uhc.intro.ConfigureMatch;
import alisolarflare.uhc.commands.StartMatch; import alisolarflare.uhc.intro.ScheduleMatch;
import alisolarflare.uhc.intro.StartMatch;
import alisolarflare.uhc.memory.MatchState; import alisolarflare.uhc.memory.MatchState;
import alisolarflare.uhc.memory.UHCMatch; import alisolarflare.uhc.memory.UHCMatch;
@ -23,6 +24,7 @@ public class UHCModule extends Module {
} }
registerCommand(plugin, new AddToUHC(match)); registerCommand(plugin, new AddToUHC(match));
registerCommand(plugin, new JoinUHC(match));
registerCommand(plugin, new StartMatch(match)); registerCommand(plugin, new StartMatch(match));
registerCommand(plugin, new ConfigureMatch(match)); registerCommand(plugin, new ConfigureMatch(match));
registerCommand(plugin, new ScheduleMatch(match)); registerCommand(plugin, new ScheduleMatch(match));

View file

@ -1,62 +1,62 @@
package alisolarflare.uhc.commands; package alisolarflare.uhc.idle;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import alisolarflare.uhc.memory.UHCMatch; import alisolarflare.uhc.memory.UHCMatch;
import buttondevteam.lib.chat.TBMCCommandBase; 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)} * 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 * @author Alisolarflare
*/ */
public class AddToUHC extends TBMCCommandBase { public class AddToUHC extends TBMCCommandBase {
private UHCMatch match; private UHCMatch match;
public AddToUHC(UHCMatch match) { public AddToUHC(UHCMatch match) {
this.match = match; this.match = match;
} }
@Override @Override
public boolean OnCommand(CommandSender sender, String label, String[] args) { public boolean OnCommand(CommandSender sender, String label, String[] args) {
// INPUT SANITATION // INPUT SANITATION
Player player = (Player) sender; Player player = (Player) sender;
if (player.getName() != "alisolarflare") { if (!player.getName().equalsIgnoreCase("alisolarflare") && !player.getName().equalsIgnoreCase("Arsen_Derby_FTW")) {
sender.sendMessage("You must be Ali to use this command, send her a message to change the permissions"); sender.sendMessage("You must be Ali to add someone else to a UHC, send her a message to change the permissions");
return false; return false;
} }
if (args.length <= 1) { if (args.length <= 1) {
sender.sendMessage("You must supply at least one playername"); sender.sendMessage("You must supply at least one playername");
} }
// Adds players to memory // Adds players to memory
for (int i = 0; i > args.length; i++) { for (int i = 0; i > args.length; i++) {
match.playerList.add(player.getName()); match.playerList.add(player.getName());
} }
return false; return false;
} }
@Override @Override
public String[] GetHelpText(String alias) { public String[] GetHelpText(String alias) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return null; return null;
} }
@Override @Override
public String GetCommandPath() { public String GetCommandPath() {
return "addtouhc"; return "addtouhc";
} }
@Override @Override
public boolean GetPlayerOnly() { public boolean GetPlayerOnly() {
return true; return true;
} }
@Override @Override
public boolean GetModOnly() { public boolean GetModOnly() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return false; return false;
} }
} }

View file

@ -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;
}
}

View file

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

View file

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

View file

@ -1,70 +1,70 @@
package alisolarflare.uhc.commands; package alisolarflare.uhc.intro;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import alisolarflare.uhc.memory.MatchState; 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;
public class StartMatch extends TBMCCommandBase { public class StartMatch extends TBMCCommandBase {
private UHCMatch match; private UHCMatch match;
public StartMatch(UHCMatch match) { public StartMatch(UHCMatch match) {
this.match = match; this.match = match;
} }
@Override @Override
public boolean OnCommand(CommandSender sender, String label, String[] args) { public boolean OnCommand(CommandSender sender, String label, String[] args) {
if (!sender.hasPermission("moderator") && !(sender.getName() == "")) if (!sender.hasPermission("moderator") && !(sender.getName() == ""))
sender.sendMessage("You must be a moderator or Arsenalis to use this command! " sender.sendMessage("You must be a moderator or Arsenalis to use this command! "
+ "Contact a TBMC dev if you think this is wrong"); + "Contact a TBMC dev if you think this is wrong");
//ACTIVATES MATCH //ACTIVATES MATCH
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); match.setMatchState(MatchState.INTRO);
break; break;
case WAITING: case WAITING:
sender.sendMessage("There currently a match planned for: TIME:TIME:TIME"); sender.sendMessage("There currently a match planned for: TIME:TIME:TIME");
break; break;
case END: case END:
sender.sendMessage("The match has ended! Would you like to restart using current settings?"); sender.sendMessage("The match has ended! Would you like to restart using current settings?");
break; break;
default: default:
sender.sendMessage("You cannot start a match now, one is already in progress!"); sender.sendMessage("You cannot start a match now, one is already in progress!");
} }
return false; return false;
} }
@Override @Override
public String[] GetHelpText(String alias) { public String[] GetHelpText(String alias) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return null; return null;
} }
@Override @Override
public String GetCommandPath() { public String GetCommandPath() {
return "startmatch"; return "startmatch";
} }
@Override @Override
public boolean GetPlayerOnly() { public boolean GetPlayerOnly() {
return true; return true;
} }
@Override @Override
public boolean GetModOnly() { public boolean GetModOnly() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return false; return false;
} }
} }