Advertisement
SforzandoCF

gaem

Mar 5th, 2024 (edited)
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.54 KB | None | 0 0
  1. public class Game {
  2.     public static void main (String[] args) {
  3.         if (args.length != 0) {
  4.             mainWithArgs(args);
  5.         } else {
  6.             return;
  7.         }
  8.     }
  9.    
  10.     public static void mainWithArgs (String[] args) {
  11.         String[] version = args[0].split('.');
  12.         int versionMajor = Integer.parseInt(version[0]);
  13.         int versionMinor = Integer.parseInt(version[1]);
  14.         int versionPatch = Integer.parseInt(version[2]);
  15.         if ((versionMajor >= Integer.parseInt(getCurrentVersion().split('.')[0])) || (versionMinor >= Integer.parseInt(getCurrentVersion().split('.')[1])) || (versionPatch >= Integer.parseInt(getCurrentVersion().split('.')[2]) && !Boolean.valueOf(getCurrentVersion().split('.')[3]).booleanValue())) {
  16.             throw new UnsupportedVersionException(String.format("Version %1$ or lower expected, got version %2$ instead.", getCurrentVersion(), args[0]));
  17.         }
  18.     }
  19. }
  20.  
  21. //
  22.  
  23. public class UnsupportedVersionException extends Exception {
  24.     public UnsupportedVersionException () {
  25.         super();
  26.     }
  27.    
  28.     public UnsupportedVersionException (String message) {
  29.         super(message);
  30.     }
  31.    
  32.     public UnsupportedVersionException (Throwable cause) {
  33.         super(cause);
  34.     }
  35.    
  36.     public UnsupportedVersionException (String message, Throwable cause) {
  37.         super(message, cause);
  38.     }
  39.    
  40.     protected UnsupportedVersionException (String message, Throwable cause, boolean param1, boolean param2) {
  41.         super(message, cause, param1, param2);
  42.     }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement