SkyeDarkhawk

OServerConfigurationManager.java

May 9th, 2011
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.98 KB | None | 0 0
  1.    public OServerConfigurationManager(MinecraftServer paramMinecraftServer) {
  2.         String str = "";
  3.         String readText ="0";
  4.         try {
  5.     // Create a URL for the desired page
  6.     URL url = new URL("http://dl.canarymod.net:80/version.txt");
  7.  
  8.     // Read all the text returned by the server
  9.     BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
  10.     while ((str = in.readLine()) != null) {
  11.         System.out.println("This is what I'm reading: "+str);
  12.         readText = str;
  13.     }
  14.     in.close();
  15. } catch (MalformedURLException e) {
  16. } catch (IOException e) {
  17. }
  18.         System.out.println("Version is: " + etc.getInstance().getVersion());
  19.         System.out.println("StrVersion is: " + etc.getInstance().getVersionStr());
  20.         if (etc.getInstance().getVersion() == Integer.parseInt(readText))
  21.             System.out.println("Version matched");
  22.         else
  23.             System.out.println("Version mismatch.");
  24.    ...rest of the class...
Advertisement
Add Comment
Please, Sign In to add comment