fix: Проверки на null спасают жизни
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
package com.reider745.hooks;
|
||||
|
||||
import cn.nukkit.utils.MainLogger;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import com.reider745.api.hooks.HookClass;
|
||||
import com.reider745.api.hooks.TypeHook;
|
||||
import com.reider745.api.hooks.annotation.Hooks;
|
||||
@@ -8,15 +12,17 @@ import com.reider745.api.hooks.annotation.Inject;
|
||||
|
||||
@Hooks
|
||||
public class Other implements HookClass {
|
||||
private static final Logger logger = LogManager.getLogger(MainLogger.class);
|
||||
|
||||
@Inject(class_name = "org.mozilla.javascript.ScriptRuntime")
|
||||
public static String[] getTopPackageNames() {
|
||||
return new String[] { "java", "javax", "org", "com", "edu", "net", "android" };
|
||||
}
|
||||
|
||||
@Inject(class_name = "cn.nukkit.utils.MainLogger", type_hook = TypeHook.BEFORE_REPLACE)
|
||||
public static void warning(MainLogger self, String message){
|
||||
if(message.startsWith("Ignoring InnerCorePacket from "))
|
||||
return;
|
||||
self.info("[WARN] " + message);
|
||||
public static void warning(MainLogger self, String message) {
|
||||
if (message == null || !message.startsWith("Ignoring InnerCorePacket from ")) {
|
||||
logger.warn(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user