SkidSolutions
This commit is contained in:
commit
14b3235b41
7727 files changed
+864433
No files matched your search
+19
@@ -0,0 +1,19 @@
|
||||
# Gradle & build outputs
|
||||
/build/
|
||||
/.gradle/
|
||||
/out/
|
||||
|
||||
# Local game run directory
|
||||
/run/
|
||||
|
||||
# IDE project metadata
|
||||
/.idea/
|
||||
/.run/
|
||||
*.iml
|
||||
*.ipr
|
||||
*.iws
|
||||
/.vscode/
|
||||
|
||||
# OS metadata
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
@@ -0,0 +1,22 @@
|
||||
# Novoline 6.99 (Minecraft 1.8.8 + OptiFine HD U H8)
|
||||
|
||||
100% standalone Java source Gradle project (`3,633` `.java` files / `3,655` classes).
|
||||
|
||||
## Requirements
|
||||
- Any JDK 17+ to run Gradle (Java 8 toolchain & all Minecraft/Maven/Native libraries are downloaded automatically on first Gradle sync/run).
|
||||
|
||||
## Usage
|
||||
|
||||
### IntelliJ IDEA
|
||||
1. Open the `novoline-6.99` folder in IntelliJ IDEA (**File -> Open...**).
|
||||
2. Wait for Gradle sync to finish automatically.
|
||||
3. Run the `application -> runClient` Gradle task (or `build -> clientJar` to build `build/libs/novoline-6.99-runtime.jar`).
|
||||
|
||||
### Command Line
|
||||
```powershell
|
||||
# Launch client
|
||||
.\gradlew.bat runClient
|
||||
|
||||
# Build standalone runtime JAR (build/libs/novoline-6.99-runtime.jar)
|
||||
.\gradlew.bat clientJar
|
||||
```
|
||||
+325
@@ -0,0 +1,325 @@
|
||||
import org.gradle.internal.jvm.Jvm
|
||||
|
||||
plugins {
|
||||
id 'java'
|
||||
id 'idea'
|
||||
}
|
||||
|
||||
group = 'cc.novoline'
|
||||
version = '6.99'
|
||||
|
||||
java {
|
||||
toolchain {
|
||||
languageVersion = JavaLanguageVersion.of(8)
|
||||
}
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven {
|
||||
name = 'Mojang'
|
||||
url = 'https://libraries.minecraft.net/'
|
||||
}
|
||||
}
|
||||
|
||||
configurations {
|
||||
asmTools
|
||||
mcLibs
|
||||
mcNatives
|
||||
clientBundle
|
||||
implementation.extendsFrom(mcLibs, clientBundle)
|
||||
}
|
||||
|
||||
def java8Compiler = javaToolchains.compilerFor {
|
||||
languageVersion = JavaLanguageVersion.of(8)
|
||||
}
|
||||
def java8Launcher = javaToolchains.launcherFor {
|
||||
languageVersion = JavaLanguageVersion.of(8)
|
||||
}
|
||||
def gradleHostJavaExe = Jvm.current().javaExecutable.absolutePath
|
||||
|
||||
def customDepsJar = file('libs/novoline-custom-deps.jar')
|
||||
def jfxJar = file('libs/jfxrt-java8.jar')
|
||||
|
||||
// Resolve nashorn.jar automatically from the provisioned Java 8 Toolchain
|
||||
def resolveJava8Nashorn = {
|
||||
def j8Home = java8Launcher.get().metadata.installationPath.asFile
|
||||
def c1 = new File(j8Home, 'jre/lib/ext/nashorn.jar')
|
||||
if (c1.isFile()) return files(c1)
|
||||
def c2 = new File(j8Home, 'lib/ext/nashorn.jar')
|
||||
return c2.isFile() ? files(c2) : files()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly files(layout.buildDirectory.dir('tmp/restored-props'))
|
||||
implementation files(customDepsJar, jfxJar)
|
||||
implementation files({ resolveJava8Nashorn() })
|
||||
|
||||
// Client libraries bundled into standalone runtime JAR (resolved from Maven Central)
|
||||
clientBundle 'it.unimi.dsi:fastutil:8.2.1'
|
||||
clientBundle 'net.sf.trove4j:trove4j:3.0.3'
|
||||
clientBundle 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.20'
|
||||
clientBundle 'org.jetbrains.kotlin:kotlin-reflect:1.6.20'
|
||||
clientBundle 'com.squareup.okhttp3:okhttp:4.11.0'
|
||||
|
||||
// Minecraft 1.8.8 official libraries (resolved automatically from Mojang & Maven Central)
|
||||
mcLibs 'com.mojang:netty:1.8.8'
|
||||
mcLibs 'oshi-project:oshi-core:1.1'
|
||||
mcLibs 'net.java.dev.jna:jna:3.4.0'
|
||||
mcLibs 'net.java.dev.jna:platform:3.4.0'
|
||||
mcLibs 'com.ibm.icu:icu4j-core-mojang:51.2'
|
||||
mcLibs 'net.sf.jopt-simple:jopt-simple:4.6'
|
||||
mcLibs 'com.paulscode:codecjorbis:20101023'
|
||||
mcLibs 'com.paulscode:codecwav:20101023'
|
||||
mcLibs 'com.paulscode:libraryjavasound:20101123'
|
||||
mcLibs 'com.paulscode:librarylwjglopenal:20100824'
|
||||
mcLibs 'com.paulscode:soundsystem:20120107'
|
||||
mcLibs 'io.netty:netty-all:4.0.23.Final'
|
||||
mcLibs 'com.google.guava:guava:17.0'
|
||||
mcLibs 'org.apache.commons:commons-lang3:3.3.2'
|
||||
mcLibs 'commons-io:commons-io:2.4'
|
||||
mcLibs 'commons-codec:commons-codec:1.9'
|
||||
mcLibs 'net.java.jinput:jinput:2.0.5'
|
||||
mcLibs 'net.java.jutils:jutils:1.0.0'
|
||||
mcLibs 'com.google.code.gson:gson:2.2.4'
|
||||
mcLibs 'com.mojang:authlib:1.5.21'
|
||||
mcLibs 'com.mojang:realms:1.7.39'
|
||||
mcLibs 'org.apache.commons:commons-compress:1.8.1'
|
||||
mcLibs 'org.apache.httpcomponents:httpclient:4.3.3'
|
||||
mcLibs 'commons-logging:commons-logging:1.1.3'
|
||||
mcLibs 'org.apache.httpcomponents:httpcore:4.3.2'
|
||||
mcLibs 'org.apache.logging.log4j:log4j-api:2.0-beta9'
|
||||
mcLibs 'org.apache.logging.log4j:log4j-core:2.0-beta9'
|
||||
mcLibs 'org.lwjgl.lwjgl:lwjgl:2.9.4-nightly-20150209'
|
||||
mcLibs 'org.lwjgl.lwjgl:lwjgl_util:2.9.4-nightly-20150209'
|
||||
mcLibs 'tv.twitch:twitch:6.5'
|
||||
|
||||
// Native libraries for LWJGL / OpenAL / JInput / Twitch (auto-extracted on runClient)
|
||||
def osName = System.getProperty('os.name', '').toLowerCase(Locale.ROOT)
|
||||
if (osName.contains('win')) {
|
||||
mcNatives 'org.lwjgl.lwjgl:lwjgl-platform:2.9.4-nightly-20150209:natives-windows'
|
||||
mcNatives 'net.java.jinput:jinput-platform:2.0.5:natives-windows'
|
||||
mcNatives 'tv.twitch:twitch-platform:6.5:natives-windows-64'
|
||||
mcNatives 'tv.twitch:twitch-external-platform:4.5:natives-windows-64'
|
||||
} else if (osName.contains('mac')) {
|
||||
mcNatives 'org.lwjgl.lwjgl:lwjgl-platform:2.9.4-nightly-20150209:natives-osx'
|
||||
mcNatives 'net.java.jinput:jinput-platform:2.0.5:natives-osx'
|
||||
mcNatives 'tv.twitch:twitch-platform:6.5:natives-osx'
|
||||
} else {
|
||||
mcNatives 'org.lwjgl.lwjgl:lwjgl-platform:2.9.4-nightly-20150209:natives-linux'
|
||||
mcNatives 'net.java.jinput:jinput-platform:2.0.5:natives-linux'
|
||||
}
|
||||
|
||||
// Build-time ASM post-processor dependencies
|
||||
asmTools 'org.ow2.asm:asm:9.10.1'
|
||||
asmTools 'org.ow2.asm:asm-tree:9.10.1'
|
||||
asmTools 'org.ow2.asm:asm-analysis:9.10.1'
|
||||
asmTools 'org.ow2.asm:asm-commons:9.10.1'
|
||||
}
|
||||
|
||||
idea {
|
||||
module {
|
||||
downloadJavadoc = false
|
||||
downloadSources = false
|
||||
scopes.COMPILE.plus += [configurations.compileClasspath]
|
||||
}
|
||||
}
|
||||
|
||||
ext {
|
||||
propertyJavaIncludes = [
|
||||
'cc/novoline/modules/configurations/property/AbstractNumberProperty.java',
|
||||
'cc/novoline/modules/configurations/property/object/ColorProperty.java',
|
||||
'cc/novoline/modules/configurations/property/object/DoubleProperty.java',
|
||||
'cc/novoline/modules/configurations/property/object/FloatProperty.java',
|
||||
'cc/novoline/modules/configurations/property/object/IntProperty.java',
|
||||
'cc/novoline/modules/configurations/property/object/ListProperty.java',
|
||||
'cc/novoline/modules/configurations/property/object/LongProperty.java',
|
||||
'cc/novoline/modules/configurations/property/object/StringProperty.java'
|
||||
]
|
||||
emptySourceDir = layout.buildDirectory.dir('tmp/empty-sourcepath').get().asFile
|
||||
}
|
||||
|
||||
def configureJava8Compile = { JavaCompile t, boolean allowImplicitFromSrc ->
|
||||
t.javaCompiler.set(java8Compiler)
|
||||
t.options.encoding = 'UTF-8'
|
||||
t.options.fork = true
|
||||
t.options.forkOptions.memoryMaximumSize = allowImplicitFromSrc ? '512m' : '1536m'
|
||||
if (allowImplicitFromSrc) {
|
||||
t.options.sourcepath = files('src/main/java')
|
||||
t.options.compilerArgs.addAll(['-XDignore.symbol.file', '-Xlint:-options', '-proc:none'])
|
||||
} else {
|
||||
t.doFirst { emptySourceDir.mkdirs() }
|
||||
t.options.sourcepath = files(emptySourceDir)
|
||||
t.options.compilerArgs.addAll(['-XDignore.symbol.file', '-Xlint:-options', '-proc:none', '-implicit:none'])
|
||||
}
|
||||
}
|
||||
|
||||
def propRawOutDir = layout.buildDirectory.dir('tmp/javac-props')
|
||||
def propRestoredDir = layout.buildDirectory.dir('tmp/restored-props')
|
||||
|
||||
tasks.register('compilePropertiesJava', JavaCompile) {
|
||||
description = 'Phase 1: Compiles the 8 Novoline @Property hierarchy classes from pure Java source.'
|
||||
source = fileTree('src/main/java') {
|
||||
include propertyJavaIncludes
|
||||
}
|
||||
classpath = files(customDepsJar, jfxJar, { resolveJava8Nashorn() }, configurations.clientBundle, configurations.mcLibs)
|
||||
destinationDirectory.set(propRawOutDir)
|
||||
configureJava8Compile(it, true)
|
||||
}
|
||||
|
||||
tasks.register('restorePropertySignatures', Exec) {
|
||||
description = 'Phase 2: Restores original JVM generic bridge methods on the 8 @Property classes.'
|
||||
dependsOn 'compilePropertiesJava', configurations.asmTools
|
||||
doFirst {
|
||||
propRestoredDir.get().asFile.mkdirs()
|
||||
commandLine(
|
||||
gradleHostJavaExe,
|
||||
'-Xmx512m',
|
||||
'-cp', configurations.asmTools.asPath,
|
||||
file('tools/PropertySignatures.java').absolutePath,
|
||||
'restore',
|
||||
file('tools/property-bridges.tsv').absolutePath,
|
||||
propRawOutDir.get().asFile.absolutePath,
|
||||
propRestoredDir.get().asFile.absolutePath
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
tasks.named('compileJava', JavaCompile) {
|
||||
dependsOn 'restorePropertySignatures'
|
||||
exclude propertyJavaIncludes
|
||||
configureJava8Compile(it, false)
|
||||
finalizedBy 'restoreClientBytecode'
|
||||
}
|
||||
|
||||
tasks.register('restoreBooleanArguments', Exec) {
|
||||
description = 'Phase 3a: Merges restored @Property classes and restores non-canonical int->boolean arguments.'
|
||||
dependsOn configurations.asmTools
|
||||
def outClassesDir = sourceSets.main.java.destinationDirectory.get().asFile
|
||||
def boolReport = layout.buildDirectory.file('reports/boolean-arguments.tsv').get().asFile
|
||||
doFirst {
|
||||
copy {
|
||||
from propRestoredDir
|
||||
into outClassesDir
|
||||
}
|
||||
boolReport.parentFile.mkdirs()
|
||||
commandLine(
|
||||
gradleHostJavaExe,
|
||||
'-Xmx512m',
|
||||
'-cp', configurations.asmTools.asPath,
|
||||
file('tools/BooleanArgumentBytecode.java').absolutePath,
|
||||
outClassesDir.absolutePath,
|
||||
boolReport.absolutePath
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
tasks.register('restoreClientBytecode', Exec) {
|
||||
description = 'Phase 3b: Restores ZKM bridges, class versions/flags, and strips spurious narrowing casts.'
|
||||
dependsOn 'restoreBooleanArguments', configurations.asmTools
|
||||
def outClassesDir = sourceSets.main.java.destinationDirectory.get().asFile
|
||||
doFirst {
|
||||
commandLine(
|
||||
gradleHostJavaExe,
|
||||
'-Xmx512m',
|
||||
'-cp', configurations.asmTools.asPath,
|
||||
file('tools/Stage4BytecodeRestore.java').absolutePath,
|
||||
file('tools/bridge-delegates.tsv').absolutePath,
|
||||
file('tools/bytecode-metadata.tsv').absolutePath,
|
||||
outClassesDir.absolutePath
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
tasks.named('classes') {
|
||||
dependsOn 'restoreClientBytecode'
|
||||
}
|
||||
|
||||
tasks.named('jar') {
|
||||
dependsOn 'restoreClientBytecode'
|
||||
}
|
||||
|
||||
tasks.register('clientJar', Exec) {
|
||||
group = 'build'
|
||||
description = 'Builds 100% standalone novoline-6.99-runtime.jar from compiled sources + resources + third-party libs.'
|
||||
dependsOn 'classes', configurations.clientBundle
|
||||
def outClassesDir = sourceSets.main.java.destinationDirectory.get().asFile
|
||||
def resourcesDir = file('src/main/resources')
|
||||
def runtimeOut = layout.buildDirectory.file('libs/novoline-6.99-runtime.jar').get().asFile
|
||||
doFirst {
|
||||
def bundlePath = files(customDepsJar, configurations.clientBundle).asPath
|
||||
commandLine(
|
||||
gradleHostJavaExe,
|
||||
'-Xmx512m',
|
||||
file('tools/BuildStandaloneClientJar.java').absolutePath,
|
||||
outClassesDir.absolutePath,
|
||||
resourcesDir.absolutePath,
|
||||
bundlePath,
|
||||
runtimeOut.absolutePath
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
tasks.named('assemble') {
|
||||
dependsOn 'clientJar'
|
||||
}
|
||||
|
||||
def extractedNativesDir = layout.buildDirectory.dir('natives')
|
||||
|
||||
tasks.register('extractNatives', Sync) {
|
||||
description = 'Extracts platform LWJGL/OpenAL/JInput/Twitch native libraries from Mojang Maven.'
|
||||
dependsOn configurations.mcNatives
|
||||
from {
|
||||
configurations.mcNatives.collect { zipTree(it) }
|
||||
}
|
||||
exclude 'META-INF/**'
|
||||
into extractedNativesDir
|
||||
}
|
||||
|
||||
def resolveDefaultMcAssetsDir = {
|
||||
def custom = findProperty('mcAssetsDir')
|
||||
if (custom != null) return file(custom)
|
||||
def osName = System.getProperty('os.name', '').toLowerCase(Locale.ROOT)
|
||||
def home = System.getProperty('user.home', '.')
|
||||
File cand
|
||||
if (osName.contains('win')) {
|
||||
def appData = System.getenv('APPDATA') ?: new File(home, 'AppData/Roaming').absolutePath
|
||||
cand = new File(appData, '.minecraft/assets')
|
||||
} else if (osName.contains('mac')) {
|
||||
cand = new File(home, 'Library/Application Support/minecraft/assets')
|
||||
} else {
|
||||
cand = new File(home, '.minecraft/assets')
|
||||
}
|
||||
return cand.isDirectory() ? cand : file('run/assets')
|
||||
}
|
||||
|
||||
tasks.register('runClient', JavaExec) {
|
||||
group = 'application'
|
||||
description = 'Builds novoline-6.99-runtime.jar from 100% full Java source and launches Novoline 6.99 under Java 8.'
|
||||
dependsOn 'clientJar', 'extractNatives', configurations.mcLibs
|
||||
javaLauncher.set(java8Launcher)
|
||||
def runtimeOut = layout.buildDirectory.file('libs/novoline-6.99-runtime.jar').get().asFile
|
||||
def runDir = file('run')
|
||||
workingDir = runDir
|
||||
maxHeapSize = '2G'
|
||||
mainClass = 'net.minecraft.client.main.Main'
|
||||
classpath = files(runtimeOut, jfxJar, { resolveJava8Nashorn() }, configurations.mcLibs)
|
||||
doFirst {
|
||||
runDir.mkdirs()
|
||||
def assetsDir = resolveDefaultMcAssetsDir()
|
||||
assetsDir.mkdirs()
|
||||
new File(runDir, 'Novoline/configs').mkdirs()
|
||||
new File(runDir, 'Novoline/scripts').mkdirs()
|
||||
jvmArgs("-Djava.library.path=${extractedNativesDir.get().asFile.absolutePath}")
|
||||
args(
|
||||
'--version', 'Novoline-6.99',
|
||||
'--accessToken', '0',
|
||||
'--assetsDir', assetsDir.absolutePath,
|
||||
'--assetIndex', '1.8',
|
||||
'--userProperties', '{}',
|
||||
'--gameDir', runDir.absolutePath
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
org.gradle.jvmargs=-Xmx2G -Dfile.encoding=UTF-8
|
||||
org.gradle.parallel=true
|
||||
Vendored
BIN
Binary file not shown.
+7
@@ -0,0 +1,7 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.6.0-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
@@ -0,0 +1,249 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Gradle start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||
# noncompliant, but you have some other compliant shell such as ksh or
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh Gradle
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||
#
|
||||
# The "traditional" practice of packing multiple parameters into a
|
||||
# space-separated string is a well documented source of bugs and security
|
||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||
# options in "$@", and eventually passing that to Java.
|
||||
#
|
||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||
# see the in-line comments for details.
|
||||
#
|
||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
|
||||
# Resolve links: $0 may be a link
|
||||
app_path=$0
|
||||
|
||||
# Need this for daisy-chained symlinks.
|
||||
while
|
||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||
[ -h "$app_path" ]
|
||||
do
|
||||
ls=$( ls -ld "$app_path" )
|
||||
link=${ls#*' -> '}
|
||||
case $link in #(
|
||||
/*) app_path=$link ;; #(
|
||||
*) app_path=$APP_HOME$link ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
} >&2
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
} >&2
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "$( uname )" in #(
|
||||
CYGWIN* ) cygwin=true ;; #(
|
||||
Darwin* ) darwin=true ;; #(
|
||||
MSYS* | MINGW* ) msys=true ;; #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||
else
|
||||
JAVACMD=$JAVA_HOME/bin/java
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
if ! command -v java >/dev/null 2>&1
|
||||
then
|
||||
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
for arg do
|
||||
if
|
||||
case $arg in #(
|
||||
-*) false ;; # don't mess with options #(
|
||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||
[ -e "$t" ] ;; #(
|
||||
*) false ;;
|
||||
esac
|
||||
then
|
||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||
fi
|
||||
# Roll the args list around exactly as many times as the number of
|
||||
# args, so each arg winds up back in the position where it started, but
|
||||
# possibly modified.
|
||||
#
|
||||
# NB: a `for` loop captures its iteration list before it begins, so
|
||||
# changing the positional parameters here affects neither the number of
|
||||
# iterations, nor the values presented in `arg`.
|
||||
shift # remove old arg
|
||||
set -- "$@" "$arg" # push replacement arg
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
if ! command -v xargs >/dev/null 2>&1
|
||||
then
|
||||
die "xargs is not available"
|
||||
fi
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
#
|
||||
# In Bash we could simply go:
|
||||
#
|
||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||
# set -- "${ARGS[@]}" "$@"
|
||||
#
|
||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||
# character that might be a shell metacharacter, then use eval to reverse
|
||||
# that process (while maintaining the separation between arguments), and wrap
|
||||
# the whole thing up as a single "set" statement.
|
||||
#
|
||||
# This will of course break if any of these variables contains a newline or
|
||||
# an unmatched quote.
|
||||
#
|
||||
|
||||
eval "set -- $(
|
||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||
xargs -n1 |
|
||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||
tr '\n' ' '
|
||||
)" '"$@"'
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
Vendored
+92
@@ -0,0 +1,92 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@rem This is normally unused
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,5 @@
|
||||
plugins {
|
||||
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.9.0'
|
||||
}
|
||||
|
||||
rootProject.name = 'novoline-6.99'
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,12 @@
|
||||
package cc.novoline;
|
||||
|
||||
public enum InitializerHolder {
|
||||
INSTANCE;
|
||||
|
||||
private static final InitializerHolder[] initializerHolderArray = new InitializerHolder[]{InitializerHolder.INSTANCE};
|
||||
private final Initializer initializerField = new Initializer();
|
||||
|
||||
public static Initializer resolveInitializer(InitializerHolder initializerHolder) {
|
||||
return initializerHolder.initializerField;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,375 @@
|
||||
package cc.novoline;
|
||||
|
||||
import cc.novoline.commands.NovoCommandHandler;
|
||||
import cc.novoline.gui.screen.ClickGUI;
|
||||
import cc.novoline.gui.screen.alt.repository.AltRepositoryGUI;
|
||||
import cc.novoline.gui.screen.click.DiscordGUI;
|
||||
import cc.novoline.gui.screen.login.GuiLogin;
|
||||
import cc.novoline.irc.NovolineWebSocket;
|
||||
import cc.novoline.modules.PlayerManager;
|
||||
import cc.novoline.script.ScriptManager;
|
||||
import cc.novoline.utils.ServerCommandTracker;
|
||||
import cc.novoline.utils.fonts.impl.SimpleFontManager;
|
||||
import cc.novoline.utils.notifications.NotificationManager;
|
||||
import cc.novoline.utils.tasks.TaskManager;
|
||||
|
||||
import cc.novoline.modules.configurations.ConfigManager;
|
||||
import com.thealtening.api.response.Account;
|
||||
import com.thealtening.api.retriever.AsynchronousDataRetriever;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import cc.novoline.modules.ModuleManager;
|
||||
import cc.novoline.utils.fonts.api.FontManager;
|
||||
import ninja.leaping.configurate.objectmapping.ObjectMappingException;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.multiplayer.ServerData;
|
||||
import net.skidunion.security.ProtectionSession;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public final class Novoline {
|
||||
private TaskManager taskManagerField;
|
||||
private Initializer initializerField;
|
||||
private final boolean stateFlag;
|
||||
private static Novoline instance;
|
||||
private ProtectionSession protectionSessionField;
|
||||
private ServerData lastConnectedServer;
|
||||
private GuiLogin guiLoginField;
|
||||
private NovolineWebSocket novolineWebSocketField;
|
||||
private ModuleManager moduleManager;
|
||||
private ScriptManager scriptManagerField;
|
||||
private boolean stateFlag2;
|
||||
private NovoCommandHandler novoCommandHandlerField;
|
||||
private boolean stateFlag3;
|
||||
private final Minecraft mc;
|
||||
private ClickGUI clickGUIField;
|
||||
private DiscordGUI discordGUIField;
|
||||
private final String cachedText = "6.99";
|
||||
private NotificationManager notificationManagerField;
|
||||
private AltRepositoryGUI altRepositoryGUIField;
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
private static int[] p;
|
||||
private final Path configPath;
|
||||
private FontManager fontManagerField;
|
||||
private String cachedText2;
|
||||
private PlayerManager playerManagerField;
|
||||
private ServerCommandTracker serverCommandTrackerField;
|
||||
private final AsynchronousDataRetriever dataRetriever;
|
||||
|
||||
public FontManager getFontManagerField() {
|
||||
return this.fontManagerField;
|
||||
}
|
||||
|
||||
public void applyUpdate(ProtectionSession protectionSession) {
|
||||
this.protectionSessionField = protectionSession;
|
||||
}
|
||||
|
||||
public static void b(int[] intArray) {
|
||||
p = intArray;
|
||||
}
|
||||
|
||||
public ServerData getLastConnectedServer() {
|
||||
return this.lastConnectedServer;
|
||||
}
|
||||
|
||||
public boolean isReadyState() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public CompletableFuture<Account> getCompletableFuture() {
|
||||
return this.dataRetriever.getAccountDataAsync();
|
||||
}
|
||||
|
||||
public void applyUpdate(NovoCommandHandler novoCommandHandler) {
|
||||
this.novoCommandHandlerField = novoCommandHandler;
|
||||
}
|
||||
|
||||
public ClickGUI getClickGUIField() {
|
||||
return this.clickGUIField;
|
||||
}
|
||||
|
||||
public NotificationManager getNotificationManagerField() {
|
||||
return this.notificationManagerField;
|
||||
}
|
||||
|
||||
public void applyUpdate(boolean flag) {
|
||||
this.stateFlag3 = flag;
|
||||
}
|
||||
|
||||
public static int[] C() {
|
||||
return p;
|
||||
}
|
||||
|
||||
public void applyUpdate(ClickGUI clickGUI) {
|
||||
this.clickGUIField = clickGUI;
|
||||
}
|
||||
|
||||
public void performAction() {
|
||||
try {
|
||||
ModuleManager modManager = this.getModuleManager();
|
||||
ConfigManager cfgManager = modManager.getConfigManager();
|
||||
cfgManager.b("default");
|
||||
} catch (IOException ex) {
|
||||
Logger log = getLogger();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb = sb.append("An I/O error occurred while ");
|
||||
String msgText = ex.getMessage();
|
||||
sb = sb.append(msgText);
|
||||
String textStr = sb.append("!").toString();
|
||||
log.warn(textStr, ex);
|
||||
} catch (ObjectMappingException ex2) {
|
||||
Logger log2 = getLogger();
|
||||
log2.warn("An I/O error occurred while serializing config!", ex2);
|
||||
}
|
||||
}
|
||||
|
||||
public String getCachedText2() {
|
||||
return this.cachedText2;
|
||||
}
|
||||
|
||||
public Novoline() {
|
||||
this.stateFlag = false;
|
||||
this.stateFlag3 = false;
|
||||
this.mc = Minecraft.getMinecraft();
|
||||
this.initializerField = Initializer.d();
|
||||
this.novoCommandHandlerField = new NovoCommandHandler(this);
|
||||
this.dataRetriever = new AsynchronousDataRetriever(null);
|
||||
this.fontManagerField = SimpleFontManager.getFontManager();
|
||||
File fileObj = this.mc.ag;
|
||||
this.configPath = Paths.get(fileObj.getAbsolutePath()).resolve("Novoline");
|
||||
if (instance != null) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb = sb.append("Cannot instantiate ");
|
||||
Class clazz = this.getClass();
|
||||
String textStr = clazz.getCanonicalName();
|
||||
sb = sb.append(textStr);
|
||||
throw new IllegalStateException(sb.append(" twice").toString());
|
||||
}
|
||||
}
|
||||
|
||||
public AsynchronousDataRetriever getDataRetriever() {
|
||||
return this.dataRetriever;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void applyUpdate(GuiLogin guiLogin) {
|
||||
this.guiLoginField = guiLogin;
|
||||
}
|
||||
|
||||
public boolean isStateFlag3() {
|
||||
return this.stateFlag3;
|
||||
}
|
||||
|
||||
public ServerCommandTracker getServerCommandTrackerField() {
|
||||
return this.serverCommandTrackerField;
|
||||
}
|
||||
|
||||
public String getTextValue() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
String pathStr = this.mc.ag.getAbsolutePath();
|
||||
sb = sb.append(pathStr);
|
||||
return sb.append("\\Novoline\\").toString();
|
||||
}
|
||||
|
||||
public void applyUpdate(NotificationManager notificationManager) {
|
||||
this.notificationManagerField = notificationManager;
|
||||
}
|
||||
|
||||
public void performAction2() {}
|
||||
|
||||
public void applyUpdate(NovolineWebSocket novolineWebSocket) {
|
||||
this.novolineWebSocketField = novolineWebSocket;
|
||||
}
|
||||
|
||||
public TaskManager getTaskManagerField() {
|
||||
return this.taskManagerField;
|
||||
}
|
||||
|
||||
public Initializer getInitializerField() {
|
||||
return this.initializerField;
|
||||
}
|
||||
|
||||
public void applyUpdate(String text) {
|
||||
this.cachedText2 = text;
|
||||
}
|
||||
|
||||
public void applyUpdate(ScriptManager scriptManager) {
|
||||
this.scriptManagerField = scriptManager;
|
||||
}
|
||||
|
||||
public NovolineWebSocket getNovolineWebSocketField() {
|
||||
return this.novolineWebSocketField;
|
||||
}
|
||||
|
||||
public ScriptManager getScriptManagerField() {
|
||||
return this.scriptManagerField;
|
||||
}
|
||||
|
||||
public Path getConfigPath2() {
|
||||
return this.configPath;
|
||||
}
|
||||
|
||||
public DiscordGUI getDiscordGUIField() {
|
||||
return this.discordGUIField;
|
||||
}
|
||||
|
||||
public void applyUpdate(ModuleManager manager) {
|
||||
this.moduleManager = manager;
|
||||
}
|
||||
|
||||
public static Novoline getInstance() {
|
||||
try {
|
||||
if (instance == null) {
|
||||
instance = new Novoline();
|
||||
}
|
||||
|
||||
return instance;
|
||||
} catch (Throwable ex) {
|
||||
LOGGER.warn(ex);
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
public void applyUpdate(PlayerManager playerManager) {
|
||||
this.playerManagerField = playerManager;
|
||||
}
|
||||
|
||||
public Minecraft getMinecraft() {
|
||||
return this.mc;
|
||||
}
|
||||
|
||||
public void applyUpdate(AltRepositoryGUI altRepositoryGUI) {
|
||||
this.altRepositoryGUIField = altRepositoryGUI;
|
||||
}
|
||||
|
||||
public String getString() {
|
||||
return "6.99";
|
||||
}
|
||||
|
||||
public PlayerManager getPlayerManagerField() {
|
||||
return this.playerManagerField;
|
||||
}
|
||||
|
||||
public void applyUpdate(TaskManager taskManager) {
|
||||
this.taskManagerField = taskManager;
|
||||
}
|
||||
|
||||
public void applyUpdate(DiscordGUI discordGUI) {
|
||||
this.discordGUIField = discordGUI;
|
||||
}
|
||||
|
||||
public GuiLogin getGuiLoginField() {
|
||||
return this.guiLoginField;
|
||||
}
|
||||
|
||||
public void applyUpdate(ServerCommandTracker serverCommandTracker) {
|
||||
this.serverCommandTrackerField = serverCommandTracker;
|
||||
}
|
||||
|
||||
public NovoCommandHandler getNovoCommandHandlerField() {
|
||||
return this.novoCommandHandlerField;
|
||||
}
|
||||
|
||||
public static Logger getLogger() {
|
||||
return LOGGER;
|
||||
}
|
||||
|
||||
static {
|
||||
b(null);
|
||||
}
|
||||
|
||||
public void setLastConnectedServer(@NotNull ServerData serverData) {
|
||||
this.lastConnectedServer = serverData;
|
||||
}
|
||||
|
||||
public ModuleManager getModuleManager() {
|
||||
return this.moduleManager;
|
||||
}
|
||||
|
||||
public void setStateFlag2(boolean flag) {
|
||||
this.stateFlag2 = flag;
|
||||
}
|
||||
|
||||
public boolean isReadyState2() {
|
||||
Novoline novolineInst = this;
|
||||
|
||||
if (this.moduleManager == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
novolineInst = this;
|
||||
|
||||
|
||||
|
||||
if (novolineInst.playerManagerField == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
novolineInst = this;
|
||||
|
||||
|
||||
return novolineInst.notificationManagerField == null;
|
||||
}
|
||||
|
||||
public AltRepositoryGUI getAltRepositoryGUIField() {
|
||||
return this.altRepositoryGUIField;
|
||||
}
|
||||
|
||||
public void performAction3() {}
|
||||
|
||||
public boolean isStateFlag2() {
|
||||
return this.stateFlag2;
|
||||
}
|
||||
|
||||
public ProtectionSession getProtectionSession2() {
|
||||
return this.protectionSessionField;
|
||||
}
|
||||
|
||||
public NotificationManager getNotificationManager() {
|
||||
return this.getNotificationManagerField();
|
||||
}
|
||||
public PlayerManager getPlayerManager() {
|
||||
return this.getPlayerManagerField();
|
||||
}
|
||||
public TaskManager getTaskManager() {
|
||||
return this.getTaskManagerField();
|
||||
}
|
||||
public Path getDataFolder() {
|
||||
return this.getConfigPath2();
|
||||
}
|
||||
public DiscordGUI getDiscordGUI() {
|
||||
return this.getDiscordGUIField();
|
||||
}
|
||||
public ClickGUI getClickGUI() {
|
||||
return this.getClickGUIField();
|
||||
}
|
||||
public ScriptManager getScriptManager() {
|
||||
return this.getScriptManagerField();
|
||||
}
|
||||
public AltRepositoryGUI getAltRepositoryGUI() {
|
||||
return this.getAltRepositoryGUIField();
|
||||
}
|
||||
public FontManager getFontManager() {
|
||||
return this.getFontManagerField();
|
||||
}
|
||||
public String getVersion() {
|
||||
return this.getString();
|
||||
}
|
||||
|
||||
public NovoCommandHandler getCommandHandler() { return this.getNovoCommandHandlerField(); }
|
||||
public String getDataFolderString() { return this.getTextValue(); }
|
||||
public NovolineWebSocket getWebSocket() { return this.getNovolineWebSocketField(); }
|
||||
public ProtectionSession getProtectionSession() { return this.getProtectionSession2(); }
|
||||
public ServerCommandTracker getServerCommandTracker() { return this.getServerCommandTrackerField(); }
|
||||
public GuiLogin getGuiLogin() { return this.getGuiLoginField(); }
|
||||
public Initializer getInitializer() { return this.getInitializerField(); }
|
||||
public boolean isUninitialized() { return this.isReadyState2(); }
|
||||
public void saveDefaultConfig() { this.performAction(); }
|
||||
|
||||
public java.nio.file.Path getConfigPath() { return this.getConfigPath2(); }
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
package cc.novoline.auth;
|
||||
|
||||
import cc.novoline.auth.minecraft.MicrosoftOAuthCodeExchanger;
|
||||
import cc.novoline.auth.minecraft.auth.Account;
|
||||
import cc.novoline.auth.minecraft.user.MicrosoftOAuthExchangeCode;
|
||||
import cc.novoline.auth.minecraft.user.MinecraftAuthenticationException;
|
||||
import cc.novoline.auth.minecraft.user.MinecraftOAuthAuthenticate;
|
||||
import cc.novoline.auth.minecraft.user.MinecraftProfileConverter;
|
||||
import cc.novoline.auth.minecraft.user.MinecraftUser;
|
||||
import cc.novoline.auth.minecraft.user.RedirectUrl;
|
||||
import cc.novoline.auth.minecraft.user.gos.GameOwnershipValidator;
|
||||
import cc.novoline.auth.minecraft.user.mcsauth.MinecraftServicesAuthenticator;
|
||||
import cc.novoline.auth.minecraft.user.oauth.exchange.MicrosoftOAuthCodeExchangerImpl;
|
||||
import cc.novoline.auth.minecraft.user.oauth.exchange.MicrosoftOAuthRefreshCodeExchangerIMpl;
|
||||
import cc.novoline.auth.minecraft.user.preq.MinecraftProfileRequester;
|
||||
import cc.novoline.auth.minecraft.user.xb.auth.XboxLiveAuthenticator;
|
||||
import cc.novoline.auth.minecraft.user.xb.xsts.XSTSAuthenticator;
|
||||
import java.io.IOException;
|
||||
import java.net.URLDecoder;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import net.freeutils.httpserver.HTTPServer;
|
||||
import net.freeutils.httpserver.HTTPServer.VirtualHost;
|
||||
|
||||
public class Boot {
|
||||
private static final HTTPServer server = new HTTPServer(28562);
|
||||
private static final VirtualHost host = server.getVirtualHost(null);
|
||||
public static OAuthApplication microsoftAuth = OAuthApplication.NOVOLINE_APP_PARAMETERS;
|
||||
|
||||
public static void close() {
|
||||
server.stop();
|
||||
}
|
||||
|
||||
public static MinecraftUser startServer() throws IOException {
|
||||
AtomicReference atomicReference = null;
|
||||
host.addContext(
|
||||
"/",
|
||||
(arg, arg2) -> {
|
||||
if (arg.getParams().containsKey("error")) {
|
||||
arg2.getHeaders().add("Content-Type", "text/plain");
|
||||
arg2.send(500, URLDecoder.decode(arg.getParams().get("error_description")));
|
||||
close();
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!arg.getParams().containsKey("code")) {
|
||||
arg2.getHeaders().add("Content-Type", "text/plain");
|
||||
arg2.send(400, "Code is missing");
|
||||
close();
|
||||
return 0;
|
||||
}
|
||||
|
||||
try {
|
||||
Account account = new Account();
|
||||
account.setPassword(arg.getParams().get("code"));
|
||||
account.setUsername("********");
|
||||
if (Objects.isNull(account.getAccessToken())) {
|
||||
MicrosoftOAuthCodeExchanger val = new MicrosoftOAuthCodeExchangerImpl(
|
||||
"1f2e7916-9ecf-4495-a87b-f9f54ae7b707", "https://login.live.com/oauth20_token.srf"
|
||||
);
|
||||
MicrosoftOAuthExchangeCode microsoftOAuthExchangeCode = new MicrosoftOAuthExchangeCode(arg.getParams().get("code"), new RedirectUrl("http://localhost:28562"));
|
||||
atomicReference.set(doRequest(val, microsoftOAuthExchangeCode));
|
||||
} else if (account.getMicrosoftOAuthToken().isExpired()) {
|
||||
MicrosoftOAuthCodeExchanger val2 = new MicrosoftOAuthRefreshCodeExchangerIMpl(
|
||||
"1f2e7916-9ecf-4495-a87b-f9f54ae7b707", "https://login.live.com/oauth20_token.srf"
|
||||
);
|
||||
MicrosoftOAuthExchangeCode microsoftOAuthExchangeCode2 = new MicrosoftOAuthExchangeCode(
|
||||
account.getMicrosoftOAuthToken().getRefreshToken(), new RedirectUrl("http://localhost:28562")
|
||||
);
|
||||
atomicReference.set(doRequest(val2, microsoftOAuthExchangeCode2));
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
arg2.getHeaders().add("Content-Type", "text/html");
|
||||
arg2.send(500, "" + ex);
|
||||
close();
|
||||
return 0;
|
||||
}
|
||||
|
||||
arg2.getHeaders().add("Content-Type", "text/plain");
|
||||
arg2.send(200, "Received ms code: " + arg.getParams().get("code") + ". Go back to Alt Repository");
|
||||
close();
|
||||
return 0;
|
||||
},
|
||||
"GET"
|
||||
);
|
||||
server.start();
|
||||
return (cc.novoline.auth.minecraft.user.MinecraftUser) atomicReference.get();
|
||||
}
|
||||
|
||||
public static MinecraftUser doRequest(MicrosoftOAuthCodeExchanger microsoftOAuthCodeExchanger, MicrosoftOAuthExchangeCode microsoftOAuthExchangeCode) throws IOException, MinecraftAuthenticationException {
|
||||
XboxLiveAuthenticator xboxLiveAuthenticator = new XboxLiveAuthenticator(microsoftAuth);
|
||||
MinecraftOAuthAuthenticate minecraftOAuthAuthenticate = new MinecraftOAuthAuthenticate(
|
||||
microsoftOAuthCodeExchanger,
|
||||
xboxLiveAuthenticator,
|
||||
new XSTSAuthenticator(),
|
||||
new MinecraftServicesAuthenticator(),
|
||||
new GameOwnershipValidator(),
|
||||
new MinecraftProfileRequester(),
|
||||
new MinecraftProfileConverter()
|
||||
);
|
||||
return minecraftOAuthAuthenticate.authenticate(microsoftOAuthExchangeCode);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package cc.novoline.auth;
|
||||
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.io.IOException;
|
||||
import java.net.CookieHandler;
|
||||
import java.net.URI;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import javafx.application.Platform;
|
||||
import javafx.embed.swing.JFXPanel;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.scene.web.WebView;
|
||||
import javax.swing.JFrame;
|
||||
|
||||
public class LoginFrame extends JFrame {
|
||||
private CompletableFuture<String> future;
|
||||
|
||||
public LoginFrame() {
|
||||
this.setTitle("Novoline Authorization");
|
||||
this.setSize(750, 750);
|
||||
this.setLocationRelativeTo(null);
|
||||
this.setContentPane(new JFXPanel());
|
||||
}
|
||||
|
||||
public CompletableFuture<String> start(String text, String str) {
|
||||
if (this.future != null) {
|
||||
return this.future;
|
||||
}
|
||||
|
||||
this.future = new CompletableFuture<>();
|
||||
this.addWindowListener(new WindowAdapter() {
|
||||
@Override
|
||||
public void windowClosing(WindowEvent text) {
|
||||
}
|
||||
});
|
||||
Platform.runLater(() -> {
|
||||
try {
|
||||
this.init(text, str);
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
});
|
||||
return this.future;
|
||||
}
|
||||
|
||||
public void init(String text, String str) throws IOException {
|
||||
WebView webView = new WebView();
|
||||
JFXPanel jFXPanel = (JFXPanel)this.getContentPane();
|
||||
jFXPanel.setScene(new Scene(webView, this.getWidth(), this.getHeight()));
|
||||
webView.getEngine().locationProperty().addListener(this::invokeCallback);
|
||||
webView.getEngine().setUserAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36");
|
||||
if (text.contains("live.com")) {
|
||||
Map itemMap = new LinkedHashMap<>();
|
||||
itemMap.put("Set-Cookie", parseCookie(text));
|
||||
CookieHandler.getDefault().put(URI.create(str), itemMap);
|
||||
}
|
||||
|
||||
webView.getEngine().load(str);
|
||||
this.setVisible(true);
|
||||
}
|
||||
|
||||
public static List<String> parseCookie(String text) {
|
||||
List itemList = new ArrayList<>();
|
||||
|
||||
for (String textStr : text.split("\n")) {
|
||||
String[] stringArr = textStr.split("/\tFALSE\t")[1].split("\t");
|
||||
String textStr2 = stringArr[1];
|
||||
String textStr3 = stringArr[2];
|
||||
itemList.add(textStr2 + "=" + textStr3);
|
||||
}
|
||||
|
||||
return itemList;
|
||||
}
|
||||
|
||||
private void invokeCallback(ObservableValue<? extends String> observableValue, String text, String str) {
|
||||
if (str.contains("access_token")) {
|
||||
this.setVisible(false);
|
||||
this.future.complete(str);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,167 @@
|
||||
package cc.novoline.auth;
|
||||
|
||||
public class OAuthApplication {
|
||||
public static OAuthApplication NOVOLINE_APP_PARAMETERS = new OAuthApplication(
|
||||
"1f2e7916-9ecf-4495-a87b-f9f54ae7b707",
|
||||
"Xboxlive.signin offline_access",
|
||||
"https://login.live.com/oauth20_authorize.srf",
|
||||
"https://login.live.com/oauth20_token.srf",
|
||||
"http://localhost:28562",
|
||||
"https://login.microsoftonline.com/common/oauth2/nativeclient?error=access_denied"
|
||||
);
|
||||
private final String clientId;
|
||||
private final String scope;
|
||||
private final boolean useWeirdXboxTokenPrefix = true;
|
||||
private String basicURL;
|
||||
private String tokenURL;
|
||||
private String redirectURL;
|
||||
private String backButtonURL;
|
||||
|
||||
public String getClientId() {
|
||||
return this.clientId;
|
||||
}
|
||||
|
||||
public String getScope() {
|
||||
return this.scope;
|
||||
}
|
||||
|
||||
public boolean isUseWeirdXboxTokenPrefix() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public String getBasicURL() {
|
||||
return this.basicURL;
|
||||
}
|
||||
|
||||
public String getTokenURL() {
|
||||
return this.tokenURL;
|
||||
}
|
||||
|
||||
public String getRedirectURL() {
|
||||
return this.redirectURL;
|
||||
}
|
||||
|
||||
public String getBackButtonURL() {
|
||||
return this.backButtonURL;
|
||||
}
|
||||
|
||||
public void setBasicURL(String text) {
|
||||
this.basicURL = text;
|
||||
}
|
||||
|
||||
public void setTokenURL(String text) {
|
||||
this.tokenURL = text;
|
||||
}
|
||||
|
||||
public void setRedirectURL(String text) {
|
||||
this.redirectURL = text;
|
||||
}
|
||||
|
||||
public void setBackButtonURL(String text) {
|
||||
this.backButtonURL = text;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == this) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!(obj instanceof OAuthApplication)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
OAuthApplication oAuthApplication = (OAuthApplication)obj;
|
||||
if (!oAuthApplication.canEqual(this)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
String textStr = this.getClientId();
|
||||
String textStr2 = oAuthApplication.getClientId();
|
||||
if (textStr == null ? textStr2 == null : textStr.equals(textStr2)) {
|
||||
String textStr3 = this.getScope();
|
||||
String textStr4 = oAuthApplication.getScope();
|
||||
if (textStr3 == null ? textStr4 == null : textStr3.equals(textStr4)) {
|
||||
if (this.isUseWeirdXboxTokenPrefix() != oAuthApplication.isUseWeirdXboxTokenPrefix()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
String textStr5 = this.getBasicURL();
|
||||
String textStr6 = oAuthApplication.getBasicURL();
|
||||
if (textStr5 == null ? textStr6 == null : textStr5.equals(textStr6)) {
|
||||
String textStr7 = this.getTokenURL();
|
||||
String textStr8 = oAuthApplication.getTokenURL();
|
||||
if (textStr7 == null ? textStr8 == null : textStr7.equals(textStr8)) {
|
||||
String textStr9 = this.getRedirectURL();
|
||||
String textStr10 = oAuthApplication.getRedirectURL();
|
||||
if (textStr9 == null ? textStr10 == null : textStr9.equals(textStr10)) {
|
||||
String textStr11 = this.getBackButtonURL();
|
||||
String textStr12 = oAuthApplication.getBackButtonURL();
|
||||
return textStr11 == null ? textStr12 == null : textStr11.equals(textStr12);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canEqual(Object obj) {
|
||||
return obj instanceof OAuthApplication;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int intVal = 1;
|
||||
String textStr = this.getClientId();
|
||||
intVal = intVal * 59 + (textStr == null ? 43 : textStr.hashCode());
|
||||
String textStr2 = this.getScope();
|
||||
intVal = intVal * 59 + (textStr2 == null ? 43 : textStr2.hashCode());
|
||||
intVal = intVal * 59 + (this.isUseWeirdXboxTokenPrefix() ? 79 : 97);
|
||||
String textStr3 = this.getBasicURL();
|
||||
intVal = intVal * 59 + (textStr3 == null ? 43 : textStr3.hashCode());
|
||||
String textStr4 = this.getTokenURL();
|
||||
intVal = intVal * 59 + (textStr4 == null ? 43 : textStr4.hashCode());
|
||||
String textStr5 = this.getRedirectURL();
|
||||
intVal = intVal * 59 + (textStr5 == null ? 43 : textStr5.hashCode());
|
||||
String textStr6 = this.getBackButtonURL();
|
||||
return intVal * 59 + (textStr6 == null ? 43 : textStr6.hashCode());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "OAuthApplication(clientId="
|
||||
+ this.getClientId()
|
||||
+ ", scope="
|
||||
+ this.getScope()
|
||||
+ ", useWeirdXboxTokenPrefix="
|
||||
+ this.isUseWeirdXboxTokenPrefix()
|
||||
+ ", basicURL="
|
||||
+ this.getBasicURL()
|
||||
+ ", tokenURL="
|
||||
+ this.getTokenURL()
|
||||
+ ", redirectURL="
|
||||
+ this.getRedirectURL()
|
||||
+ ", backButtonURL="
|
||||
+ this.getBackButtonURL()
|
||||
+ ")";
|
||||
}
|
||||
|
||||
public OAuthApplication(String text, String str, String value, String name, String text2, String text3) {
|
||||
this.clientId = text;
|
||||
this.scope = str;
|
||||
this.basicURL = value;
|
||||
this.tokenURL = name;
|
||||
this.redirectURL = text2;
|
||||
this.backButtonURL = text3;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package cc.novoline.auth.minecraft;
|
||||
|
||||
import cc.novoline.auth.minecraft.user.InvalidResponseException;
|
||||
import cc.novoline.auth.minecraft.user.MicrosoftOAuthExchangeCode;
|
||||
import cc.novoline.auth.minecraft.user.MicrosoftOAuthToken;
|
||||
import cc.novoline.auth.minecraft.user.Parser;
|
||||
import cc.novoline.auth.minecraft.user.RequestAndParseStrategy;
|
||||
import cc.novoline.auth.minecraft.user.Requester;
|
||||
import cc.novoline.auth.minecraft.user.oauth.exchange.MicrosoftOAuthCodeExchangeException;
|
||||
import java.io.IOException;
|
||||
import org.apache.log4j.LogManager;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
public class MicrosoftOAuthCodeExchanger extends RequestAndParseStrategy<MicrosoftOAuthExchangeCode, MicrosoftOAuthToken> {
|
||||
private static final Logger LOGGER = LogManager.getLogger(MicrosoftOAuthCodeExchanger.class);
|
||||
|
||||
public MicrosoftOAuthCodeExchanger(Requester<MicrosoftOAuthExchangeCode> requester, Parser<MicrosoftOAuthToken> parser) {
|
||||
super(LOGGER, requester, parser);
|
||||
}
|
||||
|
||||
public MicrosoftOAuthToken exchangeMicrosoftOAuthCode(MicrosoftOAuthExchangeCode microsoftOAuthExchangeCode) throws MicrosoftOAuthCodeExchangeException, IOException {
|
||||
try {
|
||||
return this.requestAndParse(microsoftOAuthExchangeCode);
|
||||
} catch (InvalidResponseException ex) {
|
||||
throw new MicrosoftOAuthCodeExchangeException(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,340 @@
|
||||
package cc.novoline.auth.minecraft.auth;
|
||||
|
||||
import cc.novoline.auth.minecraft.user.MicrosoftOAuthToken;
|
||||
import cc.novoline.auth.minecraft.user.mcsauth.MinecraftServicesToken;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Random;
|
||||
import java.util.UUID;
|
||||
|
||||
public class Account {
|
||||
private String username;
|
||||
private String userID;
|
||||
private String displayName;
|
||||
private String password;
|
||||
private String accessToken;
|
||||
private MicrosoftOAuthToken microsoftOAuthToken;
|
||||
private MinecraftServicesToken minecraftServicesToken;
|
||||
private String uuid;
|
||||
private List<Map> userProperties;
|
||||
private boolean premiumAccount;
|
||||
private GameProfile[] profiles;
|
||||
private GameProfile selectedProfile;
|
||||
private User user;
|
||||
|
||||
public Account() {}
|
||||
|
||||
public Account(String text) {
|
||||
this();
|
||||
this.setUsername(text);
|
||||
}
|
||||
|
||||
public Account(Map map) {
|
||||
this();
|
||||
this.fillFromMap(map);
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return this.username;
|
||||
}
|
||||
|
||||
public boolean hasUsername() {
|
||||
return this.username != null;
|
||||
}
|
||||
|
||||
public void setUsername(String name) {
|
||||
this.username = name;
|
||||
}
|
||||
|
||||
public String getUserID() {
|
||||
return this.userID;
|
||||
}
|
||||
|
||||
public void setUserID(String text) {
|
||||
this.userID = text;
|
||||
}
|
||||
|
||||
public String getDisplayName() {
|
||||
return this.displayName == null ? this.username : this.displayName;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return this.password;
|
||||
}
|
||||
|
||||
public void setPassword(String text) {
|
||||
this.password = text;
|
||||
}
|
||||
|
||||
public String getAccessToken() {
|
||||
return Objects.nonNull(this.minecraftServicesToken) ? this.minecraftServicesToken.getAccessToken() : this.accessToken;
|
||||
}
|
||||
|
||||
public void setAccessToken(String text) {
|
||||
if ("null".equals(text)) {
|
||||
text = null;
|
||||
}
|
||||
|
||||
this.accessToken = text;
|
||||
}
|
||||
|
||||
public String getUUID() {
|
||||
return this.uuid;
|
||||
}
|
||||
|
||||
public void setUUID(String text) {
|
||||
this.uuid = text;
|
||||
}
|
||||
|
||||
public GameProfile[] getProfiles() {
|
||||
return this.profiles;
|
||||
}
|
||||
|
||||
public void setProfiles(GameProfile[] gameProfileArray) {
|
||||
this.profiles = gameProfileArray;
|
||||
}
|
||||
|
||||
public GameProfile getProfile() {
|
||||
return this.selectedProfile != null ? this.selectedProfile : GameProfile.DEFAULT_PROFILE;
|
||||
}
|
||||
|
||||
public void setProfile(GameProfile gameProfile) {
|
||||
this.selectedProfile = gameProfile;
|
||||
}
|
||||
|
||||
public void setDisplayName(String name) {
|
||||
this.displayName = name;
|
||||
}
|
||||
|
||||
public User getUser() {
|
||||
return this.user;
|
||||
}
|
||||
|
||||
public void setUser(User userIn) {
|
||||
this.user = userIn;
|
||||
}
|
||||
|
||||
public Map getProperties() {
|
||||
Map itemMap = new HashMap();
|
||||
List<UserProperty> userPropertyList = new ArrayList<>();
|
||||
if (this.userProperties != null) {
|
||||
for (Map itemMap2 : this.userProperties) {
|
||||
userPropertyList.add(new UserProperty((String)itemMap2.get("name"), (String)itemMap2.get("value")));
|
||||
}
|
||||
}
|
||||
|
||||
if (this.user != null && this.user.getProperties() != null) {
|
||||
for (Map itemMap3 : (List<Map>)this.user.getProperties()) {
|
||||
userPropertyList.add(new UserProperty((String)itemMap3.get("name"), (String)itemMap3.get("value")));
|
||||
}
|
||||
}
|
||||
|
||||
for (UserProperty userProperty : userPropertyList) {
|
||||
List itemList = new ArrayList();
|
||||
itemList.add(userProperty.getValue());
|
||||
itemMap.put(userProperty.getKey(), itemList);
|
||||
}
|
||||
|
||||
return itemMap;
|
||||
}
|
||||
|
||||
void setProperties(List list) {
|
||||
this.userProperties = list;
|
||||
}
|
||||
|
||||
public boolean isFree() {
|
||||
return false;
|
||||
}
|
||||
|
||||
Map createMap() {
|
||||
Map itemMap = new HashMap();
|
||||
itemMap.put("username", this.username);
|
||||
itemMap.put("userid", this.userID);
|
||||
itemMap.put("uuid", UUIDTypeAdapter.toUUID(this.uuid));
|
||||
itemMap.put("displayName", this.displayName);
|
||||
if (!this.isFree()) {
|
||||
itemMap.put("accessToken", this.accessToken);
|
||||
}
|
||||
|
||||
if (this.userProperties != null) {
|
||||
itemMap.put("userProperties", this.userProperties);
|
||||
}
|
||||
|
||||
return itemMap;
|
||||
}
|
||||
|
||||
void fillFromMap(Map map) {
|
||||
if (map.containsKey("username")) {
|
||||
this.setUsername(map.get("username").toString());
|
||||
}
|
||||
|
||||
this.setUserID(map.containsKey("userid") ? map.get("userid").toString() : this.getUsername());
|
||||
this.setDisplayName(map.containsKey("displayName") ? map.get("displayName").toString() : this.getUsername());
|
||||
this.setProperties(map.containsKey("userProperties") ? (List)map.get("userProperties") : null);
|
||||
this.setUUID(map.containsKey("uuid") ? UUIDTypeAdapter.toUUID(map.get("uuid").toString()) : null);
|
||||
boolean flag = map.containsKey("accessToken");
|
||||
if (flag) {
|
||||
this.setAccessToken(map.get("accessToken").toString());
|
||||
}
|
||||
}
|
||||
|
||||
public static Account createFreeAccountByUsername(String name) {
|
||||
Account account = new Account();
|
||||
account.setUUID(UUIDTypeAdapter.fromUUID(UUID.randomUUID()));
|
||||
account.setUsername(name);
|
||||
account.setUserID(account.getUsername());
|
||||
account.setDisplayName(account.getUsername());
|
||||
return account;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.toDebugString();
|
||||
}
|
||||
|
||||
public String toDebugString() {
|
||||
Map itemMap = this.createMap();
|
||||
if (itemMap.containsKey("accessToken")) {
|
||||
itemMap.remove("accessToken");
|
||||
itemMap.put("accessToken", "(not null)");
|
||||
}
|
||||
|
||||
return "Account" + itemMap;
|
||||
}
|
||||
|
||||
public static Account randomAccount() {
|
||||
return new Account("empty_manage " + new Random().nextLong());
|
||||
}
|
||||
|
||||
public boolean isPremiumAccount() {
|
||||
return this.premiumAccount;
|
||||
}
|
||||
|
||||
public void setPremiumAccount(boolean enabled) {
|
||||
this.premiumAccount = enabled;
|
||||
}
|
||||
|
||||
public MicrosoftOAuthToken getMicrosoftOAuthToken() {
|
||||
return this.microsoftOAuthToken;
|
||||
}
|
||||
|
||||
public void setMicrosoftOAuthToken(MicrosoftOAuthToken microsoftOAuthTokenIn) {
|
||||
this.microsoftOAuthToken = microsoftOAuthTokenIn;
|
||||
}
|
||||
|
||||
public MinecraftServicesToken getMinecraftServicesToken() {
|
||||
return this.minecraftServicesToken;
|
||||
}
|
||||
|
||||
public void setMinecraftServicesToken(MinecraftServicesToken minecraftServicesTokenIn) {
|
||||
this.minecraftServicesToken = minecraftServicesTokenIn;
|
||||
}
|
||||
|
||||
public String getShortUUID() {
|
||||
return UUIDTypeAdapter.toUUID(this.uuid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == this) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!(obj instanceof Account)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Account account = (Account)obj;
|
||||
if (!account.canEqual(this)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Object obj2 = this.getUsername();
|
||||
Object obj3 = account.getUsername();
|
||||
if (obj2 == null) {
|
||||
if (obj3 != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!obj2.equals(obj3)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Object obj4 = this.getUserID();
|
||||
Object obj5 = account.getUserID();
|
||||
if (obj4 == null) {
|
||||
if (obj5 != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!obj4.equals(obj5)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Object obj6 = this.getDisplayName();
|
||||
Object obj7 = account.getDisplayName();
|
||||
if (obj6 == null) {
|
||||
if (obj7 != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!obj6.equals(obj7)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Object obj8 = this.getPassword();
|
||||
Object obj9 = account.getPassword();
|
||||
if (obj8 == null ? obj9 == null : obj8.equals(obj9)) {
|
||||
obj8 = this.getAccessToken();
|
||||
obj9 = account.getAccessToken();
|
||||
if (obj8 == null ? obj9 == null : obj8.equals(obj9)) {
|
||||
obj8 = this.getMicrosoftOAuthToken();
|
||||
obj9 = account.getMicrosoftOAuthToken();
|
||||
if (obj8 == null) {
|
||||
if (obj9 != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!obj8.equals(obj9)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Object obj10 = this.getMinecraftServicesToken();
|
||||
Object obj11 = account.getMinecraftServicesToken();
|
||||
if (obj10 == null ? obj11 == null : obj10.equals(obj11)) {
|
||||
obj10 = this.getUUID();
|
||||
obj11 = account.getUUID();
|
||||
if (obj10 == null ? obj11 == null : obj10.equals(obj11)) {
|
||||
obj10 = this.userProperties;
|
||||
obj11 = account.userProperties;
|
||||
if (obj10 == null) {
|
||||
if (obj11 != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!obj10.equals(obj11)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canEqual(Object obj) {
|
||||
return obj instanceof Account;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package cc.novoline.auth.minecraft.auth;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
public class GameProfile {
|
||||
public static final GameProfile DEFAULT_PROFILE = new GameProfile("0", "(Default)");
|
||||
private final String id;
|
||||
private final String name;
|
||||
|
||||
private GameProfile(String text, String str) {
|
||||
if (StringUtils.isBlank(text) && StringUtils.isBlank(str)) {
|
||||
throw new IllegalArgumentException("Name and ID cannot both be blank");
|
||||
}
|
||||
|
||||
this.id = text;
|
||||
this.name = str;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public boolean isComplete() {
|
||||
return StringUtils.isNotBlank(this.getId()) && StringUtils.isNotBlank(this.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
} else if (obj != null && this.getClass() == obj.getClass()) {
|
||||
GameProfile gameProfile = (GameProfile)obj;
|
||||
return this.id.equals(gameProfile.id) && this.name.equals(gameProfile.name);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int intVal = this.id.hashCode();
|
||||
return 31 * intVal + this.name.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GameProfile{id='" + this.id + '\'' + ", name='" + this.name + '\'' + '}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package cc.novoline.auth.minecraft.auth;
|
||||
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.UUID;
|
||||
|
||||
public class UUIDTypeAdapter extends TypeAdapter {
|
||||
public void write(JsonWriter jsonWriter, UUID uuid) throws IOException {
|
||||
jsonWriter.value(fromUUID(uuid));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(JsonWriter jsonWriter, Object obj) throws IOException {}
|
||||
|
||||
public UUID read(JsonReader jsonReader) throws IOException {
|
||||
return fromString(jsonReader.nextString());
|
||||
}
|
||||
|
||||
public static String toUUID(String text) {
|
||||
return text == null ? null : text.replace("-", "");
|
||||
}
|
||||
|
||||
public static String fromUUID(UUID uuid) {
|
||||
return toUUID(uuid.toString());
|
||||
}
|
||||
|
||||
public static UUID fromString(String text) {
|
||||
return UUID.fromString(text.replaceFirst("(\\w{8})(\\w{4})(\\w{4})(\\w{4})(\\w{12})", "$1-$2-$3-$4-$5"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package cc.novoline.auth.minecraft.auth;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class User {
|
||||
private String id;
|
||||
private List properties;
|
||||
|
||||
public String getID() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public List getProperties() {
|
||||
return this.properties;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package cc.novoline.auth.minecraft.auth;
|
||||
|
||||
public class UserProperty {
|
||||
private String name;
|
||||
private String value;
|
||||
|
||||
public UserProperty(String text, String str) {
|
||||
this.name = text;
|
||||
this.value = str;
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Property{" + this.name + " = " + this.value + "}";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package cc.novoline.auth.minecraft.exceptions;
|
||||
|
||||
public class ParseException extends RuntimeException {
|
||||
|
||||
public ParseException(String text) {
|
||||
super(text);
|
||||
}
|
||||
|
||||
public ParseException(String text, Throwable throwable) {
|
||||
super(text, throwable);
|
||||
}
|
||||
|
||||
public ParseException(Throwable throwable) {
|
||||
super(throwable);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package cc.novoline.auth.minecraft.user;
|
||||
|
||||
import cc.novoline.auth.minecraft.auth.UUIDTypeAdapter;
|
||||
import cc.novoline.auth.minecraft.exceptions.ParseException;
|
||||
import cc.novoline.auth.minecraft.user.preq.Validatable;
|
||||
import com.google.gson.FieldNamingPolicy;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.UUID;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
public class GsonParser<V extends Validatable> implements Parser<V> {
|
||||
private final Gson gson;
|
||||
private final Type type;
|
||||
|
||||
public GsonParser(Gson gsonIn, Type typeIn) {
|
||||
this.gson = gsonIn;
|
||||
this.type = typeIn;
|
||||
}
|
||||
|
||||
public static <V extends Validatable> GsonParser<V> defaultParser(Type typeIn) {
|
||||
return new GsonParser<>(new GsonBuilder().create(), typeIn);
|
||||
}
|
||||
|
||||
public static <V extends Validatable> GsonParser<V> withDashlessUUIDAdapter(Type typeIn) {
|
||||
return new GsonParser<>(new GsonBuilder().registerTypeAdapter(UUID.class, new UUIDTypeAdapter()).create(), typeIn);
|
||||
}
|
||||
|
||||
public static <V extends Validatable> GsonParser<V> lowerCaseWithUnderscores(Type typeIn) {
|
||||
return new GsonParser<>(new GsonBuilder().setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES).create(), typeIn);
|
||||
}
|
||||
|
||||
public static <V extends Validatable> GsonParser<V> upperCamelCase(Type typeIn) {
|
||||
return new GsonParser<>(new GsonBuilder().setFieldNamingPolicy(FieldNamingPolicy.UPPER_CAMEL_CASE).create(), typeIn);
|
||||
}
|
||||
|
||||
public static <V extends Validatable> GsonParser<V> withDeserializer(Type typeIn, Object obj) {
|
||||
return new GsonParser<>(new GsonBuilder().registerTypeAdapter(typeIn, obj).create(), typeIn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public V parseResponse(Logger logger, String text) throws ParseException {
|
||||
logger.trace("Parsing response");
|
||||
|
||||
V v;
|
||||
try {
|
||||
v = this.gson.fromJson(text, this.type);
|
||||
} catch (RuntimeException ex) {
|
||||
throw new ParseException(ex);
|
||||
}
|
||||
|
||||
logger.trace("Validating response");
|
||||
|
||||
try {
|
||||
v.validate();
|
||||
return v;
|
||||
} catch (ParseException ex2) {
|
||||
throw ex2;
|
||||
} catch (RuntimeException ex3) {
|
||||
throw new ParseException(ex3);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package cc.novoline.auth.minecraft.user;
|
||||
|
||||
import cc.novoline.auth.minecraft.util.SSLFix;
|
||||
import java.io.IOException;
|
||||
import java.util.function.Function;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.client.fluent.Request;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
public class HttpClientRequester<A> implements Requester<A> {
|
||||
private final Function<A, Request> requestFactory;
|
||||
|
||||
public HttpClientRequester(Function<A, Request> function) {
|
||||
this.requestFactory = function;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String makeRequest(Logger logger, A param) throws InvalidResponseException, IOException {
|
||||
SSLFix.execute();
|
||||
Request request2 = this.requestFactory.apply(param);
|
||||
logger.trace("Sending request: {}" + request2);
|
||||
HttpResponse httpResponse = request2.execute().returnResponse();
|
||||
logger.trace("Reading response");
|
||||
String textStr = EntityUtils.toString(httpResponse.getEntity());
|
||||
logger.trace("Response: {}" + textStr);
|
||||
int intVal = httpResponse.getStatusLine().getStatusCode();
|
||||
logger.trace("Status code: {}" + intVal);
|
||||
if (intVal >= 200 && intVal <= 299) {
|
||||
return textStr;
|
||||
} else {
|
||||
throw new InvalidStatusCodeException(intVal, textStr);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package cc.novoline.auth.minecraft.user;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
|
||||
public class InvalidResponseException extends Exception {
|
||||
private final String response;
|
||||
|
||||
public InvalidResponseException(String text) {
|
||||
super(text);
|
||||
this.response = text;
|
||||
}
|
||||
|
||||
public InvalidResponseException(String text, String str) {
|
||||
super(str);
|
||||
this.response = text;
|
||||
}
|
||||
|
||||
public InvalidResponseException(String text, Throwable throwable) {
|
||||
super(text, throwable);
|
||||
this.response = text;
|
||||
}
|
||||
|
||||
public String getResponse() {
|
||||
return this.response;
|
||||
}
|
||||
|
||||
public JsonObject getResponseAsJson() {
|
||||
try {
|
||||
return (JsonObject)new JsonParser().parse(this.response);
|
||||
} catch (RuntimeException ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package cc.novoline.auth.minecraft.user;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
public class InvalidStatusCodeException extends InvalidResponseException {
|
||||
private final int statusCode;
|
||||
|
||||
public InvalidStatusCodeException(int value, String text) {
|
||||
super(text, format(value, text));
|
||||
this.statusCode = value;
|
||||
}
|
||||
|
||||
private static String format(int value, String text) {
|
||||
return StringUtils.isEmpty(text) ? String.valueOf(value) : value + ": \"" + text + "\"";
|
||||
}
|
||||
|
||||
public int getStatusCode() {
|
||||
return this.statusCode;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package cc.novoline.auth.minecraft.user;
|
||||
|
||||
import cc.novoline.auth.minecraft.auth.UUIDTypeAdapter;
|
||||
import cc.novoline.auth.minecraft.util.StringUtil;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.UUID;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
public class LoginCredentials {
|
||||
private final String username;
|
||||
private final String session;
|
||||
private final String accessToken;
|
||||
private final String playerName;
|
||||
private final String userType;
|
||||
private final String profileName;
|
||||
private final String properties;
|
||||
private final UUID uuid;
|
||||
|
||||
LoginCredentials(String text, String secondaryText, String extraText, String text2, UUID uUID, String text3, String text4) {
|
||||
this.username = StringUtil.requireNotBlank(text, "username");
|
||||
this.accessToken = StringUtil.requireNotBlank(secondaryText, "accessToken");
|
||||
this.properties = StringUtils.isBlank(extraText) ? "{}" : extraText;
|
||||
this.playerName = StringUtil.requireNotBlank(text2, "playerName");
|
||||
this.uuid = uUID;
|
||||
this.userType = StringUtil.requireNotBlank(text3, "userType");
|
||||
this.profileName = StringUtil.requireNotBlank(text4, "profileName");
|
||||
this.session = String.format(Locale.ROOT, "token:%s:%s", secondaryText, UUIDTypeAdapter.fromUUID(uUID));
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return this.username;
|
||||
}
|
||||
|
||||
public String getSession() {
|
||||
return this.session;
|
||||
}
|
||||
|
||||
public String getAccessToken() {
|
||||
return this.accessToken;
|
||||
}
|
||||
|
||||
public String getPlayerName() {
|
||||
return this.playerName;
|
||||
}
|
||||
|
||||
public String getUserType() {
|
||||
return this.userType;
|
||||
}
|
||||
|
||||
public String getProfileName() {
|
||||
return this.profileName;
|
||||
}
|
||||
|
||||
public String getProperties() {
|
||||
return this.properties;
|
||||
}
|
||||
|
||||
public UUID getUuid() {
|
||||
return this.uuid;
|
||||
}
|
||||
|
||||
public LinkedHashMap map() {
|
||||
return new LoginCredentials.LoginCredentials$1(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)
|
||||
.append("session", this.session)
|
||||
.append("accessToken", this.accessToken)
|
||||
.append("playerName", this.playerName)
|
||||
.append("userType", this.userType)
|
||||
.append("profileName", this.profileName)
|
||||
.append("properties", this.properties)
|
||||
.append("uuid", this.uuid)
|
||||
.build();
|
||||
}
|
||||
|
||||
class LoginCredentials$1 extends LinkedHashMap {
|
||||
final LoginCredentials this$0;
|
||||
|
||||
LoginCredentials$1(LoginCredentials loginCredentials) {
|
||||
this.this$0 = loginCredentials;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package cc.novoline.auth.minecraft.user;
|
||||
|
||||
public class MicrosoftOAuthExchangeCode {
|
||||
private final RedirectUrl redirectUrl;
|
||||
private String code;
|
||||
|
||||
public MicrosoftOAuthExchangeCode(String text, RedirectUrl redirectUrlIn) {
|
||||
this.code = text;
|
||||
this.redirectUrl = redirectUrlIn;
|
||||
}
|
||||
|
||||
public RedirectUrl getRedirectUrl() {
|
||||
return this.redirectUrl;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return this.code;
|
||||
}
|
||||
|
||||
public void setCode(String text) {
|
||||
this.code = text;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == this) {
|
||||
return true;
|
||||
} else if (!(obj instanceof MicrosoftOAuthExchangeCode)) {
|
||||
return false;
|
||||
} else {
|
||||
MicrosoftOAuthExchangeCode microsoftOAuthExchangeCode = (MicrosoftOAuthExchangeCode)obj;
|
||||
if (!microsoftOAuthExchangeCode.canEqual(this)) {
|
||||
return false;
|
||||
} else {
|
||||
RedirectUrl redirectUrl2 = this.getRedirectUrl();
|
||||
RedirectUrl redirectUrl3 = microsoftOAuthExchangeCode.getRedirectUrl();
|
||||
if (redirectUrl2 == null ? redirectUrl3 == null : redirectUrl2.equals(redirectUrl3)) {
|
||||
String textStr = this.getCode();
|
||||
String textStr2 = microsoftOAuthExchangeCode.getCode();
|
||||
return textStr == null ? textStr2 == null : textStr.equals(textStr2);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canEqual(Object obj) {
|
||||
return obj instanceof MicrosoftOAuthExchangeCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int intVal = 1;
|
||||
RedirectUrl redirectUrl2 = this.getRedirectUrl();
|
||||
intVal = intVal * 59 + (redirectUrl2 == null ? 43 : redirectUrl2.hashCode());
|
||||
String textStr = this.getCode();
|
||||
return intVal * 59 + (textStr == null ? 43 : textStr.hashCode());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MicrosoftOAuthExchangeCode(redirectUrl=" + this.getRedirectUrl() + ", code=" + this.getCode() + ")";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package cc.novoline.auth.minecraft.user;
|
||||
|
||||
import cc.novoline.auth.minecraft.user.preq.Validatable;
|
||||
import java.time.Instant;
|
||||
import java.util.Objects;
|
||||
|
||||
public class MicrosoftOAuthToken implements Validatable {
|
||||
private final Instant createdAt;
|
||||
private String accessToken;
|
||||
private String refreshToken;
|
||||
private int expiresIn;
|
||||
|
||||
public MicrosoftOAuthToken(String text, String str, int value) {
|
||||
this.accessToken = text;
|
||||
this.refreshToken = str;
|
||||
this.createdAt = Instant.now();
|
||||
this.expiresIn = value;
|
||||
}
|
||||
|
||||
public MicrosoftOAuthToken(String text, String str, Instant instant) {
|
||||
this.accessToken = text;
|
||||
this.refreshToken = str;
|
||||
this.createdAt = instant.minusSeconds(3600L);
|
||||
this.expiresIn = 3600;
|
||||
}
|
||||
|
||||
public MicrosoftOAuthToken() {
|
||||
this.createdAt = Instant.now();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
} else if (obj != null && this.getClass() == obj.getClass()) {
|
||||
MicrosoftOAuthToken microsoftOAuthToken = (MicrosoftOAuthToken)obj;
|
||||
return this.expiresIn == microsoftOAuthToken.expiresIn && Objects.equals(this.accessToken, microsoftOAuthToken.accessToken) && Objects.equals(this.refreshToken, microsoftOAuthToken.refreshToken);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int intVal = this.accessToken != null ? this.accessToken.hashCode() : 0;
|
||||
intVal = 31 * intVal + (this.refreshToken != null ? this.refreshToken.hashCode() : 0);
|
||||
return 31 * intVal + this.expiresIn;
|
||||
}
|
||||
|
||||
public String getAccessToken() {
|
||||
return this.accessToken;
|
||||
}
|
||||
|
||||
public String getRefreshToken() {
|
||||
return this.refreshToken;
|
||||
}
|
||||
|
||||
public Instant calculateExpiryTime() {
|
||||
return this.createdAt.plusSeconds(this.expiresIn);
|
||||
}
|
||||
|
||||
public boolean isExpired() {
|
||||
return Instant.now().isAfter(this.calculateExpiryTime());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MicrosoftOAuthToken{accessToken='"
|
||||
+ this.accessToken
|
||||
+ '\''
|
||||
+ ", refreshToken='"
|
||||
+ this.refreshToken
|
||||
+ '\''
|
||||
+ ", expiresIn="
|
||||
+ this.expiresIn
|
||||
+ ", createdAt="
|
||||
+ this.createdAt
|
||||
+ '}';
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validate() {
|
||||
Validatable.notNull(this.accessToken, "accessToken");
|
||||
Validatable.notNull(this.createdAt, "createdAt");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package cc.novoline.auth.minecraft.user;
|
||||
|
||||
public abstract class MinecraftAuthenticationException extends Exception {
|
||||
public MinecraftAuthenticationException() {}
|
||||
|
||||
public MinecraftAuthenticationException(String text) {
|
||||
super(text);
|
||||
}
|
||||
|
||||
public MinecraftAuthenticationException(String text, Throwable throwable) {
|
||||
super(text, throwable);
|
||||
}
|
||||
|
||||
public MinecraftAuthenticationException(Throwable throwable) {
|
||||
super(throwable);
|
||||
}
|
||||
|
||||
public abstract String getShortKey();
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package cc.novoline.auth.minecraft.user;
|
||||
|
||||
import cc.novoline.auth.minecraft.MicrosoftOAuthCodeExchanger;
|
||||
import cc.novoline.auth.minecraft.user.gos.GameOwnershipValidator;
|
||||
import cc.novoline.auth.minecraft.user.mcsauth.MinecraftServicesAuthenticator;
|
||||
import cc.novoline.auth.minecraft.user.mcsauth.MinecraftServicesToken;
|
||||
import cc.novoline.auth.minecraft.user.preq.MinecraftOAuthProfile;
|
||||
import cc.novoline.auth.minecraft.user.preq.MinecraftProfileRequester;
|
||||
import cc.novoline.auth.minecraft.user.xb.XboxServiceAuthenticationResponse;
|
||||
import cc.novoline.auth.minecraft.user.xb.auth.XboxLiveAuthenticator;
|
||||
import cc.novoline.auth.minecraft.user.xb.xsts.XSTSAuthenticator;
|
||||
import java.io.IOException;
|
||||
|
||||
public class MinecraftOAuthAuthenticate {
|
||||
private final MicrosoftOAuthCodeExchanger microsoftOAuthCodeExchanger;
|
||||
private final XboxLiveAuthenticator xboxLiveAuthenticator;
|
||||
private final XSTSAuthenticator xstsAuthenticator;
|
||||
private final MinecraftServicesAuthenticator minecraftServicesAuthenticator;
|
||||
private final GameOwnershipValidator gameOwnershipValidator;
|
||||
private final MinecraftProfileRequester minecraftProfileRequester;
|
||||
private final MinecraftProfileConverter minecraftProfileConverter;
|
||||
|
||||
public MinecraftOAuthAuthenticate(
|
||||
MicrosoftOAuthCodeExchanger microsoftOAuthCodeExchangerIn,
|
||||
XboxLiveAuthenticator xboxLiveAuthenticatorIn,
|
||||
XSTSAuthenticator xSTSAuthenticator,
|
||||
MinecraftServicesAuthenticator minecraftServicesAuthenticatorIn,
|
||||
GameOwnershipValidator gameOwnershipValidatorIn,
|
||||
MinecraftProfileRequester minecraftProfileRequesterIn,
|
||||
MinecraftProfileConverter minecraftProfileConverterIn
|
||||
) {
|
||||
this.microsoftOAuthCodeExchanger = microsoftOAuthCodeExchangerIn;
|
||||
this.xboxLiveAuthenticator = xboxLiveAuthenticatorIn;
|
||||
this.xstsAuthenticator = xSTSAuthenticator;
|
||||
this.minecraftServicesAuthenticator = minecraftServicesAuthenticatorIn;
|
||||
this.gameOwnershipValidator = gameOwnershipValidatorIn;
|
||||
this.minecraftProfileRequester = minecraftProfileRequesterIn;
|
||||
this.minecraftProfileConverter = minecraftProfileConverterIn;
|
||||
}
|
||||
|
||||
public MinecraftUser authenticate(MicrosoftOAuthExchangeCode microsoftOAuthExchangeCode) throws MinecraftAuthenticationException, IOException {
|
||||
MicrosoftOAuthToken microsoftOAuthToken = this.microsoftOAuthCodeExchanger.exchangeMicrosoftOAuthCode(microsoftOAuthExchangeCode);
|
||||
XboxServiceAuthenticationResponse val = this.xboxLiveAuthenticator.xboxLiveAuthenticate(microsoftOAuthToken.getAccessToken());
|
||||
XboxServiceAuthenticationResponse val2 = this.xstsAuthenticator.xstsAuthenticate(val.getToken());
|
||||
MinecraftServicesToken minecraftServicesToken = this.minecraftServicesAuthenticator.minecraftServicesAuthenticate(val2);
|
||||
this.gameOwnershipValidator.checkGameOwnership(minecraftServicesToken);
|
||||
MinecraftOAuthProfile minecraftOAuthProfile = this.minecraftProfileRequester.requestProfile(minecraftServicesToken);
|
||||
return this.minecraftProfileConverter.convertToMinecraftUser(microsoftOAuthToken, minecraftServicesToken, minecraftOAuthProfile);
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package cc.novoline.auth.minecraft.user;
|
||||
|
||||
public class MinecraftProfileConversionException extends MinecraftAuthenticationException {
|
||||
public MinecraftProfileConversionException(Throwable throwable) {
|
||||
super(throwable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShortKey() {
|
||||
return "minecraft_profile_conversion";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package cc.novoline.auth.minecraft.user;
|
||||
|
||||
import cc.novoline.auth.minecraft.user.mcsauth.MinecraftServicesToken;
|
||||
import cc.novoline.auth.minecraft.user.preq.MinecraftOAuthProfile;
|
||||
|
||||
public class MinecraftProfileConverter {
|
||||
public MinecraftUser convertToMinecraftUser(MicrosoftOAuthToken microsoftOAuthToken, MinecraftServicesToken minecraftServicesToken, MinecraftOAuthProfile minecraftOAuthProfile) throws MinecraftProfileConversionException {
|
||||
try {
|
||||
return new MinecraftUser(minecraftOAuthProfile, microsoftOAuthToken, minecraftServicesToken);
|
||||
} catch (RuntimeException ex) {
|
||||
throw new MinecraftProfileConversionException(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package cc.novoline.auth.minecraft.user;
|
||||
|
||||
import cc.novoline.auth.minecraft.user.mcsauth.MinecraftServicesToken;
|
||||
import cc.novoline.auth.minecraft.user.preq.MinecraftOAuthProfile;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
|
||||
public class MinecraftUser extends User {
|
||||
public static final String TYPE = "minecraft";
|
||||
private MinecraftOAuthProfile profile;
|
||||
private MicrosoftOAuthToken microsoftToken;
|
||||
private MinecraftServicesToken minecraftToken;
|
||||
|
||||
public MinecraftUser(MinecraftOAuthProfile minecraftOAuthProfile, MicrosoftOAuthToken microsoftOAuthToken, MinecraftServicesToken minecraftServicesToken) {
|
||||
this.setPayload(minecraftOAuthProfile, microsoftOAuthToken, minecraftServicesToken);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUsername() {
|
||||
return this.profile.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
return this.profile.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getUUID() {
|
||||
return this.profile.getId();
|
||||
}
|
||||
|
||||
public MicrosoftOAuthToken getMicrosoftToken() {
|
||||
return this.microsoftToken;
|
||||
}
|
||||
|
||||
void setMicrosoftToken(MicrosoftOAuthToken microsoftOAuthToken) {
|
||||
this.microsoftToken = Objects.requireNonNull(microsoftOAuthToken, "microsoftToken");
|
||||
}
|
||||
|
||||
public MinecraftServicesToken getMinecraftToken() {
|
||||
return this.minecraftToken;
|
||||
}
|
||||
|
||||
void setMinecraftToken(MinecraftServicesToken minecraftServicesToken) {
|
||||
this.minecraftToken = Objects.requireNonNull(minecraftServicesToken, "minecraftToken");
|
||||
}
|
||||
|
||||
void setPayload(MinecraftOAuthProfile minecraftOAuthProfile, MicrosoftOAuthToken microsoftOAuthToken, MinecraftServicesToken minecraftServicesToken) {
|
||||
this.setProfile(minecraftOAuthProfile);
|
||||
this.setMicrosoftToken(microsoftOAuthToken);
|
||||
this.setMinecraftToken(minecraftServicesToken);
|
||||
}
|
||||
|
||||
void setProfile(MinecraftOAuthProfile minecraftOAuthProfile) {
|
||||
this.profile = Objects.requireNonNull(minecraftOAuthProfile, "profile");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return "minecraft";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(User user) {
|
||||
return user != null && this.profile.getId().equals(((MinecraftUser)user).profile.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int intVal = this.profile.hashCode();
|
||||
intVal = 31 * intVal + this.microsoftToken.hashCode();
|
||||
return 31 * intVal + this.minecraftToken.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public LoginCredentials getLoginCredentials() {
|
||||
return new LoginCredentials(
|
||||
this.profile.getName(), this.minecraftToken.getAccessToken(), "{}", this.profile.getName(), this.profile.getId(), "mojang", this.profile.getName()
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package cc.novoline.auth.minecraft.user;
|
||||
|
||||
import cc.novoline.auth.minecraft.exceptions.ParseException;
|
||||
import cc.novoline.auth.minecraft.user.preq.Validatable;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
public interface Parser<V extends Validatable> {
|
||||
V parseResponse(Logger logger, String text) throws ParseException;
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package cc.novoline.auth.minecraft.user;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
|
||||
public class RedirectUrl {
|
||||
private final URL url;
|
||||
|
||||
public RedirectUrl(URL uRL) {
|
||||
this.url = uRL;
|
||||
}
|
||||
|
||||
public RedirectUrl(String text) throws MalformedURLException {
|
||||
this(new URL(text));
|
||||
}
|
||||
|
||||
public static RedirectUrl of(String text) {
|
||||
try {
|
||||
return new RedirectUrl(text);
|
||||
} catch (MalformedURLException ex) {
|
||||
throw new Error("invalid url: " + text, ex);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
} else if (obj != null && this.getClass() == obj.getClass()) {
|
||||
RedirectUrl redirectUrl = (RedirectUrl)obj;
|
||||
return this.url.equals(redirectUrl.url);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return this.url.hashCode();
|
||||
}
|
||||
|
||||
public URL getUrl() {
|
||||
return this.url;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "RedirectUrl{uri=" + this.url + '}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package cc.novoline.auth.minecraft.user;
|
||||
|
||||
import cc.novoline.auth.minecraft.exceptions.ParseException;
|
||||
import cc.novoline.auth.minecraft.user.preq.Validatable;
|
||||
import java.io.IOException;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
public abstract class RequestAndParseStrategy<A, V extends Validatable> {
|
||||
private final Logger logger;
|
||||
private final Requester<A> requester;
|
||||
private final Parser<V> parser;
|
||||
|
||||
public RequestAndParseStrategy(Logger logger2, Requester<A> requesterIn, Parser<V> parserIn) {
|
||||
this.logger = logger2;
|
||||
this.requester = requesterIn;
|
||||
this.parser = parserIn;
|
||||
}
|
||||
|
||||
public V requestAndParse(A param) throws IOException, InvalidResponseException {
|
||||
String textStr = this.requester.makeRequest(this.logger, param);
|
||||
|
||||
try {
|
||||
return this.parser.parseResponse(this.logger, textStr);
|
||||
} catch (ParseException ex) {
|
||||
ex.printStackTrace();
|
||||
throw new InvalidResponseException(textStr, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package cc.novoline.auth.minecraft.user;
|
||||
|
||||
import java.io.IOException;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
public interface Requester<A> {
|
||||
String makeRequest(Logger logger, A param) throws InvalidResponseException, IOException;
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package cc.novoline.auth.minecraft.user;
|
||||
|
||||
import java.util.UUID;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
public abstract class User {
|
||||
public abstract String getUsername();
|
||||
|
||||
public abstract String getDisplayName();
|
||||
|
||||
public abstract UUID getUUID();
|
||||
|
||||
public abstract String getType();
|
||||
|
||||
public abstract boolean equals(User user);
|
||||
|
||||
@Override
|
||||
public abstract int hashCode();
|
||||
|
||||
public abstract LoginCredentials getLoginCredentials();
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (!(obj instanceof User)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
User user = (User)obj;
|
||||
return this.getType().equals(user.getType()) && this.equals(user);
|
||||
}
|
||||
|
||||
public ToStringBuilder toStringBuilder() {
|
||||
return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)
|
||||
.append("username", this.getUsername())
|
||||
.append("displayName", this.getDisplayName())
|
||||
.append("uuid", this.getUUID())
|
||||
.append("type", this.getType());
|
||||
}
|
||||
|
||||
@Override
|
||||
public final String toString() {
|
||||
return this.toStringBuilder().build();
|
||||
}
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
package cc.novoline.auth.minecraft.user.gos;
|
||||
|
||||
import cc.novoline.auth.minecraft.user.MinecraftAuthenticationException;
|
||||
|
||||
public class GameOwnershipValidationException extends MinecraftAuthenticationException {
|
||||
private final boolean isKnownNotToOwn;
|
||||
|
||||
public GameOwnershipValidationException(Throwable throwable) {
|
||||
super(throwable);
|
||||
this.isKnownNotToOwn = false;
|
||||
}
|
||||
|
||||
public GameOwnershipValidationException(String text) {
|
||||
super(text);
|
||||
this.isKnownNotToOwn = true;
|
||||
}
|
||||
|
||||
public boolean isKnownNotToOwn() {
|
||||
return this.isKnownNotToOwn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShortKey() {
|
||||
return "game_ownership";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package cc.novoline.auth.minecraft.user.gos;
|
||||
|
||||
import cc.novoline.auth.minecraft.user.GsonParser;
|
||||
import cc.novoline.auth.minecraft.user.HttpClientRequester;
|
||||
import cc.novoline.auth.minecraft.user.InvalidResponseException;
|
||||
import cc.novoline.auth.minecraft.user.Parser;
|
||||
import cc.novoline.auth.minecraft.user.RequestAndParseStrategy;
|
||||
import cc.novoline.auth.minecraft.user.Requester;
|
||||
import cc.novoline.auth.minecraft.user.mcsauth.MinecraftServicesToken;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import org.apache.http.client.fluent.Request;
|
||||
import org.apache.log4j.LogManager;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
public class GameOwnershipValidator extends RequestAndParseStrategy<MinecraftServicesToken, MinecraftUserGameOwnershipResponse> {
|
||||
private static final Logger LOGGER = LogManager.getLogger(GameOwnershipValidator.class);
|
||||
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
public GameOwnershipValidator() {
|
||||
this(
|
||||
new HttpClientRequester(
|
||||
arg -> Request.Get("https://api.minecraftservices.com/entitlements/mcstore")
|
||||
.addHeader("Authorization", "Bearer " + ((MinecraftServicesToken)arg).getAccessToken())
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
GameOwnershipValidator(Requester<MinecraftServicesToken> requesterArg) {
|
||||
this(requesterArg, GsonParser.defaultParser(MinecraftUserGameOwnershipResponse.class));
|
||||
}
|
||||
|
||||
GameOwnershipValidator(Requester<MinecraftServicesToken> requesterArg, Parser<MinecraftUserGameOwnershipResponse> parserArg) {
|
||||
super(LOGGER, requesterArg, parserArg);
|
||||
}
|
||||
|
||||
public void checkGameOwnership(MinecraftServicesToken minecraftServicesToken) throws GameOwnershipValidationException, IOException {
|
||||
MinecraftUserGameOwnershipResponse val;
|
||||
try {
|
||||
val = this.requestAndParse(minecraftServicesToken);
|
||||
} catch (InvalidResponseException ex) {
|
||||
throw new GameOwnershipValidationException(ex);
|
||||
}
|
||||
|
||||
List<MinecraftUserGameOwnershipResponse.Item> itemList = val.getItems();
|
||||
if (itemList.isEmpty()) {
|
||||
throw new GameOwnershipValidationException("no ownership found");
|
||||
}
|
||||
|
||||
if (itemList.stream().noneMatch((MinecraftUserGameOwnershipResponse.Item item) -> "product_minecraft".equals(item.getName()))) {
|
||||
throw new GameOwnershipValidationException("no \"product_minecraft\"");
|
||||
}
|
||||
|
||||
if (itemList.stream().noneMatch((MinecraftUserGameOwnershipResponse.Item item2) -> "game_minecraft".equals(item2.getName()))) {
|
||||
throw new GameOwnershipValidationException("no \"game_minecraft\"");
|
||||
}
|
||||
}
|
||||
}
|
||||
+88
@@ -0,0 +1,88 @@
|
||||
package cc.novoline.auth.minecraft.user.gos;
|
||||
|
||||
import cc.novoline.auth.minecraft.user.preq.Validatable;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public class MinecraftUserGameOwnershipResponse implements Validatable {
|
||||
private List<MinecraftUserGameOwnershipResponse.Item> items;
|
||||
|
||||
public MinecraftUserGameOwnershipResponse(List<MinecraftUserGameOwnershipResponse.Item> list) {
|
||||
this.items = list;
|
||||
}
|
||||
|
||||
public MinecraftUserGameOwnershipResponse() {}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
} else if (obj != null && this.getClass() == obj.getClass()) {
|
||||
MinecraftUserGameOwnershipResponse val = (MinecraftUserGameOwnershipResponse)obj;
|
||||
return Objects.equals(this.items, val.items);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return this.items != null ? this.items.hashCode() : 0;
|
||||
}
|
||||
|
||||
public List<MinecraftUserGameOwnershipResponse.Item> getItems() {
|
||||
return this.items;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validate() {
|
||||
Validatable.notNull(this.items, "items");
|
||||
|
||||
for (MinecraftUserGameOwnershipResponse.Item item : this.items) {
|
||||
item.validate();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MinecraftUserGameOwnershipResponse{items=" + this.items + '}';
|
||||
}
|
||||
|
||||
public static class Item implements Validatable {
|
||||
private String name;
|
||||
private String signature;
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
} else if (obj != null && this.getClass() == obj.getClass()) {
|
||||
MinecraftUserGameOwnershipResponse.Item item = (MinecraftUserGameOwnershipResponse.Item)obj;
|
||||
return this.name.equals(item.name) && this.signature.equals(item.signature);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int intVal = this.name.hashCode();
|
||||
return 31 * intVal + this.signature.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Item{name='" + this.name + '\'' + ", signature='" + this.signature + '\'' + '}';
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validate() {
|
||||
Validatable.notEmpty(this.name, "name");
|
||||
Validatable.notEmpty(this.signature, "signature");
|
||||
}
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package cc.novoline.auth.minecraft.user.mcsauth;
|
||||
|
||||
import cc.novoline.auth.minecraft.user.MinecraftAuthenticationException;
|
||||
|
||||
public class MinecraftServicesAuthenticationException extends MinecraftAuthenticationException {
|
||||
public MinecraftServicesAuthenticationException(Throwable throwable) {
|
||||
super(throwable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShortKey() {
|
||||
return "minecraft_services_auth";
|
||||
}
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
package cc.novoline.auth.minecraft.user.mcsauth;
|
||||
|
||||
import cc.novoline.auth.minecraft.user.GsonParser;
|
||||
import cc.novoline.auth.minecraft.user.HttpClientRequester;
|
||||
import cc.novoline.auth.minecraft.user.InvalidResponseException;
|
||||
import cc.novoline.auth.minecraft.user.Parser;
|
||||
import cc.novoline.auth.minecraft.user.RequestAndParseStrategy;
|
||||
import cc.novoline.auth.minecraft.user.Requester;
|
||||
import cc.novoline.auth.minecraft.user.xb.XboxServiceAuthenticationResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.Locale;
|
||||
import org.apache.http.client.fluent.Request;
|
||||
import org.apache.http.entity.ContentType;
|
||||
import org.apache.log4j.LogManager;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
public class MinecraftServicesAuthenticator extends RequestAndParseStrategy<XboxServiceAuthenticationResponse, MinecraftServicesToken> {
|
||||
private static final Logger LOGGER = LogManager.getLogger(MinecraftServicesAuthenticator.class);
|
||||
|
||||
public MinecraftServicesAuthenticator() {
|
||||
this(
|
||||
new HttpClientRequester(
|
||||
arg -> Request.Post("https://api.minecraftservices.com/authentication/login_with_xbox")
|
||||
.bodyString(String.format(Locale.ROOT, "{\"identityToken\":\"XBL3.0 x=%s;%s\"}", ((XboxServiceAuthenticationResponse)arg).getUHS(), ((XboxServiceAuthenticationResponse)arg).getToken()), ContentType.APPLICATION_JSON)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
MinecraftServicesAuthenticator(Requester<XboxServiceAuthenticationResponse> requesterArg) {
|
||||
this(requesterArg, GsonParser.lowerCaseWithUnderscores(MinecraftServicesToken.class));
|
||||
}
|
||||
|
||||
MinecraftServicesAuthenticator(Requester<XboxServiceAuthenticationResponse> requesterArg, Parser<MinecraftServicesToken> parserArg) {
|
||||
super(LOGGER, requesterArg, parserArg);
|
||||
}
|
||||
|
||||
public MinecraftServicesToken minecraftServicesAuthenticate(XboxServiceAuthenticationResponse xboxServiceAuthenticationResponse) throws MinecraftServicesAuthenticationException, IOException {
|
||||
try {
|
||||
return this.requestAndParse(xboxServiceAuthenticationResponse);
|
||||
} catch (InvalidResponseException ex) {
|
||||
throw new MinecraftServicesAuthenticationException(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package cc.novoline.auth.minecraft.user.mcsauth;
|
||||
|
||||
import cc.novoline.auth.minecraft.user.preq.Validatable;
|
||||
import java.time.Instant;
|
||||
|
||||
public class MinecraftServicesToken implements Validatable {
|
||||
private final Instant createdAt;
|
||||
private String accessToken;
|
||||
private int expiresIn;
|
||||
|
||||
public MinecraftServicesToken(String text, int value) {
|
||||
this.accessToken = text;
|
||||
this.createdAt = Instant.now();
|
||||
this.expiresIn = value;
|
||||
}
|
||||
|
||||
public MinecraftServicesToken(String text, Instant instant) {
|
||||
this.accessToken = text;
|
||||
this.createdAt = instant.minusSeconds(3600L);
|
||||
this.expiresIn = 3600;
|
||||
}
|
||||
|
||||
public MinecraftServicesToken() {
|
||||
this.createdAt = Instant.now();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
} else if (obj != null && this.getClass() == obj.getClass()) {
|
||||
MinecraftServicesToken minecraftServicesToken = (MinecraftServicesToken)obj;
|
||||
return this.expiresIn == minecraftServicesToken.expiresIn && this.accessToken.equals(minecraftServicesToken.accessToken);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int intVal = this.accessToken.hashCode();
|
||||
return 31 * intVal + this.expiresIn;
|
||||
}
|
||||
|
||||
public String getAccessToken() {
|
||||
return this.accessToken;
|
||||
}
|
||||
|
||||
public int getExpiresIn() {
|
||||
return this.expiresIn;
|
||||
}
|
||||
|
||||
public Instant calculateExpiryTime() {
|
||||
return this.createdAt.plusSeconds(this.expiresIn);
|
||||
}
|
||||
|
||||
public boolean isExpired() {
|
||||
return Instant.now().isAfter(this.calculateExpiryTime());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MinecraftServicesToken{accessToken='" + this.accessToken + '\'' + ", expiresIn=" + this.expiresIn + '}';
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validate() {
|
||||
Validatable.notEmpty(this.accessToken, "accessToken");
|
||||
Validatable.notNegative(this.expiresIn, "expiresIn");
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package cc.novoline.auth.minecraft.user.oauth.exchange;
|
||||
|
||||
import cc.novoline.auth.minecraft.user.MinecraftAuthenticationException;
|
||||
|
||||
public class MicrosoftOAuthCodeExchangeException extends MinecraftAuthenticationException {
|
||||
public MicrosoftOAuthCodeExchangeException(Throwable throwable) {
|
||||
super(throwable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShortKey() {
|
||||
return "microsoft_oauth_code_exchange";
|
||||
}
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
package cc.novoline.auth.minecraft.user.oauth.exchange;
|
||||
|
||||
import cc.novoline.auth.minecraft.MicrosoftOAuthCodeExchanger;
|
||||
import cc.novoline.auth.minecraft.user.GsonParser;
|
||||
import cc.novoline.auth.minecraft.user.HttpClientRequester;
|
||||
import cc.novoline.auth.minecraft.user.MicrosoftOAuthToken;
|
||||
import org.apache.http.client.fluent.Form;
|
||||
import org.apache.http.client.fluent.Request;
|
||||
import org.apache.log4j.LogManager;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
public class MicrosoftOAuthCodeExchangerImpl extends MicrosoftOAuthCodeExchanger {
|
||||
private static final Logger LOGGER = LogManager.getLogger(MicrosoftOAuthCodeExchangerImpl.class);
|
||||
|
||||
public MicrosoftOAuthCodeExchangerImpl(String text, String str) {
|
||||
super(
|
||||
new HttpClientRequester(
|
||||
var2x -> Request.Post(str)
|
||||
.bodyForm(
|
||||
Form.form()
|
||||
.add("client_id", text)
|
||||
.add("code", ((cc.novoline.auth.minecraft.user.MicrosoftOAuthExchangeCode)var2x).getCode())
|
||||
.add("grant_type", "authorization_code")
|
||||
.add("redirect_uri", ((cc.novoline.auth.minecraft.user.MicrosoftOAuthExchangeCode)var2x).getRedirectUrl().getUrl().toString())
|
||||
.build()
|
||||
)
|
||||
),
|
||||
GsonParser.lowerCaseWithUnderscores(MicrosoftOAuthToken.class)
|
||||
);
|
||||
}
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
package cc.novoline.auth.minecraft.user.oauth.exchange;
|
||||
|
||||
import cc.novoline.auth.minecraft.MicrosoftOAuthCodeExchanger;
|
||||
import cc.novoline.auth.minecraft.user.GsonParser;
|
||||
import cc.novoline.auth.minecraft.user.HttpClientRequester;
|
||||
import cc.novoline.auth.minecraft.user.MicrosoftOAuthToken;
|
||||
import org.apache.http.client.fluent.Form;
|
||||
import org.apache.http.client.fluent.Request;
|
||||
import org.apache.log4j.LogManager;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
public class MicrosoftOAuthRefreshCodeExchangerIMpl extends MicrosoftOAuthCodeExchanger {
|
||||
private static final Logger LOGGER = LogManager.getLogger(MicrosoftOAuthRefreshCodeExchangerIMpl.class);
|
||||
|
||||
public MicrosoftOAuthRefreshCodeExchangerIMpl(String text, String str) {
|
||||
super(
|
||||
new HttpClientRequester(
|
||||
var2x -> Request.Post(str)
|
||||
.bodyForm(
|
||||
Form.form()
|
||||
.add("client_id", text)
|
||||
.add("refresh_token", ((cc.novoline.auth.minecraft.user.MicrosoftOAuthExchangeCode)var2x).getCode())
|
||||
.add("grant_type", "refresh_token")
|
||||
.add("redirect_uri", ((cc.novoline.auth.minecraft.user.MicrosoftOAuthExchangeCode)var2x).getRedirectUrl().getUrl().toString())
|
||||
.build()
|
||||
)
|
||||
),
|
||||
GsonParser.lowerCaseWithUnderscores(MicrosoftOAuthToken.class)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package cc.novoline.auth.minecraft.user.preq;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
|
||||
public class MinecraftOAuthProfile implements Validatable {
|
||||
private UUID id;
|
||||
private String name;
|
||||
|
||||
public MinecraftOAuthProfile(UUID uuid, String text) {
|
||||
this.id = uuid;
|
||||
this.name = text;
|
||||
}
|
||||
|
||||
public MinecraftOAuthProfile() {}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
} else if (obj != null && this.getClass() == obj.getClass()) {
|
||||
MinecraftOAuthProfile minecraftOAuthProfile = (MinecraftOAuthProfile)obj;
|
||||
return Objects.equals(this.id, minecraftOAuthProfile.id) && Objects.equals(this.name, minecraftOAuthProfile.name);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int intVal = this.id != null ? this.id.hashCode() : 0;
|
||||
return 31 * intVal + (this.name != null ? this.name.hashCode() : 0);
|
||||
}
|
||||
|
||||
public UUID getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MinecraftOAuthProfile{id='" + this.id + '\'' + ", name='" + this.name + '\'' + '}';
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validate() {
|
||||
Validatable.notNull(this.id, "id");
|
||||
Validatable.notEmpty(this.name, "name");
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package cc.novoline.auth.minecraft.user.preq;
|
||||
|
||||
import cc.novoline.auth.minecraft.user.MinecraftAuthenticationException;
|
||||
|
||||
public class MinecraftProfileRequestException extends MinecraftAuthenticationException {
|
||||
public MinecraftProfileRequestException(Throwable throwable) {
|
||||
super(throwable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShortKey() {
|
||||
return "minecraft_profile_request";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package cc.novoline.auth.minecraft.user.preq;
|
||||
|
||||
import cc.novoline.auth.minecraft.user.GsonParser;
|
||||
import cc.novoline.auth.minecraft.user.HttpClientRequester;
|
||||
import cc.novoline.auth.minecraft.user.InvalidResponseException;
|
||||
import cc.novoline.auth.minecraft.user.Parser;
|
||||
import cc.novoline.auth.minecraft.user.RequestAndParseStrategy;
|
||||
import cc.novoline.auth.minecraft.user.Requester;
|
||||
import cc.novoline.auth.minecraft.user.mcsauth.MinecraftServicesToken;
|
||||
import java.io.IOException;
|
||||
import org.apache.http.client.fluent.Request;
|
||||
import org.apache.log4j.LogManager;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
public class MinecraftProfileRequester extends RequestAndParseStrategy<MinecraftServicesToken, MinecraftOAuthProfile> {
|
||||
private static final Logger LOGGER = LogManager.getLogger(MinecraftProfileRequester.class);
|
||||
|
||||
public MinecraftProfileRequester() {
|
||||
this(
|
||||
new HttpClientRequester(
|
||||
arg -> Request.Get("https://api.minecraftservices.com/minecraft/profile").addHeader("Authorization", "Bearer " + ((MinecraftServicesToken)arg).getAccessToken())
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
MinecraftProfileRequester(Requester<MinecraftServicesToken> requesterArg) {
|
||||
this(requesterArg, GsonParser.withDashlessUUIDAdapter(MinecraftOAuthProfile.class));
|
||||
}
|
||||
|
||||
MinecraftProfileRequester(Requester<MinecraftServicesToken> requesterArg, Parser<MinecraftOAuthProfile> parserArg) {
|
||||
super(LOGGER, requesterArg, parserArg);
|
||||
}
|
||||
|
||||
public MinecraftOAuthProfile requestProfile(MinecraftServicesToken minecraftServicesToken) throws MinecraftProfileRequestException, IOException {
|
||||
try {
|
||||
return this.requestAndParse(minecraftServicesToken);
|
||||
} catch (InvalidResponseException ex) {
|
||||
throw new MinecraftProfileRequestException(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package cc.novoline.auth.minecraft.user.preq;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
public interface Validatable {
|
||||
static void notNull(Object obj, String text) {
|
||||
if (obj == null) {
|
||||
throw new NullPointerException(text);
|
||||
}
|
||||
}
|
||||
|
||||
static void notEmpty(String text, String str) {
|
||||
if (text == null) {
|
||||
throw new NullPointerException(str);
|
||||
}
|
||||
|
||||
if (StringUtils.isEmpty(text)) {
|
||||
throw new IllegalArgumentException("blank " + str);
|
||||
}
|
||||
}
|
||||
|
||||
static void notNegative(int value, String text) {
|
||||
if (value < 0) {
|
||||
throw new IllegalArgumentException("negative " + text);
|
||||
}
|
||||
}
|
||||
|
||||
void validate();
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package cc.novoline.auth.minecraft.user.xb;
|
||||
|
||||
import cc.novoline.auth.minecraft.user.GsonParser;
|
||||
import cc.novoline.auth.minecraft.user.Parser;
|
||||
import cc.novoline.auth.minecraft.user.RequestAndParseStrategy;
|
||||
import cc.novoline.auth.minecraft.user.Requester;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
public abstract class XboxServiceAuthStrategy extends RequestAndParseStrategy<String, XboxServiceAuthenticationResponse> {
|
||||
public XboxServiceAuthStrategy(Logger logger, Requester<String> requester) {
|
||||
this(logger, requester, createGsonParser());
|
||||
}
|
||||
|
||||
public XboxServiceAuthStrategy(Logger logger, Requester<String> requester, Parser<XboxServiceAuthenticationResponse> parser) {
|
||||
super(logger, requester, parser);
|
||||
}
|
||||
|
||||
public static GsonParser<XboxServiceAuthenticationResponse> createGsonParser() {
|
||||
return GsonParser.withDeserializer(XboxServiceAuthenticationResponse.class, new XboxServiceAuthenticationResponse.Deserializer());
|
||||
}
|
||||
}
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
package cc.novoline.auth.minecraft.user.xb;
|
||||
|
||||
import cc.novoline.auth.minecraft.user.preq.Validatable;
|
||||
import com.google.gson.JsonDeserializationContext;
|
||||
import com.google.gson.JsonDeserializer;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParseException;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.Objects;
|
||||
|
||||
public class XboxServiceAuthenticationResponse implements Validatable {
|
||||
private final String token;
|
||||
private final String uhs;
|
||||
|
||||
public XboxServiceAuthenticationResponse(String text, String str) {
|
||||
this.token = text;
|
||||
this.uhs = str;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
} else if (obj != null && this.getClass() == obj.getClass()) {
|
||||
XboxServiceAuthenticationResponse val = (XboxServiceAuthenticationResponse)obj;
|
||||
return Objects.equals(this.token, val.token) && Objects.equals(this.uhs, val.uhs);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int intVal = this.token != null ? this.token.hashCode() : 0;
|
||||
return 31 * intVal + (this.uhs != null ? this.uhs.hashCode() : 0);
|
||||
}
|
||||
|
||||
public String getToken() {
|
||||
return this.token;
|
||||
}
|
||||
|
||||
public String getUHS() {
|
||||
return this.uhs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "XboxServiceAuthenticationResponse{token='" + this.token + '\'' + ", uhs='" + this.uhs + '\'' + '}';
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validate() {
|
||||
Validatable.notEmpty(this.token, "token");
|
||||
Validatable.notEmpty(this.uhs, "uhs");
|
||||
}
|
||||
|
||||
public static class Deserializer implements JsonDeserializer<XboxServiceAuthenticationResponse> {
|
||||
public XboxServiceAuthenticationResponse deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) throws JsonParseException {
|
||||
JsonObject jsonObject = jsonElement.getAsJsonObject();
|
||||
return new XboxServiceAuthenticationResponse(
|
||||
jsonObject.get("Token").getAsString(),
|
||||
jsonObject.get("DisplayClaims").getAsJsonObject().get("xui").getAsJsonArray().get(0).getAsJsonObject().get("uhs").getAsString()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package cc.novoline.auth.minecraft.user.xb.auth;
|
||||
|
||||
import cc.novoline.auth.minecraft.user.MinecraftAuthenticationException;
|
||||
|
||||
public class XboxLiveAuthenticationException extends MinecraftAuthenticationException {
|
||||
public XboxLiveAuthenticationException(Throwable throwable) {
|
||||
super(throwable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShortKey() {
|
||||
return "xbox_live_authentication";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package cc.novoline.auth.minecraft.user.xb.auth;
|
||||
|
||||
import cc.novoline.auth.OAuthApplication;
|
||||
import cc.novoline.auth.minecraft.user.HttpClientRequester;
|
||||
import cc.novoline.auth.minecraft.user.InvalidResponseException;
|
||||
import cc.novoline.auth.minecraft.user.MicrosoftOAuthToken;
|
||||
import cc.novoline.auth.minecraft.user.Requester;
|
||||
import cc.novoline.auth.minecraft.user.xb.XboxServiceAuthStrategy;
|
||||
import cc.novoline.auth.minecraft.user.xb.XboxServiceAuthenticationResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.Locale;
|
||||
import org.apache.http.client.fluent.Request;
|
||||
import org.apache.http.entity.ContentType;
|
||||
import org.apache.log4j.LogManager;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
public class XboxLiveAuthenticator extends XboxServiceAuthStrategy {
|
||||
private static final Logger LOGGER = LogManager.getLogger(XboxLiveAuthenticator.class);
|
||||
|
||||
public XboxLiveAuthenticator(OAuthApplication oAuthApplication) {
|
||||
super(
|
||||
LOGGER,
|
||||
new HttpClientRequester(
|
||||
var1x -> Request.Post("https://user.auth.xboxlive.com/user/authenticate")
|
||||
.bodyString(
|
||||
String.format(
|
||||
Locale.ROOT,
|
||||
"{\"Properties\":{\"AuthMethod\":\"RPS\",\"SiteName\":\"user.auth.xboxlive.com\",\"RpsTicket\":\"%s\"},\"RelyingParty\":\"http://auth.xboxlive.com\",\"TokenType\":\"JWT\"}",
|
||||
(oAuthApplication.isUseWeirdXboxTokenPrefix() ? "d=" : "") + var1x
|
||||
),
|
||||
ContentType.APPLICATION_JSON
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
XboxLiveAuthenticator(Requester<String> requesterArg) {
|
||||
super(LOGGER, requesterArg);
|
||||
}
|
||||
|
||||
public XboxServiceAuthenticationResponse xboxLiveAuthenticate(String text) throws XboxLiveAuthenticationException, IOException {
|
||||
try {
|
||||
return this.requestAndParse(text);
|
||||
} catch (InvalidResponseException ex) {
|
||||
throw new XboxLiveAuthenticationException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
public XboxServiceAuthenticationResponse xboxLiveAuthenticate(MicrosoftOAuthToken microsoftOAuthToken) throws XboxLiveAuthenticationException, IOException {
|
||||
return this.xboxLiveAuthenticate(microsoftOAuthToken.getAccessToken());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package cc.novoline.auth.minecraft.user.xb.xsts;
|
||||
|
||||
public class ChildAccountException extends XSTSAuthenticationException {
|
||||
@Override
|
||||
public String getShortKey() {
|
||||
return super.getShortKey() + ".child_account";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package cc.novoline.auth.minecraft.user.xb.xsts;
|
||||
|
||||
public class NoXboxAccountException extends XSTSAuthenticationException {
|
||||
@Override
|
||||
public String getShortKey() {
|
||||
return super.getShortKey() + ".no_xbox_account";
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package cc.novoline.auth.minecraft.user.xb.xsts;
|
||||
|
||||
import cc.novoline.auth.minecraft.user.MinecraftAuthenticationException;
|
||||
|
||||
public class XSTSAuthenticationException extends MinecraftAuthenticationException {
|
||||
public XSTSAuthenticationException() {}
|
||||
|
||||
public XSTSAuthenticationException(Throwable throwable) {
|
||||
super(throwable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShortKey() {
|
||||
return "xsts_authentication";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package cc.novoline.auth.minecraft.user.xb.xsts;
|
||||
|
||||
import cc.novoline.auth.minecraft.user.HttpClientRequester;
|
||||
import cc.novoline.auth.minecraft.user.InvalidResponseException;
|
||||
import cc.novoline.auth.minecraft.user.InvalidStatusCodeException;
|
||||
import cc.novoline.auth.minecraft.user.Requester;
|
||||
import cc.novoline.auth.minecraft.user.xb.XboxServiceAuthStrategy;
|
||||
import cc.novoline.auth.minecraft.user.xb.XboxServiceAuthenticationResponse;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonPrimitive;
|
||||
import java.io.IOException;
|
||||
import java.util.Locale;
|
||||
import org.apache.http.client.fluent.Request;
|
||||
import org.apache.http.entity.ContentType;
|
||||
import org.apache.log4j.LogManager;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
public class XSTSAuthenticator extends XboxServiceAuthStrategy {
|
||||
private static final Logger LOGGER = LogManager.getLogger(XSTSAuthenticator.class);
|
||||
|
||||
public XSTSAuthenticator() {
|
||||
super(
|
||||
LOGGER,
|
||||
new HttpClientRequester(
|
||||
arg -> Request.Post("https://xsts.auth.xboxlive.com/xsts/authorize")
|
||||
.bodyString(
|
||||
String.format(
|
||||
Locale.ROOT,
|
||||
"{\"Properties\":{\"SandboxId\":\"RETAIL\",\"UserTokens\":[\"%s\"]},\"RelyingParty\": \"rp://api.minecraftservices.com/\",\"TokenType\": \"JWT\"}",
|
||||
arg
|
||||
),
|
||||
ContentType.APPLICATION_JSON
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
XSTSAuthenticator(Requester<String> requesterArg) {
|
||||
super(LOGGER, requesterArg);
|
||||
}
|
||||
|
||||
private static XSTSAuthenticationException parseXErr(JsonObject jsonObject) {
|
||||
if (jsonObject.has("XErr")) {
|
||||
JsonElement jsonElement = jsonObject.get("XErr");
|
||||
if (jsonElement instanceof JsonPrimitive) {
|
||||
String textStr = jsonElement.getAsString();
|
||||
switch (textStr) {
|
||||
case "2148916233":
|
||||
return new NoXboxAccountException();
|
||||
case "2148916238":
|
||||
return new ChildAccountException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public XboxServiceAuthenticationResponse xstsAuthenticate(String text) throws XSTSAuthenticationException, IOException {
|
||||
try {
|
||||
return this.requestAndParse(text);
|
||||
} catch (InvalidResponseException ex) {
|
||||
if (ex instanceof InvalidStatusCodeException && ((InvalidStatusCodeException)ex).getStatusCode() == 401) {
|
||||
JsonObject jsonObject = ex.getResponseAsJson();
|
||||
if (jsonObject != null) {
|
||||
XSTSAuthenticationException ex2 = parseXErr(jsonObject);
|
||||
if (ex2 != null) {
|
||||
throw ex2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
throw new XSTSAuthenticationException(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package cc.novoline.auth.minecraft.util;
|
||||
|
||||
import java.security.KeyManagementException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.SecureRandom;
|
||||
import java.security.cert.CertificateException;
|
||||
import java.security.cert.X509Certificate;
|
||||
import javax.net.ssl.HostnameVerifier;
|
||||
import javax.net.ssl.HttpsURLConnection;
|
||||
import javax.net.ssl.SSLContext;
|
||||
import javax.net.ssl.SSLSession;
|
||||
import javax.net.ssl.TrustManager;
|
||||
import javax.net.ssl.X509TrustManager;
|
||||
|
||||
public class SSLFix {
|
||||
public static void execute() {
|
||||
TrustManager[] trustManagerArr = new TrustManager[]{new X509TrustManager() {
|
||||
@Override
|
||||
public X509Certificate[] getAcceptedIssuers() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkClientTrusted(X509Certificate[] x509CertificateArr, String textStr) throws CertificateException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkServerTrusted(X509Certificate[] x509CertificateArr2, String textStr2) throws CertificateException {
|
||||
}
|
||||
}};
|
||||
SSLContext sSLContext = null;
|
||||
|
||||
try {
|
||||
sSLContext = SSLContext.getInstance("SSL");
|
||||
} catch (NoSuchAlgorithmException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
try {
|
||||
sSLContext.init(null, trustManagerArr, new SecureRandom());
|
||||
} catch (KeyManagementException ex2) {
|
||||
ex2.printStackTrace();
|
||||
}
|
||||
|
||||
HttpsURLConnection.setDefaultSSLSocketFactory(sSLContext.getSocketFactory());
|
||||
HostnameVerifier hostnameVerifier = new HostnameVerifier() {
|
||||
@Override
|
||||
public boolean verify(String textStr3, SSLSession sSLSession) {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
HttpsURLConnection.setDefaultHostnameVerifier(hostnameVerifier);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,353 @@
|
||||
package cc.novoline.auth.minecraft.util;
|
||||
|
||||
import cc.novoline.auth.minecraft.exceptions.ParseException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.CharBuffer;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
public class StringUtil {
|
||||
public static final String LINK_PATTERN = "<a style='color:#585858;' href='link'>link</a>";
|
||||
|
||||
public static String iconv(String text, String str, String value) {
|
||||
Charset charset = Charset.forName(text);
|
||||
Charset charset2 = Charset.forName(str);
|
||||
CharsetDecoder charsetDecoder = charset.newDecoder();
|
||||
CharsetEncoder charsetEncoder = charset2.newEncoder();
|
||||
|
||||
try {
|
||||
ByteBuffer byteBuffer = charsetEncoder.encode(CharBuffer.wrap(value));
|
||||
CharBuffer charBuffer = charsetDecoder.decode(byteBuffer);
|
||||
return charBuffer.toString();
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean parseBoolean(String text) throws ParseException {
|
||||
if (text == null) {
|
||||
throw new ParseException("String cannot be NULL!");
|
||||
} else if (text.equalsIgnoreCase("true")) {
|
||||
return true;
|
||||
} else if (text.equalsIgnoreCase("false")) {
|
||||
return false;
|
||||
} else {
|
||||
throw new ParseException("Cannot parse value (" + text + ")!");
|
||||
}
|
||||
}
|
||||
|
||||
public static int countLines(String text) {
|
||||
if (text != null && text.length() != 0) {
|
||||
int intVal = 1;
|
||||
int len = text.length();
|
||||
|
||||
for (int index = 0; index < len; index++) {
|
||||
char ch = text.charAt(index);
|
||||
if (ch == '\r') {
|
||||
intVal++;
|
||||
if (index + 1 < len && text.charAt(index + 1) == '\n') {
|
||||
index++;
|
||||
}
|
||||
} else if (ch == '\n') {
|
||||
intVal++;
|
||||
}
|
||||
}
|
||||
|
||||
return intVal;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static char lastChar(String text) {
|
||||
if (text == null) {
|
||||
throw new NullPointerException();
|
||||
} else {
|
||||
int len = text.length();
|
||||
if (len == 0) {
|
||||
return '\u0000';
|
||||
} else {
|
||||
return len == 1 ? text.charAt(0) : text.charAt(len - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static String randomizeWord(String text, boolean flag) {
|
||||
if (text == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
int len = text.length();
|
||||
if (len < 4) {
|
||||
return text;
|
||||
}
|
||||
|
||||
boolean[] boolArr = new boolean[len];
|
||||
if (flag) {
|
||||
boolArr[0] = true;
|
||||
}
|
||||
|
||||
boolean flag2 = !flag;
|
||||
char[] charArr = text.toCharArray();
|
||||
|
||||
for (int index = len - 1; index > -1; index--) {
|
||||
char ch = charArr[index];
|
||||
int intVal = Character.getType(ch);
|
||||
boolean flag3 = intVal == 1 || intVal == 2;
|
||||
boolArr[index] |= !flag3;
|
||||
if (flag3 && !flag2) {
|
||||
boolArr[index] = true;
|
||||
flag2 = true;
|
||||
}
|
||||
}
|
||||
|
||||
for (int index2 = 0; index2 < len; index2++) {
|
||||
if (!boolArr[index2]) {
|
||||
int intVal2 = index2;
|
||||
int intVal3 = 0;
|
||||
|
||||
while (intVal3 < 3) {
|
||||
intVal3++;
|
||||
intVal2 = new Random().nextInt(len);
|
||||
if (!boolArr[intVal2]) {
|
||||
intVal3 = 10;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (intVal3 == 10) {
|
||||
char ch2 = charArr[index2];
|
||||
char ch3 = charArr[intVal2];
|
||||
charArr[index2] = ch3;
|
||||
charArr[intVal2] = ch2;
|
||||
boolArr[index2] = true;
|
||||
boolArr[intVal2] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new String(charArr);
|
||||
}
|
||||
|
||||
public static String randomizeWord(String text) {
|
||||
return randomizeWord(text, true);
|
||||
}
|
||||
|
||||
public static String randomize(String text, boolean flag) {
|
||||
if (text == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (text.isEmpty()) {
|
||||
return text;
|
||||
}
|
||||
|
||||
String[] stringArr = text.split("\n");
|
||||
StringBuilder sb = new StringBuilder();
|
||||
boolean flag2 = true;
|
||||
String[] stringArr2 = stringArr;
|
||||
int len = stringArr.length;
|
||||
|
||||
for (int index = 0; index < len; index++) {
|
||||
String textStr = stringArr2[index];
|
||||
String[] stringArr3 = textStr.split(" ");
|
||||
StringBuilder sb2 = new StringBuilder();
|
||||
boolean flag3 = true;
|
||||
String[] stringArr4 = stringArr3;
|
||||
int len2 = stringArr3.length;
|
||||
|
||||
for (int index2 = 0; index2 < len2; index2++) {
|
||||
String textStr2 = stringArr4[index2];
|
||||
if (flag3) {
|
||||
flag3 = false;
|
||||
} else {
|
||||
sb2.append(' ');
|
||||
}
|
||||
|
||||
sb2.append(randomizeWord(textStr2));
|
||||
}
|
||||
|
||||
if (flag2) {
|
||||
flag2 = false;
|
||||
} else {
|
||||
sb.append('\n');
|
||||
}
|
||||
|
||||
sb.append(sb2);
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static String randomize(String text) {
|
||||
return randomize(text, true);
|
||||
}
|
||||
|
||||
public static boolean isHTML(char[] charArray) {
|
||||
if (charArray != null && charArray.length >= 6 && charArray[0] == '<' && charArray[5] == '>') {
|
||||
String textStr = new String(charArray, 1, 4);
|
||||
return textStr.equalsIgnoreCase("html");
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static String wrap(char[] charArray, int value, boolean flag, boolean enabled) {
|
||||
if (charArray == null) {
|
||||
throw new NullPointerException("sequence");
|
||||
}
|
||||
|
||||
if (value < 1) {
|
||||
throw new IllegalArgumentException("maxChars < 1");
|
||||
}
|
||||
|
||||
enabled = enabled && isHTML(charArray);
|
||||
String textStr = enabled ? "<br />" : "\n";
|
||||
StringBuilder sb = new StringBuilder();
|
||||
int len = charArray.length;
|
||||
int intVal = value;
|
||||
boolean flag2 = false;
|
||||
boolean flag3 = false;
|
||||
|
||||
for (int index = 0; index < len; index++) {
|
||||
char ch = charArray[index];
|
||||
if (ch == '<' && enabled) {
|
||||
flag2 = true;
|
||||
flag3 = true;
|
||||
} else if (flag2) {
|
||||
if (ch == '>') {
|
||||
flag2 = false;
|
||||
}
|
||||
|
||||
flag3 = true;
|
||||
}
|
||||
|
||||
if (flag3) {
|
||||
flag3 = false;
|
||||
sb.append(ch);
|
||||
} else {
|
||||
intVal--;
|
||||
if (charArray[index] != '\n' && (intVal >= 1 || ch != ' ')) {
|
||||
if (lookForward(charArray, index, textStr)) {
|
||||
intVal = value;
|
||||
}
|
||||
|
||||
sb.append(ch);
|
||||
if (intVal <= 0 && flag) {
|
||||
intVal = value;
|
||||
sb.append(textStr);
|
||||
}
|
||||
} else {
|
||||
intVal = value;
|
||||
sb.append(textStr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private static boolean lookForward(char[] charArray, int value, CharSequence charSequence) {
|
||||
if (charArray == null) {
|
||||
throw new NullPointerException("char array");
|
||||
}
|
||||
|
||||
if (value < 0) {
|
||||
throw new IllegalArgumentException("caret < 0");
|
||||
}
|
||||
|
||||
if (value >= charArray.length) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int len = charSequence.length();
|
||||
int len2 = charArray.length - value;
|
||||
if (len < len2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int index = 0; index < len; index++) {
|
||||
if (charArray[value + index] != charSequence.charAt(index)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static String wrap(String text, int value, boolean flag, boolean enabled) {
|
||||
return wrap(text.toCharArray(), value, flag, enabled);
|
||||
}
|
||||
|
||||
public static String wrap(char[] charArray, int value, boolean flag) {
|
||||
return wrap(charArray, value, flag, true);
|
||||
}
|
||||
|
||||
public static String wrap(char[] charArray, int value) {
|
||||
return wrap(charArray, value, false);
|
||||
}
|
||||
|
||||
public static String wrap(String text, int value) {
|
||||
return wrap(text.toCharArray(), value);
|
||||
}
|
||||
|
||||
public static String cut(String text, int value) {
|
||||
if (text == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
int len = text.length();
|
||||
if (len <= value) {
|
||||
return text;
|
||||
}
|
||||
|
||||
String[] stringArr = text.split(" ");
|
||||
String textStr = "";
|
||||
int intVal = value + 1;
|
||||
|
||||
for (int index = 0; index < stringArr.length; index++) {
|
||||
String textStr2 = stringArr[index];
|
||||
int len2 = textStr2.length();
|
||||
if (len2 >= intVal) {
|
||||
if (index == 0) {
|
||||
textStr = textStr + " " + textStr2.substring(0, intVal - 1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
textStr = textStr + " " + textStr2;
|
||||
intVal -= len2 + 1;
|
||||
}
|
||||
|
||||
return textStr.length() == 0 ? "" : textStr.substring(1) + "...";
|
||||
}
|
||||
|
||||
public static String requireNotBlank(String text, String str) {
|
||||
if (text == null) {
|
||||
throw new NullPointerException(str);
|
||||
} else if (StringUtils.isBlank(text)) {
|
||||
throw new IllegalArgumentException(str);
|
||||
} else {
|
||||
return text;
|
||||
}
|
||||
}
|
||||
|
||||
public static String getLink(String text) {
|
||||
return "<a style='color:#585858;' href='link'>link</a>".replaceAll("link", text);
|
||||
}
|
||||
|
||||
public static String convertListToString(String text, List list) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
for (String textStr : (List<String>)list) {
|
||||
sb.append(textStr).append(text);
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,355 @@
|
||||
package cc.novoline.commands;
|
||||
|
||||
|
||||
import cc.novoline.utils.messages.MessageMessage;
|
||||
import cc.novoline.Novoline;
|
||||
import cc.novoline.utils.lazy.LazySupplier;
|
||||
import cc.novoline.utils.messages.ChatComponentBase;
|
||||
import cc.novoline.utils.messages.FormattedMessage;
|
||||
import cc.novoline.utils.messages.CommandUsageMessage;
|
||||
import cc.novoline.utils.messages.TextMessage;
|
||||
import cc.novoline.utils.notifications.NotificationManager;
|
||||
import cc.novoline.utils.notifications.NotificationType;
|
||||
import com.google.common.collect.Lists;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.Collector;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import net.minecraft.command.NumberInvalidException;
|
||||
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.EntityPlayerSP;
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.CommandException;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.IChatComponent;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public abstract class NovoCommand extends CommandBase {
|
||||
public LazySupplier<Minecraft> mcSupplier;
|
||||
public final List<String> stringList;
|
||||
public final String commandSummary;
|
||||
public static final TextMessage PREFIX;
|
||||
private static Object[] objectArray;
|
||||
public static final IChatComponent EMPTY_COMPONENT = new ChatComponentText("");
|
||||
|
||||
static {
|
||||
String textStr = "Novoline";
|
||||
EnumChatFormatting enumChatFormatting = EnumChatFormatting.LIGHT_PURPLE;
|
||||
PREFIX = TextMessage.resolveTextMessage2(textStr, enumChatFormatting).a(" \u00bb ", EnumChatFormatting.GRAY);
|
||||
resolveDouble((Object[])null);
|
||||
}
|
||||
public final LazySupplier<EntityPlayerSP> lazySupplier;
|
||||
public final String textValue;
|
||||
public final Novoline novoline2;
|
||||
|
||||
public void updateState(@Nullable TextMessage textMessage, boolean flag) {
|
||||
EntityPlayerSP player;
|
||||
Object obj;
|
||||
label26: {
|
||||
player = this.lazySupplier.get();
|
||||
Object obj2 = textMessage;
|
||||
if (textMessage != null) {
|
||||
if (flag) {
|
||||
obj = textMessage.a(PREFIX);
|
||||
break label26;
|
||||
}
|
||||
|
||||
obj = textMessage;
|
||||
break label26;
|
||||
}
|
||||
|
||||
obj2 = EMPTY_COMPONENT;
|
||||
|
||||
obj = obj2;
|
||||
}
|
||||
|
||||
player.addChatComponentMessage((IChatComponent)obj);
|
||||
}
|
||||
|
||||
public void applyString3(@Nullable String text) {
|
||||
this.sendClientMessage(TextMessage.b(text));
|
||||
}
|
||||
|
||||
public void sendPacket(Packet packet) {
|
||||
Minecraft mcClient = this.mcSupplier.get();
|
||||
mcClient.getNetHandler().addToSendQueue(packet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void processCommand(ICommandSender sender, String[] args) throws CommandException {
|
||||
String[] stringArr = args;
|
||||
|
||||
try {
|
||||
String[] stringArr2 = stringArr;
|
||||
this.sendLines(stringArr2);
|
||||
} catch (CommandException ex) {
|
||||
Logger log = this.getLogger2();
|
||||
log.warn(ex);
|
||||
throw ex;
|
||||
} catch (Throwable ex2) {
|
||||
Logger log2 = this.getLogger2();
|
||||
log2.warn(ex2);
|
||||
ex2.printStackTrace();
|
||||
throw new CommandException("Unexpected error occurred while executing command", ex2);
|
||||
}
|
||||
}
|
||||
|
||||
public double resolveDouble(String text) throws NumberInvalidException {
|
||||
try {
|
||||
return Double.parseDouble(text);
|
||||
} catch (NumberFormatException ex) {
|
||||
StringBuilder sb = new StringBuilder().append(text);
|
||||
throw new NumberInvalidException(sb.append(" is not a valid number").toString());
|
||||
}
|
||||
}
|
||||
|
||||
public void updateState2(@NotNull String text, int value, @Nullable NotificationType notificationType) {
|
||||
Novoline novolineInst = Novoline.getInstance();
|
||||
NotificationManager notifManager = novolineInst.getNotificationManager();
|
||||
notifManager.pop(text, value, notificationType);
|
||||
}
|
||||
|
||||
public Logger getLogger2() {
|
||||
return Novoline.getLogger();
|
||||
}
|
||||
|
||||
public NovoCommand(@NotNull Novoline novoline, @NotNull String text, @Nullable String str, @Nullable String value) {
|
||||
this(novoline, text, str, value != null ? Collections.singleton(value) : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int getRequiredPermissionLevel() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean canCommandSenderUseCommand(ICommandSender sender) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void applyString4(@NotNull String text) {
|
||||
this.updateState3(text, 2000);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public List<String> resolveDouble(String[] args) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void sendClientMessage(@Nullable TextMessage textMessage) {
|
||||
this.updateState(textMessage, false);
|
||||
}
|
||||
|
||||
public static void resolveDouble(Object[] flowGuardArray) {
|
||||
objectArray = flowGuardArray;
|
||||
}
|
||||
|
||||
public void updateState(@Nullable String text, boolean flag) {
|
||||
this.updateState(TextMessage.b(text), flag);
|
||||
}
|
||||
|
||||
public void updateState(@NotNull String text, @Nullable NotificationType notificationType) {
|
||||
this.updateState2(text, 2000, notificationType);
|
||||
}
|
||||
|
||||
public List<String> updateState2(@NotNull Stream<String> stream, @NotNull String text, boolean flag) {
|
||||
if (flag) {
|
||||
Locale locale = Locale.ROOT;
|
||||
String lowerStr = text.toLowerCase(locale);
|
||||
Function<java.lang.String, java.lang.String> mapper = (String textStr) -> textStr.toLowerCase(Locale.ROOT);
|
||||
Stream stream2 = stream.map(mapper);
|
||||
Predicate<java.lang.String> predicate = (textStr2) -> textStr2.startsWith(lowerStr);
|
||||
stream2 = stream2.filter(predicate);
|
||||
Supplier supplier = ObjectArrayList::new;
|
||||
Collector collector = Collectors.toCollection(supplier);
|
||||
return (java.util.List<java.lang.String>) stream2.collect(collector);
|
||||
} else {
|
||||
Predicate<java.lang.String> predicate2 = ((java.util.function.Predicate<java.lang.String>) (textStr3) -> textStr3.startsWith(text));
|
||||
Stream stream3 = stream.filter(predicate2);
|
||||
Supplier supplier2 = ObjectArrayList::new;
|
||||
Collector collector2 = Collectors.toCollection(supplier2);
|
||||
return (java.util.List<java.lang.String>) stream3.collect(collector2);
|
||||
}
|
||||
}
|
||||
|
||||
private EntityPlayerSP lambdaImpl$new$0() {
|
||||
return this.mcSupplier.get().thePlayer;
|
||||
}
|
||||
|
||||
public void applyString5(@NotNull String text) {
|
||||
this.updateState2(text, 2000, NotificationType.INFO);
|
||||
}
|
||||
|
||||
public void applyString6(@NotNull String text) {
|
||||
this.applyUpdate(text, 2000);
|
||||
}
|
||||
|
||||
public void updateState3(@NotNull String text, int value) {
|
||||
this.updateState2(text, value, NotificationType.ERROR);
|
||||
}
|
||||
|
||||
public List<String> updateState2(@NotNull Collection<String> collection, @NotNull String text, boolean flag) {
|
||||
return this.updateState2(collection.stream(), text, flag);
|
||||
}
|
||||
|
||||
public void performAction() {
|
||||
EntityPlayerSP player = this.lazySupplier.get();
|
||||
ChatComponentBase chatComponentBase = MessageMessage.obtainMessageMessage();
|
||||
player.addChatComponentMessage(chatComponentBase);
|
||||
}
|
||||
|
||||
public void updateState(@NotNull String text, @NotNull String str) {
|
||||
this.sendClientMessage(CommandUsageMessage.of(text, str));
|
||||
}
|
||||
|
||||
public void applyUpdate(@NotNull String text, int value) {
|
||||
this.updateState2(text, value, NotificationType.WARNING);
|
||||
}
|
||||
|
||||
public void updateState4(@NotNull String text, @NotNull String str, int value, NotificationType notificationType) {
|
||||
NotificationManager notifManager = this.novoline2.getNotificationManager();
|
||||
notifManager.pop(text, str, value, notificationType);
|
||||
}
|
||||
|
||||
public NovoCommand(@NotNull Novoline novoline, @NotNull String text) {
|
||||
this(novoline, text, null, (Iterable<String>)null);
|
||||
}
|
||||
|
||||
public int calculateInt(String text) throws NumberInvalidException {
|
||||
try {
|
||||
return Integer.parseInt(text);
|
||||
} catch (NumberFormatException ex) {
|
||||
StringBuilder sb = new StringBuilder().append(text);
|
||||
throw new NumberInvalidException(sb.append(" is not a valid number").toString());
|
||||
}
|
||||
}
|
||||
|
||||
public LazySupplier<Minecraft> getMcSupplier() {
|
||||
return this.mcSupplier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final String getCommandName() {
|
||||
return this.textValue;
|
||||
}
|
||||
|
||||
public NovoCommand(@NotNull Novoline novoline, @NotNull String text, @Nullable String str) {
|
||||
this(novoline, text, null, str != null ? Collections.singleton(str) : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final List<String> getCommandAliases() {
|
||||
return this.stringList;
|
||||
}
|
||||
|
||||
public Novoline getNovoline() {
|
||||
return this.novoline2;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public final String getCommandUsage(ICommandSender sender) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Object[] obtainObjectArray() {
|
||||
return objectArray;
|
||||
}
|
||||
|
||||
public void updateState(@Nullable String text, @NotNull EnumChatFormatting enumChatFormatting) {
|
||||
TextMessage textMessage = TextMessage.b(text);
|
||||
textMessage.resolveChatComponent(enumChatFormatting);
|
||||
this.sendClientMessage(textMessage);
|
||||
}
|
||||
|
||||
public void updateState(@NotNull String text, int value) {
|
||||
this.updateState2(text, value, NotificationType.INFO);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public final List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) {
|
||||
return this.resolveDouble(args);
|
||||
}
|
||||
|
||||
public NovoCommand(@NotNull Novoline novoline, @NotNull String text, @Nullable Iterable<String> iterable) {
|
||||
this(novoline, text, null, iterable);
|
||||
}
|
||||
|
||||
public NovoCommand(@NotNull Novoline novoline, @NotNull String text, @Nullable String str, @Nullable Iterable<String> iterable) {
|
||||
String textStr;
|
||||
List itemList;
|
||||
label19: {
|
||||
this.mcSupplier = LazySupplier.resolveLazySupplier3(Minecraft::getMinecraft);
|
||||
this.lazySupplier = LazySupplier.resolveLazySupplier3(this::lambdaImpl$new$0);
|
||||
this.novoline2 = novoline;
|
||||
textStr = "";
|
||||
this.textValue = text;
|
||||
this.commandSummary = str;
|
||||
Iterable iterable2 = iterable;
|
||||
if (textStr != null) {
|
||||
if (iterable == null) {
|
||||
itemList = Collections.emptyList();
|
||||
break label19;
|
||||
}
|
||||
|
||||
iterable2 = iterable;
|
||||
}
|
||||
|
||||
itemList = Lists.newArrayList(iterable2);
|
||||
}
|
||||
|
||||
this.stringList = itemList;
|
||||
}
|
||||
|
||||
public void sendLines(String[] args) throws CommandException, IOException {
|
||||
long longVal = 4046879720664L;
|
||||
this.updateState2((char)(int)(longVal >>> 48), longVal << 16 >>> 16, args);
|
||||
}
|
||||
|
||||
public void updateState2(char ch, long time, String[] args) throws CommandException, IOException {}
|
||||
|
||||
@Override
|
||||
public final boolean isUsernameIndex(String[] args, int value) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void updateState2(@NotNull String text, @NotNull String str, @NotNull CommandUsageMessage... formattedMessage3Array) {
|
||||
this.updateState(FormattedMessage.resolveFormattedMessage(text, str, formattedMessage3Array), true);
|
||||
}
|
||||
|
||||
public void handleObject(@Nullable Object obj) {
|
||||
String textStr;
|
||||
label15: {
|
||||
Object obj2 = obj;
|
||||
if (obj == null) {
|
||||
textStr = null;
|
||||
break label15;
|
||||
}
|
||||
|
||||
obj2 = obj;
|
||||
|
||||
textStr = obj2.toString();
|
||||
}
|
||||
|
||||
this.applyString3(textStr);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package cc.novoline.commands;
|
||||
|
||||
import cc.novoline.Novoline;
|
||||
import cc.novoline.commands.util.CommandPrefixHolder;
|
||||
import net.minecraft.command.CommandHandler;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class NovoCommandHandler extends CommandHandler {
|
||||
public NovoCommandHandler(@NotNull Novoline novoline) {
|
||||
super(CommandPrefixHolder.textValue);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package cc.novoline.commands.impl;
|
||||
|
||||
import cc.novoline.Novoline;
|
||||
import cc.novoline.commands.NovoCommand;
|
||||
import cc.novoline.utils.StringScrambler;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import net.minecraft.client.entity.EntityPlayerSP;
|
||||
import net.minecraft.command.CommandException;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class AutoRegisterCommand extends NovoCommand {
|
||||
public AutoRegisterCommand(@NotNull Novoline novoline, String text, List<String> list) {
|
||||
super(novoline, text, list);
|
||||
}
|
||||
|
||||
public void updateState2(char ch, long time, String[] args) throws CommandException, IOException {
|
||||
List itemList = StringScrambler.resolveList("", 1, 8);
|
||||
String textStr = (String)itemList.get(0);
|
||||
EntityPlayerSP player = this.mcSupplier.get().thePlayer;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb = sb.append("/reg ").append(textStr);
|
||||
sb = sb.append(" ");
|
||||
String textStr2 = sb.append(textStr).toString();
|
||||
player.sendChatMessage(textStr2);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,201 @@
|
||||
package cc.novoline.commands.impl;
|
||||
import cc.novoline.Novoline;
|
||||
import cc.novoline.commands.NovoCommand;
|
||||
import cc.novoline.modules.AbstractModule;
|
||||
import cc.novoline.modules.binds.KeyboardKeybind;
|
||||
import cc.novoline.modules.binds.ModuleKeybind;
|
||||
import cc.novoline.utils.messages.CommandUsageMessage;
|
||||
import cc.novoline.utils.messages.TextMessage;
|
||||
import cc.novoline.modules.configurations.holder.ModuleHolder;
|
||||
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectCollection;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Stream;
|
||||
import cc.novoline.modules.ModuleArrayMap;
|
||||
import cc.novoline.modules.ModuleManager;
|
||||
|
||||
|
||||
import net.optifine.FieldReflectionAccess;
|
||||
import cc.novoline.modules.binds.ModuleKeybindImpl;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
public final class BindCommand extends NovoCommand {
|
||||
private static final Map<String, Integer> entryMap = new Object2ObjectOpenHashMap<>();
|
||||
|
||||
public void updateState(@NotNull AbstractModule module, ModuleKeybind moduleKeybind) {
|
||||
module.handleModuleKeybind(moduleKeybind);
|
||||
ModuleManager modManager = this.novoline2.getModuleManager();
|
||||
modManager.getBindManager().isReadyState();
|
||||
}
|
||||
|
||||
public void updateState2(char ch, long time, String[] args) {
|
||||
StringBuilder sb = null;
|
||||
byte byteVal = (byte)(true ? 1 : 0);
|
||||
String[] stringArr = args;
|
||||
byte byteVal2 = byteVal;
|
||||
if (time > 0L) {
|
||||
if (byteVal != 0) {
|
||||
if (args.length < 2) {
|
||||
String textStr = "Binds help:";
|
||||
String textStr7 = ".bind";
|
||||
CommandUsageMessage[] commandUsageMessageArr = new CommandUsageMessage[1];
|
||||
commandUsageMessageArr[0] = CommandUsageMessage.of("(module) (key)", "sets keyBind to module");
|
||||
this.updateState2(textStr, textStr7, commandUsageMessageArr);
|
||||
this.performAction();
|
||||
String textStr2 = "TIP: ";
|
||||
EnumChatFormatting enumChatFormatting = EnumChatFormatting.GRAY;
|
||||
this.sendClientMessage(TextMessage.resolveTextMessage2(textStr2, enumChatFormatting).a("Use ").a("\"none\"", EnumChatFormatting.YELLOW).a(" to unbind!"));
|
||||
return;
|
||||
}
|
||||
|
||||
stringArr = args;
|
||||
}
|
||||
|
||||
byteVal2 = 0;
|
||||
}
|
||||
|
||||
String textStr3 = stringArr[byteVal2];
|
||||
String textStr4 = args[1];
|
||||
Locale locale = Locale.ROOT;
|
||||
String textStr5 = textStr4.toUpperCase(locale);
|
||||
Map itemMap = entryMap;
|
||||
Integer intVal = (Integer)itemMap.getOrDefault(textStr5, null);
|
||||
if (byteVal != 0) {
|
||||
if (intVal != null) {
|
||||
Novoline novolineInst = this.novoline2;
|
||||
ModuleManager modManager = novolineInst.getModuleManager();
|
||||
AbstractModule mod = modManager.getByName(textStr3);
|
||||
if (byteVal != 0) {
|
||||
if (mod != null) {
|
||||
label53: {
|
||||
Object obj;
|
||||
label52: {
|
||||
int intVal2 = intVal;
|
||||
if (byteVal != 0) {
|
||||
if (intVal2 >= 0) {
|
||||
int intVal3 = intVal;
|
||||
obj = KeyboardKeybind.of(intVal3);
|
||||
if (ch < 0) {
|
||||
break label53;
|
||||
}
|
||||
|
||||
if (byteVal != 0) {
|
||||
break label52;
|
||||
}
|
||||
}
|
||||
|
||||
intVal2 = -intVal;
|
||||
}
|
||||
|
||||
obj = ModuleKeybindImpl.applyUpdate(intVal2);
|
||||
}
|
||||
|
||||
this.updateState(mod, (ModuleKeybind)obj);
|
||||
}
|
||||
|
||||
String textStr6;
|
||||
label42: {
|
||||
StringBuilder sb2 = new StringBuilder();
|
||||
textStr6 = "Module ";
|
||||
StringBuilder sb3 = sb2.append(textStr6);
|
||||
textStr6 = mod.getDisplayName();
|
||||
sb = sb3.append(textStr6);
|
||||
if (time >= 0L) {
|
||||
textStr6 = " was ";
|
||||
if (byteVal == 0) {
|
||||
break label42;
|
||||
}
|
||||
|
||||
sb = sb.append(textStr6);
|
||||
}
|
||||
|
||||
if (intVal != 0) {
|
||||
StringBuilder sb5 = new StringBuilder().append("bound to ");
|
||||
textStr6 = sb5.append(textStr5).toString();
|
||||
} else {
|
||||
textStr6 = "unbound";
|
||||
}
|
||||
}
|
||||
|
||||
this.applyString5(sb.append(textStr6).toString());
|
||||
return;
|
||||
}
|
||||
|
||||
StringBuilder sb8 = new StringBuilder().append("Module ").append(textStr3);
|
||||
this.applyString4(sb8.append(" not found!").toString());
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
this.applyString4("Key was not found!");
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
Map itemMap = entryMap;
|
||||
String textStr = "MOUSE4";
|
||||
Integer intVal = -4;
|
||||
itemMap.put(textStr, intVal);
|
||||
itemMap = entryMap;
|
||||
textStr = "MOUSE3";
|
||||
intVal = -3;
|
||||
itemMap.put(textStr, intVal);
|
||||
|
||||
try {
|
||||
BindCommand.<IllegalAccessException>$keepCatch();
|
||||
for (Field index : Keyboard.class.getFields()) {
|
||||
String textStr2 = index.getName();
|
||||
if (textStr2.startsWith("KEY_")) {
|
||||
FieldReflectionAccess.updateState(index, true);
|
||||
itemMap = entryMap;
|
||||
textStr = index.getName();
|
||||
textStr = textStr.substring(4);
|
||||
Locale locale = Locale.ROOT;
|
||||
textStr = textStr.toUpperCase(locale);
|
||||
intVal = (Integer)FieldReflectionAccess.updateState(index, (Object)null);
|
||||
int intVal2 = intVal;
|
||||
Integer intVal3 = intVal2;
|
||||
itemMap.put(textStr, intVal3);
|
||||
}
|
||||
}
|
||||
} catch (IllegalAccessException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public BindCommand(@NotNull Novoline novoline, String text, String str, List<String> list) {
|
||||
super(novoline, text, str, list);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public List<String> resolveDouble(@NotNull String[] args) {
|
||||
switch (args.length) {
|
||||
case 1:
|
||||
ModuleManager modManager = this.novoline2.getModuleManager();
|
||||
ModuleArrayMap moduleArrayMap = modManager.getModules();
|
||||
ObjectCollection objectCollection = moduleArrayMap.values();
|
||||
Stream stream2 = objectCollection.stream();
|
||||
Function mapper = ((java.util.function.Function<cc.novoline.modules.configurations.holder.ModuleHolder, cc.novoline.modules.AbstractModule>) ModuleHolder::getModule);
|
||||
stream2 = stream2.map(mapper);
|
||||
mapper = ((java.util.function.Function<cc.novoline.modules.AbstractModule, java.lang.String>) AbstractModule::getName);
|
||||
return this.updateState2(stream2.map(mapper), args[0], true);
|
||||
case 2:
|
||||
Map itemMap = entryMap;
|
||||
return this.updateState2(itemMap.keySet(), args[1], true);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
private static <E extends Throwable> void $keepCatch() throws E {}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package cc.novoline.commands.impl;
|
||||
|
||||
import cc.novoline.Novoline;
|
||||
import cc.novoline.commands.NovoCommand;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import net.minecraft.command.CommandException;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
public class ConfigAliasCommand extends NovoCommand {
|
||||
public ConfigAliasCommand(@NonNull Novoline novoline, String text, List<String> list) {
|
||||
super(novoline, text, list);
|
||||
}
|
||||
|
||||
public void updateState2(char ch, long time, String[] args) throws CommandException, IOException {}
|
||||
}
|
||||
@@ -0,0 +1,948 @@
|
||||
package cc.novoline.commands.impl;
|
||||
import cc.novoline.Novoline;
|
||||
import cc.novoline.commands.NovoCommand;
|
||||
import cc.novoline.commands.util.ConfigCommandException;
|
||||
import cc.novoline.commands.util.ConfigReadWriteException;
|
||||
import cc.novoline.modules.EnumModuleType;
|
||||
import cc.novoline.modules.configurations.ConfigManager;
|
||||
import cc.novoline.utils.messages.CommandUsageMessage;
|
||||
import cc.novoline.utils.messages.TextMessage;
|
||||
import cc.novoline.utils.notifications.NotificationManager;
|
||||
import cc.novoline.utils.notifications.NotificationType;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
import cc.novoline.modules.ModuleManager;
|
||||
import ninja.leaping.configurate.objectmapping.ObjectMappingException;
|
||||
|
||||
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
public final class ConfigCommand extends NovoCommand {
|
||||
public static String textValue2 = "";
|
||||
|
||||
public static void executeConfigManager(@NonNull ConfigManager configManager, @NonNull String text) {
|
||||
boolean flag = true;
|
||||
boolean empty = text.trim().isEmpty();
|
||||
if (!flag) {
|
||||
try {
|
||||
ConfigCommand.<ConfigReadWriteException>$keepCatch();
|
||||
ConfigCommand.<IOException>$keepCatch();
|
||||
ConfigCommand.<ObjectMappingException>$keepCatch();
|
||||
Novoline novolineInst = Novoline.getInstance();
|
||||
NotificationManager notifManager = novolineInst.getNotificationManager();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb = sb.append("Saved config ").append(text);
|
||||
String textStr = sb.append("!").toString();
|
||||
NotificationType notificationType = NotificationType.SUCCESS;
|
||||
notifManager.pop(textStr, 2000, notificationType);
|
||||
} catch (ConfigReadWriteException ex) {
|
||||
Logger log = Novoline.getLogger();
|
||||
String textStr2 = "An I/O error occurred while reading config!";
|
||||
log.warn(textStr2, ex);
|
||||
Novoline novolineInst2 = Novoline.getInstance();
|
||||
NotificationManager notifManager2 = novolineInst2.getNotificationManager();
|
||||
textStr2 = "Cannot read config!";
|
||||
NotificationType notificationType2 = NotificationType.ERROR;
|
||||
notifManager2.pop(textStr2, 2000, notificationType2);
|
||||
} catch (IOException ex2) {
|
||||
Logger log2 = Novoline.getLogger();
|
||||
String textStr3 = "An I/O error occurred while saving config!";
|
||||
log2.warn(textStr3, ex2);
|
||||
Novoline novolineInst3 = Novoline.getInstance();
|
||||
NotificationManager notifManager3 = novolineInst3.getNotificationManager();
|
||||
textStr3 = "Cannot save config!";
|
||||
NotificationType notificationType3 = NotificationType.ERROR;
|
||||
notifManager3.pop(textStr3, 2000, notificationType3);
|
||||
} catch (ObjectMappingException ex3) {
|
||||
Logger log3 = Novoline.getLogger();
|
||||
String textStr4 = "An I/O error occurred while serializing config!";
|
||||
log3.warn(textStr4, ex3);
|
||||
Novoline novolineInst4 = Novoline.getInstance();
|
||||
NotificationManager notifManager4 = novolineInst4.getNotificationManager();
|
||||
textStr4 = "Cannot save config!";
|
||||
NotificationType notificationType4 = NotificationType.ERROR;
|
||||
notifManager4.pop(textStr4, 2000, notificationType4);
|
||||
} catch (Throwable ex4) {
|
||||
Logger log4 = Novoline.getLogger();
|
||||
String textStr5 = "An unexpected error occurred while saving config!";
|
||||
log4.warn(textStr5, ex4);
|
||||
Novoline novolineInst5 = Novoline.getInstance();
|
||||
NotificationManager notifManager5 = novolineInst5.getNotificationManager();
|
||||
textStr5 = "Cannot save config!";
|
||||
NotificationType notificationType5 = NotificationType.ERROR;
|
||||
notifManager5.pop(textStr5, 2000, notificationType5);
|
||||
}
|
||||
} else if (empty) {
|
||||
Novoline novolineInst6 = Novoline.getInstance();
|
||||
NotificationManager notifManager6 = novolineInst6.getNotificationManager();
|
||||
String textStr6 = "Name may not be blank!";
|
||||
NotificationType notificationType6 = NotificationType.ERROR;
|
||||
notifManager6.pop(textStr6, 2000, notificationType6);
|
||||
} else {
|
||||
label29:
|
||||
try {
|
||||
configManager.b(text);
|
||||
break label29;
|
||||
} catch (ConfigReadWriteException ex5) {
|
||||
Logger log5 = Novoline.getLogger();
|
||||
String textStr7 = "An I/O error occurred while reading config!";
|
||||
log5.warn(textStr7, ex5);
|
||||
Novoline novolineInst7 = Novoline.getInstance();
|
||||
NotificationManager notifManager7 = novolineInst7.getNotificationManager();
|
||||
textStr7 = "Cannot read config!";
|
||||
NotificationType notificationType7 = NotificationType.ERROR;
|
||||
notifManager7.pop(textStr7, 2000, notificationType7);
|
||||
} catch (IOException ex6) {
|
||||
Logger log6 = Novoline.getLogger();
|
||||
String textStr8 = "An I/O error occurred while saving config!";
|
||||
log6.warn(textStr8, ex6);
|
||||
Novoline novolineInst8 = Novoline.getInstance();
|
||||
NotificationManager notifManager8 = novolineInst8.getNotificationManager();
|
||||
textStr8 = "Cannot save config!";
|
||||
NotificationType notificationType8 = NotificationType.ERROR;
|
||||
notifManager8.pop(textStr8, 2000, notificationType8);
|
||||
} catch (ObjectMappingException ex7) {
|
||||
Logger log7 = Novoline.getLogger();
|
||||
String textStr9 = "An I/O error occurred while serializing config!";
|
||||
log7.warn(textStr9, ex7);
|
||||
Novoline novolineInst9 = Novoline.getInstance();
|
||||
NotificationManager notifManager9 = novolineInst9.getNotificationManager();
|
||||
textStr9 = "Cannot save config!";
|
||||
NotificationType notificationType9 = NotificationType.ERROR;
|
||||
notifManager9.pop(textStr9, 2000, notificationType9);
|
||||
} catch (Throwable ex8) {
|
||||
Logger log8 = Novoline.getLogger();
|
||||
log8.warn("An unexpected error occurred while saving config!", ex8);
|
||||
Novoline novolineInst10 = Novoline.getInstance();
|
||||
NotificationManager notifManager10 = novolineInst10.getNotificationManager();
|
||||
notifManager10.pop("Cannot save config!", 2000, NotificationType.ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void updateState2(char ch, long time, String[] args) {
|
||||
java.lang.String[] stringArr;
|
||||
byte byteVal = (byte)(false ? 1 : 0);
|
||||
int intVal = byteVal;
|
||||
if (time > 0L) {
|
||||
if (byteVal != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
intVal = args.length;
|
||||
}
|
||||
|
||||
if (intVal >= 1) {
|
||||
ConfigManager cfgManager;
|
||||
String lowerStr;
|
||||
byte byteVal2;
|
||||
label325: {
|
||||
Novoline novolineInst = this.novoline2;
|
||||
ModuleManager modManager = novolineInst.getModuleManager();
|
||||
cfgManager = modManager.getConfigManager();
|
||||
String textStr = args[0];
|
||||
lowerStr = textStr.toLowerCase();
|
||||
String textStr2 = lowerStr;
|
||||
byte byteVal3 = -1;
|
||||
intVal = textStr2.hashCode();
|
||||
label324:
|
||||
if (byteVal == 0) {
|
||||
label337: {
|
||||
label321: {
|
||||
label338: {
|
||||
label319: {
|
||||
label339: {
|
||||
label317: {
|
||||
label340: {
|
||||
label315: {
|
||||
label341: {
|
||||
label313: {
|
||||
label342: {
|
||||
switch (intVal) {
|
||||
case -1335458389:
|
||||
break label339;
|
||||
case 3237038:
|
||||
break label342;
|
||||
case 3322014:
|
||||
break label338;
|
||||
case 3327206:
|
||||
break label341;
|
||||
case 3522941:
|
||||
break label340;
|
||||
case 1427818632:
|
||||
intVal = (textStr2.equals("download") ? 1 : 0);
|
||||
if (byteVal != 0) {
|
||||
break label324;
|
||||
}
|
||||
|
||||
if (intVal == 0) {
|
||||
break label337;
|
||||
}
|
||||
|
||||
byteVal3 = 0;
|
||||
byte byteVal4 = byteVal;
|
||||
if (ch >= 0) {
|
||||
if (byteVal == 0) {
|
||||
break label337;
|
||||
}
|
||||
|
||||
byteVal4 = 1;
|
||||
}
|
||||
|
||||
case -838595071:
|
||||
intVal = (textStr2.equals("upload") ? 1 : 0);
|
||||
if (byteVal != 0) {
|
||||
break label324;
|
||||
}
|
||||
|
||||
if (intVal == 0) {
|
||||
break label337;
|
||||
}
|
||||
|
||||
byteVal3 = 1;
|
||||
intVal = byteVal;
|
||||
if (time <= 0L) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (byteVal == 0) {
|
||||
break label337;
|
||||
}
|
||||
case -934610812:
|
||||
intVal = (textStr2.equals("remove") ? 1 : 0);
|
||||
break;
|
||||
default:
|
||||
break label337;
|
||||
}
|
||||
|
||||
if (byteVal != 0) {
|
||||
break label324;
|
||||
}
|
||||
|
||||
if (intVal == 0) {
|
||||
break label337;
|
||||
}
|
||||
|
||||
byteVal3 = 2;
|
||||
intVal = byteVal;
|
||||
if (time < 0L) {
|
||||
break label313;
|
||||
}
|
||||
|
||||
if (byteVal == 0) {
|
||||
break label337;
|
||||
}
|
||||
}
|
||||
|
||||
intVal = (textStr2.equals("info") ? 1 : 0);
|
||||
}
|
||||
|
||||
if (byteVal != 0) {
|
||||
break label324;
|
||||
}
|
||||
|
||||
if (intVal == 0) {
|
||||
break label337;
|
||||
}
|
||||
|
||||
byteVal3 = 3;
|
||||
intVal = byteVal;
|
||||
if (ch < 0) {
|
||||
break label315;
|
||||
}
|
||||
|
||||
if (byteVal == 0) {
|
||||
break label337;
|
||||
}
|
||||
}
|
||||
|
||||
intVal = (textStr2.equals("load") ? 1 : 0);
|
||||
}
|
||||
|
||||
if (byteVal != 0) {
|
||||
break label324;
|
||||
}
|
||||
|
||||
if (intVal == 0) {
|
||||
break label337;
|
||||
}
|
||||
|
||||
byteVal3 = 4;
|
||||
intVal = byteVal;
|
||||
if (ch < 0) {
|
||||
break label317;
|
||||
}
|
||||
|
||||
if (byteVal == 0) {
|
||||
break label337;
|
||||
}
|
||||
}
|
||||
|
||||
intVal = (textStr2.equals("save") ? 1 : 0);
|
||||
}
|
||||
|
||||
if (byteVal != 0) {
|
||||
break label324;
|
||||
}
|
||||
|
||||
if (intVal == 0) {
|
||||
break label337;
|
||||
}
|
||||
|
||||
byteVal3 = 5;
|
||||
intVal = byteVal;
|
||||
if (ch < 0) {
|
||||
break label319;
|
||||
}
|
||||
|
||||
if (byteVal == 0) {
|
||||
break label337;
|
||||
}
|
||||
}
|
||||
|
||||
intVal = (textStr2.equals("delete") ? 1 : 0);
|
||||
}
|
||||
|
||||
if (byteVal != 0) {
|
||||
break label324;
|
||||
}
|
||||
|
||||
if (intVal == 0) {
|
||||
break label337;
|
||||
}
|
||||
|
||||
byteVal3 = 6;
|
||||
intVal = byteVal;
|
||||
if (ch < 0) {
|
||||
break label321;
|
||||
}
|
||||
|
||||
if (byteVal == 0) {
|
||||
break label337;
|
||||
}
|
||||
}
|
||||
|
||||
intVal = (textStr2.equals("list") ? 1 : 0);
|
||||
}
|
||||
|
||||
byteVal2 = byteVal;
|
||||
if (ch < 0) {
|
||||
break label325;
|
||||
}
|
||||
|
||||
if (byteVal != 0) {
|
||||
break label324;
|
||||
}
|
||||
|
||||
if (intVal != 0) {
|
||||
byteVal3 = 7;
|
||||
}
|
||||
}
|
||||
|
||||
intVal = byteVal3;
|
||||
}
|
||||
|
||||
byteVal2 = byteVal;
|
||||
}
|
||||
|
||||
label235: {
|
||||
label345: {
|
||||
if (ch >= 0) {
|
||||
if (byteVal2 == 0) {
|
||||
switch (intVal) {
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
case 6:
|
||||
stringArr = args;
|
||||
byteVal2 = byteVal;
|
||||
if (ch < 0) {
|
||||
break label235;
|
||||
}
|
||||
|
||||
if (byteVal != 0) {
|
||||
break label345;
|
||||
}
|
||||
|
||||
intVal = args.length;
|
||||
break;
|
||||
case 7:
|
||||
;
|
||||
List itemList = cfgManager.getConfigs();
|
||||
TextMessage textMessage = TextMessage.b("List of configs:");
|
||||
if (ch >= 0) {
|
||||
List itemList2 = itemList;
|
||||
if (byteVal == 0) {
|
||||
if (itemList.isEmpty()) {
|
||||
textMessage.a(" (empty)", EnumChatFormatting.RED);
|
||||
}
|
||||
|
||||
this.updateState(textMessage, true);
|
||||
itemList2 = itemList;
|
||||
}
|
||||
|
||||
Consumer<java.lang.String> consumer = (String textStr8) -> { this.sendClientMessage(TextMessage.resolveTextMessage2("> ", EnumChatFormatting.GRAY).a(textStr8, EnumChatFormatting.GREEN)); };
|
||||
itemList2.forEach(consumer);
|
||||
}
|
||||
|
||||
return;
|
||||
default:
|
||||
StringBuilder sb = new StringBuilder();
|
||||
String textStr3 = "Unknown command: ";
|
||||
StringBuilder sb2 = sb.append(textStr3);
|
||||
textStr3 = args[0];
|
||||
this.applyString4(sb2.append(textStr3).toString());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
byteVal2 = 2;
|
||||
}
|
||||
|
||||
if (intVal < byteVal2) {
|
||||
StringBuilder sb3 = new StringBuilder();
|
||||
String textStr4 = "Usage: .config ";
|
||||
StringBuilder sb4 = sb3.append(textStr4);
|
||||
StringBuilder sb5 = sb4.append(lowerStr);
|
||||
textStr4 = " <name>";
|
||||
this.updateState(sb5.append(textStr4).toString(), EnumChatFormatting.RED);
|
||||
return;
|
||||
}
|
||||
|
||||
stringArr = args;
|
||||
}
|
||||
|
||||
byteVal2 = 1;
|
||||
}
|
||||
|
||||
String textStr7;
|
||||
textStr7 = stringArr[byteVal2];
|
||||
String textStr5 = lowerStr;
|
||||
byte byteVal5 = -1;
|
||||
intVal = textStr5.hashCode();
|
||||
label222:
|
||||
if (byteVal == 0) {
|
||||
label347: {
|
||||
label219: {
|
||||
label348: {
|
||||
label217: {
|
||||
label349: {
|
||||
label215: {
|
||||
label350: {
|
||||
label213: {
|
||||
label351: {
|
||||
switch (intVal) {
|
||||
case -1335458389:
|
||||
break label351;
|
||||
case -934610812:
|
||||
break label348;
|
||||
case -838595071:
|
||||
break label350;
|
||||
case 3327206:
|
||||
intVal = (textStr5.equals("load") ? 1 : 0);
|
||||
if (byteVal != 0) {
|
||||
break label222;
|
||||
}
|
||||
|
||||
if (intVal == 0) {
|
||||
break label347;
|
||||
}
|
||||
|
||||
byteVal5 = 0;
|
||||
intVal = byteVal;
|
||||
if (time < 0L) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (byteVal == 0) {
|
||||
break label347;
|
||||
}
|
||||
case 3522941:
|
||||
intVal = (textStr5.equals("save") ? 1 : 0);
|
||||
break;
|
||||
case 1427818632:
|
||||
break label349;
|
||||
default:
|
||||
break label347;
|
||||
}
|
||||
|
||||
if (byteVal != 0) {
|
||||
break label222;
|
||||
}
|
||||
|
||||
if (intVal == 0) {
|
||||
break label347;
|
||||
}
|
||||
|
||||
byteVal5 = 1;
|
||||
intVal = byteVal;
|
||||
if (time < 0L) {
|
||||
break label213;
|
||||
}
|
||||
|
||||
if (byteVal == 0) {
|
||||
break label347;
|
||||
}
|
||||
}
|
||||
|
||||
intVal = (textStr5.equals("delete") ? 1 : 0);
|
||||
}
|
||||
|
||||
if (byteVal != 0) {
|
||||
break label222;
|
||||
}
|
||||
|
||||
if (intVal == 0) {
|
||||
break label347;
|
||||
}
|
||||
|
||||
byteVal5 = 2;
|
||||
intVal = byteVal;
|
||||
if (ch < 0) {
|
||||
break label215;
|
||||
}
|
||||
|
||||
if (byteVal == 0) {
|
||||
break label347;
|
||||
}
|
||||
}
|
||||
|
||||
intVal = (textStr5.equals("upload") ? 1 : 0);
|
||||
}
|
||||
|
||||
if (byteVal != 0) {
|
||||
break label222;
|
||||
}
|
||||
|
||||
if (intVal == 0) {
|
||||
break label347;
|
||||
}
|
||||
|
||||
byteVal5 = 3;
|
||||
intVal = byteVal;
|
||||
if (time <= 0L) {
|
||||
break label217;
|
||||
}
|
||||
|
||||
if (byteVal == 0) {
|
||||
break label347;
|
||||
}
|
||||
}
|
||||
|
||||
intVal = (textStr5.equals("download") ? 1 : 0);
|
||||
}
|
||||
|
||||
if (byteVal != 0) {
|
||||
break label222;
|
||||
}
|
||||
|
||||
if (intVal == 0) {
|
||||
break label347;
|
||||
}
|
||||
|
||||
byteVal5 = 4;
|
||||
intVal = byteVal;
|
||||
if (time < 0L) {
|
||||
break label219;
|
||||
}
|
||||
|
||||
if (byteVal == 0) {
|
||||
break label347;
|
||||
}
|
||||
}
|
||||
|
||||
intVal = (textStr5.equals("remove") ? 1 : 0);
|
||||
}
|
||||
|
||||
if (time <= 0L || byteVal != 0) {
|
||||
break label222;
|
||||
}
|
||||
|
||||
if (intVal != 0) {
|
||||
byteVal5 = 5;
|
||||
}
|
||||
}
|
||||
|
||||
intVal = byteVal5;
|
||||
}
|
||||
|
||||
switch (intVal) {
|
||||
case 0:
|
||||
updateState(cfgManager, textStr7);
|
||||
return;
|
||||
case 1:
|
||||
executeConfigManager(cfgManager, textStr7);
|
||||
return;
|
||||
case 2:
|
||||
updateState3(cfgManager, textStr7);
|
||||
return;
|
||||
case 3:
|
||||
String textStr6 = resolveString(cfgManager, textStr7);
|
||||
return;
|
||||
case 4:
|
||||
return;
|
||||
case 5:
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
CommandUsageMessage[] commandUsageMessageArr = new CommandUsageMessage[4];
|
||||
commandUsageMessageArr[0] = CommandUsageMessage.of("list", "shows all configs");
|
||||
commandUsageMessageArr[1] = CommandUsageMessage.of("load (name)", "loads a config");
|
||||
commandUsageMessageArr[2] = CommandUsageMessage.of("save (name)", "saves a config");
|
||||
commandUsageMessageArr[3] = CommandUsageMessage.of("delete (name)", "removes a config");
|
||||
this.updateState2("Configs help:", ".configs", commandUsageMessageArr);
|
||||
}
|
||||
}
|
||||
|
||||
public ConfigCommand(@NonNull Novoline novoline, String text, String str, List<String> list) {
|
||||
super(novoline, text, str, list);
|
||||
}
|
||||
|
||||
public static void updateState2(@NonNull ConfigManager configManager, @NonNull String text, EnumModuleType[] enumModuleTypeArray) {
|
||||
boolean flag = true;
|
||||
String trimmedStr = text.trim();
|
||||
if (flag) {
|
||||
if (trimmedStr.isEmpty()) {
|
||||
Novoline novolineInst = Novoline.getInstance();
|
||||
NotificationManager notifManager = novolineInst.getNotificationManager();
|
||||
String textStr = "Name may not be blank!";
|
||||
NotificationType notificationType = NotificationType.ERROR;
|
||||
notifManager.pop(textStr, 2000, notificationType);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
configManager.a(text, true, enumModuleTypeArray);
|
||||
Novoline novolineInst2 = Novoline.getInstance();
|
||||
NotificationManager notifManager2 = novolineInst2.getNotificationManager();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb = sb.append("Loaded config ").append(text);
|
||||
String textStr2 = sb.append("!").toString();
|
||||
NotificationType notificationType2 = NotificationType.SUCCESS;
|
||||
notifManager2.pop(textStr2, 2000, notificationType2);
|
||||
trimmedStr = text;
|
||||
} catch (FileNotFoundException ex) {
|
||||
Novoline novolineInst3 = Novoline.getInstance();
|
||||
NotificationManager notifManager3 = novolineInst3.getNotificationManager();
|
||||
String textStr3 = "Config not found!";
|
||||
NotificationType notificationType3 = NotificationType.ERROR;
|
||||
notifManager3.pop(textStr3, 2000, notificationType3);
|
||||
return;
|
||||
} catch (IOException ex5) {
|
||||
Logger log = Novoline.getLogger();
|
||||
String textStr4 = "An I/O error occurred while reading config!";
|
||||
log.warn(textStr4, ex5);
|
||||
Novoline novolineInst4 = Novoline.getInstance();
|
||||
NotificationManager notifManager4 = novolineInst4.getNotificationManager();
|
||||
textStr4 = "Cannot read config!";
|
||||
NotificationType notificationType4 = NotificationType.ERROR;
|
||||
notifManager4.pop(textStr4, 2000, notificationType4);
|
||||
return;
|
||||
} catch (ObjectMappingException ex6) {
|
||||
Logger log2 = Novoline.getLogger();
|
||||
String textStr5 = "An error occurred while deserializing config!";
|
||||
log2.warn(textStr5, ex6);
|
||||
Novoline novolineInst5 = Novoline.getInstance();
|
||||
NotificationManager notifManager5 = novolineInst5.getNotificationManager();
|
||||
textStr5 = "Cannot load config!";
|
||||
NotificationType notificationType5 = NotificationType.ERROR;
|
||||
notifManager5.pop(textStr5, 2000, notificationType5);
|
||||
return;
|
||||
} catch (ConfigCommandException ex2) {
|
||||
Novoline novolineInst6 = Novoline.getInstance();
|
||||
NotificationManager notifManager6 = novolineInst6.getNotificationManager();
|
||||
String textStr6 = "Config is outdated!";
|
||||
NotificationType notificationType6 = NotificationType.ERROR;
|
||||
notifManager6.pop(textStr6, 2000, notificationType6);
|
||||
return;
|
||||
} catch (Throwable ex7) {
|
||||
Logger log3 = Novoline.getLogger();
|
||||
log3.warn("An unexpected error occurred while loading config!", ex7);
|
||||
Novoline novolineInst7 = Novoline.getInstance();
|
||||
NotificationManager notifManager7 = novolineInst7.getNotificationManager();
|
||||
notifManager7.pop("Cannot load config!", 2000, NotificationType.ERROR);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
ConfigCommand.<FileNotFoundException>$keepCatch();
|
||||
ConfigCommand.<IOException>$keepCatch();
|
||||
ConfigCommand.<ObjectMappingException>$keepCatch();
|
||||
textValue2 = trimmedStr;
|
||||
} catch (FileNotFoundException ex3) {
|
||||
Novoline novolineInst8 = Novoline.getInstance();
|
||||
NotificationManager notifManager8 = novolineInst8.getNotificationManager();
|
||||
String textStr7 = "Config not found!";
|
||||
NotificationType notificationType7 = NotificationType.ERROR;
|
||||
notifManager8.pop(textStr7, 2000, notificationType7);
|
||||
} catch (IOException ex8) {
|
||||
Logger log4 = Novoline.getLogger();
|
||||
String textStr8 = "An I/O error occurred while reading config!";
|
||||
log4.warn(textStr8, ex8);
|
||||
Novoline novolineInst9 = Novoline.getInstance();
|
||||
NotificationManager notifManager9 = novolineInst9.getNotificationManager();
|
||||
textStr8 = "Cannot read config!";
|
||||
NotificationType notificationType8 = NotificationType.ERROR;
|
||||
notifManager9.pop(textStr8, 2000, notificationType8);
|
||||
} catch (ObjectMappingException ex9) {
|
||||
Logger log5 = Novoline.getLogger();
|
||||
String textStr9 = "An error occurred while deserializing config!";
|
||||
log5.warn(textStr9, ex9);
|
||||
Novoline novolineInst10 = Novoline.getInstance();
|
||||
NotificationManager notifManager10 = novolineInst10.getNotificationManager();
|
||||
textStr9 = "Cannot load config!";
|
||||
NotificationType notificationType9 = NotificationType.ERROR;
|
||||
notifManager10.pop(textStr9, 2000, notificationType9);
|
||||
} catch (ConfigCommandException ex4) {
|
||||
Novoline novolineInst11 = Novoline.getInstance();
|
||||
NotificationManager notifManager11 = novolineInst11.getNotificationManager();
|
||||
String textStr10 = "Config is outdated!";
|
||||
NotificationType notificationType10 = NotificationType.ERROR;
|
||||
notifManager11.pop(textStr10, 2000, notificationType10);
|
||||
} catch (Throwable ex10) {
|
||||
Logger log6 = Novoline.getLogger();
|
||||
String textStr11 = "An unexpected error occurred while loading config!";
|
||||
log6.warn(textStr11, ex10);
|
||||
Novoline novolineInst12 = Novoline.getInstance();
|
||||
NotificationManager notifManager12 = novolineInst12.getNotificationManager();
|
||||
textStr11 = "Cannot load config!";
|
||||
NotificationType notificationType11 = NotificationType.ERROR;
|
||||
notifManager12.pop(textStr11, 2000, notificationType11);
|
||||
}
|
||||
}
|
||||
|
||||
public static void updateState3(@NonNull ConfigManager configManager, @NonNull String text) {
|
||||
boolean flag = false;
|
||||
boolean empty = text.trim().isEmpty();
|
||||
if (flag) {
|
||||
try {
|
||||
ConfigCommand.<FileNotFoundException>$keepCatch();
|
||||
ConfigCommand.<IOException>$keepCatch();
|
||||
Novoline novolineInst = Novoline.getInstance();
|
||||
NotificationManager notifManager = novolineInst.getNotificationManager();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb = sb.append("Deleted config ").append(text);
|
||||
String textStr = sb.append("!").toString();
|
||||
NotificationType notificationType = NotificationType.SUCCESS;
|
||||
notifManager.pop(textStr, 2000, notificationType);
|
||||
} catch (FileNotFoundException ex) {
|
||||
Novoline novolineInst2 = Novoline.getInstance();
|
||||
NotificationManager notifManager2 = novolineInst2.getNotificationManager();
|
||||
String textStr2 = "Config not found!";
|
||||
NotificationType notificationType2 = NotificationType.ERROR;
|
||||
notifManager2.pop(textStr2, 2000, notificationType2);
|
||||
} catch (IOException ex3) {
|
||||
Logger log = Novoline.getLogger();
|
||||
String textStr3 = "An I/O error occurred while deleting config!";
|
||||
log.error(textStr3, ex3);
|
||||
Novoline novolineInst3 = Novoline.getInstance();
|
||||
NotificationManager notifManager3 = novolineInst3.getNotificationManager();
|
||||
textStr3 = "Cannot delete config!";
|
||||
NotificationType notificationType3 = NotificationType.ERROR;
|
||||
notifManager3.pop(textStr3, 2000, notificationType3);
|
||||
} catch (Throwable ex4) {
|
||||
Logger log2 = Novoline.getLogger();
|
||||
String textStr4 = "An unexpected error occurred while deleting config!";
|
||||
log2.warn(textStr4, ex4);
|
||||
Novoline novolineInst4 = Novoline.getInstance();
|
||||
NotificationManager notifManager4 = novolineInst4.getNotificationManager();
|
||||
textStr4 = "Cannot delete config!";
|
||||
NotificationType notificationType4 = NotificationType.ERROR;
|
||||
notifManager4.pop(textStr4, 2000, notificationType4);
|
||||
}
|
||||
} else if (empty) {
|
||||
Novoline novolineInst5 = Novoline.getInstance();
|
||||
NotificationManager notifManager5 = novolineInst5.getNotificationManager();
|
||||
String textStr5 = "Name may not be blank!";
|
||||
NotificationType notificationType5 = NotificationType.ERROR;
|
||||
notifManager5.pop(textStr5, 2000, notificationType5);
|
||||
} else {
|
||||
label26:
|
||||
try {
|
||||
configManager.delete(text);
|
||||
break label26;
|
||||
} catch (FileNotFoundException ex2) {
|
||||
Novoline novolineInst6 = Novoline.getInstance();
|
||||
NotificationManager notifManager6 = novolineInst6.getNotificationManager();
|
||||
String textStr6 = "Config not found!";
|
||||
NotificationType notificationType6 = NotificationType.ERROR;
|
||||
notifManager6.pop(textStr6, 2000, notificationType6);
|
||||
} catch (IOException ex5) {
|
||||
Logger log3 = Novoline.getLogger();
|
||||
String textStr7 = "An I/O error occurred while deleting config!";
|
||||
log3.error(textStr7, ex5);
|
||||
Novoline novolineInst7 = Novoline.getInstance();
|
||||
NotificationManager notifManager7 = novolineInst7.getNotificationManager();
|
||||
textStr7 = "Cannot delete config!";
|
||||
NotificationType notificationType7 = NotificationType.ERROR;
|
||||
notifManager7.pop(textStr7, 2000, notificationType7);
|
||||
} catch (Throwable ex6) {
|
||||
Logger log4 = Novoline.getLogger();
|
||||
log4.warn("An unexpected error occurred while deleting config!", ex6);
|
||||
Novoline novolineInst8 = Novoline.getInstance();
|
||||
NotificationManager notifManager8 = novolineInst8.getNotificationManager();
|
||||
notifManager8.pop("Cannot delete config!", 2000, NotificationType.ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static String resolveString(@NonNull ConfigManager configManager, @NonNull String text) {
|
||||
boolean flag = false;
|
||||
String trimmedStr = text.trim();
|
||||
if (!flag) {
|
||||
if (trimmedStr.isEmpty()) {
|
||||
Novoline novolineInst = Novoline.getInstance();
|
||||
NotificationManager notifManager = novolineInst.getNotificationManager();
|
||||
String textStr = "Name may not be blank!";
|
||||
NotificationType notificationType = NotificationType.ERROR;
|
||||
notifManager.pop(textStr, 2000, notificationType);
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
return configManager.a(text);
|
||||
} catch (IOException ex) {
|
||||
Logger log = Novoline.getLogger();
|
||||
String textStr2 = "An I/O error occurred while saving config!";
|
||||
log.warn(textStr2, ex);
|
||||
Novoline novolineInst2 = Novoline.getInstance();
|
||||
NotificationManager notifManager2 = novolineInst2.getNotificationManager();
|
||||
textStr2 = "Cannot save config!";
|
||||
NotificationType notificationType2 = NotificationType.ERROR;
|
||||
notifManager2.pop(textStr2, 2000, notificationType2);
|
||||
} catch (ObjectMappingException ex2) {
|
||||
Logger log2 = Novoline.getLogger();
|
||||
log2.warn("An I/O error occurred while serializing config!", ex2);
|
||||
Novoline novolineInst3 = Novoline.getInstance();
|
||||
NotificationManager notifManager3 = novolineInst3.getNotificationManager();
|
||||
notifManager3.pop("Cannot save config!", 2000, NotificationType.ERROR);
|
||||
}
|
||||
|
||||
return null;
|
||||
} else {
|
||||
return trimmedStr;
|
||||
}
|
||||
}
|
||||
|
||||
public static void updateState(@NonNull ConfigManager configManager, @NonNull String text) {
|
||||
String trimmedStr = text.trim();
|
||||
if (trimmedStr.isEmpty()) {
|
||||
Novoline novolineInst = Novoline.getInstance();
|
||||
NotificationManager notifManager = novolineInst.getNotificationManager();
|
||||
String textStr = "Name may not be blank!";
|
||||
NotificationType notificationType = NotificationType.ERROR;
|
||||
notifManager.pop(textStr, 2000, notificationType);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
configManager.a(text, true);
|
||||
Novoline novolineInst2 = Novoline.getInstance();
|
||||
NotificationManager notifManager2 = novolineInst2.getNotificationManager();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb = sb.append("Loaded config ").append(text);
|
||||
String textStr2 = sb.append("!").toString();
|
||||
NotificationType notificationType2 = NotificationType.SUCCESS;
|
||||
notifManager2.pop(textStr2, 2000, notificationType2);
|
||||
trimmedStr = text;
|
||||
} catch (FileNotFoundException ex) {
|
||||
Novoline novolineInst3 = Novoline.getInstance();
|
||||
NotificationManager notifManager3 = novolineInst3.getNotificationManager();
|
||||
String textStr3 = "Config not found!";
|
||||
NotificationType notificationType3 = NotificationType.ERROR;
|
||||
notifManager3.pop(textStr3, 2000, notificationType3);
|
||||
return;
|
||||
} catch (IOException ex5) {
|
||||
Logger log = Novoline.getLogger();
|
||||
String textStr4 = "An I/O error occurred while reading config!";
|
||||
log.warn(textStr4, ex5);
|
||||
Novoline novolineInst4 = Novoline.getInstance();
|
||||
NotificationManager notifManager4 = novolineInst4.getNotificationManager();
|
||||
textStr4 = "Cannot read config!";
|
||||
NotificationType notificationType4 = NotificationType.ERROR;
|
||||
notifManager4.pop(textStr4, 2000, notificationType4);
|
||||
return;
|
||||
} catch (ObjectMappingException ex6) {
|
||||
Logger log2 = Novoline.getLogger();
|
||||
String textStr5 = "An error occurred while deserializing config!";
|
||||
log2.warn(textStr5, ex6);
|
||||
Novoline novolineInst5 = Novoline.getInstance();
|
||||
NotificationManager notifManager5 = novolineInst5.getNotificationManager();
|
||||
textStr5 = "Cannot load config!";
|
||||
NotificationType notificationType5 = NotificationType.ERROR;
|
||||
notifManager5.pop(textStr5, 2000, notificationType5);
|
||||
return;
|
||||
} catch (ConfigCommandException ex2) {
|
||||
Novoline novolineInst6 = Novoline.getInstance();
|
||||
NotificationManager notifManager6 = novolineInst6.getNotificationManager();
|
||||
String textStr6 = "Config is outdated!";
|
||||
NotificationType notificationType6 = NotificationType.ERROR;
|
||||
notifManager6.pop(textStr6, 2000, notificationType6);
|
||||
return;
|
||||
} catch (Throwable ex7) {
|
||||
Logger log3 = Novoline.getLogger();
|
||||
log3.warn("An unexpected error occurred while loading config!", ex7);
|
||||
Novoline novolineInst7 = Novoline.getInstance();
|
||||
NotificationManager notifManager7 = novolineInst7.getNotificationManager();
|
||||
notifManager7.pop("Cannot load config!", 2000, NotificationType.ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
ConfigCommand.<FileNotFoundException>$keepCatch();
|
||||
ConfigCommand.<IOException>$keepCatch();
|
||||
ConfigCommand.<ObjectMappingException>$keepCatch();
|
||||
textValue2 = trimmedStr;
|
||||
} catch (FileNotFoundException ex3) {
|
||||
Novoline novolineInst8 = Novoline.getInstance();
|
||||
NotificationManager notifManager8 = novolineInst8.getNotificationManager();
|
||||
String textStr7 = "Config not found!";
|
||||
NotificationType notificationType7 = NotificationType.ERROR;
|
||||
notifManager8.pop(textStr7, 2000, notificationType7);
|
||||
} catch (IOException ex8) {
|
||||
Logger log4 = Novoline.getLogger();
|
||||
String textStr8 = "An I/O error occurred while reading config!";
|
||||
log4.warn(textStr8, ex8);
|
||||
Novoline novolineInst9 = Novoline.getInstance();
|
||||
NotificationManager notifManager9 = novolineInst9.getNotificationManager();
|
||||
textStr8 = "Cannot read config!";
|
||||
NotificationType notificationType8 = NotificationType.ERROR;
|
||||
notifManager9.pop(textStr8, 2000, notificationType8);
|
||||
} catch (ObjectMappingException ex9) {
|
||||
Logger log5 = Novoline.getLogger();
|
||||
String textStr9 = "An error occurred while deserializing config!";
|
||||
log5.warn(textStr9, ex9);
|
||||
Novoline novolineInst10 = Novoline.getInstance();
|
||||
NotificationManager notifManager10 = novolineInst10.getNotificationManager();
|
||||
textStr9 = "Cannot load config!";
|
||||
NotificationType notificationType9 = NotificationType.ERROR;
|
||||
notifManager10.pop(textStr9, 2000, notificationType9);
|
||||
} catch (ConfigCommandException ex4) {
|
||||
Novoline novolineInst11 = Novoline.getInstance();
|
||||
NotificationManager notifManager11 = novolineInst11.getNotificationManager();
|
||||
String textStr10 = "Config is outdated!";
|
||||
NotificationType notificationType10 = NotificationType.ERROR;
|
||||
notifManager11.pop(textStr10, 2000, notificationType10);
|
||||
} catch (Throwable ex10) {
|
||||
Logger log6 = Novoline.getLogger();
|
||||
String textStr11 = "An unexpected error occurred while loading config!";
|
||||
log6.warn(textStr11, ex10);
|
||||
Novoline novolineInst12 = Novoline.getInstance();
|
||||
NotificationManager notifManager12 = novolineInst12.getNotificationManager();
|
||||
textStr11 = "Cannot load config!";
|
||||
NotificationType notificationType11 = NotificationType.ERROR;
|
||||
notifManager12.pop(textStr11, 2000, notificationType11);
|
||||
}
|
||||
}
|
||||
private static <E extends Throwable> void $keepCatch() throws E {}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package cc.novoline.commands.impl;
|
||||
import cc.novoline.Novoline;
|
||||
import cc.novoline.commands.NovoCommand;
|
||||
import cc.novoline.utils.messages.CommandUsageMessage;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.command.CommandException;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class DirectMessageCommand extends NovoCommand {
|
||||
|
||||
|
||||
public void updateState2(char ch, long time, String[] args) throws CommandException {
|
||||
byte byteVal = (byte)(true ? 1 : 0);
|
||||
int intVal = byteVal;
|
||||
if (time >= 0L) {
|
||||
if (byteVal == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
intVal = args.length;
|
||||
}
|
||||
|
||||
if (intVal < 2) {
|
||||
CommandUsageMessage[] commandUsageMessageArr = new CommandUsageMessage[1];
|
||||
commandUsageMessageArr[0] = CommandUsageMessage.of("(username) (message)", "directly message a user");
|
||||
this.updateState2("Message help:", ".message / .dm / .msg / .m", commandUsageMessageArr);
|
||||
}
|
||||
}
|
||||
|
||||
public DirectMessageCommand(@NotNull Novoline novoline, String text, String str, List<String> list) {
|
||||
super(novoline, text, str, list);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package cc.novoline.commands.impl;
|
||||
import cc.novoline.Novoline;
|
||||
import cc.novoline.commands.NovoCommand;
|
||||
import cc.novoline.modules.visual.HUD;
|
||||
import cc.novoline.utils.messages.CommandUsageMessage;
|
||||
import cc.novoline.modules.ModuleRegistry;
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.command.CommandException;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class FontCommand extends NovoCommand {
|
||||
public FontCommand(@NotNull Novoline novoline, String text) {
|
||||
super(novoline, text);
|
||||
}
|
||||
|
||||
public void updateState2(char ch, long time, String[] args) throws CommandException, IOException {
|
||||
boolean flag = false;
|
||||
if (time > 0L) {
|
||||
if (args.length == 1) {
|
||||
HUD hudMod = ModuleRegistry.HUD.getModule();
|
||||
String textStr2 = args[0];
|
||||
hudMod.createString(textStr2);
|
||||
hudMod.performAction();
|
||||
if (ch < 0 || !flag) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
String textStr = "Usage";
|
||||
CommandUsageMessage[] commandUsageMessageArr = new CommandUsageMessage[1];
|
||||
commandUsageMessageArr[0] = CommandUsageMessage.of("", "<font name> (path to file)");
|
||||
this.updateState2(textStr, ".font", commandUsageMessageArr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,623 @@
|
||||
package cc.novoline.commands.impl;
|
||||
import cc.novoline.Novoline;
|
||||
import cc.novoline.commands.NovoCommand;
|
||||
import cc.novoline.commands.util.FriendRelationSwitchMap;
|
||||
import cc.novoline.modules.PlayerManager;
|
||||
import cc.novoline.modules.PlayerRelationType;
|
||||
import cc.novoline.utils.messages.CommandUsageMessage;
|
||||
import cc.novoline.utils.messages.TextMessage;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import cc.novoline.modules.configurations.holder.SavingModuleHolderSupport;
|
||||
import net.minecraft.client.network.NetHandlerPlayClient;
|
||||
import net.minecraft.client.network.NetworkPlayerInfo;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
public final class FriendCommand extends NovoCommand {
|
||||
private boolean matchesString(String text) {
|
||||
boolean flag = this.novoline2.getPlayerManager().checkString(text, PlayerRelationType.FRIEND);
|
||||
flag = !flag;
|
||||
|
||||
return flag;
|
||||
}
|
||||
|
||||
private static boolean matchesEntry(Entry entry) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void updateState2(char ch, long time, String[] args) {
|
||||
int intVal;
|
||||
byte byteVal;
|
||||
cc.novoline.modules.PlayerRelationType playerRelationType;
|
||||
cc.novoline.modules.PlayerRelationType playerRelationType2;
|
||||
int intVal2;
|
||||
byte byteVal2;
|
||||
String[] stringArr;
|
||||
byte byteVal3;
|
||||
label311: {
|
||||
label334: {
|
||||
byteVal2 = (byte)(true ? 1 : 0);
|
||||
int len = args.length;
|
||||
byte byteVal7 = 1;
|
||||
if (byteVal2 != 0) {
|
||||
if (len < 1) {
|
||||
this.performStep();
|
||||
return;
|
||||
}
|
||||
|
||||
stringArr = args;
|
||||
byteVal3 = byteVal2;
|
||||
if (ch < 0) {
|
||||
break label311;
|
||||
}
|
||||
|
||||
if (byteVal2 == 0) {
|
||||
break label334;
|
||||
}
|
||||
|
||||
len = args.length;
|
||||
byteVal7 = 1;
|
||||
}
|
||||
|
||||
if (len == byteVal7) {
|
||||
String textStr;
|
||||
textStr = args[0];
|
||||
String lowerStr = textStr.toLowerCase();
|
||||
byte byteVal4 = -1;
|
||||
intVal = lowerStr.hashCode();
|
||||
label301:
|
||||
if (byteVal2 != 0) {
|
||||
label317: {
|
||||
label298: {
|
||||
label318: {
|
||||
switch (intVal) {
|
||||
case 108:
|
||||
intVal = (lowerStr.equals("l") ? 1 : 0);
|
||||
if (byteVal2 == 0) {
|
||||
break label301;
|
||||
}
|
||||
|
||||
if (intVal == 0) {
|
||||
break label317;
|
||||
}
|
||||
|
||||
byteVal4 = 0;
|
||||
intVal = byteVal2;
|
||||
if (ch < 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (byteVal2 != 0) {
|
||||
break label317;
|
||||
}
|
||||
case 3322014:
|
||||
intVal = (lowerStr.equals("list") ? 1 : 0);
|
||||
break;
|
||||
case 94746189:
|
||||
break label318;
|
||||
default:
|
||||
break label317;
|
||||
}
|
||||
|
||||
if (byteVal2 == 0) {
|
||||
break label301;
|
||||
}
|
||||
|
||||
if (intVal == 0) {
|
||||
break label317;
|
||||
}
|
||||
|
||||
byteVal4 = 1;
|
||||
intVal = byteVal2;
|
||||
if (ch < 0) {
|
||||
break label298;
|
||||
}
|
||||
|
||||
if (byteVal2 != 0) {
|
||||
break label317;
|
||||
}
|
||||
}
|
||||
|
||||
intVal = (lowerStr.equals("clear") ? 1 : 0);
|
||||
}
|
||||
|
||||
if (byteVal2 == 0) {
|
||||
break label301;
|
||||
}
|
||||
|
||||
if (intVal != 0) {
|
||||
byteVal4 = 2;
|
||||
}
|
||||
}
|
||||
|
||||
intVal = byteVal4;
|
||||
}
|
||||
|
||||
label271: {
|
||||
label320: {
|
||||
switch (intVal) {
|
||||
case 0:
|
||||
case 1:
|
||||
Novoline novolineInst = this.novoline2;
|
||||
List itemList = novolineInst.getPlayerManager().evaluateCheck(PlayerRelationType.FRIEND);
|
||||
TextMessage textMessage = TextMessage.b("Friends list:");
|
||||
List itemList2 = itemList;
|
||||
if (byteVal2 != 0) {
|
||||
if (itemList.isEmpty()) {
|
||||
textMessage.appendPart(TextMessage.resolveTextMessage2(" (empty)", EnumChatFormatting.RED));
|
||||
}
|
||||
|
||||
this.updateState(textMessage, true);
|
||||
itemList2 = itemList;
|
||||
}
|
||||
|
||||
Iterator iter = itemList2.iterator();
|
||||
|
||||
label265:
|
||||
while (true) {
|
||||
if (!iter.hasNext()) {
|
||||
break;
|
||||
}
|
||||
|
||||
String textStr2 = (String)iter.next();
|
||||
TextMessage textMessage2 = TextMessage.b(" - ");
|
||||
this.sendClientMessage(textMessage2.appendPart(TextMessage.resolveTextMessage2(textStr2, EnumChatFormatting.GRAY)));
|
||||
|
||||
while (true) {
|
||||
byteVal = byteVal2;
|
||||
if (time < 0L) {
|
||||
break label271;
|
||||
}
|
||||
|
||||
if (byteVal2 == 0) {
|
||||
break label320;
|
||||
}
|
||||
|
||||
if (byteVal2 != 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (ch >= 0) {
|
||||
break label265;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (time >= 0L && byteVal2 != 0) {
|
||||
break label320;
|
||||
}
|
||||
case 2:
|
||||
if (ch >= 0) {
|
||||
FriendCommand friendCommand = this;
|
||||
if (byteVal2 != 0 && time > 0L) {
|
||||
Novoline novolineInst2 = this.novoline2;
|
||||
if (novolineInst2.getPlayerManager().evaluateCondition(PlayerRelationType.FRIEND, FriendCommand::matchesEntry)) {
|
||||
this.applyString5("Friend list was cleared");
|
||||
if (byteVal2 != 0) {
|
||||
break label320;
|
||||
}
|
||||
}
|
||||
|
||||
friendCommand = this;
|
||||
}
|
||||
|
||||
friendCommand.applyString5("Friend list is empty");
|
||||
}
|
||||
|
||||
if (byteVal2 != 0) {
|
||||
break label320;
|
||||
}
|
||||
}
|
||||
|
||||
label238: {
|
||||
PlayerRelationType playerRelationType3;
|
||||
label237: {
|
||||
Novoline novolineInst3 = this.novoline2;
|
||||
playerRelationType3 = novolineInst3.getPlayerManager().resolvePlayerRelationType(textStr);
|
||||
byte byteVal5 = byteVal2;
|
||||
if (ch >= 0) {
|
||||
if (byteVal2 != 0) {
|
||||
if (playerRelationType3 != null) {
|
||||
playerRelationType = playerRelationType3;
|
||||
playerRelationType2 = PlayerRelationType.TARGET;
|
||||
if (time <= 0L || byteVal2 == 0 || time < 0L) {
|
||||
break label238;
|
||||
}
|
||||
|
||||
if (playerRelationType3 != PlayerRelationType.TARGET) {
|
||||
break label237;
|
||||
}
|
||||
}
|
||||
|
||||
this.applyString(textStr);
|
||||
}
|
||||
|
||||
byteVal5 = byteVal2;
|
||||
}
|
||||
|
||||
if (byteVal5 != 0) {
|
||||
break label320;
|
||||
}
|
||||
}
|
||||
|
||||
playerRelationType = playerRelationType3;
|
||||
playerRelationType2 = PlayerRelationType.FRIEND;
|
||||
}
|
||||
|
||||
if (playerRelationType == playerRelationType2) {
|
||||
this.handleCommandArg(textStr);
|
||||
}
|
||||
}
|
||||
|
||||
byteVal = byteVal2;
|
||||
}
|
||||
|
||||
if (byteVal != 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
stringArr = args;
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
byteVal3 = 0;
|
||||
} catch (Exception ex2) {
|
||||
ex2.printStackTrace();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
String textStr3;
|
||||
String textStr4 = stringArr[byteVal3];
|
||||
textStr3 = args[1];
|
||||
String lowerStr2 = textStr4.toLowerCase();
|
||||
byte byteVal6 = -1;
|
||||
intVal2 = lowerStr2.hashCode();
|
||||
label161:
|
||||
if (byteVal2 != 0) {
|
||||
label327: {
|
||||
label204: {
|
||||
label328: {
|
||||
label202: {
|
||||
label329: {
|
||||
label200: {
|
||||
label330: {
|
||||
switch (intVal2) {
|
||||
case -1335458389:
|
||||
break label330;
|
||||
case 96417:
|
||||
intVal2 = (lowerStr2.equals("add") ? 1 : 0);
|
||||
if (byteVal2 == 0) {
|
||||
break label161;
|
||||
}
|
||||
|
||||
if (intVal2 == 0) {
|
||||
break label327;
|
||||
}
|
||||
|
||||
byteVal6 = 0;
|
||||
intVal2 = byteVal2;
|
||||
if (time <= 0L) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (byteVal2 != 0) {
|
||||
break label327;
|
||||
}
|
||||
case -934610812:
|
||||
intVal2 = (lowerStr2.equals("remove") ? 1 : 0);
|
||||
break;
|
||||
case 99339:
|
||||
break label329;
|
||||
case 112794:
|
||||
break label328;
|
||||
default:
|
||||
break label327;
|
||||
}
|
||||
|
||||
if (byteVal2 == 0) {
|
||||
break label161;
|
||||
}
|
||||
|
||||
if (intVal2 == 0) {
|
||||
break label327;
|
||||
}
|
||||
|
||||
byteVal6 = 1;
|
||||
intVal2 = byteVal2;
|
||||
if (ch < 0) {
|
||||
break label200;
|
||||
}
|
||||
|
||||
if (byteVal2 != 0) {
|
||||
break label327;
|
||||
}
|
||||
}
|
||||
|
||||
intVal2 = (lowerStr2.equals("delete") ? 1 : 0);
|
||||
}
|
||||
|
||||
if (byteVal2 == 0) {
|
||||
break label161;
|
||||
}
|
||||
|
||||
if (intVal2 == 0) {
|
||||
break label327;
|
||||
}
|
||||
|
||||
byteVal6 = 2;
|
||||
intVal2 = byteVal2;
|
||||
if (time <= 0L) {
|
||||
break label202;
|
||||
}
|
||||
|
||||
if (byteVal2 != 0) {
|
||||
break label327;
|
||||
}
|
||||
}
|
||||
|
||||
intVal2 = (lowerStr2.equals("del") ? 1 : 0);
|
||||
}
|
||||
|
||||
if (byteVal2 == 0) {
|
||||
break label161;
|
||||
}
|
||||
|
||||
if (intVal2 == 0) {
|
||||
break label327;
|
||||
}
|
||||
|
||||
byteVal6 = 3;
|
||||
intVal2 = byteVal2;
|
||||
if (ch < 0) {
|
||||
break label204;
|
||||
}
|
||||
|
||||
if (byteVal2 != 0) {
|
||||
break label327;
|
||||
}
|
||||
}
|
||||
|
||||
intVal2 = (lowerStr2.equals("rem") ? 1 : 0);
|
||||
}
|
||||
|
||||
if (time <= 0L || byteVal2 == 0) {
|
||||
break label161;
|
||||
}
|
||||
|
||||
if (intVal2 != 0) {
|
||||
byteVal6 = 4;
|
||||
}
|
||||
}
|
||||
|
||||
intVal2 = byteVal6;
|
||||
}
|
||||
|
||||
label150: {
|
||||
label149: {
|
||||
if (ch >= 0) {
|
||||
switch (intVal2) {
|
||||
case 0:
|
||||
this.applyString(textStr3);
|
||||
intVal2 = byteVal2;
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
break label149;
|
||||
default:
|
||||
break label150;
|
||||
}
|
||||
}
|
||||
|
||||
if (intVal2 != 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
this.handleCommandArg(textStr3);
|
||||
if (byteVal2 != 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
String textStr5 = "Illegal command specified: ";
|
||||
StringBuilder sb2 = sb.append(textStr5);
|
||||
textStr5 = args[0];
|
||||
StringBuilder sb3 = sb2.append(textStr5);
|
||||
textStr5 = "!";
|
||||
this.applyString4(sb3.append(textStr5).toString());
|
||||
} catch (Exception ex3) {
|
||||
ex3.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void handleCommandArg(String text) {
|
||||
SavingModuleHolderSupport.applyUpdate(text, "name");
|
||||
String lowerStr = text.toLowerCase();
|
||||
Novoline novolineInst = this.novoline2;
|
||||
PlayerManager playerManager = novolineInst.getPlayerManager();
|
||||
PlayerManager playerManager2 = playerManager;
|
||||
String textStr = lowerStr;
|
||||
if (playerManager.resolvePlayerRelationType(lowerStr) != PlayerRelationType.FRIEND) {
|
||||
StringBuilder sb2 = new StringBuilder().append(text);
|
||||
this.applyString4(sb2.append(" is not friend!").toString());
|
||||
return;
|
||||
}
|
||||
|
||||
playerManager2 = playerManager;
|
||||
textStr = lowerStr;
|
||||
|
||||
boolean flag = playerManager2.evaluateCheck(textStr);
|
||||
if (flag) {
|
||||
StringBuilder sb3 = new StringBuilder();
|
||||
StringBuilder sb4 = sb3.append("Removed ");
|
||||
StringBuilder sb5 = sb4.append(text);
|
||||
this.applyString5(sb5.append(" from friends!").toString());
|
||||
|
||||
try {
|
||||
playerManager.obtainPlayerManagerConfigisnotlHelper().a();
|
||||
return;
|
||||
} catch (IOException ex) {
|
||||
this.applyString4("Can't save to file");
|
||||
Logger log = playerManager.getLog();
|
||||
log.warn("An error occurred while saving friends list", ex);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
StringBuilder sb6 = new StringBuilder();
|
||||
StringBuilder sb7 = sb6.append("Cannot remove ");
|
||||
StringBuilder sb8 = sb7.append(text);
|
||||
this.applyString4(sb8.append(" from friends!").toString());
|
||||
}
|
||||
|
||||
public FriendCommand(@NonNull Novoline novoline, String text, String str, String value) {
|
||||
super(novoline, text, str, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable List<String> resolveDouble(String[] args) {
|
||||
switch (args.length) {
|
||||
case 1:
|
||||
String[] stringArr = new String[]{"add", "remove", "list"};
|
||||
return this.updateState2(Stream.of(stringArr), args[0], true);
|
||||
case 2:
|
||||
String textStr = args[0];
|
||||
boolean flag = textStr.equalsIgnoreCase("add");
|
||||
if (flag) {
|
||||
Collection collection = NetHandlerPlayClient.entryMap.values();
|
||||
Stream stream2 = collection.stream();
|
||||
Function mapper = ((java.util.function.Function<net.minecraft.client.network.NetworkPlayerInfo, com.mojang.authlib.GameProfile>) NetworkPlayerInfo::getGameProfile);
|
||||
Stream stream3 = stream2.map(mapper);
|
||||
mapper = ((java.util.function.Function<com.mojang.authlib.GameProfile, java.lang.String>) GameProfile::getName);
|
||||
Stream stream4 = stream3.map(mapper);
|
||||
Predicate<java.lang.String> predicate = this::matchesString;
|
||||
return this.updateState2(stream4.filter(predicate), args[1], true);
|
||||
}
|
||||
|
||||
textStr = args[0];
|
||||
flag = textStr.equalsIgnoreCase("remove");
|
||||
|
||||
if (flag) {
|
||||
Novoline novolineInst = this.novoline2;
|
||||
return this.updateState2(novolineInst.getPlayerManager().evaluateCheck(PlayerRelationType.FRIEND), args[1], true);
|
||||
}
|
||||
|
||||
return null;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private void performStep() {
|
||||
CommandUsageMessage[] commandUsageMessageArr = new CommandUsageMessage[3];
|
||||
commandUsageMessageArr[0] = CommandUsageMessage.of("add (name)", "adds friend");
|
||||
commandUsageMessageArr[1] = CommandUsageMessage.of("remove (name)", "removes friend");
|
||||
commandUsageMessageArr[2] = CommandUsageMessage.of("list", "shows friends");
|
||||
this.updateState2("Friends help:", ".friend", commandUsageMessageArr);
|
||||
}
|
||||
|
||||
public void applyString(String text) {
|
||||
label52: {
|
||||
boolean flag;
|
||||
PlayerManager playerManager;
|
||||
int intVal;
|
||||
label49: {
|
||||
SavingModuleHolderSupport.applyUpdate(text, "name");
|
||||
String lowerStr = text.toLowerCase();
|
||||
Novoline novolineInst = this.novoline2;
|
||||
playerManager = novolineInst.getPlayerManager();
|
||||
PlayerRelationType playerRelationType = playerManager.resolvePlayerRelationType(lowerStr);
|
||||
flag = false;
|
||||
if (playerRelationType != null) {
|
||||
intVal = FriendRelationSwitchMap.SWITCH_MAP[playerRelationType.ordinal()];
|
||||
if (flag) {
|
||||
break label49;
|
||||
}
|
||||
|
||||
switch (intVal) {
|
||||
case 1:
|
||||
if (playerManager.removeType(lowerStr, PlayerRelationType.TARGET)) {
|
||||
StringBuilder sb3 = new StringBuilder().append("Removed ").append(text);
|
||||
this.applyString6(sb3.append(" from targets!").toString());
|
||||
if (!flag) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
StringBuilder sb4 = new StringBuilder();
|
||||
String textStr = "Cannot remove ";
|
||||
StringBuilder sb5 = sb4.append(textStr);
|
||||
StringBuilder sb6 = sb5.append(text);
|
||||
textStr = " from targets!";
|
||||
this.applyString6(sb6.append(textStr).toString());
|
||||
if (!flag) {
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
break label52;
|
||||
}
|
||||
}
|
||||
|
||||
intVal = (playerManager.evaluateCondition(lowerStr, PlayerRelationType.FRIEND) ? 1 : 0);
|
||||
}
|
||||
|
||||
int intVal2 = intVal;
|
||||
if (!flag) {
|
||||
if (intVal2 != 0) {
|
||||
StringBuilder sb7 = new StringBuilder();
|
||||
String textStr2 = "Added ";
|
||||
sb7 = sb7.append(textStr2).append(text);
|
||||
textStr2 = " to friends!";
|
||||
this.applyString5(sb7.append(textStr2).toString());
|
||||
|
||||
try {
|
||||
playerManager.obtainPlayerManagerConfigisnotlHelper().a();
|
||||
return;
|
||||
} catch (IOException ex) {
|
||||
this.applyString4("Can't save to file");
|
||||
Logger log = playerManager.getLog();
|
||||
log.warn("An error occurred while saving friends list", ex);
|
||||
if (!flag) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
StringBuilder sb8 = new StringBuilder();
|
||||
String textStr3 = "Cannot add ";
|
||||
sb8 = sb8.append(textStr3).append(text);
|
||||
textStr3 = " to friends!";
|
||||
this.applyString4(sb8.append(textStr3).toString());
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
StringBuilder sb9 = new StringBuilder().append(text);
|
||||
this.applyString4(sb9.append(" is friend already!").toString());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package cc.novoline.commands.impl;
|
||||
|
||||
import cc.novoline.Novoline;
|
||||
import cc.novoline.commands.NovoCommand;
|
||||
import cc.novoline.events.EventManager;
|
||||
import cc.novoline.modules.misc.uhc.HypixelAutoRewards;
|
||||
import java.io.IOException;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.command.CommandException;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class HelpCommand extends NovoCommand {
|
||||
@Override
|
||||
public void sendLines(String[] args) throws CommandException, IOException {
|
||||
Object obj = this.mcSupplier.get();
|
||||
Minecraft mcClient = (Minecraft)obj;
|
||||
EventManager.register(new HypixelAutoRewards(mcClient));
|
||||
}
|
||||
|
||||
public HelpCommand(@NotNull Novoline novoline, String text) {
|
||||
super(novoline, text);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package cc.novoline.commands.impl;
|
||||
import cc.novoline.Novoline;
|
||||
import cc.novoline.commands.NovoCommand;
|
||||
import cc.novoline.modules.AbstractModule;
|
||||
import cc.novoline.modules.visual.HUD;
|
||||
import cc.novoline.modules.ModuleRegistry;
|
||||
import java.util.List;
|
||||
import cc.novoline.modules.ModuleManager;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
public final class HideCommand extends NovoCommand {
|
||||
public HideCommand(@NonNull Novoline novoline, String text, String str, List<String> list) {
|
||||
super(novoline, text, str, list);
|
||||
}
|
||||
|
||||
public void updateState2(char ch, long time, String[] args) {
|
||||
HideCommand hideCommand;
|
||||
String textStr;
|
||||
label46: {
|
||||
label49: {
|
||||
byte byteVal = (byte)(true ? 1 : 0);
|
||||
String[] stringArr = args;
|
||||
byte byteVal2 = byteVal;
|
||||
if (ch >= 0) {
|
||||
if (byteVal != 0) {
|
||||
if (args.length != 1) {
|
||||
break label49;
|
||||
}
|
||||
|
||||
stringArr = args;
|
||||
}
|
||||
|
||||
byteVal2 = 0;
|
||||
}
|
||||
|
||||
String textStr2 = stringArr[byteVal2];
|
||||
Novoline novolineInst = this.novoline2;
|
||||
ModuleManager modManager = novolineInst.getModuleManager();
|
||||
AbstractModule mod = modManager.getByName(textStr2);
|
||||
AbstractModule mod2 = mod;
|
||||
if (byteVal != 0) {
|
||||
if (mod == null) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
String textStr3 = "Module ";
|
||||
StringBuilder sb2 = sb.append(textStr3);
|
||||
StringBuilder sb3 = sb2.append(textStr2);
|
||||
textStr3 = " was not found!";
|
||||
this.applyString4(sb3.append(textStr3).toString());
|
||||
return;
|
||||
}
|
||||
|
||||
ModuleRegistry modEntry = ModuleRegistry.HUD;
|
||||
mod2 = modEntry.getModule();
|
||||
}
|
||||
|
||||
HUD hudMod = (HUD)mod2;
|
||||
boolean flag = mod.isHidden();
|
||||
if (byteVal != 0) {
|
||||
flag = !flag;
|
||||
}
|
||||
|
||||
mod.setHidden(flag);
|
||||
hudMod.performAction();
|
||||
hideCommand = this;
|
||||
StringBuilder sb4 = new StringBuilder();
|
||||
String textStr4 = mod.isHidden() ? "Hidden" : "Shown";
|
||||
StringBuilder sb5 = sb4.append(textStr4);
|
||||
StringBuilder sb6 = sb5.append(" ");
|
||||
textStr4 = mod.getName();
|
||||
textStr = sb6.append(textStr4).toString();
|
||||
if (time < 0L) {
|
||||
break label46;
|
||||
}
|
||||
|
||||
this.applyString5(textStr);
|
||||
if (byteVal != 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
hideCommand = this;
|
||||
textStr = "Use .hide <module> to hide a module!";
|
||||
}
|
||||
|
||||
hideCommand.applyString4(textStr);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package cc.novoline.commands.impl;
|
||||
import cc.novoline.Novoline;
|
||||
import cc.novoline.commands.NovoCommand;
|
||||
import java.awt.Toolkit;
|
||||
import java.awt.datatransfer.Clipboard;
|
||||
import java.awt.datatransfer.StringSelection;
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.EntityPlayerSP;
|
||||
import net.minecraft.command.CommandException;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class IgnCommand extends NovoCommand {
|
||||
public IgnCommand(@NotNull Novoline novoline, String text) {
|
||||
super(novoline, text);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void updateState2(char ch, long time, String[] args) throws CommandException, IOException {
|
||||
label21: {
|
||||
boolean flag = true;
|
||||
boolean flag2 = flag;
|
||||
if (ch >= 0) {
|
||||
if (flag) {
|
||||
if (args.length == 0) {
|
||||
break label21;
|
||||
}
|
||||
|
||||
this.updateState("Usage", ".ign");
|
||||
}
|
||||
|
||||
flag2 = flag;
|
||||
}
|
||||
|
||||
if (flag2) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
EntityPlayerSP player = Minecraft.getMinecraft().thePlayer;
|
||||
StringSelection stringSelection = new StringSelection(player.getName());
|
||||
Clipboard clipboard2 = Toolkit.getDefaultToolkit().getSystemClipboard();
|
||||
clipboard2.setContents(stringSelection, stringSelection);
|
||||
this.applyString3("Copied ign to your clipboard!");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package cc.novoline.commands.impl;
|
||||
import cc.novoline.Novoline;
|
||||
import cc.novoline.commands.NovoCommand;
|
||||
import cc.novoline.irc.NovolineWebSocket;
|
||||
import cc.novoline.irc.packet.BroadcastCloudPacket;
|
||||
import cc.novoline.utils.messages.CommandUsageMessage;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.command.CommandException;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
public class IrcChatCommand extends NovoCommand {
|
||||
public IrcChatCommand(@NonNull Novoline novoline, String message, String text, List<String> list) {
|
||||
super(novoline, message, text, list);
|
||||
}
|
||||
|
||||
public void updateState2(char ch, long time, String[] args) throws CommandException {
|
||||
byte byteVal = (byte)(false ? 1 : 0);
|
||||
int intVal = byteVal;
|
||||
if (ch >= 0) {
|
||||
if (byteVal != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
intVal = args.length;
|
||||
}
|
||||
|
||||
if (intVal >= 1) {
|
||||
Novoline novolineInst = this.novoline2;
|
||||
NovolineWebSocket novolineWebSocket = novolineInst.getWebSocket();
|
||||
if (byteVal == 0) {
|
||||
if (novolineWebSocket == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Novoline novolineInst2 = this.novoline2;
|
||||
novolineWebSocket = novolineInst2.getWebSocket();
|
||||
}
|
||||
|
||||
BroadcastCloudPacket packet = new BroadcastCloudPacket(String.join(" ", args));
|
||||
novolineWebSocket.applyUpdate(packet);
|
||||
} else {
|
||||
CommandUsageMessage[] commandUsageMessageArr = new CommandUsageMessage[1];
|
||||
String textStr = this.commandSummary;
|
||||
commandUsageMessageArr[0] = CommandUsageMessage.of("(message)", textStr);
|
||||
this.updateState2("Command help", ".chat (.c)", commandUsageMessageArr);
|
||||
this.performAction();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package cc.novoline.commands.impl;
|
||||
|
||||
import cc.novoline.Novoline;
|
||||
import cc.novoline.commands.NovoCommand;
|
||||
import java.io.IOException;
|
||||
import net.minecraft.command.CommandException;
|
||||
import net.skidunion.security.ProtectionSession;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class KickCommand extends NovoCommand {
|
||||
public KickCommand(@NotNull Novoline novoline, String text, String str, String value) {
|
||||
super(novoline, text, str, value);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void updateState2(char ch, long time, String[] args) throws CommandException, IOException {
|
||||
int intVal = Integer.parseInt(ProtectionSession.c);
|
||||
byte byteVal = 2;
|
||||
if (intVal > 2) {
|
||||
return;
|
||||
}
|
||||
|
||||
intVal = args.length;
|
||||
|
||||
if (intVal != 1) {
|
||||
this.updateState("kick", "\u0435\u0431\u043b\u0430\u043d \u043d\u0438\u043a\u043d\u0435\u0439\u043c \u043d\u0435 \u0437\u0430\u0431\u0443\u0434\u044c");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package cc.novoline.commands.impl;
|
||||
|
||||
import cc.novoline.Novoline;
|
||||
import cc.novoline.commands.NovoCommand;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import net.minecraft.command.CommandException;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class KillsultsCommand extends NovoCommand {
|
||||
public KillsultsCommand(@NotNull Novoline novoline, String text, List<String> list) {
|
||||
super(novoline, text, list);
|
||||
}
|
||||
|
||||
public void updateState2(char ch, long time, String[] args) throws CommandException, IOException {}
|
||||
}
|
||||
@@ -0,0 +1,258 @@
|
||||
package cc.novoline.commands.impl;
|
||||
import cc.novoline.Novoline;
|
||||
import cc.novoline.commands.NovoCommand;
|
||||
import cc.novoline.commands.util.JsonSchemaUtil;
|
||||
import cc.novoline.commands.util.NameHistoryTypeToken;
|
||||
import cc.novoline.commands.util.NameHistoryRecord;
|
||||
import cc.novoline.commands.util.PlayerNameCache;
|
||||
import com.google.common.cache.Cache;
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import java.io.IOException;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.ForkJoinPool;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import cc.novoline.modules.configurations.holder.SavingModuleHolderSupport;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
public final class NameHistoryCommand extends NovoCommand {
|
||||
private final Cache<String, PlayerNameCache> cacheField;
|
||||
private final SimpleDateFormat simpleDateFormatField;
|
||||
|
||||
private PlayerNameCache mapString(String text) throws Exception {
|
||||
HttpURLConnection httpURLConnection = JsonSchemaUtil.resolveHttpURLConnection(new StringBuilder().append("https://api.mojang.com/users/profiles/minecraft/").append(text).toString());
|
||||
JsonElement jsonElement = JsonSchemaUtil.resolveJsonElement(httpURLConnection, ((java.util.function.Consumer<java.net.HttpURLConnection>) (httpURLConnection2) -> this.invokeCallback2(text, httpURLConnection2)), JsonElement.class);
|
||||
JsonElement jsonElement2 = jsonElement;
|
||||
if (jsonElement == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
JsonObject jsonObject = jsonElement.getAsJsonObject();
|
||||
jsonElement = jsonObject.get("id");
|
||||
jsonElement2 = jsonElement;
|
||||
|
||||
if (jsonElement2 == null) {
|
||||
throw new RuntimeException("Mojang API schema has been changed!");
|
||||
}
|
||||
|
||||
jsonElement2 = jsonElement;
|
||||
|
||||
if (!jsonElement2.isJsonPrimitive()) {
|
||||
throw new RuntimeException("Mojang API schema has been changed!");
|
||||
}
|
||||
|
||||
jsonElement2 = jsonElement;
|
||||
|
||||
String textStr = jsonElement2.getAsString();
|
||||
StringBuilder sb3 = new StringBuilder().append("https://api.mojang.com/user/profiles/").append(textStr);
|
||||
httpURLConnection = JsonSchemaUtil.resolveHttpURLConnection(sb3.append("/names").toString());
|
||||
JsonArray jsonArray = JsonSchemaUtil.resolveJsonElement(httpURLConnection, this::handleHttpURLConnection, JsonArray.class);
|
||||
return new PlayerNameCache(JsonSchemaUtil.getGson().fromJson(jsonArray, new NameHistoryTypeToken(this).getType()), null);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private @NonNull String resolveString(@NonNull PlayerNameCache playerNameCache) {
|
||||
boolean flag;
|
||||
List itemList;
|
||||
Object obj;
|
||||
label40: {
|
||||
itemList = playerNameCache.getNameHistoryRecordList();
|
||||
flag = true;
|
||||
int intVal = (itemList.isEmpty() ? 1 : 0);
|
||||
if (flag) {
|
||||
if (intVal != 0) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
obj = itemList;
|
||||
if (!flag) {
|
||||
break label40;
|
||||
}
|
||||
|
||||
intVal = itemList.size();
|
||||
}
|
||||
|
||||
if (intVal == 1) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
StringBuilder sb2 = sb.append("\n ");
|
||||
EnumChatFormatting enumChatFormatting = EnumChatFormatting.GOLD;
|
||||
StringBuilder sb3 = sb2.append(enumChatFormatting);
|
||||
EnumChatFormatting enumChatFormatting2 = EnumChatFormatting.BOLD;
|
||||
StringBuilder sb4 = sb3.append(enumChatFormatting2);
|
||||
String textStr3 = ((NameHistoryRecord)itemList.get(0)).getTextValue();
|
||||
StringBuilder sb5 = sb4.append(textStr3);
|
||||
return sb5.append("\n").toString();
|
||||
}
|
||||
|
||||
obj = itemList.get(0);
|
||||
}
|
||||
|
||||
NameHistoryRecord nameHistoryRecord = (NameHistoryRecord)obj;
|
||||
StringBuilder sb6 = new StringBuilder();
|
||||
String textStr = "\n ";
|
||||
sb6 = sb6.append(textStr);
|
||||
textStr = EnumChatFormatting.GOLD.toString();
|
||||
sb6 = sb6.append(textStr);
|
||||
EnumChatFormatting enumChatFormatting3 = EnumChatFormatting.BOLD;
|
||||
sb6 = sb6.append(enumChatFormatting3);
|
||||
textStr = nameHistoryRecord.getTextValue();
|
||||
sb6 = sb6.append(textStr);
|
||||
EnumChatFormatting enumChatFormatting4 = EnumChatFormatting.GOLD;
|
||||
sb6 = sb6.append(enumChatFormatting4);
|
||||
textStr = " (Original name)\n";
|
||||
String textStr2 = sb6.append(textStr).toString();
|
||||
StringBuilder sb7 = new StringBuilder(textStr2);
|
||||
int intVal2 = 1;
|
||||
|
||||
while (true) {
|
||||
if (intVal2 < itemList.size() - 1) {
|
||||
int intVal3 = intVal2++;
|
||||
nameHistoryRecord = (NameHistoryRecord)itemList.get(intVal3);
|
||||
textStr = " ";
|
||||
sb6 = sb7.append(textStr);
|
||||
EnumChatFormatting enumChatFormatting5 = EnumChatFormatting.GOLD;
|
||||
sb6 = sb6.append(enumChatFormatting5);
|
||||
textStr = " - ";
|
||||
sb6 = sb6.append(textStr);
|
||||
textStr = nameHistoryRecord.getTextValue();
|
||||
sb6 = sb6.append(textStr);
|
||||
textStr = " (";
|
||||
sb6 = sb6.append(textStr);
|
||||
textStr = this.resolveString2(nameHistoryRecord.getLongValue());
|
||||
sb6 = sb6.append(textStr);
|
||||
textStr = ")\n";
|
||||
sb6.append(textStr);
|
||||
if (!flag) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
nameHistoryRecord = (NameHistoryRecord)itemList.get(intVal2);
|
||||
textStr = " ";
|
||||
sb6 = sb7.append(textStr);
|
||||
EnumChatFormatting enumChatFormatting6 = EnumChatFormatting.GOLD;
|
||||
sb6 = sb6.append(enumChatFormatting6);
|
||||
textStr = " - ";
|
||||
sb6 = sb6.append(textStr);
|
||||
textStr = nameHistoryRecord.getTextValue();
|
||||
sb6 = sb6.append(textStr);
|
||||
textStr = " (";
|
||||
sb6 = sb6.append(textStr);
|
||||
textStr = this.resolveString2(nameHistoryRecord.getLongValue());
|
||||
sb6 = sb6.append(textStr);
|
||||
textStr = ")";
|
||||
sb6.append(textStr);
|
||||
break;
|
||||
}
|
||||
|
||||
return sb7.toString();
|
||||
}
|
||||
|
||||
public NameHistoryCommand(@NonNull Novoline novoline, String name, String text) {
|
||||
super(novoline, name, text);
|
||||
CacheBuilder cacheBuilder = CacheBuilder.newBuilder();
|
||||
TimeUnit timeUnit = TimeUnit.MINUTES;
|
||||
cacheBuilder = cacheBuilder.expireAfterAccess(5L, timeUnit);
|
||||
this.cacheField = cacheBuilder.build();
|
||||
this.simpleDateFormatField = new SimpleDateFormat("dd.MM.yyyy");
|
||||
}
|
||||
|
||||
private void handleHttpURLConnection(HttpURLConnection httpURLConnection) {
|
||||
StringBuilder sb = new StringBuilder().append(EnumChatFormatting.RED);
|
||||
this.applyString3(sb.append("Mojang API schema has been changed. Let the developers know!").toString());
|
||||
}
|
||||
|
||||
public void updateState2(char ch, long time, String[] args) {
|
||||
byte byteVal = (byte)(true ? 1 : 0);
|
||||
String[] stringArr = args;
|
||||
byte byteVal2 = byteVal;
|
||||
if (ch >= 0) {
|
||||
if (byteVal != 0) {
|
||||
if (args.length < 1) {
|
||||
this.applyString4("Use .name (name)");
|
||||
return;
|
||||
}
|
||||
|
||||
stringArr = args;
|
||||
}
|
||||
|
||||
byteVal2 = 0;
|
||||
}
|
||||
|
||||
String textStr = stringArr[byteVal2];
|
||||
this.updateHelper(textStr, 0);
|
||||
}
|
||||
|
||||
public PlayerNameCache resolvePlayerNameCache(@NonNull String text) throws ExecutionException {
|
||||
SavingModuleHolderSupport.applyUpdate(text, "name");
|
||||
return (cc.novoline.commands.util.PlayerNameCache) this.cacheField.get(text.toLowerCase(), ((java.util.concurrent.Callable<cc.novoline.commands.util.PlayerNameCache>) () -> this.mapString(text)));
|
||||
}
|
||||
|
||||
private @NonNull String resolveString2(long time) {
|
||||
return this.simpleDateFormatField.format(new Date(time));
|
||||
}
|
||||
|
||||
private void invokeCallback(String text, int value) {
|
||||
try {
|
||||
PlayerNameCache playerNameCache = this.resolvePlayerNameCache(text);
|
||||
if (playerNameCache == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
this.applyString3(this.resolveString(playerNameCache));
|
||||
} catch (Throwable ex) {
|
||||
label29: {
|
||||
if (value >= 1) {
|
||||
break label29;
|
||||
}
|
||||
|
||||
this.updateHelper(text, value + 1);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder().append(EnumChatFormatting.RED).append("Could not find name ").append(text);
|
||||
this.applyString3(sb.append("!").toString());
|
||||
}
|
||||
} catch (Throwable ex2) {
|
||||
Logger log = this.getLogger2();
|
||||
log.warn("An error occurred while trying to reach Mojang API!", ex2);
|
||||
}
|
||||
}
|
||||
|
||||
public void updateHelper(String text, int value) {
|
||||
ForkJoinPool.commonPool().execute(((java.lang.Runnable) () -> this.invokeCallback(text, value)));
|
||||
}
|
||||
|
||||
private void invokeCallback2(String text, HttpURLConnection httpURLConnection) {
|
||||
try {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
EnumChatFormatting enumChatFormatting = EnumChatFormatting.RED;
|
||||
sb = sb.append(enumChatFormatting).append("Could not find name ");
|
||||
sb = sb.append(text).append("! (");
|
||||
int intVal = httpURLConnection.getResponseCode();
|
||||
sb = sb.append(intVal);
|
||||
this.applyString3(sb.append(")").toString());
|
||||
} catch (IOException ex) {
|
||||
StringBuilder sb2 = new StringBuilder().append(EnumChatFormatting.RED).append("Could not find name ").append(text);
|
||||
this.applyString3(sb2.append("!").toString());
|
||||
Logger log = this.getLogger2();
|
||||
log.warn("An I/O error occurred while trying to get response code!", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
package cc.novoline.commands.impl;
|
||||
import cc.novoline.Novoline;
|
||||
import cc.novoline.commands.NovoCommand;
|
||||
import cc.novoline.modules.AbstractModule;
|
||||
import cc.novoline.modules.combat.AntiBot;
|
||||
import cc.novoline.modules.exploits.Disabler;
|
||||
import cc.novoline.modules.configurations.holder.ModuleHolder;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectCollection;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectIterator;
|
||||
import cc.novoline.modules.ModuleManager;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
public final class PanicCommand extends NovoCommand {
|
||||
public PanicCommand(@NonNull Novoline novoline, String text, String str, String value) {
|
||||
super(novoline, text, str, value);
|
||||
}
|
||||
|
||||
public void updateState2(char ch, long time, String[] args) {
|
||||
byte byteVal;
|
||||
int len;
|
||||
label138: {
|
||||
byteVal = (byte)(false ? 1 : 0);
|
||||
len = args.length;
|
||||
byte byteVal5 = byteVal;
|
||||
if (ch >= 0) {
|
||||
if (byteVal != 0) {
|
||||
break label138;
|
||||
}
|
||||
|
||||
byteVal5 = 1;
|
||||
}
|
||||
|
||||
if (len > byteVal5) {
|
||||
this.applyString4("Use .panic or .panic (module type)");
|
||||
return;
|
||||
}
|
||||
|
||||
len = args.length;
|
||||
}
|
||||
|
||||
if (len == 0) {
|
||||
Novoline novolineInst = this.novoline2;
|
||||
ModuleManager modManager = novolineInst.getModuleManager();
|
||||
ObjectCollection objectCollection = modManager.getModules().values();
|
||||
ObjectIterator objectIterator = objectCollection.iterator();
|
||||
|
||||
do {
|
||||
if (!objectIterator.hasNext()) {
|
||||
break;
|
||||
}
|
||||
|
||||
ModuleHolder modHolder = (ModuleHolder)objectIterator.next();
|
||||
AbstractModule mod = modHolder.getModule();
|
||||
byte byteVal2 = byteVal;
|
||||
if (ch >= 0) {
|
||||
if (byteVal != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
byteVal2 = (byte)(mod.isEnabled() ? 1 : 0);
|
||||
}
|
||||
|
||||
byte byteVal3 = byteVal;
|
||||
if (ch >= 0) {
|
||||
if (byteVal == 0) {
|
||||
if (byteVal2 == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
byteVal2 = (byte)(mod instanceof AntiBot ? 1 : 0);
|
||||
}
|
||||
|
||||
byteVal3 = byteVal;
|
||||
}
|
||||
|
||||
if (time > 0L) {
|
||||
if (byteVal3 == 0) {
|
||||
if (byteVal2 != 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
byteVal2 = (byte)(mod instanceof Disabler ? 1 : 0);
|
||||
}
|
||||
|
||||
byteVal3 = byteVal;
|
||||
}
|
||||
|
||||
if (byteVal3 == 0 && byteVal2 == 0) {
|
||||
mod.toggle();
|
||||
}
|
||||
} while (byteVal == 0);
|
||||
|
||||
if (ch < 0 || byteVal == 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Novoline novolineInst2 = this.novoline2;
|
||||
ModuleManager modManager2 = novolineInst2.getModuleManager();
|
||||
ObjectCollection objectCollection2 = modManager2.getModules().values();
|
||||
ObjectIterator objectIterator2 = objectCollection2.iterator();
|
||||
|
||||
do {
|
||||
if (!objectIterator2.hasNext()) {
|
||||
break;
|
||||
}
|
||||
|
||||
ModuleHolder modHolder2 = (ModuleHolder)objectIterator2.next();
|
||||
AbstractModule mod2 = modHolder2.getModule();
|
||||
boolean enabled = mod2.isEnabled();
|
||||
byte byteVal4 = byteVal;
|
||||
if (ch >= 0) {
|
||||
if (byteVal == 0) {
|
||||
if (!enabled) {
|
||||
continue;
|
||||
}
|
||||
|
||||
enabled = mod2 instanceof AntiBot;
|
||||
}
|
||||
|
||||
byteVal4 = byteVal;
|
||||
}
|
||||
|
||||
if (ch >= 0) {
|
||||
if (byteVal4 == 0) {
|
||||
if (enabled) {
|
||||
continue;
|
||||
}
|
||||
|
||||
enabled = mod2 instanceof Disabler;
|
||||
}
|
||||
|
||||
byteVal4 = byteVal;
|
||||
}
|
||||
|
||||
if (time >= 0L) {
|
||||
if (byteVal4 == 0) {
|
||||
if (enabled) {
|
||||
continue;
|
||||
}
|
||||
|
||||
String textStr = mod2.getCategory().toString();
|
||||
String textStr2 = args[0];
|
||||
enabled = textStr.equalsIgnoreCase(textStr2);
|
||||
}
|
||||
|
||||
byteVal4 = byteVal;
|
||||
}
|
||||
|
||||
if (byteVal4 == 0 && enabled) {
|
||||
mod2.toggle();
|
||||
}
|
||||
} while (byteVal == 0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,350 @@
|
||||
package cc.novoline.commands.impl;
|
||||
import cc.novoline.Novoline;
|
||||
import cc.novoline.commands.NovoCommand;
|
||||
import cc.novoline.events.EventManager;
|
||||
import cc.novoline.events.EventTarget;
|
||||
import cc.novoline.events.events.MotionUpdateEvent;
|
||||
import cc.novoline.events.type.State;
|
||||
import cc.novoline.modules.PlayerManager;
|
||||
import cc.novoline.modules.PlayerRelationType;
|
||||
import cc.novoline.utils.TimerUtil;
|
||||
import cc.novoline.utils.notifications.NotificationType;
|
||||
import cc.novoline.utils.tasks.TaskManager;
|
||||
import cc.novoline.utils.tasks.TaskStage;
|
||||
import cc.novoline.utils.tasks.impl.RandomOrbTask;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import java.io.IOException;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import net.minecraft.network.play.client.C01PacketChatMessage;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiIngame;
|
||||
import net.minecraft.client.multiplayer.WorldClient;
|
||||
import net.minecraft.client.network.NetworkPlayerInfo;
|
||||
import net.minecraft.command.CommandException;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.scoreboard.ScorePlayerTeam;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class PitBountyCommand extends NovoCommand {
|
||||
private TimerUtil timer = new TimerUtil();
|
||||
private int stateTicks;
|
||||
private Minecraft mcClient;
|
||||
private boolean stateFlag;
|
||||
private int stateTicks2;
|
||||
|
||||
@EventTarget
|
||||
public void onMotionUpdate(MotionUpdateEvent event) {
|
||||
boolean flag = true;
|
||||
if (event.getState() == State.PRE) {
|
||||
TimerUtil timerUtil = this.timer;
|
||||
if (flag && timerUtil.delay(1000L)) {
|
||||
timerUtil = this.timer;
|
||||
timerUtil.reset();
|
||||
Minecraft mcClient2 = this.mcClient;
|
||||
mcClient2.getNetHandler().addToSendQueue(new C01PacketChatMessage("/play pit"));
|
||||
this.isStateReady();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isStateReady() {
|
||||
java.lang.String textStr;
|
||||
java.lang.String textStr2;
|
||||
int intVal4 = (true ? 1 : 0);
|
||||
List itemList = this.mcClient.ingameGUI.getTabList().obtainList();
|
||||
Iterator iter = itemList.iterator();
|
||||
boolean flag = (intVal4 != 0);
|
||||
|
||||
while (true) {
|
||||
if (!iter.hasNext()) {
|
||||
break;
|
||||
}
|
||||
|
||||
NetworkPlayerInfo networkPlayerInfo;
|
||||
int intVal;
|
||||
label85: {
|
||||
label93: {
|
||||
networkPlayerInfo = (NetworkPlayerInfo)iter.next();
|
||||
NetworkPlayerInfo networkPlayerInfo2 = networkPlayerInfo;
|
||||
if (flag) {
|
||||
if (networkPlayerInfo == null) {
|
||||
break label93;
|
||||
}
|
||||
|
||||
networkPlayerInfo2 = networkPlayerInfo;
|
||||
}
|
||||
|
||||
label94: {
|
||||
ScorePlayerTeam scorePlayerTeam = networkPlayerInfo2.getPlayerTeam();
|
||||
GameProfile gameProfile = networkPlayerInfo.getGameProfile();
|
||||
String nameStr = ScorePlayerTeam.formatPlayerName(scorePlayerTeam, gameProfile.getName());
|
||||
String[] stringArr = nameStr.split(" ");
|
||||
String textStr3 = stringArr[stringArr.length - 1];
|
||||
boolean flag2 = textStr3.endsWith("g");
|
||||
if (flag) {
|
||||
if (!flag2) {
|
||||
break label93;
|
||||
}
|
||||
|
||||
textStr = textStr3;
|
||||
textStr2 = "\u00a7";
|
||||
if (!flag) {
|
||||
break label94;
|
||||
}
|
||||
|
||||
flag2 = textStr3.contains(textStr2);
|
||||
}
|
||||
|
||||
if (!flag2) {
|
||||
break label93;
|
||||
}
|
||||
|
||||
textStr = textStr3;
|
||||
textStr2 = "g";
|
||||
}
|
||||
|
||||
String textStr4 = textStr.replace(textStr2, "");
|
||||
long longVal = textStr4.chars().filter((int intVal5) -> intVal5 == 167).count();
|
||||
int intVal2 = (int)(longVal * 2L);
|
||||
textStr4 = textStr4.substring(intVal2);
|
||||
intVal = Integer.parseInt(textStr4);
|
||||
intVal4 = intVal;
|
||||
int ticks = this.stateTicks;
|
||||
if (flag) {
|
||||
if (intVal < this.stateTicks) {
|
||||
break label93;
|
||||
}
|
||||
|
||||
intVal4 = intVal;
|
||||
if (!flag) {
|
||||
break label85;
|
||||
}
|
||||
|
||||
ticks = this.stateTicks2;
|
||||
}
|
||||
|
||||
if (intVal4 <= ticks) {
|
||||
intVal4 = (this.resolveDouble(networkPlayerInfo) ? 1 : 0);
|
||||
break label85;
|
||||
}
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
if (intVal4 != 0) {
|
||||
boolean flag3 = this.matchesNetworkPlayerInfo(networkPlayerInfo);
|
||||
if (!flag) {
|
||||
return flag3;
|
||||
}
|
||||
|
||||
if (!flag3) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
String textStr5 = "Found a bountied player!";
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb = sb.append("Found ");
|
||||
EnumChatFormatting enumChatFormatting = EnumChatFormatting.GOLD;
|
||||
sb = sb.append(enumChatFormatting).append(intVal);
|
||||
sb = sb.append("g");
|
||||
EnumChatFormatting enumChatFormatting2 = EnumChatFormatting.RESET;
|
||||
sb = sb.append(enumChatFormatting2).append(" on ");
|
||||
GameProfile gameProfile2 = networkPlayerInfo.getGameProfile();
|
||||
String nameStr3 = gameProfile2.getName();
|
||||
sb = sb.append(nameStr3);
|
||||
nameStr3 = "!";
|
||||
this.updateState4(textStr5, sb.append(nameStr3).toString(), 5000, NotificationType.INFO);
|
||||
Novoline novolineInst = this.novoline2;
|
||||
PlayerManager playerManager = novolineInst.getPlayerManager();
|
||||
GameProfile gameProfile3 = networkPlayerInfo.getGameProfile();
|
||||
playerManager.evaluateCondition(gameProfile3.getName(), PlayerRelationType.TARGET);
|
||||
StringBuilder sb3 = new StringBuilder().append("Added ");
|
||||
GameProfile gameProfile4 = networkPlayerInfo.getGameProfile();
|
||||
String nameStr2 = gameProfile4.getName();
|
||||
StringBuilder sb4 = sb3.append(nameStr2);
|
||||
this.applyString5(sb4.append(" to targets!").toString());
|
||||
intVal4 = 0;
|
||||
}
|
||||
|
||||
int intVal3 = intVal4;
|
||||
|
||||
while (intVal3 < 20) {
|
||||
Novoline novolineInst2 = this.novoline2;
|
||||
TaskManager taskManager = novolineInst2.getTaskManager();
|
||||
RandomOrbTask randomOrbTask = new RandomOrbTask(this, 100 * intVal3, TaskStage.TICK);
|
||||
taskManager.applyFutureTask(randomOrbTask);
|
||||
intVal3++;
|
||||
if (!flag) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!flag) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
EventManager.unregister(this);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean matchesNetworkPlayerInfo(NetworkPlayerInfo networkPlayerInfo) {
|
||||
List itemList = this.mcClient.theWorld.getLoadedEntityList();
|
||||
Iterator iter = itemList.iterator();
|
||||
boolean flag = false;
|
||||
|
||||
do {
|
||||
if (!iter.hasNext()) {
|
||||
break;
|
||||
}
|
||||
|
||||
Entity entity = (Entity)iter.next();
|
||||
UUID uUID = entity.getUUID2();
|
||||
GameProfile gameProfile = networkPlayerInfo.getGameProfile();
|
||||
if (uUID == gameProfile.getId()) {
|
||||
double posY2 = this.mcClient.thePlayer.posY - entity.posY;
|
||||
int intVal = (Math.abs(posY2) > 5.0) ? 1 : 0;
|
||||
|
||||
return ((((intVal & 1)) != 0));
|
||||
}
|
||||
} while (!flag);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public PitBountyCommand(@NotNull Novoline novoline, String text, String str, List<String> list) {
|
||||
super(novoline, text, str, list);
|
||||
this.mcClient = Minecraft.getMinecraft();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void updateState2(char ch, long time, String[] args) throws CommandException, IOException {
|
||||
int len;
|
||||
cc.novoline.commands.impl.PitBountyCommand pitBountyCommand;
|
||||
boolean flag;
|
||||
String textStr;
|
||||
String[] stringArr = null;
|
||||
label68: {
|
||||
String textStr2;
|
||||
label71: {
|
||||
label66: {
|
||||
flag = true;
|
||||
len = args.length;
|
||||
boolean flag2 = flag;
|
||||
if (ch >= 0) {
|
||||
if (flag) {
|
||||
if (len == 0) {
|
||||
this.updateState("Find Bounty", ".fb <amountMin>-<amountMax>");
|
||||
return;
|
||||
}
|
||||
|
||||
len = args.length;
|
||||
}
|
||||
|
||||
if (time < 0L) {
|
||||
break label66;
|
||||
}
|
||||
|
||||
flag2 = flag;
|
||||
}
|
||||
|
||||
if (flag2) {
|
||||
if (len != 1) {
|
||||
this.updateState("Find Bounty", ".fb <amountMin>-<amountMax>");
|
||||
return;
|
||||
}
|
||||
|
||||
textStr = null;
|
||||
if (ch < 0) {
|
||||
break label68;
|
||||
}
|
||||
|
||||
textStr = args[0];
|
||||
textStr2 = "stop";
|
||||
if (!flag) {
|
||||
break label71;
|
||||
}
|
||||
|
||||
len = (textStr.equalsIgnoreCase(textStr2) ? 1 : 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (len != 0) {
|
||||
EventManager.unregister(this);
|
||||
return;
|
||||
}
|
||||
|
||||
textStr = args[0];
|
||||
textStr2 = "-";
|
||||
}
|
||||
|
||||
stringArr = textStr.split(textStr2);
|
||||
}
|
||||
|
||||
label74: {
|
||||
|
||||
this.stateTicks = Integer.parseInt(stringArr[0]);
|
||||
this.stateTicks2 = Integer.parseInt(stringArr[1]);
|
||||
int ticks = this.stateTicks;
|
||||
if (time > 0L && flag) {
|
||||
if (this.stateTicks > this.stateTicks2) {
|
||||
this.updateState("Find Bounty", "The minimum amount is greater than the maximum amount!");
|
||||
return;
|
||||
}
|
||||
|
||||
this.applyString5("Trying to find the bounty.");
|
||||
TimerUtil timerUtil = this.timer;
|
||||
timerUtil.reset();
|
||||
pitBountyCommand = this;
|
||||
if (!flag) {
|
||||
break label74;
|
||||
}
|
||||
|
||||
ticks = (this.isStateReady() ? 1 : 0);
|
||||
}
|
||||
|
||||
if (ticks != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.applyString5("Swapping servers...");
|
||||
pitBountyCommand = this;
|
||||
}
|
||||
|
||||
EventManager.register(pitBountyCommand);
|
||||
}
|
||||
|
||||
private boolean resolveDouble(NetworkPlayerInfo networkPlayerInfo) {
|
||||
List itemList = this.mcClient.theWorld.getLoadedEntityList();
|
||||
Iterator iter = itemList.iterator();
|
||||
boolean flag = true;
|
||||
|
||||
do {
|
||||
if (!iter.hasNext()) {
|
||||
break;
|
||||
}
|
||||
|
||||
Entity entity = (Entity)iter.next();
|
||||
UUID uUID = entity.getUUID2();
|
||||
GameProfile gameProfile = networkPlayerInfo.getGameProfile();
|
||||
if (uUID == gameProfile.getId()) {
|
||||
return true;
|
||||
}
|
||||
} while (flag);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,220 @@
|
||||
package cc.novoline.commands.impl;
|
||||
import cc.novoline.Novoline;
|
||||
import cc.novoline.commands.NovoCommand;
|
||||
import cc.novoline.modules.AbstractModule;
|
||||
import cc.novoline.modules.EnumModuleType;
|
||||
import cc.novoline.modules.visual.HUD;
|
||||
import cc.novoline.utils.messages.CommandUsageMessage;
|
||||
import cc.novoline.modules.ModuleRegistry;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import cc.novoline.modules.ModuleManager;
|
||||
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
public final class RenameCommand extends NovoCommand {
|
||||
public void updateState2(char ch, long time, String[] args) {
|
||||
cc.novoline.commands.impl.RenameCommand renameCommand;
|
||||
cc.novoline.modules.AbstractModule mod;
|
||||
boolean flag;
|
||||
label130: {
|
||||
boolean flag2;
|
||||
label131: {
|
||||
flag2 = false;
|
||||
int len2 = args.length;
|
||||
byte byteVal = 1;
|
||||
if (!flag2) {
|
||||
label122: {
|
||||
if (len2 == 1) {
|
||||
String textStr = args[0];
|
||||
len2 = (textStr.equalsIgnoreCase("reset") ? 1 : 0);
|
||||
if (flag2) {
|
||||
break label122;
|
||||
}
|
||||
|
||||
if (len2 != 0) {
|
||||
EnumModuleType[] modCategoryArr = EnumModuleType.values();
|
||||
int len = modCategoryArr.length;
|
||||
int intVal = 0;
|
||||
|
||||
while (intVal < len) {
|
||||
EnumModuleType modCategory = modCategoryArr[intVal];
|
||||
if (flag2) {
|
||||
break label131;
|
||||
}
|
||||
|
||||
Novoline novolineInst = this.novoline2;
|
||||
ModuleManager modManager = novolineInst.getModuleManager();
|
||||
List itemList = modManager.getModules().getByCategory(modCategory);
|
||||
Iterator iter = itemList.iterator();
|
||||
|
||||
label113: {
|
||||
while (true) {
|
||||
if (iter.hasNext()) {
|
||||
AbstractModule mod2 = (AbstractModule)iter.next();
|
||||
String displayName = mod2.getRawDisplayName();
|
||||
mod2.applyUpdate2(displayName);
|
||||
this.applyString5("all module names reseted");
|
||||
flag = flag2;
|
||||
if (ch < 0) {
|
||||
break label113;
|
||||
}
|
||||
|
||||
if (flag2) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (!flag2) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (ch >= 0) {
|
||||
intVal++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
flag = flag2;
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ModuleRegistry modEntry = ModuleRegistry.HUD;
|
||||
HUD hudMod = modEntry.getModule();
|
||||
hudMod.performAction();
|
||||
flag = flag2;
|
||||
if (time <= 0L) {
|
||||
break label130;
|
||||
}
|
||||
|
||||
if (!flag2) {
|
||||
break label131;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
len2 = args.length;
|
||||
}
|
||||
|
||||
byteVal = 2;
|
||||
}
|
||||
|
||||
label90: {
|
||||
label89:
|
||||
if (len2 == byteVal) {
|
||||
renameCommand = this;
|
||||
if (flag2) {
|
||||
break label90;
|
||||
}
|
||||
|
||||
Novoline novolineInst2 = this.novoline2;
|
||||
ModuleManager modManager2 = novolineInst2.getModuleManager();
|
||||
String textStr2 = args[0];
|
||||
AbstractModule mod3 = modManager2.getByName(textStr2);
|
||||
if (time > 0L) {
|
||||
if (mod3 == null) {
|
||||
break label89;
|
||||
}
|
||||
|
||||
Novoline novolineInst3 = this.novoline2;
|
||||
ModuleManager modManager3 = novolineInst3.getModuleManager();
|
||||
String textStr3 = args[0];
|
||||
mod3 = modManager3.getByName(textStr3);
|
||||
}
|
||||
|
||||
label81: {
|
||||
label80: {
|
||||
AbstractModule mod4 = mod3;
|
||||
String textStr4 = args[1];
|
||||
if (ch >= 0) {
|
||||
String textStr5 = "reset";
|
||||
if (!flag2) {
|
||||
label75: {
|
||||
boolean flag3 = textStr4.equalsIgnoreCase(textStr5);
|
||||
if (ch >= 0) {
|
||||
if (!flag3) {
|
||||
break label75;
|
||||
}
|
||||
|
||||
mod = mod4;
|
||||
if (ch < 0) {
|
||||
break label81;
|
||||
}
|
||||
|
||||
String displayName2 = mod4.getRawDisplayName();
|
||||
mod4.applyUpdate2(displayName2);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
String textStr10 = args[0];
|
||||
StringBuilder sb2 = sb.append(textStr10);
|
||||
textStr10 = " name reseted";
|
||||
this.applyString5(sb2.append(textStr10).toString());
|
||||
flag3 = flag2;
|
||||
}
|
||||
|
||||
if (!flag3) {
|
||||
break label80;
|
||||
}
|
||||
}
|
||||
|
||||
String textStr6 = args[1];
|
||||
textStr4 = textStr6.replace("_", " ");
|
||||
textStr5 = "&";
|
||||
}
|
||||
|
||||
textStr4 = textStr4.replace(textStr5, "\u00a7");
|
||||
}
|
||||
|
||||
String textStr7 = textStr4;
|
||||
mod4.applyUpdate2(textStr7);
|
||||
StringBuilder sb3 = new StringBuilder();
|
||||
String textStr8 = args[0];
|
||||
StringBuilder sb4 = sb3.append(textStr8);
|
||||
textStr8 = " renamed to ";
|
||||
StringBuilder sb5 = sb4.append(textStr8);
|
||||
this.applyString5(sb5.append(textStr7).toString());
|
||||
}
|
||||
|
||||
ModuleRegistry modEntry2 = ModuleRegistry.HUD;
|
||||
mod = modEntry2.getModule();
|
||||
}
|
||||
|
||||
HUD hudMod2 = (HUD)mod;
|
||||
hudMod2.performAction();
|
||||
if (!flag2) {
|
||||
break label131;
|
||||
}
|
||||
}
|
||||
|
||||
renameCommand = this;
|
||||
}
|
||||
|
||||
String textStr9 = "Rename help:";
|
||||
String textStr11 = ".rename";
|
||||
CommandUsageMessage[] commandUsageMessageArr = new CommandUsageMessage[3];
|
||||
commandUsageMessageArr[0] = CommandUsageMessage.of("(module name) (new name)", "rename module");
|
||||
commandUsageMessageArr[1] = CommandUsageMessage.of("(module name) reset", "resets module name");
|
||||
commandUsageMessageArr[2] = CommandUsageMessage.of("reset", "resets names for all modules");
|
||||
renameCommand.updateState2(textStr9, textStr11, commandUsageMessageArr);
|
||||
}
|
||||
|
||||
if (((Object[])null) == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
flag = flag2;
|
||||
}
|
||||
|
||||
if (time > 0L) {
|
||||
flag = !flag;
|
||||
}
|
||||
}
|
||||
|
||||
public RenameCommand(@NonNull Novoline novoline, String name, String text, List<String> list) {
|
||||
super(novoline, name, text, list);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package cc.novoline.commands.impl;
|
||||
|
||||
import cc.novoline.Novoline;
|
||||
import cc.novoline.commands.NovoCommand;
|
||||
import net.minecraft.command.CommandException;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public final class ReplyCommand extends NovoCommand {
|
||||
public ReplyCommand(@NotNull Novoline novoline) {
|
||||
super(novoline, "reply", "Replies to the last messaged user", "r");
|
||||
}
|
||||
|
||||
public void updateState2(char ch, long time, String[] args) throws CommandException {}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package cc.novoline.commands.impl;
|
||||
import cc.novoline.Novoline;
|
||||
import cc.novoline.commands.NovoCommand;
|
||||
import cc.novoline.utils.ServerUtils;
|
||||
import cc.novoline.utils.messages.CommandUsageMessage;
|
||||
import cc.novoline.utils.notifications.NotificationManager;
|
||||
import cc.novoline.utils.notifications.NotificationType;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import net.minecraft.network.play.client.C01PacketChatMessage;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.command.CommandException;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class ReportCommand extends NovoCommand {
|
||||
public ReportCommand(@NotNull Novoline novoline, String text, List<String> list) {
|
||||
super(novoline, text, list);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void updateState2(char ch, long time, String[] args) throws CommandException, IOException {
|
||||
String textStr = "";
|
||||
label29:
|
||||
if (ServerUtils.isHypixel()) {
|
||||
Minecraft mcClient = Minecraft.getMinecraft();
|
||||
int intVal = (mcClient.isSingleplayer() ? 1 : 0);
|
||||
if (time > 0L && textStr != null) {
|
||||
if (intVal != 0) {
|
||||
break label29;
|
||||
}
|
||||
|
||||
intVal = args.length;
|
||||
}
|
||||
|
||||
if (intVal < 1) {
|
||||
String textStr2 = "Command help";
|
||||
CommandUsageMessage[] commandUsageMessageArr = new CommandUsageMessage[1];
|
||||
commandUsageMessageArr[0] = CommandUsageMessage.of("(name)", "report player by all online users");
|
||||
this.updateState2(textStr2, ".report (.wdr)", commandUsageMessageArr);
|
||||
this.performAction();
|
||||
return;
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
StringBuilder sb2 = sb.append("/report ");
|
||||
String textStr5 = args[0];
|
||||
StringBuilder sb3 = sb2.append(textStr5);
|
||||
String textStr3 = sb3.append(" killaura fly speed").toString();
|
||||
mcClient = this.getMcSupplier().get();
|
||||
mcClient.getNetHandler().sendPacketNoEvent(new C01PacketChatMessage(textStr3));
|
||||
return;
|
||||
}
|
||||
|
||||
Novoline novolineInst = this.novoline2;
|
||||
NotificationManager notifManager = novolineInst.getNotificationManager();
|
||||
String textStr4 = "Report command works only on Hypixel";
|
||||
NotificationType notificationType = NotificationType.WARNING;
|
||||
notifManager.pop(textStr4, 4000, notificationType);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package cc.novoline.commands.impl;
|
||||
import cc.novoline.Novoline;
|
||||
import cc.novoline.commands.NovoCommand;
|
||||
import cc.novoline.commands.util.SayUsageHolder;
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.command.CommandException;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class SayCommand extends NovoCommand {
|
||||
public void updateState2(char ch, long time, String[] args) throws CommandException, IOException {
|
||||
boolean flag = true;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
int intVal = 1;
|
||||
while (intVal < args.length) {
|
||||
sb.append(args[intVal]);
|
||||
sb.append(SayUsageHolder.textValue);
|
||||
intVal++;
|
||||
if (flag) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public SayCommand(@NotNull Novoline novoline, String text, String str, String value) {
|
||||
super(novoline, text, str, value);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,295 @@
|
||||
package cc.novoline.commands.impl;
|
||||
import cc.novoline.Novoline;
|
||||
import cc.novoline.commands.NovoCommand;
|
||||
import cc.novoline.script.Script;
|
||||
import java.io.IOException;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.command.CommandException;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class ScriptCommand extends NovoCommand {
|
||||
public ScriptCommand(@NotNull Novoline novoline, String text, String str, List<String> list) {
|
||||
super(novoline, text, str, list);
|
||||
}
|
||||
|
||||
public void updateState2(char ch, long time, String[] args) throws CommandException, IOException {
|
||||
int intVal;
|
||||
byte byteVal;
|
||||
int intVal2;
|
||||
cc.novoline.script.Script script2;
|
||||
label212: {
|
||||
byte byteVal2;
|
||||
String[] stringArr;
|
||||
byte byteVal3;
|
||||
label194: {
|
||||
label199: {
|
||||
byteVal2 = (byte)(false ? 1 : 0);
|
||||
int len = args.length;
|
||||
byte byteVal6 = 1;
|
||||
if (byteVal2 == 0) {
|
||||
if (len == 1) {
|
||||
String textStr = args[0];
|
||||
byte byteVal4 = (byte)(textStr.equalsIgnoreCase("refresh") ? 1 : 0);
|
||||
if (time > 0L) {
|
||||
if (byteVal4 != 0) {
|
||||
Novoline novolineInst = this.novoline2;
|
||||
novolineInst.getScriptManager().a(this.novoline2);
|
||||
this.applyString3("Refreshed the scripts successfully");
|
||||
if (byteVal2 == 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
this.updateState("Script", ".script refresh - refreshes all scripts");
|
||||
byteVal4 = byteVal2;
|
||||
}
|
||||
|
||||
if (byteVal4 == 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
stringArr = args;
|
||||
byteVal3 = byteVal2;
|
||||
if (time <= 0L) {
|
||||
break label194;
|
||||
}
|
||||
|
||||
if (byteVal2 != 0) {
|
||||
break label199;
|
||||
}
|
||||
|
||||
len = args.length;
|
||||
byteVal6 = 2;
|
||||
}
|
||||
|
||||
if (len != byteVal6) {
|
||||
break label212;
|
||||
}
|
||||
|
||||
stringArr = args;
|
||||
}
|
||||
|
||||
byteVal3 = 0;
|
||||
}
|
||||
|
||||
String textStr2;
|
||||
String textStr3 = stringArr[byteVal3];
|
||||
textStr2 = args[1];
|
||||
String textStr4 = textStr3;
|
||||
byte byteVal5 = -1;
|
||||
intVal = textStr4.hashCode();
|
||||
label156:
|
||||
if (byteVal2 == 0) {
|
||||
label202: {
|
||||
label177: {
|
||||
label203: {
|
||||
switch (intVal) {
|
||||
case -1335458389:
|
||||
break label203;
|
||||
case 3327206:
|
||||
intVal = (textStr4.equals("load") ? 1 : 0);
|
||||
if (byteVal2 != 0) {
|
||||
break label156;
|
||||
}
|
||||
|
||||
if (intVal == 0) {
|
||||
break label202;
|
||||
}
|
||||
|
||||
byteVal5 = 0;
|
||||
intVal = byteVal2;
|
||||
if (ch < 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (byteVal2 == 0) {
|
||||
break label202;
|
||||
}
|
||||
case -840442113:
|
||||
intVal = (textStr4.equals("unload") ? 1 : 0);
|
||||
break;
|
||||
default:
|
||||
break label202;
|
||||
}
|
||||
|
||||
if (byteVal2 != 0) {
|
||||
break label156;
|
||||
}
|
||||
|
||||
if (intVal == 0) {
|
||||
break label202;
|
||||
}
|
||||
|
||||
byteVal5 = 1;
|
||||
intVal = byteVal2;
|
||||
if (ch < 0) {
|
||||
break label177;
|
||||
}
|
||||
|
||||
if (byteVal2 == 0) {
|
||||
break label202;
|
||||
}
|
||||
}
|
||||
|
||||
intVal = (textStr4.equals("delete") ? 1 : 0);
|
||||
}
|
||||
|
||||
if (time < 0L || byteVal2 != 0) {
|
||||
break label156;
|
||||
}
|
||||
|
||||
if (intVal != 0) {
|
||||
byteVal5 = 2;
|
||||
}
|
||||
}
|
||||
|
||||
intVal = byteVal5;
|
||||
}
|
||||
|
||||
label205: {
|
||||
label146: {
|
||||
label206: {
|
||||
label144: {
|
||||
if (ch >= 0) {
|
||||
switch (intVal) {
|
||||
case 0:
|
||||
Novoline novolineInst2 = this.novoline2;
|
||||
novolineInst2.getScriptManager().b(textStr2);
|
||||
StringBuilder sb2 = new StringBuilder().append("Successfully unloaded script ");
|
||||
this.applyString3(sb2.append(textStr2).toString());
|
||||
intVal = byteVal2;
|
||||
break;
|
||||
case 1:
|
||||
break label144;
|
||||
case 2:
|
||||
break label206;
|
||||
default:
|
||||
break label146;
|
||||
}
|
||||
}
|
||||
|
||||
if (intVal == 0) {
|
||||
break label146;
|
||||
}
|
||||
}
|
||||
|
||||
Novoline novolineInst3 = this.novoline2;
|
||||
List itemList = novolineInst3.getScriptManager().a();
|
||||
Iterator iter = itemList.iterator();
|
||||
|
||||
do {
|
||||
if (!iter.hasNext()) {
|
||||
break;
|
||||
}
|
||||
|
||||
Script script3 = (Script)iter.next();
|
||||
byteVal = byteVal2;
|
||||
if (ch < 0) {
|
||||
break label205;
|
||||
}
|
||||
|
||||
if (byteVal2 != 0) {
|
||||
break label146;
|
||||
}
|
||||
|
||||
label130: {
|
||||
label208: {
|
||||
label128: {
|
||||
label209: {
|
||||
String textStr5 = script3.g();
|
||||
intVal2 = (textStr5.equalsIgnoreCase(textStr2) ? 1 : 0);
|
||||
if (byteVal2 == 0) {
|
||||
if (ch < 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (intVal2 == 0) {
|
||||
break label130;
|
||||
}
|
||||
|
||||
script2 = script3;
|
||||
byteVal3 = byteVal2;
|
||||
if (time < 0L) {
|
||||
break label128;
|
||||
}
|
||||
|
||||
if (byteVal2 != 0) {
|
||||
break label209;
|
||||
}
|
||||
|
||||
intVal2 = (script3.c() ? 1 : 0);
|
||||
}
|
||||
|
||||
if (intVal2 == 0) {
|
||||
break label208;
|
||||
}
|
||||
|
||||
script2 = script3;
|
||||
}
|
||||
|
||||
byteVal3 = 0;
|
||||
}
|
||||
|
||||
script2.c((boolean)((byteVal3) != 0));
|
||||
StringBuilder sb4 = new StringBuilder().append("Successfully unloaded script ");
|
||||
this.applyString3(sb4.append(textStr2).toString());
|
||||
intVal2 = byteVal2;
|
||||
if (time <= 0L) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (byteVal2 == 0) {
|
||||
break label130;
|
||||
}
|
||||
}
|
||||
|
||||
this.applyString3("This script is not loaded!");
|
||||
}
|
||||
|
||||
intVal2 = byteVal2;
|
||||
} while (intVal2 == 0);
|
||||
|
||||
if (ch < 0) {
|
||||
break label146;
|
||||
}
|
||||
|
||||
byteVal = byteVal2;
|
||||
if (ch < 0) {
|
||||
break label205;
|
||||
}
|
||||
|
||||
if (byteVal2 == 0) {
|
||||
break label146;
|
||||
}
|
||||
}
|
||||
|
||||
Novoline novolineInst4 = this.novoline2;
|
||||
novolineInst4.getScriptManager().c(textStr2);
|
||||
StringBuilder sb5 = new StringBuilder();
|
||||
String textStr6 = "Removed script ";
|
||||
StringBuilder sb6 = sb5.append(textStr6);
|
||||
StringBuilder sb7 = sb6.append(textStr2);
|
||||
textStr6 = " successfuly";
|
||||
this.applyString3(sb7.append(textStr6).toString());
|
||||
}
|
||||
|
||||
if (time <= 0L) {
|
||||
return;
|
||||
}
|
||||
|
||||
byteVal = byteVal2;
|
||||
}
|
||||
|
||||
if (byteVal == 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
this.updateState("Script", "Usage: load/unload/delete <name>, refresh (all)");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
package cc.novoline.commands.impl;
|
||||
import cc.novoline.Novoline;
|
||||
import cc.novoline.commands.NovoCommand;
|
||||
import java.io.IOException;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.EntityPlayerSP;
|
||||
import net.minecraft.client.multiplayer.WorldClient;
|
||||
import net.minecraft.command.CommandException;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class SpectateCommand extends NovoCommand {
|
||||
|
||||
|
||||
public void updateState2(char ch, long time, String[] args) throws CommandException, IOException {
|
||||
net.minecraft.entity.player.EntityPlayer player2;
|
||||
int intVal;
|
||||
byte byteVal;
|
||||
label91: {
|
||||
byte byteVal2 = (byte)(false ? 1 : 0);
|
||||
int len = args.length;
|
||||
if (ch >= 0 && byteVal2 == 0) {
|
||||
if (len != 1) {
|
||||
break label91;
|
||||
}
|
||||
|
||||
String textStr = args[0];
|
||||
len = (textStr.equalsIgnoreCase("stop") ? 1 : 0);
|
||||
}
|
||||
|
||||
label81: {
|
||||
if (ch >= 0) {
|
||||
if (len == 0) {
|
||||
break label81;
|
||||
}
|
||||
|
||||
Minecraft mcClient = Minecraft.getMinecraft();
|
||||
EntityPlayerSP player3 = Minecraft.getMinecraft().thePlayer;
|
||||
mcClient.setRenderViewEntity(player3);
|
||||
len = byteVal2;
|
||||
}
|
||||
|
||||
if (len == 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
EntityPlayer player4 = null;
|
||||
WorldClient world = Minecraft.getMinecraft().theWorld;
|
||||
List itemList = world.getPlayerEntities();
|
||||
Iterator iter = itemList.iterator();
|
||||
|
||||
label92: {
|
||||
label93: {
|
||||
while (true) {
|
||||
if (iter.hasNext()) {
|
||||
EntityPlayer player5 = (EntityPlayer)iter.next();
|
||||
player2 = player5;
|
||||
if (time < 0L || byteVal2 != 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
label67: {
|
||||
label66: {
|
||||
if (byteVal2 == 0) {
|
||||
String nameStr = player5.getName();
|
||||
String textStr2 = args[0];
|
||||
intVal = (nameStr.equalsIgnoreCase(textStr2) ? 1 : 0);
|
||||
if (ch < 0) {
|
||||
break label67;
|
||||
}
|
||||
|
||||
if (intVal == 0) {
|
||||
break label66;
|
||||
}
|
||||
|
||||
player2 = player5;
|
||||
}
|
||||
|
||||
player4 = player2;
|
||||
}
|
||||
|
||||
intVal = byteVal2;
|
||||
}
|
||||
|
||||
if (intVal == 0) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (time <= 0L) {
|
||||
break label93;
|
||||
}
|
||||
|
||||
player2 = player4;
|
||||
break;
|
||||
}
|
||||
|
||||
if (player2 != null) {
|
||||
Minecraft mcClient2 = Minecraft.getMinecraft();
|
||||
mcClient2.setRenderViewEntity(player4);
|
||||
byteVal = byteVal2;
|
||||
if (ch < 0) {
|
||||
break label92;
|
||||
}
|
||||
|
||||
if (byteVal2 == 0) {
|
||||
break label93;
|
||||
}
|
||||
}
|
||||
|
||||
this.applyString3("Player not found, did you spell the name right?");
|
||||
}
|
||||
|
||||
if (ch < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
byteVal = byteVal2;
|
||||
}
|
||||
|
||||
if (byteVal == 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
this.updateState("Spectate", ".spectate <name>");
|
||||
}
|
||||
|
||||
public SpectateCommand(@NotNull Novoline novoline, String text, String str, List<String> list) {
|
||||
super(novoline, text, str, list);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,674 @@
|
||||
package cc.novoline.commands.impl;
|
||||
import cc.novoline.Novoline;
|
||||
import cc.novoline.commands.NovoCommand;
|
||||
import cc.novoline.commands.util.TargetRelationSwitchMap;
|
||||
import cc.novoline.modules.PlayerManager;
|
||||
import cc.novoline.modules.PlayerRelationType;
|
||||
import cc.novoline.utils.messages.CommandUsageMessage;
|
||||
import cc.novoline.utils.messages.TextMessage;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import cc.novoline.modules.configurations.holder.SavingModuleHolderSupport;
|
||||
import net.minecraft.client.network.NetHandlerPlayClient;
|
||||
import net.minecraft.client.network.NetworkPlayerInfo;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
public final class TargetCommand extends NovoCommand {
|
||||
public void updateState2(char ch, long time, String[] args) {
|
||||
int intVal;
|
||||
byte byteVal;
|
||||
cc.novoline.modules.PlayerRelationType playerRelationType;
|
||||
int intVal2;
|
||||
byte byteVal2;
|
||||
String[] stringArr;
|
||||
byte byteVal3;
|
||||
label349: {
|
||||
label373: {
|
||||
byteVal2 = (byte)(true ? 1 : 0);
|
||||
int len = args.length;
|
||||
byte byteVal7 = 1;
|
||||
if (byteVal2 != 0) {
|
||||
if (len < 1) {
|
||||
String textStr = "Targets help:";
|
||||
String textStr7 = ".target";
|
||||
CommandUsageMessage[] commandUsageMessageArr = new CommandUsageMessage[3];
|
||||
commandUsageMessageArr[0] = CommandUsageMessage.of("add (name)", "adds target");
|
||||
commandUsageMessageArr[1] = CommandUsageMessage.of("remove (name)", "removes target");
|
||||
commandUsageMessageArr[2] = CommandUsageMessage.of("list", "shows targets");
|
||||
this.updateState2(textStr, textStr7, commandUsageMessageArr);
|
||||
return;
|
||||
}
|
||||
|
||||
stringArr = args;
|
||||
byteVal3 = byteVal2;
|
||||
if (ch < 0) {
|
||||
break label349;
|
||||
}
|
||||
|
||||
if (byteVal2 == 0) {
|
||||
break label373;
|
||||
}
|
||||
|
||||
len = args.length;
|
||||
byteVal7 = 1;
|
||||
}
|
||||
|
||||
if (len == byteVal7) {
|
||||
String textStr2;
|
||||
textStr2 = args[0];
|
||||
String lowerStr = textStr2.toLowerCase();
|
||||
byte byteVal4 = -1;
|
||||
intVal = lowerStr.hashCode();
|
||||
label339:
|
||||
if (byteVal2 != 0) {
|
||||
label355: {
|
||||
label336: {
|
||||
label356: {
|
||||
switch (intVal) {
|
||||
case 3322014:
|
||||
intVal = (lowerStr.equals("list") ? 1 : 0);
|
||||
if (byteVal2 == 0) {
|
||||
break label339;
|
||||
}
|
||||
|
||||
if (intVal == 0) {
|
||||
break label355;
|
||||
}
|
||||
|
||||
byteVal4 = 0;
|
||||
intVal = byteVal2;
|
||||
if (time < 0L) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (byteVal2 != 0) {
|
||||
break label355;
|
||||
}
|
||||
case 108:
|
||||
intVal = (lowerStr.equals("l") ? 1 : 0);
|
||||
break;
|
||||
case 94746189:
|
||||
break label356;
|
||||
default:
|
||||
break label355;
|
||||
}
|
||||
|
||||
if (byteVal2 == 0) {
|
||||
break label339;
|
||||
}
|
||||
|
||||
if (intVal == 0) {
|
||||
break label355;
|
||||
}
|
||||
|
||||
byteVal4 = 1;
|
||||
intVal = byteVal2;
|
||||
if (time <= 0L) {
|
||||
break label336;
|
||||
}
|
||||
|
||||
if (byteVal2 != 0) {
|
||||
break label355;
|
||||
}
|
||||
}
|
||||
|
||||
intVal = (lowerStr.equals("clear") ? 1 : 0);
|
||||
}
|
||||
|
||||
if (byteVal2 == 0) {
|
||||
break label339;
|
||||
}
|
||||
|
||||
if (intVal != 0) {
|
||||
byteVal4 = 2;
|
||||
}
|
||||
}
|
||||
|
||||
intVal = byteVal4;
|
||||
}
|
||||
|
||||
label309: {
|
||||
label358: {
|
||||
switch (intVal) {
|
||||
case 0:
|
||||
case 1:
|
||||
Novoline novolineInst = this.novoline2;
|
||||
List itemList = novolineInst.getPlayerManager().evaluateCheck(PlayerRelationType.TARGET);
|
||||
TextMessage textMessage = TextMessage.b("Targets list:");
|
||||
List itemList2 = itemList;
|
||||
if (byteVal2 != 0) {
|
||||
if (itemList.isEmpty()) {
|
||||
textMessage.appendPart(TextMessage.resolveTextMessage2(" (empty)", EnumChatFormatting.RED));
|
||||
}
|
||||
|
||||
this.updateState(textMessage, true);
|
||||
itemList2 = itemList;
|
||||
}
|
||||
|
||||
Iterator iter = itemList2.iterator();
|
||||
|
||||
label303:
|
||||
while (true) {
|
||||
if (!iter.hasNext()) {
|
||||
break;
|
||||
}
|
||||
|
||||
String textStr3 = (String)iter.next();
|
||||
TextMessage textMessage2 = TextMessage.b(" - ");
|
||||
this.sendClientMessage(textMessage2.appendPart(TextMessage.resolveTextMessage2(textStr3, EnumChatFormatting.GRAY)));
|
||||
|
||||
while (true) {
|
||||
byteVal = byteVal2;
|
||||
if (ch < 0) {
|
||||
break label309;
|
||||
}
|
||||
|
||||
if (byteVal2 == 0) {
|
||||
break label358;
|
||||
}
|
||||
|
||||
if (byteVal2 != 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (time >= 0L) {
|
||||
break label303;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ch >= 0 && byteVal2 != 0) {
|
||||
break label358;
|
||||
}
|
||||
case 2:
|
||||
if (ch >= 0) {
|
||||
TargetCommand targetCommand = this;
|
||||
if (byteVal2 != 0 && time > 0L) {
|
||||
Novoline novolineInst2 = this.novoline2;
|
||||
if (novolineInst2.getPlayerManager().evaluateCondition(PlayerRelationType.TARGET, TargetCommand::matchesEntry2)) {
|
||||
this.applyString5("Target list was cleared");
|
||||
if (byteVal2 != 0) {
|
||||
break label358;
|
||||
}
|
||||
}
|
||||
|
||||
targetCommand = this;
|
||||
}
|
||||
|
||||
targetCommand.applyString5("Target list is empty");
|
||||
}
|
||||
|
||||
if (byteVal2 != 0) {
|
||||
break label358;
|
||||
}
|
||||
}
|
||||
|
||||
label276: {
|
||||
PlayerRelationType playerRelationType2;
|
||||
label275: {
|
||||
Novoline novolineInst3 = this.novoline2;
|
||||
playerRelationType2 = novolineInst3.getPlayerManager().resolvePlayerRelationType(textStr2);
|
||||
byte byteVal5 = byteVal2;
|
||||
if (ch >= 0) {
|
||||
if (byteVal2 != 0) {
|
||||
if (playerRelationType2 != PlayerRelationType.FRIEND) {
|
||||
playerRelationType = playerRelationType2;
|
||||
if (time < 0L || byteVal2 == 0 || ch < 0) {
|
||||
break label276;
|
||||
}
|
||||
|
||||
if (playerRelationType2 != null) {
|
||||
break label275;
|
||||
}
|
||||
}
|
||||
|
||||
this.handleCommandArg(textStr2);
|
||||
}
|
||||
|
||||
byteVal5 = byteVal2;
|
||||
}
|
||||
|
||||
if (byteVal5 != 0) {
|
||||
break label358;
|
||||
}
|
||||
}
|
||||
|
||||
playerRelationType = playerRelationType2;
|
||||
}
|
||||
|
||||
if (playerRelationType == PlayerRelationType.TARGET) {
|
||||
this.applyString2(textStr2);
|
||||
}
|
||||
}
|
||||
|
||||
byteVal = byteVal2;
|
||||
}
|
||||
|
||||
if (byteVal != 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
stringArr = args;
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
byteVal3 = 0;
|
||||
} catch (Exception ex2) {
|
||||
ex2.printStackTrace();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
label245: {
|
||||
String textStr4;
|
||||
label244: {
|
||||
label243: {
|
||||
label363: {
|
||||
label364: {
|
||||
label365: {
|
||||
String textStr5 = stringArr[byteVal3];
|
||||
textStr4 = args[1];
|
||||
String lowerStr2 = textStr5.toLowerCase();
|
||||
byte byteVal6 = -1;
|
||||
intVal2 = lowerStr2.hashCode();
|
||||
label239:
|
||||
if (byteVal2 != 0) {
|
||||
label366: {
|
||||
label236: {
|
||||
label367: {
|
||||
label234: {
|
||||
label368: {
|
||||
label232: {
|
||||
label369: {
|
||||
label230: {
|
||||
label370: {
|
||||
switch (intVal2) {
|
||||
case -1335458389:
|
||||
break label369;
|
||||
case -934610812:
|
||||
break label370;
|
||||
case 99339:
|
||||
break label368;
|
||||
case 112794:
|
||||
break label367;
|
||||
case 94746189:
|
||||
intVal2 = (lowerStr2.equals("clear") ? 1 : 0);
|
||||
if (byteVal2 == 0) {
|
||||
break label239;
|
||||
}
|
||||
|
||||
if (intVal2 == 0) {
|
||||
break label366;
|
||||
}
|
||||
|
||||
byteVal6 = 0;
|
||||
intVal2 = byteVal2;
|
||||
if (ch < 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (byteVal2 != 0) {
|
||||
break label366;
|
||||
}
|
||||
case 96417:
|
||||
intVal2 = (lowerStr2.equals("add") ? 1 : 0);
|
||||
break;
|
||||
default:
|
||||
break label366;
|
||||
}
|
||||
|
||||
if (byteVal2 == 0) {
|
||||
break label239;
|
||||
}
|
||||
|
||||
if (intVal2 == 0) {
|
||||
break label366;
|
||||
}
|
||||
|
||||
byteVal6 = 1;
|
||||
intVal2 = byteVal2;
|
||||
if (ch < 0) {
|
||||
break label230;
|
||||
}
|
||||
|
||||
if (byteVal2 != 0) {
|
||||
break label366;
|
||||
}
|
||||
}
|
||||
|
||||
intVal2 = (lowerStr2.equals("remove") ? 1 : 0);
|
||||
}
|
||||
|
||||
if (byteVal2 == 0) {
|
||||
break label239;
|
||||
}
|
||||
|
||||
if (intVal2 == 0) {
|
||||
break label366;
|
||||
}
|
||||
|
||||
byteVal6 = 2;
|
||||
intVal2 = byteVal2;
|
||||
if (ch < 0) {
|
||||
break label232;
|
||||
}
|
||||
|
||||
if (byteVal2 != 0) {
|
||||
break label366;
|
||||
}
|
||||
}
|
||||
|
||||
intVal2 = (lowerStr2.equals("delete") ? 1 : 0);
|
||||
}
|
||||
|
||||
if (byteVal2 == 0) {
|
||||
break label239;
|
||||
}
|
||||
|
||||
if (intVal2 == 0) {
|
||||
break label366;
|
||||
}
|
||||
|
||||
byteVal6 = 3;
|
||||
intVal2 = byteVal2;
|
||||
if (ch < 0) {
|
||||
break label234;
|
||||
}
|
||||
|
||||
if (byteVal2 != 0) {
|
||||
break label366;
|
||||
}
|
||||
}
|
||||
|
||||
intVal2 = (lowerStr2.equals("del") ? 1 : 0);
|
||||
}
|
||||
|
||||
if (byteVal2 == 0) {
|
||||
break label239;
|
||||
}
|
||||
|
||||
if (intVal2 == 0) {
|
||||
break label366;
|
||||
}
|
||||
|
||||
byteVal6 = 4;
|
||||
intVal2 = byteVal2;
|
||||
if (ch < 0) {
|
||||
break label236;
|
||||
}
|
||||
|
||||
if (byteVal2 != 0) {
|
||||
break label366;
|
||||
}
|
||||
}
|
||||
|
||||
intVal2 = (lowerStr2.equals("rem") ? 1 : 0);
|
||||
}
|
||||
|
||||
byteVal3 = byteVal2;
|
||||
if (time <= 0L) {
|
||||
break label365;
|
||||
}
|
||||
|
||||
if (byteVal2 == 0) {
|
||||
break label239;
|
||||
}
|
||||
|
||||
if (intVal2 != 0) {
|
||||
byteVal6 = 5;
|
||||
}
|
||||
}
|
||||
|
||||
intVal2 = byteVal6;
|
||||
}
|
||||
|
||||
if (ch < 0) {
|
||||
break label364;
|
||||
}
|
||||
|
||||
byteVal3 = byteVal2;
|
||||
}
|
||||
|
||||
if (byteVal3 != 0) {
|
||||
switch (intVal2) {
|
||||
case 0:
|
||||
Novoline novolineInst4 = this.novoline2;
|
||||
novolineInst4.getPlayerManager().evaluateCondition(PlayerRelationType.TARGET, TargetCommand::matchesEntry);
|
||||
break;
|
||||
case 1:
|
||||
break label363;
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
break label244;
|
||||
default:
|
||||
break label245;
|
||||
}
|
||||
}
|
||||
|
||||
intVal2 = byteVal2;
|
||||
}
|
||||
|
||||
if (time <= 0L) {
|
||||
break label243;
|
||||
}
|
||||
|
||||
if (intVal2 != 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
this.handleCommandArg(textStr4);
|
||||
intVal2 = byteVal2;
|
||||
}
|
||||
|
||||
if (intVal2 != 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
this.applyString2(textStr4);
|
||||
if (byteVal2 != 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
String textStr6 = "Illegal command specified: ";
|
||||
StringBuilder sb2 = sb.append(textStr6);
|
||||
textStr6 = args[0];
|
||||
StringBuilder sb3 = sb2.append(textStr6);
|
||||
textStr6 = "!";
|
||||
this.applyString4(sb3.append(textStr6).toString());
|
||||
} catch (Exception ex3) {
|
||||
ex3.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void handleCommandArg(String text) {
|
||||
boolean flag;
|
||||
PlayerManager playerManager;
|
||||
int intVal;
|
||||
label37: {
|
||||
SavingModuleHolderSupport.applyUpdate(text, "name");
|
||||
flag = false;
|
||||
String lowerStr = text.toLowerCase();
|
||||
Novoline novolineInst = this.novoline2;
|
||||
playerManager = novolineInst.getPlayerManager();
|
||||
PlayerRelationType playerRelationType = playerManager.resolvePlayerRelationType(lowerStr);
|
||||
if (playerRelationType != null) {
|
||||
intVal = TargetRelationSwitchMap.SWITCH_MAP[playerRelationType.ordinal()];
|
||||
if (flag) {
|
||||
break label37;
|
||||
}
|
||||
|
||||
switch (intVal) {
|
||||
case 1:
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb = sb.append(text);
|
||||
this.applyString4(sb.append(" is friend").toString());
|
||||
return;
|
||||
case 2:
|
||||
StringBuilder sb2 = new StringBuilder().append(text);
|
||||
this.applyString4(sb2.append(" is target already!").toString());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
intVal = (playerManager.evaluateCondition(lowerStr, PlayerRelationType.TARGET) ? 1 : 0);
|
||||
}
|
||||
|
||||
int intVal2 = intVal;
|
||||
if (!flag) {
|
||||
if (intVal2 != 0) {
|
||||
StringBuilder sb3 = new StringBuilder();
|
||||
String textStr = "Added ";
|
||||
sb3 = sb3.append(textStr).append(text);
|
||||
textStr = " to targets!";
|
||||
this.applyString5(sb3.append(textStr).toString());
|
||||
|
||||
try {
|
||||
playerManager.obtainPlayerManagerConfigisnotlHelper().a();
|
||||
return;
|
||||
} catch (IOException ex) {
|
||||
this.applyString4("Can't save to file");
|
||||
Logger log = playerManager.getLog();
|
||||
log.warn("An error occurred while saving targets list", ex);
|
||||
if (!flag) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
StringBuilder sb4 = new StringBuilder();
|
||||
String textStr2 = "Cannot add ";
|
||||
sb4 = sb4.append(textStr2).append(text);
|
||||
textStr2 = " to targets!";
|
||||
this.applyString4(sb4.append(textStr2).toString());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable List<String> resolveDouble(String[] args) {
|
||||
switch (args.length) {
|
||||
case 1:
|
||||
String[] stringArr = new String[]{"add", "remove", "list"};
|
||||
return this.updateState2(Stream.of(stringArr), args[0], true);
|
||||
case 2:
|
||||
PlayerManager playerManager = this.novoline2.getPlayerManager();
|
||||
String textStr = args[0];
|
||||
boolean flag = textStr.equalsIgnoreCase("add");
|
||||
if (flag) {
|
||||
Collection collection = NetHandlerPlayClient.entryMap.values();
|
||||
Stream stream2 = collection.stream();
|
||||
Function mapper = ((java.util.function.Function<net.minecraft.client.network.NetworkPlayerInfo, com.mojang.authlib.GameProfile>) NetworkPlayerInfo::getGameProfile);
|
||||
Stream stream3 = stream2.map(mapper);
|
||||
mapper = ((java.util.function.Function<com.mojang.authlib.GameProfile, java.lang.String>) GameProfile::getName);
|
||||
Stream stream4 = stream3.map(mapper);
|
||||
Predicate<java.lang.String> predicate = ((java.util.function.Predicate) (($a0) -> TargetCommand.invokeCallback(playerManager, ((String) $a0))));
|
||||
return this.updateState2(stream4.filter(predicate), args[1], true);
|
||||
}
|
||||
|
||||
String textStr2 = args[0];
|
||||
flag = textStr2.equalsIgnoreCase("remove");
|
||||
|
||||
if (flag) {
|
||||
return this.updateState2(playerManager.evaluateCheck(PlayerRelationType.TARGET), args[1], true);
|
||||
}
|
||||
|
||||
return null;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void applyString2(String text) {
|
||||
SavingModuleHolderSupport.applyUpdate(text, "name");
|
||||
String lowerStr = text.toLowerCase();
|
||||
Novoline novolineInst = this.novoline2;
|
||||
PlayerManager playerManager = novolineInst.getPlayerManager();
|
||||
PlayerManager playerManager2 = playerManager;
|
||||
String textStr = lowerStr;
|
||||
if (playerManager.resolvePlayerRelationType(lowerStr) != PlayerRelationType.TARGET) {
|
||||
StringBuilder sb2 = new StringBuilder().append(text);
|
||||
this.applyString4(sb2.append(" is not target!").toString());
|
||||
return;
|
||||
}
|
||||
|
||||
playerManager2 = playerManager;
|
||||
textStr = lowerStr;
|
||||
|
||||
boolean flag = playerManager2.evaluateCheck(textStr);
|
||||
if (flag) {
|
||||
StringBuilder sb3 = new StringBuilder();
|
||||
StringBuilder sb4 = sb3.append("Removed ");
|
||||
StringBuilder sb5 = sb4.append(text);
|
||||
this.applyString5(sb5.append(" from targets!").toString());
|
||||
|
||||
try {
|
||||
playerManager.obtainPlayerManagerConfigisnotlHelper().a();
|
||||
return;
|
||||
} catch (IOException ex) {
|
||||
this.applyString4("Can't save to file");
|
||||
Logger log = playerManager.getLog();
|
||||
log.warn("An error occurred while saving targets list", ex);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
StringBuilder sb6 = new StringBuilder();
|
||||
StringBuilder sb7 = sb6.append("Cannot remove ");
|
||||
StringBuilder sb8 = sb7.append(text);
|
||||
this.applyString4(sb8.append(" from targets!").toString());
|
||||
}
|
||||
|
||||
private static boolean matchesEntry(Entry entry) {
|
||||
return true;
|
||||
}
|
||||
|
||||
private static boolean invokeCallback(PlayerManager playerManager, String text) {
|
||||
PlayerRelationType playerRelationType = playerManager.resolvePlayerRelationType(text);
|
||||
boolean flag = true;
|
||||
PlayerRelationType playerRelationType2 = playerRelationType;
|
||||
PlayerRelationType playerRelationType3 = PlayerRelationType.TARGET;
|
||||
if (flag) {
|
||||
if (playerRelationType == PlayerRelationType.TARGET) {
|
||||
return false;
|
||||
}
|
||||
|
||||
playerRelationType2 = playerRelationType;
|
||||
playerRelationType3 = PlayerRelationType.FRIEND;
|
||||
}
|
||||
|
||||
return playerRelationType2 != playerRelationType3;
|
||||
}
|
||||
|
||||
private static boolean matchesEntry2(Entry entry) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public TargetCommand(@NonNull Novoline novoline, String text, List<String> list) {
|
||||
super(novoline, text, list);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,576 @@
|
||||
package cc.novoline.commands.impl;
|
||||
import cc.novoline.Novoline;
|
||||
import cc.novoline.commands.NovoCommand;
|
||||
import cc.novoline.events.EventManager;
|
||||
import cc.novoline.events.EventTarget;
|
||||
import cc.novoline.events.State;
|
||||
import cc.novoline.events.events.LoadWorldEvent;
|
||||
import cc.novoline.events.events.MotionUpdateEvent;
|
||||
import cc.novoline.events.events.MoveEvent;
|
||||
import cc.novoline.events.events.PacketEvent;
|
||||
import cc.novoline.utils.HypixelLobbyType;
|
||||
import cc.novoline.utils.ServerUtils;
|
||||
import cc.novoline.utils.TimerUtil;
|
||||
import cc.novoline.utils.messages.CommandUsageMessage;
|
||||
import cc.novoline.utils.notifications.NotificationManager;
|
||||
import cc.novoline.utils.notifications.NotificationType;
|
||||
import net.minecraft.network.play.client.C01PacketChatMessage;
|
||||
import net.minecraft.network.play.client.C06PacketPlayerPosLook;
|
||||
|
||||
import net.minecraft.network.play.server.S02PacketChat;
|
||||
import net.minecraft.network.play.client.C03PacketPlayer;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.network.play.server.S08PacketPlayerPosLook;
|
||||
import net.minecraft.client.settings.KeyBinding;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.EntityPlayerSP;
|
||||
import net.minecraft.client.multiplayer.WorldClient;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.IChatComponent;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class TeleportCommand extends NovoCommand {
|
||||
private String cachedText;
|
||||
private double cachedValue;
|
||||
private TimerUtil timer;
|
||||
private double cachedValue2;
|
||||
private int stateTicks;
|
||||
private double cachedValue3;
|
||||
private TeleportMode teleportModeField = TeleportMode.WAIT;
|
||||
|
||||
public TeleportCommand(@NotNull Novoline novoline, String text, String str, String value) {
|
||||
super(novoline, text, str, value);
|
||||
}
|
||||
|
||||
@EventTarget
|
||||
public void onPacket(PacketEvent event) {
|
||||
int intVal;
|
||||
boolean flag = true;
|
||||
PacketEvent packetEvent = event;
|
||||
if (flag) {
|
||||
if (event.getState() != State.INCOMING) {
|
||||
return;
|
||||
}
|
||||
|
||||
packetEvent = event;
|
||||
}
|
||||
|
||||
boolean flag2 = packetEvent.getPacket() instanceof S02PacketChat;
|
||||
if (flag) {
|
||||
if (flag2) {
|
||||
S02PacketChat chatPacket = (S02PacketChat)event.getPacket();
|
||||
IChatComponent chatComp = chatPacket.getChatComponent();
|
||||
String msgText = chatComp.getFormattedText();
|
||||
String textStr = msgText;
|
||||
byte byteVal = -1;
|
||||
intVal = textStr.hashCode();
|
||||
label85:
|
||||
if (flag) {
|
||||
switch (intVal) {
|
||||
case 506901630:
|
||||
intVal = (textStr.equals("\u00a7cWoah there, slow down!\u00a7r") ? 1 : 0);
|
||||
if (!flag) {
|
||||
break label85;
|
||||
}
|
||||
|
||||
if (intVal == 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
byteVal = 0;
|
||||
if (flag) {
|
||||
break;
|
||||
}
|
||||
case 1708764411:
|
||||
intVal = (textStr.equals("\u00a7cA kick occurred in your connection, so you were put in the UHC Champions lobby!\u00a7r") ? 1 : 0);
|
||||
if (!flag) {
|
||||
break label85;
|
||||
}
|
||||
|
||||
if (intVal == 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
byteVal = 1;
|
||||
if (flag) {
|
||||
break;
|
||||
}
|
||||
case 1027147741:
|
||||
intVal = (textStr.equals("\u00a7rIllegal characters in chat\u00a7r") ? 1 : 0);
|
||||
if (!flag) {
|
||||
break label85;
|
||||
}
|
||||
|
||||
if (intVal != 0) {
|
||||
byteVal = 2;
|
||||
}
|
||||
}
|
||||
|
||||
intVal = byteVal;
|
||||
}
|
||||
|
||||
switch (intVal) {
|
||||
case 0:
|
||||
this.sendPacket(new C01PacketChatMessage("\u00a7"));
|
||||
if (flag) {
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
;
|
||||
event.setCancelled(true);
|
||||
if (flag) {
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
;
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
flag2 = event.getPacket() instanceof S08PacketPlayerPosLook;
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
if (!flag2) {
|
||||
return;
|
||||
}
|
||||
|
||||
HypixelLobbyType lobbyType = HypixelLobbyType.UHC;
|
||||
flag2 = ServerUtils.serverIs(lobbyType);
|
||||
}
|
||||
|
||||
if (flag2 && this.teleportModeField == TeleportMode.TP) {
|
||||
label49: {
|
||||
S08PacketPlayerPosLook playerPosLookPacket;
|
||||
label48: {
|
||||
playerPosLookPacket = (S08PacketPlayerPosLook)event.getPacket();
|
||||
double doubleVal = playerPosLookPacket.getX();
|
||||
int intVal2 = MathHelper.floor_double(doubleVal);
|
||||
double doubleVal3 = this.cachedValue2;
|
||||
int intVal3 = MathHelper.floor_double(doubleVal3);
|
||||
if (flag) {
|
||||
if (intVal2 != intVal3) {
|
||||
break label48;
|
||||
}
|
||||
|
||||
double doubleVal2 = playerPosLookPacket.getZ();
|
||||
intVal2 = MathHelper.floor_double(doubleVal2);
|
||||
doubleVal3 = this.cachedValue3;
|
||||
intVal3 = MathHelper.floor_double(doubleVal3);
|
||||
}
|
||||
|
||||
if (intVal2 == intVal3) {
|
||||
this.sendPacket(new C06PacketPlayerPosLook(this.cachedValue2, this.cachedValue, this.cachedValue3, playerPosLookPacket.getYaw(), playerPosLookPacket.getYaw(), false));
|
||||
if (flag) {
|
||||
break label49;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.sendPacket(new C06PacketPlayerPosLook(playerPosLookPacket.getX(), playerPosLookPacket.getY(), playerPosLookPacket.getZ(), playerPosLookPacket.getYaw(), playerPosLookPacket.getYaw(), false));
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
this.stateTicks++;
|
||||
}
|
||||
}
|
||||
|
||||
@EventTarget
|
||||
public void onLoadWorld(LoadWorldEvent event) {}
|
||||
|
||||
@EventTarget
|
||||
public void onMotionUpdate(MotionUpdateEvent event) {
|
||||
cc.novoline.commands.impl.TeleportCommand teleportCommand;
|
||||
Object obj;
|
||||
boolean flag = true;
|
||||
Object obj2 = event.getState();
|
||||
if (flag) {
|
||||
if (obj2 != cc.novoline.events.type.State.PRE) {
|
||||
return;
|
||||
}
|
||||
|
||||
obj2 = this.mcSupplier.get();
|
||||
}
|
||||
|
||||
label97: {
|
||||
EntityPlayerSP player;
|
||||
label106: {
|
||||
player = ((Minecraft)obj2).thePlayer;
|
||||
TeleportMode teleportMode = this.teleportModeField;
|
||||
TeleportMode teleportMode2 = TeleportMode.WAIT;
|
||||
if (flag) {
|
||||
if (this.teleportModeField == TeleportMode.WAIT) {
|
||||
player.sendChatMessage("/hub");
|
||||
this.teleportModeField = TeleportMode.RECONNECT;
|
||||
if (flag) {
|
||||
break label106;
|
||||
}
|
||||
}
|
||||
|
||||
teleportMode = this.teleportModeField;
|
||||
teleportMode2 = TeleportMode.RECONNECT;
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
label86:
|
||||
if (teleportMode == teleportMode2) {
|
||||
EntityPlayerSP player2 = player;
|
||||
if (flag) {
|
||||
if (player.ticksExisted != 1) {
|
||||
break label86;
|
||||
}
|
||||
|
||||
player2 = player;
|
||||
}
|
||||
|
||||
player2.sendChatMessage("/rejoin");
|
||||
this.teleportModeField = TeleportMode.TP;
|
||||
TimerUtil timerUtil = this.timer;
|
||||
timerUtil.reset();
|
||||
if (flag) {
|
||||
break label106;
|
||||
}
|
||||
}
|
||||
|
||||
teleportCommand = this;
|
||||
if (!flag) {
|
||||
break label97;
|
||||
}
|
||||
|
||||
teleportMode = this.teleportModeField;
|
||||
teleportMode2 = TeleportMode.TP;
|
||||
}
|
||||
|
||||
label78:
|
||||
if (teleportMode == teleportMode2) {
|
||||
HypixelLobbyType lobbyType = HypixelLobbyType.UHC;
|
||||
int intVal = (ServerUtils.serverIs(lobbyType) ? 1 : 0);
|
||||
if (flag) {
|
||||
if (intVal == 0) {
|
||||
break label78;
|
||||
}
|
||||
|
||||
intVal = this.stateTicks;
|
||||
}
|
||||
|
||||
label110: {
|
||||
label111: {
|
||||
if (flag) {
|
||||
if (intVal != 0) {
|
||||
TimerUtil timerUtil2 = this.timer;
|
||||
timerUtil2.reset();
|
||||
}
|
||||
|
||||
obj = this.timer;
|
||||
if (!flag) {
|
||||
break label111;
|
||||
}
|
||||
|
||||
intVal = (((TimerUtil)obj).delay(800L) ? 1 : 0);
|
||||
}
|
||||
|
||||
if (intVal != 0) {
|
||||
this.mcSupplier.get().renderGlobal.performStep2();
|
||||
EventManager.unregister(this);
|
||||
if (flag) {
|
||||
break label110;
|
||||
}
|
||||
}
|
||||
|
||||
obj = this.mcSupplier.get();
|
||||
}
|
||||
|
||||
WorldClient world = ((Minecraft)obj).theWorld;
|
||||
label63:
|
||||
if (this.cachedText != null) {
|
||||
String textStr = this.cachedText;
|
||||
EntityPlayer player3 = world.applyFlag(textStr);
|
||||
if (flag) {
|
||||
if (player3 == null) {
|
||||
break label63;
|
||||
}
|
||||
|
||||
String textStr2 = this.cachedText;
|
||||
player3 = world.applyFlag(textStr2);
|
||||
}
|
||||
|
||||
EntityPlayer player4 = player3;
|
||||
this.cachedValue2 = player4.posX;
|
||||
this.cachedValue3 = player4.posZ;
|
||||
}
|
||||
|
||||
if (player.ticksExisted == 1) {
|
||||
this.sendPacket(new C06PacketPlayerPosLook(this.cachedValue2, this.cachedValue, this.cachedValue3, player.rotationYaw, player.rotationPitch, false));
|
||||
this.sendPacket(new C03PacketPlayer(false));
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
teleportCommand = this;
|
||||
if (!flag) {
|
||||
break label97;
|
||||
}
|
||||
|
||||
KeyBinding keyBinding = this.mcSupplier.get().gameSettings.keyBindUseItem;
|
||||
if (keyBinding.isKeyDown()) {
|
||||
EventManager.unregister(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
player.cameraPitch = 0.0F;
|
||||
player.cameraYaw = 0.0F;
|
||||
teleportCommand = this;
|
||||
}
|
||||
|
||||
teleportCommand.stateTicks = 0;
|
||||
}
|
||||
|
||||
@EventTarget
|
||||
public void onMove(MoveEvent event) {
|
||||
event.setMoveSpeed(0.0);
|
||||
event.setY(0.0);
|
||||
}
|
||||
|
||||
public void updateState2(char ch, long time, String[] args) {
|
||||
double posX2;
|
||||
double posZ2;
|
||||
double posX3;
|
||||
double posY2;
|
||||
double posZ3;
|
||||
byte byteVal = (byte)(true ? 1 : 0);
|
||||
int intVal = byteVal;
|
||||
if (ch >= 0) {
|
||||
if (byteVal == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
intVal = args.length;
|
||||
}
|
||||
|
||||
label158: {
|
||||
byte byteVal2 = 1;
|
||||
if (ch >= 0) {
|
||||
if (intVal < 1) {
|
||||
break label158;
|
||||
}
|
||||
|
||||
intVal = args.length;
|
||||
byteVal2 = byteVal;
|
||||
}
|
||||
|
||||
if (time > 0L) {
|
||||
if (byteVal2 != 0) {
|
||||
if (intVal > 3) {
|
||||
break label158;
|
||||
}
|
||||
|
||||
intVal = (ServerUtils.isHypixel() ? 1 : 0);
|
||||
}
|
||||
|
||||
byteVal2 = byteVal;
|
||||
}
|
||||
|
||||
label175: {
|
||||
if (ch >= 0) {
|
||||
if (byteVal2 != 0) {
|
||||
if (intVal == 0) {
|
||||
break label175;
|
||||
}
|
||||
|
||||
HypixelLobbyType lobbyType = HypixelLobbyType.UHC;
|
||||
intVal = (ServerUtils.serverIs(lobbyType) ? 1 : 0);
|
||||
}
|
||||
|
||||
byteVal2 = byteVal;
|
||||
}
|
||||
|
||||
if (byteVal2 != 0) {
|
||||
if (intVal == 0) {
|
||||
break label175;
|
||||
}
|
||||
|
||||
this.cachedText = null;
|
||||
if (byteVal == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
intVal = args.length;
|
||||
}
|
||||
|
||||
label176: {
|
||||
switch (intVal) {
|
||||
case 1:
|
||||
WorldClient world = this.mcSupplier.get().theWorld;
|
||||
String textStr = args[0];
|
||||
EntityPlayer player2 = world.applyFlag(textStr);
|
||||
if (byteVal == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
EntityPlayer player3 = player2;
|
||||
if (ch >= 0) {
|
||||
if (player2 == null) {
|
||||
break label176;
|
||||
}
|
||||
|
||||
player3 = player2;
|
||||
}
|
||||
|
||||
if (player3 == this.mcSupplier.get().thePlayer) {
|
||||
break label176;
|
||||
}
|
||||
|
||||
this.cachedText = player2.getName();
|
||||
this.cachedValue2 = player2.posX;
|
||||
this.cachedValue3 = player2.posZ;
|
||||
this.cachedValue = 100.0;
|
||||
if (time < 0L) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (byteVal != 0) {
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
label127: {
|
||||
String textStr2 = args[0];
|
||||
if (byteVal != 0) {
|
||||
if (textStr2.equals("~")) {
|
||||
posX2 = this.mcSupplier.get().thePlayer.posX;
|
||||
break label127;
|
||||
}
|
||||
|
||||
textStr2 = args[0];
|
||||
}
|
||||
|
||||
posX2 = Double.parseDouble(textStr2);
|
||||
}
|
||||
|
||||
label121: {
|
||||
this.cachedValue2 = posX2;
|
||||
this.cachedValue = 100.0;
|
||||
String textStr3 = args[1];
|
||||
if (byteVal != 0) {
|
||||
if (textStr3.equals("~")) {
|
||||
posZ2 = this.mcSupplier.get().thePlayer.posZ;
|
||||
break label121;
|
||||
}
|
||||
|
||||
textStr3 = args[1];
|
||||
}
|
||||
|
||||
posZ2 = Double.parseDouble(textStr3);
|
||||
}
|
||||
|
||||
this.cachedValue3 = posZ2;
|
||||
if (ch < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (byteVal != 0) {
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
label102: {
|
||||
String textStr4 = args[0];
|
||||
if (byteVal != 0) {
|
||||
if (textStr4.equals("~")) {
|
||||
posX3 = this.mcSupplier.get().thePlayer.posX;
|
||||
break label102;
|
||||
}
|
||||
|
||||
textStr4 = args[0];
|
||||
}
|
||||
|
||||
posX3 = Double.parseDouble(textStr4);
|
||||
}
|
||||
|
||||
label96: {
|
||||
this.cachedValue2 = posX3;
|
||||
String textStr5 = args[1];
|
||||
if (byteVal != 0) {
|
||||
if (textStr5.equals("~")) {
|
||||
posY2 = this.mcSupplier.get().thePlayer.posY;
|
||||
break label96;
|
||||
}
|
||||
|
||||
textStr5 = args[1];
|
||||
}
|
||||
|
||||
posY2 = Double.parseDouble(textStr5);
|
||||
}
|
||||
|
||||
label90: {
|
||||
this.cachedValue = posY2;
|
||||
String textStr6 = args[2];
|
||||
if (byteVal != 0) {
|
||||
if (textStr6.equals("~")) {
|
||||
posZ3 = this.mcSupplier.get().thePlayer.posZ;
|
||||
break label90;
|
||||
}
|
||||
|
||||
textStr6 = args[2];
|
||||
}
|
||||
|
||||
posZ3 = Double.parseDouble(textStr6);
|
||||
}
|
||||
|
||||
this.cachedValue3 = posZ3;
|
||||
}
|
||||
|
||||
Novoline novolineInst = this.novoline2;
|
||||
NotificationManager notifManager = novolineInst.getNotificationManager();
|
||||
String textStr7 = "UHC Teleport";
|
||||
String textStr12 = "Try To Teleport to %.0f,%.0f,%.0f";
|
||||
Object[] objArr = new Object[3];
|
||||
double doubleVal = this.cachedValue2;
|
||||
objArr[0] = doubleVal;
|
||||
doubleVal = this.cachedValue;
|
||||
objArr[1] = doubleVal;
|
||||
doubleVal = this.cachedValue3;
|
||||
objArr[2] = doubleVal;
|
||||
textStr12 = String.format(textStr12, objArr);
|
||||
notifManager.pop(textStr7, textStr12, 6500, NotificationType.INFO);
|
||||
EventManager.register(this);
|
||||
this.timer = new TimerUtil();
|
||||
this.teleportModeField = TeleportMode.WAIT;
|
||||
return;
|
||||
}
|
||||
|
||||
Novoline novolineInst2 = this.novoline2;
|
||||
NotificationManager notifManager2 = novolineInst2.getNotificationManager();
|
||||
String textStr8 = "UHC Teleport";
|
||||
StringBuilder sb = new StringBuilder();
|
||||
String textStr9 = "Player ";
|
||||
sb = sb.append(textStr9);
|
||||
textStr9 = args[0];
|
||||
sb = sb.append(textStr9);
|
||||
textStr9 = " not found!";
|
||||
String textStr13 = sb.append(textStr9).toString();
|
||||
NotificationType notificationType = NotificationType.ERROR;
|
||||
notifManager2.pop(textStr8, textStr13, 2500, notificationType);
|
||||
return;
|
||||
}
|
||||
|
||||
Novoline novolineInst3 = this.novoline2;
|
||||
NotificationManager notifManager3 = novolineInst3.getNotificationManager();
|
||||
String textStr10 = "UHC Teleport";
|
||||
String textStr14 = "You have to be in Hypixel UHC";
|
||||
NotificationType notificationType2 = NotificationType.ERROR;
|
||||
notifManager3.pop(textStr10, textStr14, 3500, notificationType2);
|
||||
return;
|
||||
}
|
||||
|
||||
String textStr11 = "Teleport help:";
|
||||
String textStr15 = ".tp";
|
||||
CommandUsageMessage[] commandUsageMessageArr = new CommandUsageMessage[1];
|
||||
commandUsageMessageArr[0] = CommandUsageMessage.of("<x y z>, <x z>, <player name>", "Hypixel UHC Teleport");
|
||||
this.updateState2(textStr11, textStr15, commandUsageMessageArr);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package cc.novoline.commands.impl;
|
||||
|
||||
public enum TeleportMode {
|
||||
WAIT,
|
||||
RECONNECT,
|
||||
TP;
|
||||
|
||||
private static final TeleportMode[] teleportModeArray = new TeleportMode[]{TeleportMode.WAIT, TeleportMode.RECONNECT, TeleportMode.TP};
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
package cc.novoline.commands.impl;
|
||||
import cc.novoline.Novoline;
|
||||
import cc.novoline.commands.NovoCommand;
|
||||
import cc.novoline.modules.AbstractModule;
|
||||
import cc.novoline.modules.configurations.holder.ModuleHolder;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectCollection;
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.Collector;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
import cc.novoline.modules.ModuleManager;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
public final class ToggleCommand extends NovoCommand {
|
||||
public ToggleCommand(@NonNull Novoline novoline, String text, String str, String value) {
|
||||
super(novoline, text, str, value);
|
||||
}
|
||||
|
||||
public void updateState2(char ch, long time, String[] args) {
|
||||
boolean flag = true;
|
||||
String[] stringArr = args;
|
||||
if (flag) {
|
||||
if (args.length < 1) {
|
||||
this.applyString4("Use .toggle (module)");
|
||||
return;
|
||||
}
|
||||
|
||||
stringArr = args;
|
||||
}
|
||||
|
||||
String[] stringArr2 = stringArr;
|
||||
int len = stringArr2.length;
|
||||
int intVal = 0;
|
||||
|
||||
while (intVal < len) {
|
||||
String textStr = stringArr2[intVal];
|
||||
boolean flag2 = flag;
|
||||
if (ch >= 0) {
|
||||
if (flag) {
|
||||
label48:
|
||||
if (textStr != null) {
|
||||
AbstractModule mod;
|
||||
label46: {
|
||||
Novoline novolineInst = Novoline.getInstance();
|
||||
ModuleManager modManager = novolineInst.getModuleManager();
|
||||
mod = modManager.getByName(textStr);
|
||||
boolean flag3 = flag;
|
||||
if (time > 0L) {
|
||||
if (flag) {
|
||||
if (mod != null) {
|
||||
break label46;
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb = sb.append("Module ").append(textStr);
|
||||
this.applyString4(sb.append(" was not found!").toString());
|
||||
}
|
||||
|
||||
flag3 = flag;
|
||||
}
|
||||
|
||||
if (flag3) {
|
||||
break label48;
|
||||
}
|
||||
}
|
||||
|
||||
StringBuilder sb2 = new StringBuilder();
|
||||
String textStr2 = mod.toggle() ? "Enabled" : "Disabled";
|
||||
sb2 = sb2.append(textStr2);
|
||||
textStr2 = " ";
|
||||
sb2 = sb2.append(textStr2);
|
||||
textStr2 = mod.getName();
|
||||
this.applyString5(sb2.append(textStr2).toString());
|
||||
}
|
||||
|
||||
intVal++;
|
||||
}
|
||||
|
||||
flag2 = flag;
|
||||
}
|
||||
|
||||
if (!flag2) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull List<String> resolveDouble(@NonNull String[] args) {
|
||||
String lowerStr = args[args.length - 1].toLowerCase();
|
||||
Novoline novolineInst = this.novoline2;
|
||||
ModuleManager modManager = novolineInst.getModuleManager();
|
||||
ObjectCollection objectCollection = modManager.getModules().values();
|
||||
Stream stream2 = objectCollection.stream();
|
||||
Function mapper = ((java.util.function.Function<cc.novoline.modules.configurations.holder.ModuleHolder, cc.novoline.modules.AbstractModule>) ModuleHolder::getModule);
|
||||
Stream stream3 = stream2.map(mapper);
|
||||
mapper = ((java.util.function.Function<cc.novoline.modules.AbstractModule, java.lang.String>) AbstractModule::getName);
|
||||
Stream stream4 = stream3.map(mapper);
|
||||
mapper = ((java.util.function.Function<java.lang.String, java.lang.String>) String::toLowerCase);
|
||||
Stream stream5 = stream4.map(mapper);
|
||||
Predicate<java.lang.String> predicate = ((java.util.function.Predicate) (($a0) -> ((String) $a0).startsWith(lowerStr)));
|
||||
Stream stream6 = stream5.filter(predicate);
|
||||
Supplier supplier = ObjectArrayList::new;
|
||||
Collector collector = Collectors.toCollection(supplier);
|
||||
return (java.util.List<java.lang.String>) stream6.collect(collector);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package cc.novoline.commands.impl;
|
||||
import cc.novoline.Novoline;
|
||||
import cc.novoline.commands.NovoCommand;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.EntityPlayerSP;
|
||||
import net.minecraft.command.CommandException;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
public final class VClipCommand extends NovoCommand {
|
||||
public VClipCommand(@NonNull Novoline novoline, String text, String str) {
|
||||
super(novoline, text, str);
|
||||
}
|
||||
|
||||
public void updateState2(char ch, long time, String[] args) throws CommandException {
|
||||
byte byteVal = (byte)(false ? 1 : 0);
|
||||
int intVal = byteVal;
|
||||
if (ch >= 0) {
|
||||
if (byteVal != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
intVal = args.length;
|
||||
}
|
||||
|
||||
if (intVal == 1) {
|
||||
EntityPlayerSP player = Minecraft.getMinecraft().thePlayer;
|
||||
double doubleVal = this.resolveDouble(args[0]);
|
||||
double posX2 = player.posX;
|
||||
double posY2 = player.posY + doubleVal;
|
||||
double posZ2 = player.posZ;
|
||||
player.setPositionAndUpdate(posX2, posY2, posZ2);
|
||||
} else {
|
||||
this.applyString4("Use .vclip (height)");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,439 @@
|
||||
package cc.novoline.commands.impl;
|
||||
import cc.novoline.Novoline;
|
||||
import cc.novoline.commands.NovoCommand;
|
||||
import cc.novoline.modules.configurations.util.WaypointEntry;
|
||||
import cc.novoline.modules.visual.Waypoints;
|
||||
import cc.novoline.utils.messages.CommandUsageMessage;
|
||||
import cc.novoline.utils.notifications.NotificationManager;
|
||||
import cc.novoline.utils.notifications.NotificationType;
|
||||
import cc.novoline.modules.ModuleRegistry;
|
||||
import java.io.IOException;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
public final class WaypointCommand extends NovoCommand {
|
||||
public WaypointCommand(@NonNull Novoline novoline, String text, String str, List<String> list) {
|
||||
super(novoline, text, str, list);
|
||||
}
|
||||
|
||||
public void updateState2(char ch, long time, String[] args) {
|
||||
int intVal;
|
||||
cc.novoline.modules.visual.Waypoints waypoints2;
|
||||
byte byteVal;
|
||||
java.util.List<cc.novoline.modules.configurations.util.WaypointEntry> waypointEntryList;
|
||||
int intVal5 = (true ? 1 : 0);
|
||||
Waypoints waypoints3 = ModuleRegistry.WAYPOINTS.getModule();
|
||||
byte byteVal2 = (byte)intVal5;
|
||||
String[] stringArr = args;
|
||||
byte byteVal3 = byteVal2;
|
||||
if (ch >= 0) {
|
||||
if (byteVal2 != 0) {
|
||||
if (args.length == 0) {
|
||||
this.performStep();
|
||||
return;
|
||||
}
|
||||
|
||||
stringArr = args;
|
||||
}
|
||||
|
||||
byteVal3 = 0;
|
||||
}
|
||||
|
||||
label275: {
|
||||
String textStr = stringArr[byteVal3];
|
||||
String lowerStr = textStr.toLowerCase();
|
||||
byte byteVal4 = -1;
|
||||
intVal5 = lowerStr.hashCode();
|
||||
label274:
|
||||
if (byteVal2 != 0) {
|
||||
label279: {
|
||||
label271: {
|
||||
label280: {
|
||||
label269: {
|
||||
label281: {
|
||||
label267: {
|
||||
label282: {
|
||||
label265: {
|
||||
label283: {
|
||||
switch (intVal5) {
|
||||
case -1335458389:
|
||||
break label283;
|
||||
case 96417:
|
||||
intVal5 = (lowerStr.equals("add") ? 1 : 0);
|
||||
if (byteVal2 == 0) {
|
||||
break label274;
|
||||
}
|
||||
|
||||
if (intVal5 == 0) {
|
||||
break label279;
|
||||
}
|
||||
|
||||
byteVal4 = 0;
|
||||
intVal5 = byteVal2;
|
||||
if (time < 0L) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (byteVal2 != 0) {
|
||||
break label279;
|
||||
}
|
||||
case -934610812:
|
||||
intVal5 = (lowerStr.equals("remove") ? 1 : 0);
|
||||
break;
|
||||
case 99339:
|
||||
break label282;
|
||||
case 3322014:
|
||||
break label280;
|
||||
case 94746189:
|
||||
break label281;
|
||||
default:
|
||||
break label279;
|
||||
}
|
||||
|
||||
if (byteVal2 == 0) {
|
||||
break label274;
|
||||
}
|
||||
|
||||
if (intVal5 == 0) {
|
||||
break label279;
|
||||
}
|
||||
|
||||
byteVal4 = 1;
|
||||
intVal5 = byteVal2;
|
||||
if (ch < 0) {
|
||||
break label265;
|
||||
}
|
||||
|
||||
if (byteVal2 != 0) {
|
||||
break label279;
|
||||
}
|
||||
}
|
||||
|
||||
intVal5 = (lowerStr.equals("delete") ? 1 : 0);
|
||||
}
|
||||
|
||||
if (byteVal2 == 0) {
|
||||
break label274;
|
||||
}
|
||||
|
||||
if (intVal5 == 0) {
|
||||
break label279;
|
||||
}
|
||||
|
||||
byteVal4 = 2;
|
||||
intVal5 = byteVal2;
|
||||
if (ch < 0) {
|
||||
break label267;
|
||||
}
|
||||
|
||||
if (byteVal2 != 0) {
|
||||
break label279;
|
||||
}
|
||||
}
|
||||
|
||||
intVal5 = (lowerStr.equals("del") ? 1 : 0);
|
||||
}
|
||||
|
||||
if (byteVal2 == 0) {
|
||||
break label274;
|
||||
}
|
||||
|
||||
if (intVal5 == 0) {
|
||||
break label279;
|
||||
}
|
||||
|
||||
byteVal4 = 3;
|
||||
intVal5 = byteVal2;
|
||||
if (ch < 0) {
|
||||
break label269;
|
||||
}
|
||||
|
||||
if (byteVal2 != 0) {
|
||||
break label279;
|
||||
}
|
||||
}
|
||||
|
||||
intVal5 = (lowerStr.equals("clear") ? 1 : 0);
|
||||
}
|
||||
|
||||
if (byteVal2 == 0) {
|
||||
break label274;
|
||||
}
|
||||
|
||||
if (intVal5 == 0) {
|
||||
break label279;
|
||||
}
|
||||
|
||||
byteVal4 = 4;
|
||||
intVal5 = byteVal2;
|
||||
if (time < 0L) {
|
||||
break label271;
|
||||
}
|
||||
|
||||
if (byteVal2 != 0) {
|
||||
break label279;
|
||||
}
|
||||
}
|
||||
|
||||
intVal5 = (lowerStr.equals("list") ? 1 : 0);
|
||||
}
|
||||
|
||||
intVal = byteVal2;
|
||||
if (ch < 0) {
|
||||
break label275;
|
||||
}
|
||||
|
||||
if (byteVal2 == 0) {
|
||||
break label274;
|
||||
}
|
||||
|
||||
if (intVal5 != 0) {
|
||||
byteVal4 = 5;
|
||||
}
|
||||
}
|
||||
|
||||
intVal5 = byteVal4;
|
||||
}
|
||||
|
||||
intVal = byteVal2;
|
||||
}
|
||||
|
||||
label286: {
|
||||
label287: {
|
||||
label288: {
|
||||
label289: {
|
||||
label199: {
|
||||
label290: {
|
||||
if (time >= 0L) {
|
||||
if (intVal != 0) {
|
||||
switch (intVal5) {
|
||||
case 0:
|
||||
intVal5 = args.length;
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
break label290;
|
||||
case 4:
|
||||
break label289;
|
||||
case 5:
|
||||
break label288;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
intVal = 5;
|
||||
}
|
||||
|
||||
if (intVal5 != intVal) {
|
||||
this.performStep();
|
||||
return;
|
||||
}
|
||||
|
||||
waypoints3.handleWaypointEntry(WaypointEntry.resolveWaypointEntry(args[4], Integer.parseInt(args[1]), Integer.parseInt(args[2]), Integer.parseInt(args[3])));
|
||||
|
||||
try {
|
||||
waypoints3.getPlayerManagerConfigisnotlHelper().a();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
String textStr2 = "Waypoint ";
|
||||
StringBuilder sb2 = sb.append(textStr2);
|
||||
textStr2 = args[4];
|
||||
StringBuilder sb3 = sb2.append(textStr2);
|
||||
textStr2 = " was added successfully!";
|
||||
this.updateState(sb3.append(textStr2).toString(), 5000);
|
||||
return;
|
||||
} catch (IOException ex) {
|
||||
this.applyString4("Can't save to file");
|
||||
Logger log = waypoints3.getLogger();
|
||||
log.warn("An error occurred while saving waypoints list", ex);
|
||||
intVal5 = byteVal2;
|
||||
if (time < 0L) {
|
||||
break label199;
|
||||
}
|
||||
|
||||
if (byteVal2 != 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
intVal5 = args.length;
|
||||
}
|
||||
|
||||
label181: {
|
||||
label180: {
|
||||
label179: {
|
||||
label291: {
|
||||
if (byteVal2 != 0) {
|
||||
if (intVal5 != 2) {
|
||||
this.performStep();
|
||||
return;
|
||||
}
|
||||
|
||||
if (time < 0L) {
|
||||
return;
|
||||
}
|
||||
|
||||
waypoints2 = waypoints3;
|
||||
if (byteVal2 == 0) {
|
||||
break label291;
|
||||
}
|
||||
|
||||
intVal5 = (waypoints3.evaluateFlag9(args[1]) ? 1 : 0);
|
||||
}
|
||||
|
||||
if (intVal5 == 0) {
|
||||
break label180;
|
||||
}
|
||||
|
||||
StringBuilder sb4 = new StringBuilder();
|
||||
StringBuilder sb5 = sb4.append("Removed ");
|
||||
String textStr6 = args[1];
|
||||
StringBuilder sb6 = sb5.append(textStr6);
|
||||
this.updateState(sb6.append(" waypoint!").toString(), 5000);
|
||||
|
||||
try {
|
||||
WaypointCommand.<IOException>$keepCatch();
|
||||
waypoints2 = waypoints3;
|
||||
} catch (IOException ex2) {
|
||||
Novoline novolineInst = Novoline.getInstance();
|
||||
NotificationManager notifManager = novolineInst.getNotificationManager();
|
||||
String textStr3 = "Can't save to file";
|
||||
NotificationType notificationType = NotificationType.ERROR;
|
||||
notifManager.pop(textStr3, notificationType);
|
||||
Logger log2 = waypoints3.getLogger();
|
||||
log2.warn("An error occurred while saving waypoints list", ex2);
|
||||
byteVal = byteVal2;
|
||||
if (ch < 0) {
|
||||
break label181;
|
||||
}
|
||||
break label179;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
waypoints2.getPlayerManagerConfigisnotlHelper().a();
|
||||
return;
|
||||
} catch (IOException ex3) {
|
||||
Novoline novolineInst2 = Novoline.getInstance();
|
||||
NotificationManager notifManager2 = novolineInst2.getNotificationManager();
|
||||
String textStr4 = "Can't save to file";
|
||||
NotificationType notificationType2 = NotificationType.ERROR;
|
||||
notifManager2.pop(textStr4, notificationType2);
|
||||
Logger log3 = waypoints3.getLogger();
|
||||
log3.warn("An error occurred while saving waypoints list", ex3);
|
||||
byteVal = byteVal2;
|
||||
if (ch < 0) {
|
||||
break label181;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (byteVal != 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
this.updateState3("Waypoint doesn't exist!", 5000);
|
||||
byteVal = byteVal2;
|
||||
}
|
||||
|
||||
if (byteVal != 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
label293: {
|
||||
int len = args.length;
|
||||
if (ch >= 0 && byteVal2 != 0) {
|
||||
if (len != 1) {
|
||||
this.performStep();
|
||||
return;
|
||||
}
|
||||
|
||||
waypointEntryList = waypoints3.getListValue7();
|
||||
if (time <= 0L || byteVal2 == 0) {
|
||||
break label293;
|
||||
}
|
||||
|
||||
len = (waypointEntryList.isEmpty() ? 1 : 0);
|
||||
}
|
||||
|
||||
if (len != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
waypointEntryList = waypoints3.getListValue7();
|
||||
}
|
||||
|
||||
waypointEntryList.clear();
|
||||
intVal5 = byteVal2;
|
||||
if (time <= 0L) {
|
||||
break label287;
|
||||
}
|
||||
|
||||
if (byteVal2 != 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (ch < 0) {
|
||||
break label286;
|
||||
}
|
||||
|
||||
intVal5 = args.length;
|
||||
}
|
||||
|
||||
if (intVal5 != 1) {
|
||||
this.performStep();
|
||||
return;
|
||||
}
|
||||
|
||||
this.applyString3("Waypoints:");
|
||||
}
|
||||
|
||||
List itemList = waypoints3.getListValue7();
|
||||
Iterator iter = itemList.iterator();
|
||||
|
||||
do {
|
||||
if (!iter.hasNext()) {
|
||||
break;
|
||||
}
|
||||
|
||||
WaypointEntry waypointEntry = (WaypointEntry)iter.next();
|
||||
StringBuilder sb7 = new StringBuilder();
|
||||
String textStr5 = " - name: \u00a73";
|
||||
StringBuilder sb8 = sb7.append(textStr5);
|
||||
textStr5 = waypointEntry.getCachedText();
|
||||
StringBuilder sb9 = sb8.append(textStr5);
|
||||
textStr5 = "\u00a7r, coordinates: \u00a78X:\u00a7r ";
|
||||
StringBuilder sb10 = sb9.append(textStr5);
|
||||
int intVal2 = waypointEntry.getStateTicks2();
|
||||
StringBuilder sb11 = sb10.append(intVal2);
|
||||
textStr5 = " \u00a78Y:\u00a7r ";
|
||||
StringBuilder sb12 = sb11.append(textStr5);
|
||||
int intVal3 = waypointEntry.getStateTicks();
|
||||
StringBuilder sb13 = sb12.append(intVal3);
|
||||
textStr5 = " \u00a78Z:\u00a7r ";
|
||||
StringBuilder sb14 = sb13.append(textStr5);
|
||||
int intVal4 = waypointEntry.getIntValue();
|
||||
this.applyString3(sb14.append(intVal4).toString());
|
||||
} while (byteVal2 != 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void performStep() {
|
||||
CommandUsageMessage[] commandUsageMessageArr = new CommandUsageMessage[4];
|
||||
commandUsageMessageArr[0] = CommandUsageMessage.of("add (x) (y) (z) (name)", "add waypoint");
|
||||
commandUsageMessageArr[1] = CommandUsageMessage.of("remove (name)", "removes waypoint");
|
||||
commandUsageMessageArr[2] = CommandUsageMessage.of("clear", "remove all waypoints");
|
||||
commandUsageMessageArr[3] = CommandUsageMessage.of("list", "show waypoints list");
|
||||
this.updateState2("Waypoints help:", ".waypoint", commandUsageMessageArr);
|
||||
}
|
||||
private static <E extends Throwable> void $keepCatch() throws E {}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package cc.novoline.commands.util;
|
||||
|
||||
public class CommandPrefixHolder {
|
||||
public static String textValue;
|
||||
|
||||
public static void handleAction() {
|
||||
textValue = ".";
|
||||
}
|
||||
|
||||
static {
|
||||
handleAction();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package cc.novoline.commands.util;
|
||||
public final class ConfigCommandException extends IllegalArgumentException {
|
||||
public ConfigCommandException(String text) {
|
||||
super(text);
|
||||
}
|
||||
|
||||
public ConfigCommandException() {}
|
||||
|
||||
public ConfigCommandException(Throwable throwable) {
|
||||
super(throwable);
|
||||
}
|
||||
|
||||
public ConfigCommandException(String text, Throwable throwable) {
|
||||
super(text, throwable);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package cc.novoline.commands.util;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public final class ConfigReadWriteException extends IOException {
|
||||
public ConfigReadWriteException(Throwable throwable) {
|
||||
super(throwable);
|
||||
}
|
||||
|
||||
public ConfigReadWriteException() {}
|
||||
|
||||
public ConfigReadWriteException(String text, Throwable throwable) {
|
||||
super(text, throwable);
|
||||
}
|
||||
|
||||
public ConfigReadWriteException(String text) {
|
||||
super(text);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package cc.novoline.commands.util;
|
||||
|
||||
import cc.novoline.modules.PlayerRelationType;
|
||||
|
||||
public class FriendRelationSwitchMap {
|
||||
public static final int[] SWITCH_MAP = new int[PlayerRelationType.values().length];
|
||||
|
||||
static {
|
||||
try {
|
||||
SWITCH_MAP[PlayerRelationType.TARGET.ordinal()] = 1;
|
||||
} catch (NoSuchFieldError noSuchFieldError) {
|
||||
}
|
||||
|
||||
try {
|
||||
SWITCH_MAP[PlayerRelationType.FRIEND.ordinal()] = 2;
|
||||
} catch (NoSuchFieldError noSuchFieldError2) {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
package cc.novoline.commands.util;
|
||||
|
||||
import com.google.gson.FieldNamingPolicy;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonParser;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.util.function.Consumer;
|
||||
import cc.novoline.modules.configurations.holder.SavingModuleHolderSupport;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
public final class JsonSchemaUtil {
|
||||
private static final Gson gson2 = new GsonBuilder()
|
||||
.disableHtmlEscaping()
|
||||
.serializeNulls()
|
||||
.excludeFieldsWithoutExposeAnnotation()
|
||||
.setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES)
|
||||
.create();
|
||||
private static final JsonParser jsonParser = new JsonParser();
|
||||
|
||||
public static <T extends JsonElement> @Nullable T resolveJsonElement(
|
||||
@NonNull HttpURLConnection httpURLConnection, @Nullable Consumer<? super HttpURLConnection> consumer, @NonNull Class<T> param
|
||||
) throws IOException {
|
||||
httpURLConnection.connect();
|
||||
|
||||
JsonElement jsonElement;
|
||||
try {
|
||||
label83: {
|
||||
label72: {
|
||||
int intVal = httpURLConnection.getResponseCode();
|
||||
short shortVal = 200;
|
||||
if (intVal < 200) {
|
||||
break label72;
|
||||
}
|
||||
|
||||
intVal = httpURLConnection.getResponseCode();
|
||||
|
||||
if (intVal <= 299) {
|
||||
jsonElement = jsonParser.parse(new InputStreamReader(httpURLConnection.getInputStream()));
|
||||
break label83;
|
||||
}
|
||||
}
|
||||
|
||||
Consumer consumer2 = consumer;
|
||||
if (consumer == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
consumer2 = consumer;
|
||||
|
||||
consumer2.accept(httpURLConnection);
|
||||
return null;
|
||||
}
|
||||
} finally {
|
||||
httpURLConnection.disconnect();
|
||||
}
|
||||
|
||||
if (!param.isInstance(jsonElement)) {
|
||||
throw new RuntimeException("API schema has been changed!");
|
||||
} else {
|
||||
return (T)jsonElement;
|
||||
}
|
||||
}
|
||||
|
||||
private JsonSchemaUtil() {
|
||||
throw new UnsupportedOperationException("This is a utility class and cannot be instantiated");
|
||||
}
|
||||
|
||||
public static @NonNull HttpURLConnection resolveHttpURLConnection(String text) throws IOException {
|
||||
SavingModuleHolderSupport.applyUpdate(text, "URL");
|
||||
URL uRL = new URL(text);
|
||||
HttpURLConnection httpURLConnection = (HttpURLConnection)uRL.openConnection();
|
||||
httpURLConnection.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36 OPR/65.0.3467.62");
|
||||
httpURLConnection.setRequestProperty("Content-Type", "application/json");
|
||||
httpURLConnection.setConnectTimeout(15000);
|
||||
httpURLConnection.setRequestMethod("GET");
|
||||
httpURLConnection.setDoOutput(true);
|
||||
|
||||
return httpURLConnection;
|
||||
}
|
||||
|
||||
public static JsonParser getJsonParser() {
|
||||
return jsonParser;
|
||||
}
|
||||
|
||||
public static Gson getGson() {
|
||||
return gson2;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package cc.novoline.commands.util;
|
||||
|
||||
import com.google.gson.annotations.Expose;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class NameHistoryRecord {
|
||||
@Expose
|
||||
@SerializedName("changedToAt")
|
||||
private final long a;
|
||||
@Expose
|
||||
@SerializedName("name")
|
||||
private final String b;
|
||||
|
||||
public long getLongValue() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
public String getTextValue() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
public boolean isStateReady() {
|
||||
int intVal = ((this.a == 0L) ? 1 : 0);
|
||||
|
||||
return ((((intVal & 1)) != 0));
|
||||
}
|
||||
|
||||
public NameHistoryRecord(String name, long time) {
|
||||
this.b = name;
|
||||
this.a = time;
|
||||
}
|
||||
}
|
||||
Loaded 100 of 7727 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user