* ModuleManager safety

* Module wasn't spelled correctly, causing NPE.
This commit is contained in:
Sasha 2019-12-18 06:03:17 -08:00 committed by Bella Who
parent 52af5bbead
commit 27dda1b073
2 changed files with 6 additions and 2 deletions

View File

@ -27,7 +27,7 @@ public class MixinC00Handshake {
@Inject(method = "writePacketData", at = @At(value = "HEAD"), cancellable = true)
public void writePacketData(PacketBuffer buf, CallbackInfo info) {
if (ModuleManager.isModuleEnabled("FakeVanilla")) {
if (ModuleManager.isModuleEnabled("FakeVanillaClient")) {
info.cancel();
buf.writeVarInt(protocolVersion);
buf.writeString(ip);

View File

@ -119,7 +119,11 @@ public class ModuleManager {
public static Module getModuleByName(String name) {
return modules.get(lookup.get(name.toLowerCase()));
Integer index = lookup.get(name.toLowerCase());
if (index == null) {
throw new IllegalArgumentException("getModuleByName() failed. Are you calling this too early? Is the module spelled correctly? Please check!!!!");
}
return modules.get(index);
}
public static boolean isModuleEnabled(String moduleName) {