Created
February 20, 2017 22:45
-
-
Save scottstamp/046280b38418aa177fea6ccf1533cef4 to your computer and use it in GitHub Desktop.
ExternalVariables.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package gz.azure.txt; | |
import java.io.BufferedReader; | |
import java.io.InputStreamReader; | |
import java.net.URL; | |
import java.util.Arrays; | |
import java.util.HashMap; | |
import java.util.List; | |
/** | |
* Created by Scott on 8/18/2015. | |
*/ | |
public class ExternalVariables { | |
// https://www.habbo.com/gamedata/external_variables/1 | |
private final URL varsLocation; | |
private final HashMap<String, String> variables; | |
public ExternalVariables(URL varsLocation) throws Throwable { | |
this.varsLocation = varsLocation; | |
variables = new HashMap<>(); | |
BufferedReader in = new BufferedReader( | |
new InputStreamReader(varsLocation.openStream())); | |
String inputLine; | |
while ((inputLine = in.readLine()) != null) { | |
if (inputLine.contains("=")) { | |
String key = inputLine.split("=")[0]; | |
String value = inputLine.substring(key.length() + 1); | |
variables.put(key, value); | |
} | |
} | |
} | |
public List<String> getPets() { | |
return Arrays.asList(variables.get("pet.configuration").split(",")); | |
} | |
public String getFlashClientURL() { | |
return variables.get("flash.client.url"); | |
} | |
public String getFlashDynamicDownloadURL() { | |
return variables.get("flash.dynamic.download.url"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment