Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Game {
- public static void main (String[] args) {
- if (args.length != 0) {
- mainWithArgs(args);
- } else {
- return;
- }
- }
- public static void mainWithArgs (String[] args) {
- String[] version = args[0].split('.');
- int versionMajor = Integer.parseInt(version[0]);
- int versionMinor = Integer.parseInt(version[1]);
- int versionPatch = Integer.parseInt(version[2]);
- 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())) {
- throw new UnsupportedVersionException(String.format("Version %1$ or lower expected, got version %2$ instead.", getCurrentVersion(), args[0]));
- }
- }
- }
- //
- public class UnsupportedVersionException extends Exception {
- public UnsupportedVersionException () {
- super();
- }
- public UnsupportedVersionException (String message) {
- super(message);
- }
- public UnsupportedVersionException (Throwable cause) {
- super(cause);
- }
- public UnsupportedVersionException (String message, Throwable cause) {
- super(message, cause);
- }
- protected UnsupportedVersionException (String message, Throwable cause, boolean param1, boolean param2) {
- super(message, cause, param1, param2);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement