-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
149 additions
and
117 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
package net.aspw.client.utils | ||
|
||
import net.aspw.client.Launch | ||
import okhttp3.* | ||
|
||
object APIConnecter { | ||
|
||
var canConnect = false | ||
var isLatest = false | ||
var discord = "" | ||
var discordApp = "" | ||
var appClientID = "" | ||
var appClientSecret = "" | ||
var bmcstafflist = "" | ||
var mushstafflist = "" | ||
var hypixelstafflist = "" | ||
|
||
fun checkStatus() { | ||
try { | ||
var gotData: String | ||
val client = OkHttpClient() | ||
val builder = Request.Builder().url(URLComponent.STATUS) | ||
val request: Request = builder.build() | ||
client.newCall(request).execute().use { response -> | ||
gotData = response.body!!.string() | ||
} | ||
val details = gotData.split("///") | ||
isLatest = details[4] == Launch.CLIENT_VERSION | ||
discord = details[3] | ||
discordApp = details[2] | ||
appClientSecret = details[1] | ||
appClientID = details[0] | ||
canConnect = true | ||
ClientUtils.getLogger().info("Loaded API") | ||
} catch (e: Exception) { | ||
canConnect = false | ||
ClientUtils.getLogger().info("Failed to load API") | ||
} | ||
} | ||
|
||
fun checkStaffList() { | ||
try { | ||
var gotData: String | ||
val client = OkHttpClient() | ||
val builder = Request.Builder().url(URLComponent.STAFFS) | ||
val request: Request = builder.build() | ||
client.newCall(request).execute().use { response -> | ||
gotData = response.body!!.string() | ||
} | ||
val details = gotData.split("-") | ||
bmcstafflist = details[0] | ||
mushstafflist = details[1] | ||
hypixelstafflist = details[2] | ||
ClientUtils.getLogger().info("Loaded Staff List") | ||
} catch (e: Exception) { | ||
ClientUtils.getLogger().info("Failed to load Staff List") | ||
} | ||
} | ||
|
||
fun configLoad(name: String): String { | ||
var gotData = "" | ||
try { | ||
val client = OkHttpClient() | ||
val builder = Request.Builder().url(URLComponent.CONFIGS + name) | ||
val request: Request = builder.build() | ||
client.newCall(request).execute().use { response -> | ||
gotData = response.body!!.string() | ||
} | ||
ClientUtils.getLogger().info("Loaded Config Data") | ||
} catch (e: Exception) { | ||
ClientUtils.getLogger().info("Failed to load Config Data") | ||
} | ||
return gotData | ||
} | ||
|
||
fun configList(): String { | ||
var gotData = "" | ||
try { | ||
val client = OkHttpClient() | ||
val builder = Request.Builder().url(URLComponent.CONFIGLIST) | ||
val request: Request = builder.build() | ||
client.newCall(request).execute().use { response -> | ||
gotData = response.body!!.string() | ||
} | ||
ClientUtils.getLogger().info("Loaded Config List") | ||
} catch (e: Exception) { | ||
ClientUtils.getLogger().info("Failed to load Config List") | ||
} | ||
return gotData | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package net.aspw.client.utils | ||
|
||
object URLComponent { | ||
const val WEBSITE = "https://aspw-w.github.io/NightX" //Pastebinだとエラー出ない GitHubSitesでやるとJava1.8.0_51でエラー | ||
const val STATUS = "$WEBSITE/database/data.txt" | ||
const val STAFFS = "$WEBSITE/database/staffs.txt" | ||
const val CONFIGLIST = "$WEBSITE/configs/str/list.txt" | ||
const val CONFIGS = "$WEBSITE/configs/" | ||
const val JAVAUPDATE = "https://www.java.com/download" | ||
} |
Oops, something went wrong.