Skip to content

Commit

Permalink
Fixed issues with BTTHNetServerHandler class
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgebonafe committed May 6, 2018
1 parent ddedb2b commit c2865f8
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 54 deletions.
Binary file modified minecraft/BTHNetServerHandler.class
Binary file not shown.
Binary file modified minecraft_server/BTHNetServerHandler.class
Binary file not shown.
49 changes: 22 additions & 27 deletions src/minecraft/net/minecraft/src/BTHNetServerHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,38 +8,33 @@ public class BTHNetServerHandler extends NetServerHandler {

public BTHNetServerHandler(MinecraftServer aServer, INetworkManager aNetManager, EntityPlayerMP aPlayer) {
super(aServer, aNetManager, aPlayer);

this.mcServer = aServer;

try {
//if (Class.forName("net.minecraft.src.JBJorgesMiscellaneous") != null) {
if (Class.forName("JBJorgesMiscellaneous") != null) {

JBJorgesMiscellaneous.sendJBMiscTest(aPlayer);

if (aServer.getCommandManager() != null && aServer.getCommandManager() instanceof ServerCommandManager) {
//Object object = Class.forName("net.minecraft.src.JBCommandServerHardcoreDay").newInstance();
Object object = Class.forName("JBCommandServerHardcoreDay").newInstance();
((ServerCommandManager)aServer.getCommandManager()).registerCommand((CommandBase)object);
}
}
} catch (ClassNotFoundException e) {} catch (Exception e) {}
}

public void handleCustomPayload(Packet250CustomPayload aPacket) {
super.handleCustomPayload(aPacket);

try {
Class.forName("JBAstrolabe").getMethod("serverCustomPacketReceived", MinecraftServer.class, EntityPlayerMP.class,
Packet250CustomPayload.class).invoke(null, this.mcServer, this.playerEntity, aPacket);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}

try {
Class.forName("AddonManager").getMethod("serverCustomPacketReceived", MinecraftServer.class, EntityPlayerMP.class,
Packet250CustomPayload.class).invoke(null, this.mcServer, this.playerEntity, aPacket);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}

try {
Class.forName("BTHBetterThanHorses").getMethod("serverCustomPacketReceived", MinecraftServer.class,
EntityPlayerMP.class, Packet250CustomPayload.class)
.invoke(null, this.mcServer, this.playerEntity, aPacket);
} catch (ClassNotFoundException e) {
} catch (Exception e) {
e.printStackTrace();
String[] mods = new String[] { "JBJorgesMiscellaneous", "AddonManager" };
for (String mod : mods) {
try {
//Class.forName("net.minecraft.src."+mod).getMethod("serverCustomPacketReceived", MinecraftServer.class, EntityPlayerMP.class, Packet250CustomPayload.class).invoke(null, this.mcServer, this.playerEntity, aPacket);
Class.forName(mod).getMethod("serverCustomPacketReceived", MinecraftServer.class, EntityPlayerMP.class, Packet250CustomPayload.class).invoke(null, this.mcServer, this.playerEntity, aPacket);
} catch (ClassNotFoundException e) {} catch (Exception e) {}
}
}
}
49 changes: 22 additions & 27 deletions src/minecraft_server/net/minecraft/src/BTHNetServerHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,38 +8,33 @@ public class BTHNetServerHandler extends NetServerHandler {

public BTHNetServerHandler(MinecraftServer aServer, INetworkManager aNetManager, EntityPlayerMP aPlayer) {
super(aServer, aNetManager, aPlayer);

this.mcServer = aServer;

try {
//if (Class.forName("net.minecraft.src.JBJorgesMiscellaneous") != null) {
if (Class.forName("JBJorgesMiscellaneous") != null) {

JBJorgesMiscellaneous.sendJBMiscTest(aPlayer);

if (aServer.getCommandManager() != null && aServer.getCommandManager() instanceof ServerCommandManager) {
//Object object = Class.forName("net.minecraft.src.JBCommandServerHardcoreDay").newInstance();
Object object = Class.forName("JBCommandServerHardcoreDay").newInstance();
((ServerCommandManager)aServer.getCommandManager()).registerCommand((CommandBase)object);
}
}
} catch (ClassNotFoundException e) {} catch (Exception e) {}
}

public void handleCustomPayload(Packet250CustomPayload aPacket) {
super.handleCustomPayload(aPacket);

try {
Class.forName("JBAstrolabe").getMethod("serverCustomPacketReceived", MinecraftServer.class, EntityPlayerMP.class,
Packet250CustomPayload.class).invoke(null, this.mcServer, this.playerEntity, aPacket);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}

try {
Class.forName("AddonManager").getMethod("serverCustomPacketReceived", MinecraftServer.class, EntityPlayerMP.class,
Packet250CustomPayload.class).invoke(null, this.mcServer, this.playerEntity, aPacket);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}

try {
Class.forName("BTHBetterThanHorses").getMethod("serverCustomPacketReceived", MinecraftServer.class,
EntityPlayerMP.class, Packet250CustomPayload.class)
.invoke(null, this.mcServer, this.playerEntity, aPacket);
} catch (ClassNotFoundException e) {
} catch (Exception e) {
e.printStackTrace();
String[] mods = new String[] { "JBJorgesMiscellaneous", "AddonManager" };
for (String mod : mods) {
try {
//Class.forName("net.minecraft.src."+mod).getMethod("serverCustomPacketReceived", MinecraftServer.class, EntityPlayerMP.class, Packet250CustomPayload.class).invoke(null, this.mcServer, this.playerEntity, aPacket);
Class.forName(mod).getMethod("serverCustomPacketReceived", MinecraftServer.class, EntityPlayerMP.class, Packet250CustomPayload.class).invoke(null, this.mcServer, this.playerEntity, aPacket);
} catch (ClassNotFoundException e) {} catch (Exception e) {}
}
}
}

0 comments on commit c2865f8

Please sign in to comment.