Completely trashed UHC progress, re-organized

Using finite state machines is *so much harder* than simply creating
commands that a player or admin uses as the match goes on. I can always
make UHC automatic later
This commit is contained in:
alisolarflare 2016-11-06 18:23:27 -05:00
parent 7bbcb7e5a0
commit a81c0ceb76
22 changed files with 451 additions and 196 deletions

View file

@ -10,9 +10,9 @@ import alisolarflare.components.flairdoor.FlairDoorModule;
import alisolarflare.components.gpowers.GPowerModule;
import alisolarflare.components.links.AliLinkModule;
import alisolarflare.creativeboundaries.CreativeBoundariesModule;
import alisolarflare.easyuhc.EasyUHCModule;
import alisolarflare.magic.MagicModule;
import alisolarflare.minigames.MinigameModule;
import alisolarflare.uhc.UHCModule;
public class AliPresents extends JavaPlugin{
public void onEnable(){
@ -25,7 +25,7 @@ public class AliPresents extends JavaPlugin{
new FlairDoorModule().register(this);
new GPowerModule().register(this);
new AliLinkModule().register(this);
new UHCModule().register(this);
new EasyUHCModule().register(this);
new MagicModule().register(this);
new MinigameModule().register(this);
new CreativeBoundariesModule().register(this);

View file

@ -0,0 +1,36 @@
package alisolarflare.autouhc;
import org.bukkit.plugin.java.JavaPlugin;
import alisolarflare.Module;
import alisolarflare.autouhc.controller.SetMatchState;
import alisolarflare.autouhc.idle.AddToUHC;
import alisolarflare.autouhc.idle.JoinUHC;
import alisolarflare.autouhc.intro.ConfigureMatch;
import alisolarflare.autouhc.intro.ScheduleMatch;
import alisolarflare.autouhc.intro.StartMatch;
import alisolarflare.autouhc.memory.MatchState;
import alisolarflare.autouhc.memory.UHCMatch;
public class UHCModule extends Module {
public UHCMatch match;
public void register(JavaPlugin plugin) {
if (plugin.getConfig().contains("UHCMatchState")){
match = new UHCMatch(plugin.getConfig(), MatchState.valueOf(plugin.getConfig().getString("UHCMatchState")));
}else{
match = new UHCMatch(plugin.getConfig(), MatchState.IDLE);
}
//registerCommand(plugin, new SetMatchState(match));
//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));
}
}

View file

@ -1,10 +1,10 @@
package alisolarflare.uhc.controller;
package alisolarflare.autouhc.controller;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import alisolarflare.uhc.memory.MatchState;
import alisolarflare.uhc.memory.UHCMatch;
import alisolarflare.autouhc.memory.MatchState;
import alisolarflare.autouhc.memory.UHCMatch;
import buttondevteam.lib.chat.TBMCCommandBase;
public class SetMatchState extends TBMCCommandBase{

View file

@ -1,9 +1,9 @@
package alisolarflare.uhc.idle;
package alisolarflare.autouhc.idle;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import alisolarflare.uhc.memory.UHCMatch;
import alisolarflare.autouhc.memory.UHCMatch;
import buttondevteam.lib.chat.TBMCCommandBase;
/**

View file

@ -1,9 +1,9 @@
package alisolarflare.uhc.idle;
package alisolarflare.autouhc.idle;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import alisolarflare.uhc.memory.UHCMatch;
import alisolarflare.autouhc.memory.UHCMatch;
import buttondevteam.lib.chat.TBMCCommandBase;
public class JoinUHC extends TBMCCommandBase{

View file

@ -1,38 +1,38 @@
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;
}
}
package alisolarflare.autouhc.intro;
import org.bukkit.command.CommandSender;
import alisolarflare.autouhc.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;
}
}

View file

@ -1,4 +1,4 @@
package alisolarflare.uhc.intro;
package alisolarflare.autouhc.intro;
public class IntroductionCutscene {
//TODO: Teleport all players to the area.

View file

@ -1,38 +1,38 @@
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;
}
}
package alisolarflare.autouhc.intro;
import org.bukkit.command.CommandSender;
import alisolarflare.autouhc.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;
}
}

View file

@ -1,70 +1,70 @@
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;
}
}
package alisolarflare.autouhc.intro;
import org.bukkit.command.CommandSender;
import alisolarflare.autouhc.memory.MatchState;
import alisolarflare.autouhc.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;
}
}

View file

@ -1,4 +1,4 @@
package alisolarflare.uhc.listeners;
package alisolarflare.autouhc.listeners;
import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;

View file

@ -1,4 +1,4 @@
package alisolarflare.uhc.listeners;
package alisolarflare.autouhc.listeners;
import org.bukkit.scheduler.BukkitRunnable;

View file

@ -1,4 +1,4 @@
package alisolarflare.uhc.memory;
package alisolarflare.autouhc.memory;
public enum MatchState {
IDLE, //Idle: Configure Match, Wait: Schedule Match, Intro: Start Match

View file

@ -1,4 +1,4 @@
package alisolarflare.uhc.memory;
package alisolarflare.autouhc.memory;
import java.util.ArrayList;
import java.util.List;

View file

@ -0,0 +1,24 @@
package alisolarflare.easyuhc;
import org.bukkit.plugin.java.JavaPlugin;
import alisolarflare.Module;
import alisolarflare.easyuhc.commands.ActivatePowers;
import alisolarflare.easyuhc.commands.SetupWorldBorders;
import alisolarflare.easyuhc.commands.SpreadPlayers;
import alisolarflare.easyuhc.commands.StartTimer;
import alisolarflare.easyuhc.commands.StartUHC;
import alisolarflare.easyuhc.commands.TeleportToUHC;
public class EasyUHCModule extends Module{
@Override
public void register(JavaPlugin plugin) {
registerCommand(plugin, new ActivatePowers());
registerCommand(plugin, new SetupWorldBorders());
registerCommand(plugin, new SetupWorldBorders());
registerCommand(plugin, new SpreadPlayers());
registerCommand(plugin, new StartTimer());
registerCommand(plugin, new StartUHC());
registerCommand(plugin, new TeleportToUHC());
}
}

View file

@ -0,0 +1,33 @@
package alisolarflare.easyuhc.commands;
import org.bukkit.command.CommandSender;
import buttondevteam.lib.chat.TBMCCommandBase;
public class ActivatePowers extends TBMCCommandBase{
@Override
public boolean OnCommand(CommandSender sender, String alias, String[] args) {
// TODO Auto-generated method stub
return false;
}
@Override
public String[] GetHelpText(String alias) {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean GetPlayerOnly() {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean GetModOnly() {
// TODO Auto-generated method stub
return false;
}
}

View file

@ -0,0 +1,33 @@
package alisolarflare.easyuhc.commands;
import org.bukkit.command.CommandSender;
import buttondevteam.lib.chat.TBMCCommandBase;
public class SetupWorldBorders extends TBMCCommandBase {
@Override
public boolean OnCommand(CommandSender sender, String alias, String[] args) {
// TODO Auto-generated method stub
return false;
}
@Override
public String[] GetHelpText(String alias) {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean GetPlayerOnly() {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean GetModOnly() {
// TODO Auto-generated method stub
return false;
}
}

View file

@ -0,0 +1,33 @@
package alisolarflare.easyuhc.commands;
import org.bukkit.command.CommandSender;
import buttondevteam.lib.chat.TBMCCommandBase;
public class ShrinkWorldBorders extends TBMCCommandBase {
@Override
public boolean OnCommand(CommandSender sender, String alias, String[] args) {
// TODO Auto-generated method stub
return false;
}
@Override
public String[] GetHelpText(String alias) {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean GetPlayerOnly() {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean GetModOnly() {
// TODO Auto-generated method stub
return false;
}
}

View file

@ -0,0 +1,33 @@
package alisolarflare.easyuhc.commands;
import org.bukkit.command.CommandSender;
import buttondevteam.lib.chat.TBMCCommandBase;
public class SpreadPlayers extends TBMCCommandBase{
@Override
public boolean OnCommand(CommandSender sender, String alias, String[] args) {
// TODO Auto-generated method stub
return false;
}
@Override
public String[] GetHelpText(String alias) {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean GetPlayerOnly() {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean GetModOnly() {
// TODO Auto-generated method stub
return false;
}
}

View file

@ -0,0 +1,33 @@
package alisolarflare.easyuhc.commands;
import org.bukkit.command.CommandSender;
import buttondevteam.lib.chat.TBMCCommandBase;
public class StartTimer extends TBMCCommandBase{
@Override
public boolean OnCommand(CommandSender sender, String alias, String[] args) {
// TODO Auto-generated method stub
return false;
}
@Override
public String[] GetHelpText(String alias) {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean GetPlayerOnly() {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean GetModOnly() {
// TODO Auto-generated method stub
return false;
}
}

View file

@ -0,0 +1,33 @@
package alisolarflare.easyuhc.commands;
import org.bukkit.command.CommandSender;
import buttondevteam.lib.chat.TBMCCommandBase;
public class StartUHC extends TBMCCommandBase{
@Override
public boolean OnCommand(CommandSender sender, String alias, String[] args) {
// TODO Auto-generated method stub
return false;
}
@Override
public String[] GetHelpText(String alias) {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean GetPlayerOnly() {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean GetModOnly() {
// TODO Auto-generated method stub
return false;
}
}

View file

@ -0,0 +1,33 @@
package alisolarflare.easyuhc.commands;
import org.bukkit.command.CommandSender;
import buttondevteam.lib.chat.TBMCCommandBase;
public class TeleportToUHC extends TBMCCommandBase{
@Override
public boolean OnCommand(CommandSender sender, String alias, String[] args) {
// TODO Auto-generated method stub
return false;
}
@Override
public String[] GetHelpText(String alias) {
// TODO Auto-generated method stub
return null;
}
@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,36 +0,0 @@
package alisolarflare.uhc;
import org.bukkit.plugin.java.JavaPlugin;
import alisolarflare.Module;
import alisolarflare.uhc.controller.SetMatchState;
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;
public class UHCModule extends Module {
public UHCMatch match;
public void register(JavaPlugin plugin) {
if (plugin.getConfig().contains("UHCMatchState")){
match = new UHCMatch(plugin.getConfig(), MatchState.valueOf(plugin.getConfig().getString("UHCMatchState")));
}else{
match = new UHCMatch(plugin.getConfig(), MatchState.IDLE);
}
registerCommand(plugin, new SetMatchState(match));
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));
}
}