Skip to content

Commit 9d2c989

Browse files
committed
v1.5
1 parent 0cb0349 commit 9d2c989

13 files changed

+62
-24
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
# Project exclude paths
2-
/target/
2+
/target/
3+
.idea/

.idea/misc.xml

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pom.xml

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>io.github.javaezlib</groupId>
88
<artifactId>JavaEZ</artifactId>
9-
<version>1.4</version>
9+
<version>1.5</version>
1010
<description>A simplification library to make Java easier for newcomers.</description>
1111
<name>${project.groupId}:${project.artifactId}</name>
1212
<packaging>jar</packaging>
@@ -101,8 +101,8 @@
101101
</build>
102102

103103
<properties>
104-
<maven.compiler.source>8</maven.compiler.source>
105-
<maven.compiler.target>8</maven.compiler.target>
104+
<maven.compiler.source>17</maven.compiler.source>
105+
<maven.compiler.target>17</maven.compiler.target>
106106
</properties>
107107

108108
</project>

src/main/java/io/github/javaezlib/javaez/JavaEZ.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
/**
1010
* Main class for JavaEZ
11-
* @author RedstoneBoy0509
11+
* @author Red050911
1212
* @since 1.1
1313
*/
1414
public class JavaEZ {
@@ -17,23 +17,23 @@ public class JavaEZ {
1717
* The current version of JavaEZ.
1818
* @since 1.1
1919
*/
20-
public static final String VERSION = "1.4";
20+
public static final String VERSION = "1.5";
2121

2222
/**
2323
* Prints info about your version of JavaEZ
2424
* @since 1.1
2525
*/
2626
public static void info() {
2727
System.out.println("=[JavaEZ Info]=");
28-
System.out.println("JavaEZ running on version " + VERSION);
28+
System.out.println("JavaEZ is running on version " + VERSION);
2929
String latestVersion = getLatestVersion();
3030
boolean areWeUpdated = latestVersion.equalsIgnoreCase(VERSION) ;
3131
if(!areWeUpdated) {
3232
if(latestVersion.equalsIgnoreCase("Unknown")) {
33-
System.out.println("Could not check for new versions");
33+
System.out.println("Could not check for new versions!");
3434
return;
3535
}
36-
System.out.println("Attention: your JavaEZ is not at latest version, please consider updating!");
36+
System.out.println("Attention: Your JavaEZ instance is not at the latest version, please consider updating!");
3737
System.out.println("Latest version: " + latestVersion);
3838
} else System.out.println("JavaEZ is up to date!");
3939
}

src/main/java/io/github/javaezlib/javaez/backend/BackendVariableContext.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
/**
66
* The context in which variables made using the Core extension are stored.
7-
* @author RedstoneBoy0509
7+
* @author Red050911
88
* @since 1.0
99
*/
1010
public class BackendVariableContext {

src/main/java/io/github/javaezlib/javaez/backend/ErrorSystem.java

+41-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,30 @@
11
package io.github.javaezlib.javaez.backend;
22

3+
import java.util.ArrayList;
4+
import java.util.List;
5+
36
/**
47
* The backend JavaEZ error system, used for handling internal Java errors.
5-
* @author RedstoneBoy0509
8+
* @author Red050911
69
* @since 1.0
710
*/
811
public class ErrorSystem {
912

13+
/**
14+
* The list of classnames allowed to call errors.
15+
* @since 1.5
16+
*/
17+
private static final List<String> ACCEPTED_CLASSNAMES = new ArrayList<>();
18+
19+
static {
20+
ACCEPTED_CLASSNAMES.add("io.github.javaezlib.javaez.extensions.Core");
21+
ACCEPTED_CLASSNAMES.add("io.github.javaezlib.javaez.extensions.Files");
22+
ACCEPTED_CLASSNAMES.add("io.github.javaezlib.javaez.extensions.System");
23+
ACCEPTED_CLASSNAMES.add("io.github.javaezlib.javaez.extensions.Threads");
24+
ACCEPTED_CLASSNAMES.add("io.github.javaezlib.javaez.backend.BackendVariableContext");
25+
ACCEPTED_CLASSNAMES.add("io.github.javaezlib.javaez.JavaEZ");
26+
}
27+
1028
/**
1129
* Sends a JavaEZ error to the console.
1230
* @param className The name of the erroring class
@@ -15,7 +33,7 @@ public class ErrorSystem {
1533
* @deprecated This is an internal method, not needing to be used by the user.
1634
*/
1735
@Deprecated
18-
public static void sendError(String className, String message) {
36+
private static void sendError(String className, String message) {
1937
System.err.println("[JavaEZ] [Error at class " + className + "] >> " + message);
2038
}
2139

@@ -27,8 +45,27 @@ public static void sendError(String className, String message) {
2745
*/
2846
@Deprecated
2947
public static void handleError(String error) {
30-
StackTraceElement e = Thread.currentThread().getStackTrace()[3];
31-
sendError(e.getClassName(), error);
48+
try {
49+
StackTraceElement e = Thread.currentThread().getStackTrace()[2];
50+
if(ACCEPTED_CLASSNAMES.contains(e.getClassName())) {
51+
e = Thread.currentThread().getStackTrace()[3];
52+
sendError(e.getClassName(), error);
53+
} else {
54+
try {
55+
StackTraceElement el = Thread.currentThread().getStackTrace()[2];
56+
sendError(el.getClassName(), "Sorry, but this class is not meant to be called upon by user classes.");
57+
} catch(Exception ex2) {
58+
sendError("[CLASSNAME IRRETRIEVABLE]", "Sorry, but this class is not meant to be called upon by user classes.");
59+
}
60+
}
61+
} catch(Exception ex) {
62+
try {
63+
StackTraceElement e = Thread.currentThread().getStackTrace()[2];
64+
sendError(e.getClassName(), "Sorry, but there was an error handling that error!");
65+
} catch(Exception ex2) {
66+
sendError("[CLASSNAME IRRETRIEVABLE]", "Sorry, but there was an error handling that error!");
67+
}
68+
}
3269
}
3370

3471
}
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* Backend for JavaEZ, usually not meant to be used. Instead, use Extensions.
3-
* @author RedstoneBoy0509
3+
* @author Red050911
44
* @since 1.0
55
*/
66
package io.github.javaezlib.javaez.backend;

src/main/java/io/github/javaezlib/javaez/extensions/Core.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
/**
1010
* The core functions of JavaEZ, usually implemented in every JavaEZ project.
11-
* @author RedstoneBoy0509
11+
* @author Red050911
1212
* @since 1.0
1313
*/
1414
@SuppressWarnings("deprecation")
@@ -143,7 +143,7 @@ public static void waitFor(int seconds) {
143143
* @since 1.1
144144
*/
145145
public static String ask(String prompt) {
146-
Scanner scanner = new Scanner(java.lang.System.in);
146+
Scanner scanner = new Scanner(java.lang.System.in).useDelimiter("\\n");
147147
java.lang.System.out.println(prompt);
148148
return scanner.nextLine();
149149
}

src/main/java/io/github/javaezlib/javaez/extensions/Files.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
/**
88
* The Files extension for handling I/O with files.
9-
* @author RedstoneBoy0509
9+
* @author Red050911
1010
* @since 1.0
1111
*/
1212
@SuppressWarnings("deprecation")

src/main/java/io/github/javaezlib/javaez/extensions/System.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
/**
1111
* The system extension, allowing the user to check system info
12-
* @author RedstoneBoy0509
12+
* @author Red050911
1313
* @since 1.2
1414
*/
1515
@SuppressWarnings("deprecation")
@@ -38,7 +38,7 @@ public static String whatsMySimplifiedOS() {
3838
} else if(osName.toLowerCase().contains("mac")) {
3939
osSimplifiedName = "macOS";
4040
} else if(osName.toLowerCase().contains("nix") || osName.toLowerCase().contains("nux") || osName.toLowerCase().contains("aix")) {
41-
osSimplifiedName = "Linux UNIX";
41+
osSimplifiedName = "Linux or UNIX";
4242
} else if(osName.toLowerCase().contains("sunos")) {
4343
osSimplifiedName = "Solaris";
4444
}

src/main/java/io/github/javaezlib/javaez/extensions/Threads.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
/**
88
* Threads extension for JavaEZ, allowing you to run something parallel to your other code
9-
* @author RedstoneBoy0509
9+
* @author Red050911
1010
* @since 1.0
1111
*/
1212
@SuppressWarnings("deprecation")

src/main/java/io/github/javaezlib/javaez/extensions/package-info.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Extensions package, containing all extensions. Extensions allow functions to be added.
33
* Existing extensions: {@link io.github.javaezlib.javaez.extensions.Core}, {@link io.github.javaezlib.javaez.extensions.Files}, {@link io.github.javaezlib.javaez.extensions.Threads}, {@link io.github.javaezlib.javaez.extensions.System}
44
* Add one to your code by putting {@code import static io.github.redstoneboy0509.javaez.extensions.TheExtension.*;} at the top of your file.
5-
* @author RedstoneBoy0509
5+
* @author Red050911
66
* @since 1.0
77
*/
88
package io.github.javaezlib.javaez.extensions;
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* JavaEZ main package, everything to do with the library is in here.
3-
* @author RedstoneBoy0509
3+
* @author Red050911
44
* @since 1.0
55
*/
66
package io.github.javaezlib.javaez;

0 commit comments

Comments
 (0)