From bf1847375060f8f8f788374801ea8a83cb166bd0 Mon Sep 17 00:00:00 2001 From: alisolarflare Date: Wed, 2 Nov 2016 15:33:19 -0400 Subject: [PATCH] added new files --- .../modules/events/uhc/MatchState.java | 5 +++ .../modules/events/uhc/UHCMatch.java | 42 +------------------ .../modules/events/uhc/UHCModule.java | 1 + .../modules/events/uhc/commands/AddToUHC.java | 2 +- .../listeners/PlayerPowerCyclingListener.java | 18 ++++++++ .../events/uhc/listeners/PlayerPowerTask.java | 24 +++++++++++ .../events/uhc/memory/PlayerPowerModule.java | 5 +++ 7 files changed, 55 insertions(+), 42 deletions(-) create mode 100644 src/alisolarflare/modules/events/uhc/MatchState.java create mode 100644 src/alisolarflare/modules/events/uhc/listeners/PlayerPowerCyclingListener.java create mode 100644 src/alisolarflare/modules/events/uhc/listeners/PlayerPowerTask.java create mode 100644 src/alisolarflare/modules/events/uhc/memory/PlayerPowerModule.java diff --git a/src/alisolarflare/modules/events/uhc/MatchState.java b/src/alisolarflare/modules/events/uhc/MatchState.java new file mode 100644 index 0000000..107358c --- /dev/null +++ b/src/alisolarflare/modules/events/uhc/MatchState.java @@ -0,0 +1,5 @@ +package alisolarflare.modules.events.uhc; + +public enum MatchState { + +} diff --git a/src/alisolarflare/modules/events/uhc/UHCMatch.java b/src/alisolarflare/modules/events/uhc/UHCMatch.java index f8aa26c..9b4bad7 100644 --- a/src/alisolarflare/modules/events/uhc/UHCMatch.java +++ b/src/alisolarflare/modules/events/uhc/UHCMatch.java @@ -11,46 +11,6 @@ import org.bukkit.entity.Player; * @author Alisolarflare */ public class UHCMatch { - private List matchPlayerUsernames = new ArrayList(); + public List matchPlayerUsernames = new ArrayList(); - /** - * Adds a player to an Ultrahardcore match, storing their name - * @param playername player.getName(); - */ - public void addPlayerToMatch(String playername){ - if (!(matchPlayerUsernames.contains(playername))){ - matchPlayerUsernames.add(playername); - } - } - /** - * Adds a player to an Ultrahardcore match, storing their name - * @param player Player to be added - */ - public void addPlayerToMatch(Player player){ - if (!(matchPlayerUsernames.contains(player.getName()))){ - matchPlayerUsernames.add(player.getName()); - } - } - /** - * Removes a player from an Ultrahardcore match, removing their username from the list - * @param player - */ - public void removePlayerFromMatch(Player player){ - if (matchPlayerUsernames.contains(player)){ - matchPlayerUsernames.remove(player.getName()); - } - } - - /** - * Removes all players from the match - */ - public void removeAllPlayersFromMatch(){ - matchPlayerUsernames.clear(); - } - /** - * Fully de-loads and clears out this match, reverting all values to the initialized setting - */ - public void endMatch(){ - matchPlayerUsernames.clear(); - } } diff --git a/src/alisolarflare/modules/events/uhc/UHCModule.java b/src/alisolarflare/modules/events/uhc/UHCModule.java index 35dd1a2..17fa970 100644 --- a/src/alisolarflare/modules/events/uhc/UHCModule.java +++ b/src/alisolarflare/modules/events/uhc/UHCModule.java @@ -7,6 +7,7 @@ import alisolarflare.modules.events.uhc.commands.AddToUHC; public class UHCModule extends Module { public UHCMatch generalMemory; + public String[] finiteStates = {"SETUP", "INTRO", "PEACE", "TENSION", "POWER", "END"}; public void register(JavaPlugin plugin){ registerCommands(plugin); diff --git a/src/alisolarflare/modules/events/uhc/commands/AddToUHC.java b/src/alisolarflare/modules/events/uhc/commands/AddToUHC.java index 02a90cf..227a7c7 100644 --- a/src/alisolarflare/modules/events/uhc/commands/AddToUHC.java +++ b/src/alisolarflare/modules/events/uhc/commands/AddToUHC.java @@ -50,7 +50,7 @@ public class AddToUHC implements CommandExecutor{ //Adds players to memory for (int i = 0; i > args.length; i++){ - generalMemory.addPlayerToMatch(player); + generalMemory.matchPlayerUsernames.add(player.getName()); } return false; } diff --git a/src/alisolarflare/modules/events/uhc/listeners/PlayerPowerCyclingListener.java b/src/alisolarflare/modules/events/uhc/listeners/PlayerPowerCyclingListener.java new file mode 100644 index 0000000..dca5fe2 --- /dev/null +++ b/src/alisolarflare/modules/events/uhc/listeners/PlayerPowerCyclingListener.java @@ -0,0 +1,18 @@ +package alisolarflare.modules.events.uhc.listeners; + +import org.bukkit.event.Listener; +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.scheduler.BukkitTask; + +/** + * Main launcher for the repeating task that activates the + * ghostie powers, if an Ultrahardcore Match is going on, + * and it's time for powers to activate + */ +public class PlayerPowerCyclingListener implements Listener { + public BukkitTask PowerCyclingTask; + + public PlayerPowerCyclingListener(JavaPlugin plugin){ + PowerCyclingTask = (new PlayerPowerTask(plugin)).runTaskTimer(plugin, 20, 20); + } +} diff --git a/src/alisolarflare/modules/events/uhc/listeners/PlayerPowerTask.java b/src/alisolarflare/modules/events/uhc/listeners/PlayerPowerTask.java new file mode 100644 index 0000000..4c41cf6 --- /dev/null +++ b/src/alisolarflare/modules/events/uhc/listeners/PlayerPowerTask.java @@ -0,0 +1,24 @@ +package alisolarflare.modules.events.uhc.listeners; + +import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.scheduler.BukkitRunnable; + +/** + * This is the main class that creates and implemnts Ghostie powers + * When run, it will apply the right potion effects to different players + * based on what colours they identify as in that time. + * @author Alisolarflare + * + */ +public class PlayerPowerTask extends BukkitRunnable{ + private JavaPlugin plugin; + public PlayerPowerTask(JavaPlugin plugin){ + this.plugin = plugin; + } + @Override + public void run() { + + } + + +} diff --git a/src/alisolarflare/modules/events/uhc/memory/PlayerPowerModule.java b/src/alisolarflare/modules/events/uhc/memory/PlayerPowerModule.java new file mode 100644 index 0000000..80f9f24 --- /dev/null +++ b/src/alisolarflare/modules/events/uhc/memory/PlayerPowerModule.java @@ -0,0 +1,5 @@ +package alisolarflare.modules.events.uhc.memory; + +public class PlayerPowerModule { + +}