Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package fr.cynoria.cynoria.launcher;
- import java.io.BufferedReader;
- import java.io.IOException;
- import java.io.InputStreamReader;
- import java.net.URL;
- import java.net.URLConnection;
- public class LauncherController {
- private String salt = "5s355f3985dfr74a";
- private String host = "http://cynoria.fr/";
- private Boolean debug = false;
- public String username;
- public String password;
- public LauncherController(String username, String password){
- this.username = username;
- this.password = password;
- }
- private String getResultFromAPI(){
- StringBuilder a = new StringBuilder();
- try {
- URL uri= new URL(
- "users/login" + this.host
- + "/launcher/login/" + this.username
- + "/" + this.password
- + "/" + this.salt
- );
- URLConnection ec;
- ec = uri.openConnection();
- BufferedReader in = new BufferedReader(new InputStreamReader( ec.getInputStream(), "UTF-8"));
- String inputLine;
- LauncherController LC = new LauncherController("{USERNAME}","{PASSWORD}");
- LC.checkPlayerAccount();
- while ((inputLine = in.readLine()) != null){
- a.append(inputLine);
- }
- in.close();
- if(debug){
- System.out.println("[LauncherController] Value : " + a.toString() + " for the couple username/password : "
- + this.username + "/" + this.password + " and salt : " + this.salt);
- }
- } catch (IOException e) {
- e.printStackTrace();
- }
- return a.toString();
- }
- public boolean checkPlayerAccount(){
- String result = this.getResultFromAPI();
- if(result.equals("true")){
- return true;
- }else{
- return false;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement