diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4073620 --- /dev/null +++ b/.gitignore @@ -0,0 +1,25 @@ +# eclipse +bin +*.launch +.settings +.metadata +.classpath +.project + +# idea +out +*.ipr +*.iws +*.iml +.idea + +# gradle +build +.gradle + +# other +eclipse +run + +# dev +dev \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..24fda35 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,13 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "type": "java", + "name": "Debug (Attach)", + "request": "attach", + "hostName": "localhost", + "port": 5005, + "preLaunchTask": "Run Client (debug)" + } + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..e4f53cf --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "java.configuration.updateBuildConfiguration": "disabled", + "java.compile.nullAnalysis.mode": "disabled", + "java.jdt.ls.vmargs": "-XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx6G -Xms100m -Xlog:disable" +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..ce5a9bf --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,21 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "Run Client (debug)", + "command": { + "quoting": "escape", + "value": [ + "./gradlew" + ] + }, + "problemMatcher": [], + "type": "shell", + "args": [ + "runClient", + "--debug-jvm" + ], + "isBackground": true, + } + ] +} \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..00d2e13 --- /dev/null +++ b/LICENSE @@ -0,0 +1,24 @@ +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or +distribute this software, either in source code form or as a compiled +binary, for any purpose, commercial or non-commercial, and by any +means. + +In jurisdictions that recognize copyright laws, the author or authors +of this software dedicate any and all copyright interest in the +software to the public domain. We make this dedication for the benefit +of the public at large and to the detriment of our heirs and +successors. We intend this dedication to be an overt act of +relinquishment in perpetuity of all present and future rights to this +software under copyright law. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +For more information, please refer to \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..9168113 --- /dev/null +++ b/README.md @@ -0,0 +1,6 @@ +# Serverlist Buffer Fixer +A mod that fixes the slow/infinite server data loading in the multiplayer menu. + +Also prevents you from spamming "refresh" too much. + +### Note that this "behavior" *(read bug)* is still present as of the latest versions (1.20.1 currently). \ No newline at end of file diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..b098519 --- /dev/null +++ b/build.gradle @@ -0,0 +1,99 @@ +buildscript { + repositories { + mavenCentral() + maven { url = "http://files.minecraftforge.net/maven" } + maven { url = "https://repo.spongepowered.org/maven" } + } + dependencies { + classpath files('forgegradle/ForgeGradle-2.1.2.jar') + classpath 'org.spongepowered:mixingradle:0.6-SNAPSHOT' + } +} +apply plugin: 'net.minecraftforge.gradle.forge' +apply plugin: 'org.spongepowered.mixin' +apply plugin: 'eclipse' + +version = mod_version +group = mod_group +archivesBaseName = mod_id + +sourceCompatibility = targetCompatibility = '1.8' +compileJava { + sourceCompatibility = targetCompatibility = '1.8' +} + +minecraft { + version = "${minecraft_version}-${forge_version}" + runDir = "run" + mappings = mappings_version + String resolved_core_plugin = mod_core_plugin.replace('${mod_group}', mod_group).replace('${mod_id}', mod_id) + clientJvmArgs += "-Dfml.coreMods.load=${resolved_core_plugin}" + serverJvmArgs += "-Dfml.coreMods.load=${resolved_core_plugin}" + String resolved_core_config = mod_mixin_configs.replace('${mod_id}', mod_id) + clientRunArgs += "--mixin ${resolved_core_config}" + serverRunArgs += "--mixin ${resolved_core_config}" +} + +runClient { + args = ["--username", dev_username] +} + +repositories { + mavenCentral() + maven { url = "https://repo.spongepowered.org/maven" } +} + +configurations { + embed + compile.extendsFrom(embed) +} + +dependencies { + embed('org.spongepowered:mixin:0.7.11-SNAPSHOT') { + exclude module: 'guava' + exclude module: 'commons-io' + exclude module: 'gson' + } + annotationProcessor 'org.spongepowered:mixin:0.7.11-SNAPSHOT' + + compileOnly 'org.projectlombok:lombok:1.18.18' + annotationProcessor 'org.projectlombok:lombok:1.18.12' +} + +processResources { + inputs.property "version", project.version + inputs.property "mcversion", project.minecraft.version + + from(sourceSets.main.resources.srcDirs) { + include 'mcmod.info' + + expand 'mod_id': mod_id, 'mod_name': mod_name, 'version': project.version, + 'mcversion': project.minecraft.version, 'mod_description': mod_description, + 'mod_author': mod_author + } + + from(sourceSets.main.resources.srcDirs) { + exclude 'mcmod.info' + } +} + +mixin { + add sourceSets.main, mod_mixin_refmap.replace('${mod_id}', mod_id) +} + +jar { + from(configurations.embed.collect { + it.isDirectory() ? it : zipTree(it) + }) { + exclude "LICENSE.txt", "META-INF/MANIFSET.MF", "META-INF/maven/**", "META-INF/*.RSA", "META-INF/*.SF" + } + + manifest { + attributes "FMLCorePlugin": mod_core_plugin.replace('${mod_group}', mod_group) + // attributes "FMLCorePluginContainsFMLMod": "true" + attributes "ForceLoadAsMod": "true" + attributes "TweakClass": "org.spongepowered.asm.launch.MixinTweaker" + attributes "MixinConfigs": mod_mixin_configs.replace('${mod_id}', mod_id) + + } +} diff --git a/forgegradle/ForgeGradle-2.1.2.jar b/forgegradle/ForgeGradle-2.1.2.jar new file mode 100644 index 0000000..ebd5192 Binary files /dev/null and b/forgegradle/ForgeGradle-2.1.2.jar differ diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..a00b4b0 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,15 @@ +mod_id=serverlistbufferfixer +mod_name=Serverlist Buffer Fixer +mod_group=me.nixuge.serverlistbufferfixer +mod_version=1.0.0 +mod_author=["Nixuge"] +mod_description=A mod that fixes the slow/infinite server data loading in the multiplayer menu. Also prevents you from spamming "refresh" too much. +minecraft_version=1.8.9 +forge_version=11.15.1.2318-1.8.9 +mappings_version=stable_22 +dev_username=ElNixuDev +mod_core_plugin=${mod_group}.mixins.MixinLoader +mod_mixin_configs=mixins.${mod_id}.json +mod_mixin_refmap=refmap.${mod_id}.json +org.gradle.daemon=true +org.gradle.jvmargs=-Xmx3G \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..758de96 Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..290541c --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew new file mode 100755 index 0000000..cccdd3d --- /dev/null +++ b/gradlew @@ -0,0 +1,172 @@ +#!/usr/bin/env sh + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# 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 + ;; + 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" + which java >/dev/null 2>&1 || 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 + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..f955316 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,84 @@ +@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=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@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= + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +: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 %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="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! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/src/main/java/me/nixuge/serverlistbufferfixer/McMod.java b/src/main/java/me/nixuge/serverlistbufferfixer/McMod.java new file mode 100644 index 0000000..55a7e8d --- /dev/null +++ b/src/main/java/me/nixuge/serverlistbufferfixer/McMod.java @@ -0,0 +1,30 @@ +package me.nixuge.serverlistbufferfixer; + +import lombok.Getter; +import lombok.Setter; +import net.minecraftforge.fml.common.Mod; + +@Mod( + modid = McMod.MOD_ID, + name = McMod.NAME, + version = McMod.VERSION, + clientSideOnly = true +) + +@Setter +public class McMod { + public static final String MOD_ID = "serverlistbufferfixer"; + public static final String NAME = "Serverlist Buffer Fixer"; + public static final String VERSION = "1.0.0"; + + + @Getter + @Mod.Instance(value = McMod.MOD_ID) + private static McMod instance; + + //@Mod.EventHandler + //public void preInit(final FMLPreInitializationEvent event) { + // Keeping that to setup the config later + // (timeout & custom messages?) + //} +} diff --git a/src/main/java/me/nixuge/serverlistbufferfixer/mixins/MixinLoader.java b/src/main/java/me/nixuge/serverlistbufferfixer/mixins/MixinLoader.java new file mode 100644 index 0000000..c327c22 --- /dev/null +++ b/src/main/java/me/nixuge/serverlistbufferfixer/mixins/MixinLoader.java @@ -0,0 +1,43 @@ +package me.nixuge.serverlistbufferfixer.mixins; + +import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin; +import org.spongepowered.asm.launch.MixinBootstrap; +import org.spongepowered.asm.mixin.MixinEnvironment; +import org.spongepowered.asm.mixin.Mixins; + +import me.nixuge.serverlistbufferfixer.McMod; + +import java.util.Map; + +@IFMLLoadingPlugin.MCVersion("1.8.9") +public class MixinLoader implements IFMLLoadingPlugin { + public MixinLoader() { + MixinBootstrap.init(); + Mixins.addConfiguration("mixins." + McMod.MOD_ID + ".json"); + MixinEnvironment.getDefaultEnvironment().setSide(MixinEnvironment.Side.CLIENT); + } + + @Override + public String[] getASMTransformerClass() { + return new String[0]; + } + + @Override + public String getModContainerClass() { + return null; + } + + @Override + public String getSetupClass() { + return null; + } + + @Override + public void injectData(final Map data) { + } + + @Override + public String getAccessTransformerClass() { + return null; + } +} diff --git a/src/main/java/me/nixuge/serverlistbufferfixer/mixins/ServerListEntryNormalMixin.java b/src/main/java/me/nixuge/serverlistbufferfixer/mixins/ServerListEntryNormalMixin.java new file mode 100644 index 0000000..ae65c3e --- /dev/null +++ b/src/main/java/me/nixuge/serverlistbufferfixer/mixins/ServerListEntryNormalMixin.java @@ -0,0 +1,98 @@ +package me.nixuge.serverlistbufferfixer.mixins; + +import com.google.common.util.concurrent.ThreadFactoryBuilder; +import lombok.SneakyThrows; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiMultiplayer; +import net.minecraft.client.multiplayer.ServerData; +import net.minecraft.client.multiplayer.ServerList; +import net.minecraft.util.EnumChatFormatting; +import org.spongepowered.asm.mixin.Final; +import org.spongepowered.asm.mixin.Mixin; + +import net.minecraft.client.gui.ServerListEntryNormal; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +import java.net.UnknownHostException; +import java.util.concurrent.*; + +@Mixin(ServerListEntryNormal.class) +public class ServerListEntryNormalMixin { + @Shadow + @Final + private + GuiMultiplayer owner; + @Shadow + @Final + private ServerData server; + + @Shadow + private static ThreadPoolExecutor field_148302_b; + // Note: if servers are added, this will be inaccurate + // But it should be good enough still + // Can't bother to mixin onto some other classes just to change that (rn at least). + private static final int serverCountCache; + static { + serverCountCache = new ServerList(Minecraft.getMinecraft()).countServers(); + // Note: not even sure this reassignement works since the field is final + field_148302_b = new ScheduledThreadPoolExecutor(serverCountCache + 5, (new ThreadFactoryBuilder()).setNameFormat("Server Pinger #%d").setDaemon(true).build()); + } + private final ScheduledExecutorService timeoutExecutor = Executors.newScheduledThreadPool(serverCountCache * 2 + 5); + + private static int runningTaskCount = 0; + + private Runnable getPingTask() { + return new Thread() { + @SneakyThrows + @Override + public void run() { + owner.getOldServerPinger().ping(server); + } + }; + } + + private void setServerFail(String error) { + server.pingToServer = -1L; + server.serverMOTD = error; + } + + @Redirect(method = "drawEntry", at = @At(value = "INVOKE", target = "Ljava/util/concurrent/ThreadPoolExecutor;submit(Ljava/lang/Runnable;)Ljava/util/concurrent/Future;")) + public Future drawEntry(ThreadPoolExecutor instance, Runnable r) { + // Check if too many running tasks, if yes cancel & set to "spamming" + if (runningTaskCount > serverCountCache * 2) { + setServerFail(EnumChatFormatting.GRAY + "Spamming..."); + return field_148302_b.submit(() -> {}); + } + + // Start up the timeout task + final Future future = timeoutExecutor.submit(getPingTask()); + runningTaskCount++; + + // "Vanilla" behavior, modified to: + // - use a timeout for the task instead of the ping directly + // - handle future.get()'s exceptions instead of the ping's exceptions + return field_148302_b.submit(new Runnable() { + public void run() { + try { + future.get(4, TimeUnit.SECONDS); + } catch (TimeoutException e1) { + setServerFail(EnumChatFormatting.RED + "Timed out"); + } catch (ExecutionException e2) { + if (e2.getCause() instanceof UnknownHostException) { + setServerFail(EnumChatFormatting.DARK_RED + "Can't resolve hostname"); + setServerFail(EnumChatFormatting.GRAY + "Spamming..."); + } + else + setServerFail(EnumChatFormatting.DARK_RED + "Can't connect to server."); + + } catch (Exception e3) { + // Shouldn't happen anymore but just in case + setServerFail(EnumChatFormatting.DARK_RED + "Can't connect to server."); + } + runningTaskCount--; + } + }); + } +} diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info new file mode 100644 index 0000000..5bd1d12 --- /dev/null +++ b/src/main/resources/mcmod.info @@ -0,0 +1,16 @@ +[ +{ + "modid": "${mod_id}", + "name": "${mod_name}", + "description": "${mod_description}", + "version": "${version}", + "mcversion": "${mcversion}", + "url": "https://github.com/Nixuge/ServerlistBufferFixer", + "updateUrl": "", + "authorList": ${mod_author}, + "credits": "", + "logoFile": "", + "screenshots": [], + "dependencies": [] +} +] diff --git a/src/main/resources/mixins.serverlistbufferfixer.json b/src/main/resources/mixins.serverlistbufferfixer.json new file mode 100644 index 0000000..66ca16a --- /dev/null +++ b/src/main/resources/mixins.serverlistbufferfixer.json @@ -0,0 +1,10 @@ +{ + "compatibilityLevel": "JAVA_8", + "package": "me.nixuge.serverlistbufferfixer.mixins", + "refmap": "refmap.serverlistbufferfixer.json", + "mixins": [], + "client": [ + "ServerListEntryNormalMixin" + ], + "server": [] +} \ No newline at end of file