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

View file

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