From 848811dbfb9c42c19538da7be54cc7239b888295 Mon Sep 17 00:00:00 2001 From: alisolarflare Date: Wed, 26 Oct 2016 14:55:07 -0400 Subject: [PATCH] Started work on the UHC module --- src/alisolarflare/uhc/AddToUHC.java | 35 ++++++++++++++++++++++++ src/alisolarflare/uhc/UHCMemoryUnit.java | 25 +++++++++++++++++ src/alisolarflare/uhc/UHCSubPlugin.java | 27 ++++++++++++++++++ 3 files changed, 87 insertions(+) create mode 100644 src/alisolarflare/uhc/AddToUHC.java create mode 100644 src/alisolarflare/uhc/UHCMemoryUnit.java create mode 100644 src/alisolarflare/uhc/UHCSubPlugin.java diff --git a/src/alisolarflare/uhc/AddToUHC.java b/src/alisolarflare/uhc/AddToUHC.java new file mode 100644 index 0000000..6e0a362 --- /dev/null +++ b/src/alisolarflare/uhc/AddToUHC.java @@ -0,0 +1,35 @@ +package alisolarflare.uhc; + +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +public class AddToUHC implements CommandExecutor{ + private UHCMemoryUnit generalMemory; + + public AddToUHC(UHCSubPlugin uhcSubPlugin){ + this.generalMemory = uhcSubPlugin.generalMemory; + } + @Override + public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + if (!(sender instanceof Player)){ + sender.sendMessage("You must be a player to use this command!"); + return false; + } + 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"); + } + + for (int i = 0; i > args.length; i++){ + //TO BE CONTINUED + } + return false; + } + +} diff --git a/src/alisolarflare/uhc/UHCMemoryUnit.java b/src/alisolarflare/uhc/UHCMemoryUnit.java new file mode 100644 index 0000000..80cdee7 --- /dev/null +++ b/src/alisolarflare/uhc/UHCMemoryUnit.java @@ -0,0 +1,25 @@ +package alisolarflare.uhc; + +import java.util.ArrayList; +import java.util.List; + +import org.bukkit.entity.Player; + +public class UHCMemoryUnit { + private List matchPlayers = new ArrayList(); + + public void addPlayerToMatch(Player player){ + matchPlayers.add(player); + } + public void removePlayerFromMatch(Player player){ + if (matchPlayers.contains(player)){ + matchPlayers.remove(player); + } + } + public void removeAllPlayersFromMatch(){ + matchPlayers.clear(); + } + public void endMatch(){ + matchPlayers.clear(); + } +} diff --git a/src/alisolarflare/uhc/UHCSubPlugin.java b/src/alisolarflare/uhc/UHCSubPlugin.java new file mode 100644 index 0000000..1116633 --- /dev/null +++ b/src/alisolarflare/uhc/UHCSubPlugin.java @@ -0,0 +1,27 @@ +package alisolarflare.uhc; + +import alisolarflare.AliPresents; + +public class UHCSubPlugin { + public AliPresents plugin; + public UHCMemoryUnit generalMemory; + + public UHCSubPlugin(AliPresents plugin){ + this.plugin = plugin; + } + public void register(){ + registerCommands(); + registerListeners(); + registerMemoryUnits(); + } + private void registerListeners() { + } + private void registerCommands() { + // TODO Auto-generated method stub + plugin.getCommand("addToUHC").setExecutor(new AddToUHC(this)); + } + private void registerMemoryUnits(){ + generalMemory = new UHCMemoryUnit(); + } + +}