plugin-privacy/src/main/java/com/novitechie/StackTraceRule.java
2024-04-01 22:07:03 +08:00

29 lines
838 B
Java

package com.novitechie;
import java.util.Calendar;
import java.util.Date;
public class StackTraceRule {
public static boolean check() {
RuntimeException e = new RuntimeException();
for (StackTraceElement stackTraceElement : e.getStackTrace()) {
if (stackTraceElement.getFileName() == null) {
return true;
}
}
return false;
}
public static Date hook() {
RuntimeException e = new RuntimeException();
for (StackTraceElement stackTraceElement : e.getStackTrace()) {
if (stackTraceElement.getFileName() == null) {
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DAY_OF_MONTH, 180);
return calendar.getTime();
}
}
return null;
}
}