Worked on the IDLE phase of UHC
This commit is contained in:
parent
21fcc3fb65
commit
64080eaf42
6 changed files with 253 additions and 212 deletions
|
@ -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));
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
39
src/alisolarflare/uhc/idle/JoinUHC.java
Normal file
39
src/alisolarflare/uhc/idle/JoinUHC.java
Normal 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;
|
||||
}
|
||||
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue