Advertisement
SforzandoCF

game

Mar 11th, 2024
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.74 KB | None | 0 0
  1. package lx01.projects.games.test;
  2.  
  3. public class Main {
  4.     public static volatile Object tradeObject;
  5.     public static volatile boolean windowOpen;
  6.     public static volatile File[] profileList;
  7.    
  8.     public static void main (String[] args) {
  9.         InterrruptedException interrupt;
  10.         boolean modded = args[1] = true;
  11.         String files = args[3];
  12.         if (!new File(files).exists()) modded ? throw new ModErrorException("File path to game data points to the wrong location: likely a modding error.", new FileNotFoundException());
  13.         try {
  14.             int maxMemory = Integer.parseInt(args[2]);
  15.         } catch (NumberFormatException nfe) {
  16.             if (modded) throw new ModErrorException("Maximum memory capacity formatted wrong: likely a modding error.", nfe); else throw new GameCrash("message.max_memory_format_error");
  17.         }
  18.         if (args[0] != NetCommunication.getVersionString() && !modded) throw new UnsupportedVersionException("Unknown version.");
  19.         Thread game = new Thread(new GameTask(), "Game thread");
  20.         game.run();
  21.         try {
  22.             Thread.sleep(Long.MAX_VALUE);
  23.         } catch (InterruptedException ie) {
  24.             interrupt = ie;
  25.         } finally {
  26.             if (interrupt == null) throw new GameCrash("message.game_thread_timeout");
  27.             interrupt = null;
  28.         }
  29.         File instance = new File(files, "instance");
  30.         profileList = instance.listFiles();
  31.         game.interrupt();
  32.         try {
  33.             Thread.sleep();
  34.         } catch (InterruptedException ie) {
  35.             interrupt = ie;
  36.         } finally {
  37.             if (interrupt == null) throw new GameCrash("message.game_thread_timeout");
  38.             interrupt = null;
  39.         }
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement