-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from anatawa12/master
Add support for 1.13
- Loading branch information
Showing
6 changed files
with
124 additions
and
56 deletions.
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
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
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
59 changes: 59 additions & 0 deletions
59
...rapper/java/zone/rong/nukejndilookupfromlog4j/tweaker/NukeJndiLookupFromLog4jTweaker.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,59 @@ | ||
package zone.rong.nukejndilookupfromlog4j.tweaker; | ||
|
||
import net.minecraft.launchwrapper.ITweaker; | ||
import net.minecraft.launchwrapper.LaunchClassLoader; | ||
import zone.rong.nukejndilookupfromlog4j.NukeJndiLookupFromLog4j; | ||
|
||
import java.io.File; | ||
import java.lang.reflect.InvocationTargetException; | ||
import java.util.List; | ||
|
||
@SuppressWarnings("unused") | ||
public class NukeJndiLookupFromLog4jTweaker implements ITweaker { | ||
public NukeJndiLookupFromLog4jTweaker() throws ReflectiveOperationException { | ||
NukeJndiLookupFromLog4j.init(); | ||
} | ||
|
||
@Override | ||
public void acceptOptions(List<String> args, File gameDir, File assetsDir, String profile) { | ||
} | ||
|
||
@Override | ||
public void injectIntoClassLoader(LaunchClassLoader classLoader) { | ||
if (classExists(classLoader, "net.minecraftforge.fml.relauncher.CoreModManager")) { | ||
callSupport(classLoader, "Support1122"); | ||
} else if (classExists(classLoader, "cpw.mods.fml.relauncher.CoreModManager")) { | ||
callSupport(classLoader, "Support1710"); | ||
} else { | ||
throw new IllegalStateException("this version of minecraft is not supported!"); | ||
} | ||
} | ||
|
||
private boolean classExists(LaunchClassLoader classLoader, String name) { | ||
try { | ||
classLoader.findClass(name); | ||
return true; | ||
} catch (ClassNotFoundException e) { | ||
return false; | ||
} | ||
} | ||
|
||
private void callSupport(LaunchClassLoader classLoader, String name) { | ||
try { | ||
Class<?> supportClass = classLoader.findClass("zone.rong.nukejndilookupfromlog4j.supports." + name); | ||
supportClass.getMethod("runSupport").invoke(null); | ||
} catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { | ||
throw new IllegalStateException(e); | ||
} | ||
} | ||
|
||
@Override | ||
public String getLaunchTarget() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public String[] getLaunchArguments() { | ||
return new String[0]; | ||
} | ||
} |
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
44 changes: 44 additions & 0 deletions
44
...ong/nukejndilookupfromlog4j/modlauncher/NukeJndiLookupFromLog4jTransformationService.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,44 @@ | ||
package zone.rong.nukejndilookupfromlog4j.modlauncher; | ||
|
||
import com.google.auto.service.AutoService; | ||
import cpw.mods.modlauncher.api.IEnvironment; | ||
import cpw.mods.modlauncher.api.ITransformationService; | ||
import cpw.mods.modlauncher.api.ITransformer; | ||
import zone.rong.nukejndilookupfromlog4j.NukeJndiLookupFromLog4j; | ||
|
||
import javax.annotation.Nonnull; | ||
import java.util.Collections; | ||
import java.util.List; | ||
import java.util.Set; | ||
|
||
@SuppressWarnings("unused") | ||
@AutoService(ITransformationService.class) | ||
public class NukeJndiLookupFromLog4jTransformationService implements ITransformationService { | ||
public NukeJndiLookupFromLog4jTransformationService() throws ReflectiveOperationException { | ||
NukeJndiLookupFromLog4j.init(); | ||
} | ||
|
||
@Nonnull | ||
@Override | ||
public String name() { | ||
return "nukejndilookupfromlog4j"; | ||
} | ||
|
||
@Override | ||
public void initialize(IEnvironment environment) { | ||
} | ||
|
||
@Override | ||
public void beginScanning(IEnvironment environment) { | ||
} | ||
|
||
@Override | ||
public void onLoad(IEnvironment env, Set<String> otherServices) { | ||
} | ||
|
||
@Nonnull | ||
@Override | ||
public List<ITransformer> transformers() { | ||
return Collections.emptyList(); | ||
} | ||
} |