Skip to content

Commit

Permalink
java51でのエラー直せません
Browse files Browse the repository at this point in the history
  • Loading branch information
Aspw-w committed Apr 1, 2024
1 parent e26732b commit 21e6169
Show file tree
Hide file tree
Showing 14 changed files with 149 additions and 117 deletions.
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ dependencies {
exclude module: "log4j-core"
}

include "com.squareup.okhttp3:okhttp:4.9.1"

for (final def via in viaLibs) {
include(via)
}
Expand Down
14 changes: 3 additions & 11 deletions src/main/java/net/aspw/client/Launch.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ import net.aspw.client.protocol.ProtocolMod
import net.aspw.client.utils.*
import net.aspw.client.utils.ClassUtils.hasForge
import net.aspw.client.utils.misc.sound.TipSoundManager
import net.aspw.client.utils.APIConnecter
import net.aspw.client.visual.client.clickgui.dropdown.ClickGui
import net.aspw.client.visual.font.semi.Fonts
import net.minecraft.util.ResourceLocation

object Launch {

Expand All @@ -33,12 +33,7 @@ object Launch {
const val CLIENT_FOLDER = "NightX-Client"
const val CLIENT_VERSION = "B102"
const val CLIENT_PROTOCOL_RANGE = "1.8 to 1.20.5"
const val CLIENT_WEBSITE = "https://aspw-w.github.io/AspieAPI/NightX"
const val CLIENT_CHAT = "§c$CLIENT_BEST: §r"
const val CLIENT_STATUS = "$CLIENT_WEBSITE/database/data.txt"
const val CLIENT_STAFFS = "$CLIENT_WEBSITE/database/staffs.txt"
const val CLIENT_CONFIGLIST = "$CLIENT_WEBSITE/configs/str/list.txt"
const val CLIENT_CONFIGS = "$CLIENT_WEBSITE/configs/"

var isStarting = false

Expand All @@ -51,9 +46,6 @@ object Launch {

lateinit var clickGui: ClickGui

// Menu Background
var background: ResourceLocation? = null

private var lastTick: Long = 0L

private var javaVersion =
Expand All @@ -76,8 +68,8 @@ object Launch {
ProtocolBase.init(ProtocolMod.PLATFORM)

// Check update
Access.checkStaffList()
Access.checkStatus()
APIConnecter.checkStaffList()
APIConnecter.checkStatus()

// Create file manager
fileManager = FileManager()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import net.aspw.client.auth.utils.HttpUtils
import net.aspw.client.auth.utils.array
import net.aspw.client.auth.utils.obj
import net.aspw.client.auth.utils.string
import net.aspw.client.utils.Access
import net.aspw.client.utils.APIConnecter

class MicrosoftAccount : MinecraftAccount("Microsoft") {
override var name = "UNKNOWN"
Expand Down Expand Up @@ -235,8 +235,8 @@ class MicrosoftAccount : MinecraftAccount("Microsoft") {
"<access_token>"
)
val AZURE_APP = AuthMethod(
Access.appClientID,
Access.appClientSecret,
APIConnecter.appClientID,
APIConnecter.appClientSecret,
"http://localhost:1919/login",
"XboxLive.signin%20offline_access",
"d=<access_token>"
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/net/aspw/client/features/api/DiscordRPC.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import com.jagrosh.discordipc.IPCListener
import com.jagrosh.discordipc.entities.RichPresence
import com.jagrosh.discordipc.entities.pipe.PipeStatus
import net.aspw.client.Launch
import net.aspw.client.utils.Access
import net.aspw.client.utils.APIConnecter
import net.aspw.client.utils.ClientUtils
import net.aspw.client.utils.MinecraftInstance
import org.json.JSONObject
Expand Down Expand Up @@ -87,7 +87,7 @@ class DiscordRPC : MinecraftInstance() {

// Set display infos
builder.setDetails(Launch.CLIENT_VERSION)
builder.setState(Access.discord)
builder.setState(APIConnecter.discord)

// Check ipc client is connected and send rpc
if (ipcClient?.status == PipeStatus.CONNECTED)
Expand All @@ -110,7 +110,7 @@ class DiscordRPC : MinecraftInstance() {
}

private fun loadConfiguration() {
appID = Access.discordApp.toLong()
appID = APIConnecter.discordApp.toLong()
assets["rpc"] = "rpc"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ package net.aspw.client.features.command.impl
import net.aspw.client.Launch
import net.aspw.client.features.command.Command
import net.aspw.client.features.module.impl.visual.Interface
import net.aspw.client.utils.APIConnecter
import net.aspw.client.utils.SettingsUtils
import net.aspw.client.utils.URLComponent
import net.aspw.client.utils.misc.StringUtils
import org.apache.http.client.methods.HttpGet
import org.apache.http.impl.client.CloseableHttpClient
Expand Down Expand Up @@ -46,15 +48,7 @@ class ConfigCommand : Command("config", arrayOf("c")) {
args[1].equals("onlineload", ignoreCase = true) -> {
if (args.size > 2) {
try {
val httpClient: CloseableHttpClient = HttpClients.createDefault()
val request = HttpGet(Launch.CLIENT_CONFIGS + args[2])
val response = httpClient.execute(request)
val entity = response.entity
val content = EntityUtils.toString(entity)
EntityUtils.consume(entity)
response.close()
httpClient.close()
SettingsUtils.executeScript(content)
SettingsUtils.executeScript(APIConnecter.configLoad(args[2]))
if (Launch.moduleManager.getModule(Interface::class.java)?.flagSoundValue!!.get()) {
Launch.tipSoundManager.popSound.asyncPlay(Launch.moduleManager.popSoundPower)
}
Expand Down Expand Up @@ -178,16 +172,8 @@ class ConfigCommand : Command("config", arrayOf("c")) {

args[1].equals("onlinelist", ignoreCase = true) -> {
try {
val httpClient: CloseableHttpClient = HttpClients.createDefault()
val request = HttpGet(Launch.CLIENT_CONFIGLIST)
val response = httpClient.execute(request)
val entity = response.entity
val content = EntityUtils.toString(entity)
EntityUtils.consume(entity)
response.close()
httpClient.close()
chat("§cOnlineConfigs:")
chat(content)
chat(APIConnecter.configList())
} catch (e: Exception) {
chat("§cAPI Error!")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ class Jesus : Module() {
"MatrixFast",
"MatrixDolphin",
"Dolphin",
"Swim"
"Swim",
"Vulcan",
"Verus"
),
"NCP"
)
Expand Down Expand Up @@ -77,6 +79,19 @@ class Jesus : Module() {
if (mc.thePlayer.hurtTime != 0) mc.thePlayer.onGround = false
}

"verus" -> if (mc.thePlayer.isInWater) {
mc.thePlayer.motionY = 0.0
MovementUtils.strafe(0.32f)
}

"vulcan" -> if (mc.thePlayer.isInWater) {
mc.thePlayer.motionY = 0.015 *
if (!MovementUtils.isMoving()) 0
else if (mc.thePlayer.ticksExisted % 2 == 0) 1
else -1
MovementUtils.strafe(0.145f)
}

"matrixfast" -> if (mc.thePlayer.isInWater) {
mc.thePlayer.motionY = 0.0
MovementUtils.strafe(0.6f)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import net.aspw.client.event.WorldEvent
import net.aspw.client.features.module.Module
import net.aspw.client.features.module.ModuleCategory
import net.aspw.client.features.module.ModuleInfo
import net.aspw.client.utils.Access
import net.aspw.client.utils.APIConnecter
import net.aspw.client.utils.EntityUtils
import net.aspw.client.utils.render.ColorUtils
import net.aspw.client.value.BoolValue
Expand Down Expand Up @@ -41,9 +41,9 @@ class StaffProtection : Module() {
override fun onEnable() {
thread {
totalCount = obStaffs.count { it.isWhitespace() }
blocksmcstaffs.addAll(Access.bmcstafflist.split(","))
mushmcstaffs.addAll(Access.mushstafflist.split(","))
hypixelstaffs.addAll(Access.hypixelstafflist.split(","))
blocksmcstaffs.addAll(APIConnecter.bmcstafflist.split(","))
mushmcstaffs.addAll(APIConnecter.mushstafflist.split(","))
hypixelstaffs.addAll(APIConnecter.hypixelstafflist.split(","))
}
detected = false
staffsInWorld.clear()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import net.aspw.client.features.module.impl.combat.KillAura
import net.aspw.client.features.module.impl.combat.KillAuraRecode
import net.aspw.client.features.module.impl.combat.TPAura
import net.aspw.client.protocol.ProtocolBase
import net.aspw.client.utils.Access
import net.aspw.client.utils.APIConnecter
import net.aspw.client.utils.AnimationUtils
import net.aspw.client.utils.render.ColorUtils
import net.aspw.client.utils.render.RenderUtils
Expand Down Expand Up @@ -88,7 +88,7 @@ class Interface : Module() {
try {
if (watermarkValue.get()) {
val inputString = clientNameValue.get()
val connectChecks = if (!Access.canConnect) " - Disconnected" else ""
val connectChecks = if (!APIConnecter.canConnect) " - Disconnected" else ""
val fpsChecks = if (watermarkFpsValue.get()) " [" + Minecraft.getDebugFPS() + " FPS]" else ""
val protocolChecks =
if (watermarkProtocolValue.get()) " [version: " + (if (!mc.isIntegratedServerRunning) ProtocolBase.getManager().targetVersion.name else "1.8.x") + "]" else ""
Expand Down
91 changes: 91 additions & 0 deletions src/main/java/net/aspw/client/utils/APIConnecter.kt
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
}
}
66 changes: 0 additions & 66 deletions src/main/java/net/aspw/client/utils/Access.kt

This file was deleted.

10 changes: 10 additions & 0 deletions src/main/java/net/aspw/client/utils/URLComponent.kt
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"
}
Loading

0 comments on commit 21e6169

Please sign in to comment.