From 7dfb9a9c72e5270b81c900704ccaae4987b1fa98 Mon Sep 17 00:00:00 2001 From: alisolarflare Date: Wed, 26 Oct 2016 16:26:57 -0400 Subject: [PATCH] Yo norbi this is pretty cool --- src/alisolarflare/uhc/AddToUHC.java | 69 ++++++++++++------------ src/alisolarflare/uhc/UHCMemoryUnit.java | 53 +++++++++--------- 2 files changed, 62 insertions(+), 60 deletions(-) diff --git a/src/alisolarflare/uhc/AddToUHC.java b/src/alisolarflare/uhc/AddToUHC.java index 6e0a362..c0ae425 100644 --- a/src/alisolarflare/uhc/AddToUHC.java +++ b/src/alisolarflare/uhc/AddToUHC.java @@ -1,35 +1,34 @@ -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; - } - -} +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++){ + generalMemory.addPlayerToMatch(player); + } + return false; + } + +} diff --git a/src/alisolarflare/uhc/UHCMemoryUnit.java b/src/alisolarflare/uhc/UHCMemoryUnit.java index 80cdee7..24a1e62 100644 --- a/src/alisolarflare/uhc/UHCMemoryUnit.java +++ b/src/alisolarflare/uhc/UHCMemoryUnit.java @@ -1,25 +1,28 @@ -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(); - } -} +package alisolarflare.uhc; + +import java.util.ArrayList; +import java.util.List; + +import org.bukkit.entity.Player; + +public class UHCMemoryUnit { + private List matchPlayerUsernames = new ArrayList(); + + public void addPlayerToMatch(String playername){ + matchPlayerUsernames.add(playername); + } + public void addPlayerToMatch(Player player){ + matchPlayerUsernames.add(player.toString()); + } + public void removePlayerFromMatch(Player player){ + if (matchPlayerUsernames.contains(player)){ + matchPlayerUsernames.remove(player.toString()); + } + } + public void removeAllPlayersFromMatch(){ + matchPlayerUsernames.clear(); + } + public void endMatch(){ + matchPlayerUsernames.clear(); + } +}