-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ddceac4
commit fbaaef6
Showing
4 changed files
with
93 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
src/main/java/io/github/redstoneboy0509/javaez/JavaEZ.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package io.github.redstoneboy0509.javaez; | ||
|
||
import java.io.BufferedReader; | ||
import java.io.InputStreamReader; | ||
import java.net.URL; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
/** | ||
* Main class for JavaEZ | ||
* @author RedstoneBoy0509 | ||
* @since 1.1 | ||
*/ | ||
public class JavaEZ { | ||
|
||
/** | ||
* The current version of JavaEZ. | ||
* @since 1.1 | ||
*/ | ||
public static final String VERSION = "1.1"; | ||
|
||
/** | ||
* Prints info about your version of JavaEZ | ||
* @since 1.1 | ||
*/ | ||
public static void info() { | ||
System.out.println("=[JavaEZ Info]="); | ||
System.out.println("JavaEZ running on version " + VERSION); | ||
String latestVersion = getLatestVersion(); | ||
boolean areWeUpdated = latestVersion.equalsIgnoreCase(VERSION); | ||
if(!areWeUpdated) { | ||
System.out.println("Attention: your JavaEZ is not at latest version, please consider updating!"); | ||
System.out.println("Latest version: " + latestVersion); | ||
} else System.out.println("JavaEZ is up to date!"); | ||
} | ||
|
||
/** | ||
* Gets the latest version | ||
* @return The latest version | ||
* @since 1.1 | ||
*/ | ||
public static String getLatestVersion() { | ||
List<String> versions = getVersions(); | ||
return versions.isEmpty() ? "Unknown" : versions.get(versions.size() - 1); | ||
} | ||
|
||
/** | ||
* Returns a list of all known versions on the Internet | ||
* @return a list of all existent versions | ||
* @since 1.1 | ||
*/ | ||
public static List<String> getVersions() { | ||
try { | ||
URL url = new URL("https://gist.githubusercontent.com/RedstoneBoy0509/fb10258f9ae7d858f94b8cbaa651548f/raw/"); | ||
BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream())); | ||
List<String> list = new ArrayList<>(); | ||
String line; | ||
while((line = reader.readLine()) != null) { | ||
if(line.isEmpty()) continue; | ||
list.add(line); | ||
} | ||
reader.close(); | ||
return list; | ||
} catch(Exception ex) { | ||
return new ArrayList<>(); | ||
} | ||
} | ||
|
||
} |
11 changes: 11 additions & 0 deletions
11
src/main/java/io/github/redstoneboy0509/javaez/JavaEZ.java.asc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
-----BEGIN PGP SIGNATURE----- | ||
|
||
iQEzBAABCAAdFiEEWi8VBza09/4dK/cJlP8Sq7x4Y/sFAmCVxjIACgkQlP8Sq7x4 | ||
Y/u2Owf/YsqeDQFdUnPqOyGrbROa5GFRM41FYMDFNk/zpTsTUxwG2SXC2F7a1i8W | ||
ZDHETF0LoTlmM+/84lJPt38QEABWvbPapKwt/nDqgxeWMkgK0IqCKpq1CPoZBv6e | ||
Gy+kxxGC+ZOX6OLIMEFdUNOSs5UHzOcU+9EnM8Xo9Cc2oTL14ETh+u1Q3FuDbtf/ | ||
HZMdMJzbZwVO6K5+7QnWbSvYvdfKrPpXyWyWfQum+ie902F1gQ7Hji1KaBRu7jTJ | ||
n1Tu5YjGixE5NRrtuAO3LTzzWV5JDlN0vM9nbWkBlU9SUI214B5pSy6NlD15DoIU | ||
sKmUcUyN9zCr9e05d1p2Pa4aIASZTQ== | ||
=op9n | ||
-----END PGP SIGNATURE----- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters