Started coding up IDLE commands

This commit is contained in:
alisolarflare 2016-11-05 14:28:23 -04:00
parent 6cc48f2a5b
commit a68d39a784
2 changed files with 140 additions and 101 deletions

View file

@ -1,62 +1,73 @@
package alisolarflare.uhc.idle; 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().equalsIgnoreCase("alisolarflare") && !player.getName().equalsIgnoreCase("Arsen_Derby_FTW")) { 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"); 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 switch(match.getMatchState()){
for (int i = 0; i > args.length; i++) { case IDLE:
match.playerList.add(player.getName()); case WAITING:
} case SETUP:
return false; case INTRO:
} case PEACE:
case TENSION:
@Override case POWER:
public String[] GetHelpText(String alias) { case END:
// TODO Auto-generated method stub }
return null;
} // Adds players to memory
for (int i = 0; i > args.length; i++) {
@Override match.playerList.add(player.getName());
public String GetCommandPath() { }
return "addtouhc"; return false;
} }
@Override @Override
public boolean GetPlayerOnly() { public String[] GetHelpText(String alias) {
return true; // TODO Auto-generated method stub
} return null;
}
@Override
public boolean GetModOnly() { @Override
// TODO Auto-generated method stub public String GetCommandPath() {
return false; return "addtouhc";
} }
} @Override
public boolean GetPlayerOnly() {
return true;
}
@Override
public boolean GetModOnly() {
// TODO Auto-generated method stub
return false;
}
}

View file

@ -1,39 +1,67 @@
package alisolarflare.uhc.idle; package alisolarflare.uhc.idle;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import alisolarflare.uhc.memory.UHCMatch;
import buttondevteam.lib.chat.TBMCCommandBase; import alisolarflare.uhc.memory.UHCMatch;
import buttondevteam.lib.chat.TBMCCommandBase;
public class JoinUHC extends TBMCCommandBase{
public class JoinUHC extends TBMCCommandBase{
private UHCMatch match;
private UHCMatch match;
public JoinUHC(UHCMatch match) {
this.match = match; public JoinUHC(UHCMatch match) {
} this.match = match;
}
@Override
public String[] GetHelpText(String alias) { @Override
// TODO Auto-generated method stub public String[] GetHelpText(String alias) {
return null; // TODO Auto-generated method stub
} return null;
}
@Override
public boolean OnCommand(CommandSender sender, String alias, String[] args) { @Override
return false; public boolean OnCommand(CommandSender sender, String alias, String[] args) {
} if (!(sender instanceof Player))
return false;
@Override Player player = (Player) sender;
public boolean GetPlayerOnly() { player.sendMessage("Adding you to the UltraHardcore match!");
// TODO Auto-generated method stub switch(match.getMatchState()){
return false;
} //Before the game
case IDLE:
@Override case WAITING:
public boolean GetModOnly() { case SETUP:
// TODO Auto-generated method stub case INTRO:
return false; 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;
}
}