title: Get HTML String From Webpage in Bukkit Plugin
body: <p>I'm trying to create a plugin for minecraft bukkit servers. The goal is to read the string on the first line of an html page. If the result is True it will execute a command.</p>
  
  <p>Here is the code I have right now:</p>
  
  <pre><code>import java.net.URLConnection;
  import java.util.Scanner;
  import java.util.logging.Logger;
  
  import org.bukkit.ChatColor;
  import org.bukkit.command.Command;
  import org.bukkit.command.CommandSender;
  import org.bukkit.entity.Player;
  import org.bukkit.plugin.java.JavaPlugin;
  
  public class main extends JavaPlugin{
  public final Logger logger = Logger.getLogger("Minecraft");
  
  public void onEnable(){
      logger.info("[First] Has Been Enabled.");
  }
  
  public void onDisable(){
      logger.info("[First] Has Been Disabled.");
  }
  
  public boolean onCommand(CommandSender sender, Command command, String commandLabel, String[] args) {
      Player player = (Player) sender;
      if(commandLabel.equalsIgnoreCase("hello")){
          player.sendMessage(ChatColor.GOLD + "Hello");
      }
      else if(commandLabel.equalsIgnoreCase("world")){
          player.sendMessage(ChatColor.GOLD + "World");
      }
      else if(commandLabel.equalsIgnoreCase("coolman")){
          player.setPlayerListName("coolman");
      }
      else if(commandLabel.equalsIgnoreCase("vote")){
          String sourceLine = null;
  
          // The URL address of the page to open.
          URL address = new URL("http://www.koolflashgames.com/test.php");
  
          // Open the address and create a BufferedReader with the source code.
          InputStreamReader pageInput = new InputStreamReader(address.openStream());
          BufferedReader source = new BufferedReader(pageInput);
  
          // Append each new HTML line into one string. Add a tab character.
          try {
              sourceLine = source.readLine();
          } catch (IOException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }
          if(sourceLine == "False"){
              player.sendMessage("Thanks for voting!");
          }
  
      }
      return false;
  
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Creates the following error in the log:</p>
  
  <pre><code>2012-11-02 16:18:30 [SEVERE] null
  org.bukkit.command.CommandException: Unhandled exception executing command 'vote' in        plugin first v1.0
  at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46)
  at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:180)
  at org.bukkit.craftbukkit.CraftServer.dispatchCommand(CraftServer.java:502)
  at net.minecraft.server.NetServerHandler.handleCommand(NetServerHandler.java:915)
  at net.minecraft.server.NetServerHandler.chat(NetServerHandler.java:828)
  at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:810)
  at net.minecraft.server.Packet3Chat.handle(Packet3Chat.java:44)
  at net.minecraft.server.NetworkManager.b(NetworkManager.java:282)
  at net.minecraft.server.NetServerHandler.d(NetServerHandler.java:111)
  at net.minecraft.server.ServerConnection.b(SourceFile:35)
  at net.minecraft.server.DedicatedServerConnection.b(SourceFile:30)
  at net.minecraft.server.MinecraftServer.q(MinecraftServer.java:561)
  at net.minecraft.server.DedicatedServer.q(DedicatedServer.java:213)
  at net.minecraft.server.MinecraftServer.p(MinecraftServer.java:474)
  at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:406)
  at net.minecraft.server.ThreadServerApplication.run(SourceFile:539)
  Caused by: java.lang.NullPointerException
  at java.io.Reader.&lt;init&gt;(Unknown Source)
  at java.io.InputStreamReader.&lt;init&gt;(Unknown Source)
  at me.storminmormon30.first.main.onCommand(main.java:43)
  at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44)
  ... 15 more
  </code></pre>