Skip to content

Commit

Permalink
Add CodeGenericUtils class
Browse files Browse the repository at this point in the history
  • Loading branch information
OldSerpskiStalker committed Sep 17, 2024
1 parent 453435b commit 0330359
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package org.imesense.dynamicspawncontrol.debug;

import org.imesense.dynamicspawncontrol.technical.customlibrary.Log;

/**
*
*/
public class CodeGenericUtils
{
/**
*
* @param object
* @param message
* @return
* @param <T>
*/
public static <T> T checkObjectNotNull(final T object, final String message)
{
if (object == null)
{
Log.writeDataToLogFile(Log.TypeLog[2], "Object<T> return null: " + message);
throw new NullPointerException(message);
}

return object;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import net.minecraftforge.fml.common.registry.GameRegistry;
import org.imesense.dynamicspawncontrol.gameplay.worldgenerator.NetherRackGenerator;
import org.imesense.dynamicspawncontrol.technical.configs.ConfigManager;
import org.imesense.dynamicspawncontrol.debug.CodeGenericUtils;

/**
* Client sided proxy
Expand Down Expand Up @@ -66,9 +67,9 @@ public void init(FMLInitializationEvent event)
@Override
public void postInit(FMLPostInitializationEvent event)
{
ConfigLogFile.save();
ConfigGameDebugger.save();
ConfigOreGeneratorFile.save();
CodeGenericUtils.checkObjectNotNull(ConfigLogFile, "ConfigLogFile").save();
CodeGenericUtils.checkObjectNotNull(ConfigGameDebugger, "ConfigGameDebugger").save();
CodeGenericUtils.checkObjectNotNull(ConfigOreGeneratorFile, "ConfigOreGeneratorFile").save();
}

/**
Expand Down

0 comments on commit 0330359

Please sign in to comment.