From 1dfef6a08d8d683bbc24a0fd894b6876ecf89d23 Mon Sep 17 00:00:00 2001 From: alisolarflare Date: Thu, 3 Nov 2016 07:01:50 -0400 Subject: [PATCH] nom nom nom --- src/alisolarflare/AliPresents.java | 2 +- .../freeforall/Freeforall.java | 29 +++++++ .../freeforall/StartMinigame.java | 5 ++ .../freeforall/commands/SetFFAS.java | 79 +++++++++++++++++++ .../buttonminigames/freeforall/data/Data.java | 8 ++ .../freeforall/data/SpawnSet.java | 27 +++++++ .../freeforall/entities/Fighter.java | 17 ++++ .../buttonminigames/hero/Hero.java | 21 +++++ .../buttonminigames/lobby/Lobby.java | 25 ++++++ .../lobby/commands/ButtonFight.java | 40 ++++++++++ .../lobby/commands/ButtonLeave.java | 35 ++++++++ .../lobby/commands/ListFighters.java | 20 +++++ .../modules/events/uhc/commands/AddToUHC.java | 26 +----- .../modules/events/uhc/memory/UHCMatch.java | 2 +- .../{magictrick => magic}/MagicModule.java | 6 +- .../aliarrow/AliArrowListener.java | 2 +- .../aliarrow/AliArrowTask.java | 2 +- .../boombow/BoomBowListener.java | 2 +- .../boombow/BoomBowRule.java | 2 +- 19 files changed, 319 insertions(+), 31 deletions(-) create mode 100644 src/alisolarflare/buttonminigames/freeforall/Freeforall.java create mode 100644 src/alisolarflare/buttonminigames/freeforall/StartMinigame.java create mode 100644 src/alisolarflare/buttonminigames/freeforall/commands/SetFFAS.java create mode 100644 src/alisolarflare/buttonminigames/freeforall/data/Data.java create mode 100644 src/alisolarflare/buttonminigames/freeforall/data/SpawnSet.java create mode 100644 src/alisolarflare/buttonminigames/freeforall/entities/Fighter.java create mode 100644 src/alisolarflare/buttonminigames/hero/Hero.java create mode 100644 src/alisolarflare/buttonminigames/lobby/Lobby.java create mode 100644 src/alisolarflare/buttonminigames/lobby/commands/ButtonFight.java create mode 100644 src/alisolarflare/buttonminigames/lobby/commands/ButtonLeave.java create mode 100644 src/alisolarflare/buttonminigames/lobby/commands/ListFighters.java rename src/alisolarflare/modules/{magictrick => magic}/MagicModule.java (73%) rename src/alisolarflare/modules/{magictrick => magic}/aliarrow/AliArrowListener.java (91%) rename src/alisolarflare/modules/{magictrick => magic}/aliarrow/AliArrowTask.java (90%) rename src/alisolarflare/modules/{magictrick => magic}/boombow/BoomBowListener.java (95%) rename src/alisolarflare/modules/{magictrick => magic}/boombow/BoomBowRule.java (94%) diff --git a/src/alisolarflare/AliPresents.java b/src/alisolarflare/AliPresents.java index 228fcee..e2f566d 100644 --- a/src/alisolarflare/AliPresents.java +++ b/src/alisolarflare/AliPresents.java @@ -11,7 +11,7 @@ import alisolarflare.modules.components.gpowers.GPowerModule; import alisolarflare.modules.components.links.AliLinkModule; import alisolarflare.modules.components.shulker.AliShulkerModule; import alisolarflare.modules.events.uhc.UHCModule; -import alisolarflare.modules.magictrick.MagicModule; +import alisolarflare.modules.magic.MagicModule; public class AliPresents extends JavaPlugin{ public void onEnable(){ diff --git a/src/alisolarflare/buttonminigames/freeforall/Freeforall.java b/src/alisolarflare/buttonminigames/freeforall/Freeforall.java new file mode 100644 index 0000000..1d7be0b --- /dev/null +++ b/src/alisolarflare/buttonminigames/freeforall/Freeforall.java @@ -0,0 +1,29 @@ +package alisolarflare.buttonminigames.freeforall; + + +import alisolarflare.MainPlugin; +import alisolarflare.buttonminigames.freeforall.commands.SetFFAS; +import alisolarflare.buttonminigames.freeforall.data.SpawnSet; + +public class Freeforall { + private MainPlugin plugin; + public SpawnSet spawnSet; + private int GameState; + + public Freeforall(MainPlugin plugin){ + this.plugin = plugin; + this.spawnSet = new SpawnSet(); + } + public void register(){ + registerEvents(); + registerCommands(); + } + private void registerEvents() { + } + + private void registerCommands() { + plugin.getCommand("setFFAS").setExecutor(new SetFFAS(plugin, spawnSet)); + } + public int getGameState() {return GameState;} + public void setGameState(int gameState) {GameState = gameState;} +} diff --git a/src/alisolarflare/buttonminigames/freeforall/StartMinigame.java b/src/alisolarflare/buttonminigames/freeforall/StartMinigame.java new file mode 100644 index 0000000..22a0102 --- /dev/null +++ b/src/alisolarflare/buttonminigames/freeforall/StartMinigame.java @@ -0,0 +1,5 @@ +package alisolarflare.buttonminigames.freeforall; + +public class StartMinigame { + +} diff --git a/src/alisolarflare/buttonminigames/freeforall/commands/SetFFAS.java b/src/alisolarflare/buttonminigames/freeforall/commands/SetFFAS.java new file mode 100644 index 0000000..abde10d --- /dev/null +++ b/src/alisolarflare/buttonminigames/freeforall/commands/SetFFAS.java @@ -0,0 +1,79 @@ +package alisolarflare.buttonminigames.freeforall.commands; + +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import alisolarflare.MainPlugin; +import alisolarflare.buttonminigames.freeforall.data.SpawnSet; + +public class SetFFAS implements CommandExecutor{ + private MainPlugin plugin; + private SpawnSet spawnSet; + + public SetFFAS(MainPlugin plugin, SpawnSet spawnSet){ + this.plugin = plugin; + this.spawnSet = spawnSet; + } + @SuppressWarnings("deprecation") + @Override + public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + if (!(sender instanceof Player)){ + sender.sendMessage("ERROR: You must be a Alisolarflare and playing to use this command!"); + } + Player player = (Player) sender; + + if(!(player.equals(plugin.getServer().getPlayer("Alisolarflare")))){ + player.sendMessage("ERROR: You must be Alisolarflare to use this command!"); + } + + if(args.length <= 0){ + sender.sendMessage("ERROR: Arguments required."); + return false; + } + + String input = args[0]; + + if(input == null){ + sender.sendMessage("ERROR: Arguments are null"); + return false; + } + + input.toLowerCase(); + switch(input){ + case ("r"): + sender.sendMessage("Setting Red Spawn..."); + spawnSet.setRSpawn(player.getLocation()); + sender.sendMessage("Red Spawn Set!"); + break; + case ("o"): + sender.sendMessage("Setting Orange Spawn..."); + spawnSet.setRSpawn(player.getLocation()); + sender.sendMessage("Orange Spawn Set!"); + break; + case ("y"): + sender.sendMessage("Setting Yellow Spawn..."); + spawnSet.setRSpawn(player.getLocation()); + sender.sendMessage("Yellow Spawn Set!"); + break; + case ("g"): + sender.sendMessage("Setting Green Spawn..."); + spawnSet.setRSpawn(player.getLocation()); + sender.sendMessage("Green Spawn Set!"); + break; + case ("b"): + sender.sendMessage("Setting Blue Spawn..."); + spawnSet.setRSpawn(player.getLocation()); + sender.sendMessage("Blue Spawn Set!"); + break; + case ("p"): + sender.sendMessage("Setting Purple Spawn..."); + spawnSet.setRSpawn(player.getLocation()); + sender.sendMessage("Purple Spawn Set!"); + break; + } + return false; + } + +} diff --git a/src/alisolarflare/buttonminigames/freeforall/data/Data.java b/src/alisolarflare/buttonminigames/freeforall/data/Data.java new file mode 100644 index 0000000..c537b74 --- /dev/null +++ b/src/alisolarflare/buttonminigames/freeforall/data/Data.java @@ -0,0 +1,8 @@ +package alisolarflare.buttonminigames.freeforall.data; + +public class Data { + public SpawnSet spawnset; + public Data(){ + spawnset = new SpawnSet(); + } +} diff --git a/src/alisolarflare/buttonminigames/freeforall/data/SpawnSet.java b/src/alisolarflare/buttonminigames/freeforall/data/SpawnSet.java new file mode 100644 index 0000000..8871a88 --- /dev/null +++ b/src/alisolarflare/buttonminigames/freeforall/data/SpawnSet.java @@ -0,0 +1,27 @@ +package alisolarflare.buttonminigames.freeforall.data; + +import org.bukkit.Location; + +public class SpawnSet { + private Location RSpawn; + private Location OSpawn; + private Location YSpawn; + private Location GSpawn; + private Location BSpawn; + private Location PSpawn; + + public Location getRSpawn(){return RSpawn;} + public Location getOSpawn(){return OSpawn;} + public Location getYSpawn(){return YSpawn;} + public Location getGSpawn(){return GSpawn;} + public Location getBSpawn(){return BSpawn;} + public Location getPSpawn(){return PSpawn;} + + public void setRSpawn(Location RSpawn){this.RSpawn = RSpawn; return;} + public void setOSpawn(Location OSpawn){this.OSpawn = OSpawn; return;} + public void setYSpawn(Location YSpawn){this.YSpawn = YSpawn; return;} + public void setGSpawn(Location GSpawn){this.GSpawn = GSpawn; return;} + public void setBSpawn(Location BSpawn){this.BSpawn = BSpawn; return;} + public void setPSpawn(Location PSpawn){this.PSpawn = PSpawn; return;} + +} diff --git a/src/alisolarflare/buttonminigames/freeforall/entities/Fighter.java b/src/alisolarflare/buttonminigames/freeforall/entities/Fighter.java new file mode 100644 index 0000000..7963aee --- /dev/null +++ b/src/alisolarflare/buttonminigames/freeforall/entities/Fighter.java @@ -0,0 +1,17 @@ +package alisolarflare.buttonminigames.freeforall.entities; + +import org.bukkit.entity.Player; + +public class Fighter { + public Player player; + public String colour; + public Fighter(Player player){ + this.player = player; + } + public Fighter(Player player, String colour){ + this.colour = colour; + } + public String ToString(){ + return player.toString() +": " + colour.toString(); + } +} diff --git a/src/alisolarflare/buttonminigames/hero/Hero.java b/src/alisolarflare/buttonminigames/hero/Hero.java new file mode 100644 index 0000000..b7baf5c --- /dev/null +++ b/src/alisolarflare/buttonminigames/hero/Hero.java @@ -0,0 +1,21 @@ +package alisolarflare.buttonminigames.hero; + + +import alisolarflare.MainPlugin; + +public class Hero { + @SuppressWarnings("unused") + private MainPlugin plugin; + public Hero(MainPlugin plugin){ + this.plugin = plugin; + } + public void register(){ + registerEvents(); + registerCommands(); + } + private void registerEvents() { + } + + private void registerCommands() { + } +} diff --git a/src/alisolarflare/buttonminigames/lobby/Lobby.java b/src/alisolarflare/buttonminigames/lobby/Lobby.java new file mode 100644 index 0000000..9f1f04e --- /dev/null +++ b/src/alisolarflare/buttonminigames/lobby/Lobby.java @@ -0,0 +1,25 @@ +package alisolarflare.buttonminigames.lobby; + +import alisolarflare.MainPlugin; +import alisolarflare.buttonminigames.lobby.commands.ButtonFight; +import alisolarflare.buttonminigames.lobby.commands.ButtonLeave; +import alisolarflare.buttonminigames.lobby.commands.ListFighters; + +public class Lobby { + private MainPlugin plugin; + public Lobby(MainPlugin plugin){ + this.plugin = plugin; + } + public void register(){ + registerEvents(); + registerCommands(); + } + private void registerEvents() { + } + + private void registerCommands() { + plugin.getCommand("buttonfight").setExecutor(new ButtonFight(plugin)); + plugin.getCommand("buttonleave").setExecutor(new ButtonLeave(plugin)); + plugin.getCommand("listfighters").setExecutor(new ListFighters(plugin)); + } +} diff --git a/src/alisolarflare/buttonminigames/lobby/commands/ButtonFight.java b/src/alisolarflare/buttonminigames/lobby/commands/ButtonFight.java new file mode 100644 index 0000000..18abeda --- /dev/null +++ b/src/alisolarflare/buttonminigames/lobby/commands/ButtonFight.java @@ -0,0 +1,40 @@ +package alisolarflare.buttonminigames.lobby.commands; + +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import alisolarflare.MainPlugin; + +public class ButtonFight implements CommandExecutor{ + private MainPlugin plugin; + public ButtonFight(MainPlugin initPlugin){ + plugin = initPlugin; + } + @Override + public boolean onCommand(CommandSender sender, Command arg1, String arg2, String[] arg3) { + + if(!(sender instanceof Player)){ + sender.sendMessage("You must be a player to be using this command!"); + return false; + } + + + Player player = (Player) sender; + player.sendMessage(player.toString()); + + if(plugin.fighters.contains(player)){ + player.sendMessage("You are already in the button fight!"); + return false; + } + + plugin.fighters.add(player); + + if(plugin.fighters.contains(player)){ + player.sendMessage("You have joined the fighters category!"); + } + return false; + } + +} diff --git a/src/alisolarflare/buttonminigames/lobby/commands/ButtonLeave.java b/src/alisolarflare/buttonminigames/lobby/commands/ButtonLeave.java new file mode 100644 index 0000000..840517c --- /dev/null +++ b/src/alisolarflare/buttonminigames/lobby/commands/ButtonLeave.java @@ -0,0 +1,35 @@ +package alisolarflare.buttonminigames.lobby.commands; + +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import alisolarflare.MainPlugin; + +public class ButtonLeave implements CommandExecutor{ + private MainPlugin plugin; + public ButtonLeave(MainPlugin initPlugin){ + plugin = initPlugin; + } + + @Override + public boolean onCommand(CommandSender sender, Command arg1, String arg2, String[] arg3) { + if(!(sender instanceof Player)){ + sender.sendMessage("You must be a player to be using this command!"); + return false; + } + + Player player = (Player) sender; + if (!(plugin.fighters.contains(player))){ + player.sendMessage("You are not fighting!"); + return false; + } + plugin.fighters.remove(player); + if(!(plugin.fighters.contains(player))){ + player.sendMessage("You have left the fighters category!"); + } + return false; + } + +} diff --git a/src/alisolarflare/buttonminigames/lobby/commands/ListFighters.java b/src/alisolarflare/buttonminigames/lobby/commands/ListFighters.java new file mode 100644 index 0000000..1532c4b --- /dev/null +++ b/src/alisolarflare/buttonminigames/lobby/commands/ListFighters.java @@ -0,0 +1,20 @@ +package alisolarflare.buttonminigames.lobby.commands; + +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; + +import alisolarflare.MainPlugin; + +public class ListFighters implements CommandExecutor{ + private MainPlugin plugin; + public ListFighters(MainPlugin initPlugin){ + plugin = initPlugin; + } + @Override + public boolean onCommand(CommandSender sender, Command arg1, String arg2, String[] arg3) { + sender.sendMessage(plugin.fighters.toString()); + return false; + } + +} diff --git a/src/alisolarflare/modules/events/uhc/commands/AddToUHC.java b/src/alisolarflare/modules/events/uhc/commands/AddToUHC.java index f260a83..13bf168 100644 --- a/src/alisolarflare/modules/events/uhc/commands/AddToUHC.java +++ b/src/alisolarflare/modules/events/uhc/commands/AddToUHC.java @@ -12,30 +12,12 @@ import buttondevteam.lib.chat.TBMCCommandBase; * @author Alisolarflare */ public class AddToUHC extends TBMCCommandBase { - private UHCMatch generalMemory; + private UHCMatch match; - /** - * Constructor for this AddToUHC - * - * @param generalMemory - * The Memory Unit for the current match - */ - public AddToUHC(UHCMatch generalMemory) { - this.generalMemory = generalMemory; + public AddToUHC(UHCMatch match) { + this.match = match; } - /** - * Activated function when /addtoUHC <> is typed in-game - * - * @param sender - * CommandSender which sent the command /addToUHC - * @param command - * Command object created when /addToUHC is called in-game - * @param label - * Name of the command called - * @param args - * Arguments passed onto /addToUHC by the player - */ @Override public boolean OnCommand(CommandSender sender, String label, String[] args) { // INPUT SANITATION @@ -50,7 +32,7 @@ public class AddToUHC extends TBMCCommandBase { // Adds players to memory for (int i = 0; i > args.length; i++) { - generalMemory.matchPlayerUsernames.add(player.getName()); + match.playerList.add(player.getName()); } return false; } diff --git a/src/alisolarflare/modules/events/uhc/memory/UHCMatch.java b/src/alisolarflare/modules/events/uhc/memory/UHCMatch.java index f102be5..9cf2323 100644 --- a/src/alisolarflare/modules/events/uhc/memory/UHCMatch.java +++ b/src/alisolarflare/modules/events/uhc/memory/UHCMatch.java @@ -11,7 +11,7 @@ import org.bukkit.configuration.file.FileConfiguration; * @author Alisolarflare */ public class UHCMatch { - public List matchPlayerUsernames = new ArrayList(); + public List playerList = new ArrayList(); private MatchState matchState = MatchState.IDLE; private FileConfiguration fileConfiguration; diff --git a/src/alisolarflare/modules/magictrick/MagicModule.java b/src/alisolarflare/modules/magic/MagicModule.java similarity index 73% rename from src/alisolarflare/modules/magictrick/MagicModule.java rename to src/alisolarflare/modules/magic/MagicModule.java index b29179e..e89ff5f 100644 --- a/src/alisolarflare/modules/magictrick/MagicModule.java +++ b/src/alisolarflare/modules/magic/MagicModule.java @@ -1,11 +1,11 @@ -package alisolarflare.modules.magictrick; +package alisolarflare.modules.magic; import org.bukkit.plugin.java.JavaPlugin; import alisolarflare.modules.Module; import alisolarflare.modules.events.uhc.commands.AddToUHC; -import alisolarflare.modules.magictrick.aliarrow.AliArrowListener; -import alisolarflare.modules.magictrick.boombow.BoomBowListener; +import alisolarflare.modules.magic.aliarrow.AliArrowListener; +import alisolarflare.modules.magic.boombow.BoomBowListener; import buttondevteam.lib.TBMCCoreAPI; import buttondevteam.lib.chat.TBMCChatAPI; diff --git a/src/alisolarflare/modules/magictrick/aliarrow/AliArrowListener.java b/src/alisolarflare/modules/magic/aliarrow/AliArrowListener.java similarity index 91% rename from src/alisolarflare/modules/magictrick/aliarrow/AliArrowListener.java rename to src/alisolarflare/modules/magic/aliarrow/AliArrowListener.java index 038b148..5c678d7 100644 --- a/src/alisolarflare/modules/magictrick/aliarrow/AliArrowListener.java +++ b/src/alisolarflare/modules/magic/aliarrow/AliArrowListener.java @@ -1,4 +1,4 @@ -package alisolarflare.modules.magictrick.aliarrow; +package alisolarflare.modules.magic.aliarrow; import org.bukkit.entity.Arrow; import org.bukkit.entity.EntityType; diff --git a/src/alisolarflare/modules/magictrick/aliarrow/AliArrowTask.java b/src/alisolarflare/modules/magic/aliarrow/AliArrowTask.java similarity index 90% rename from src/alisolarflare/modules/magictrick/aliarrow/AliArrowTask.java rename to src/alisolarflare/modules/magic/aliarrow/AliArrowTask.java index 603567d..11451c5 100644 --- a/src/alisolarflare/modules/magictrick/aliarrow/AliArrowTask.java +++ b/src/alisolarflare/modules/magic/aliarrow/AliArrowTask.java @@ -1,4 +1,4 @@ -package alisolarflare.modules.magictrick.aliarrow; +package alisolarflare.modules.magic.aliarrow; import org.bukkit.Particle; import org.bukkit.entity.Arrow; diff --git a/src/alisolarflare/modules/magictrick/boombow/BoomBowListener.java b/src/alisolarflare/modules/magic/boombow/BoomBowListener.java similarity index 95% rename from src/alisolarflare/modules/magictrick/boombow/BoomBowListener.java rename to src/alisolarflare/modules/magic/boombow/BoomBowListener.java index 3c05bff..86b6e06 100644 --- a/src/alisolarflare/modules/magictrick/boombow/BoomBowListener.java +++ b/src/alisolarflare/modules/magic/boombow/BoomBowListener.java @@ -1,4 +1,4 @@ -package alisolarflare.modules.magictrick.boombow; +package alisolarflare.modules.magic.boombow; import org.bukkit.GameMode; import org.bukkit.Location; diff --git a/src/alisolarflare/modules/magictrick/boombow/BoomBowRule.java b/src/alisolarflare/modules/magic/boombow/BoomBowRule.java similarity index 94% rename from src/alisolarflare/modules/magictrick/boombow/BoomBowRule.java rename to src/alisolarflare/modules/magic/boombow/BoomBowRule.java index 06f5ea0..7b7c493 100644 --- a/src/alisolarflare/modules/magictrick/boombow/BoomBowRule.java +++ b/src/alisolarflare/modules/magic/boombow/BoomBowRule.java @@ -1,4 +1,4 @@ -package alisolarflare.modules.magictrick.boombow; +package alisolarflare.modules.magic.boombow; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player;