@@ -126,7 +126,7 @@ static void main(String[] args) throws IOException, InterruptedException {
126126 EarlyLogger .log ("Pre-patching the game with " + mainClass );
127127 method .invoke (null , (Object ) new String []{input .getAbsolutePath (),
128128 HypertalePaths .hypertalePrePatched .getAbsolutePath ()});
129- if (HypertalePaths .hypertalePrePatched . isFile ( )) {
129+ if (MainPlus . checkHytaleJarFile ( HypertalePaths .hypertalePrePatched )) {
130130 input = HypertalePaths .hypertalePrePatched ;
131131 }
132132 } catch (Exception e ) {
@@ -177,11 +177,11 @@ static void main(String[] args) throws IOException, InterruptedException {
177177 EarlyLogger .start (false );
178178 EarlyLogger .log ("Version " + BuildConfig .HYPERTALE_VERSION );
179179 File hytaleJar = HypertalePaths .getHytaleJar ();
180- if (!hytaleJar .exists ()) {
180+ if (!hytaleJar .isFile ()) {
181181 EarlyLogger .log ("Cannot find original HytaleServer.jar" );
182+ EarlyLogger .stop ();
182183 return ;
183184 }
184- // TODO: Detect singleplayer mode
185185 HypertaleConfig .load ();
186186 HypertaleData cachedData = null ;
187187 if (HypertalePaths .hypertaleCacheJar .exists () &&
@@ -242,14 +242,21 @@ private static void launchGame(String[] args, boolean dev) throws IOException {
242242 }
243243 }
244244 }
245- if (HypertalePaths .hypertaleCacheJar .exists ()) {
245+ if (HypertalePaths .hypertaleCacheJar .isFile ()) {
246+ if (!MainPlus .checkHytaleJarFile (HypertalePaths .hypertaleCacheJar )) {
247+ EarlyLogger .log ("Patched jar is invalid, or corrupted!" );
248+ return ;
249+ }
246250 DependencyHelper .addFileToClasspath (HypertalePaths .hypertaleCacheJar );
247251 } else if (!dev ) {
248252 throw new FileNotFoundException ("Failed to get ./.hypertale/HytaleServer.jar" );
249253 }
250254 for (DependencyHelper .Dependency dependency : DependencyHelper .patcherDependencies ) {
251255 DependencyHelper .loadDependency (dependency );
252256 }
257+ if (MainPlus .checkHaltLaunchGame (args )) {
258+ return ;
259+ }
253260 MixinLoader .preInitializeMixin ();
254261 PatchHelper .install ();
255262 if (modGatherer .getModSyncBootstrap () != null &&
0 commit comments