Skip to content

Commit

Permalink
Minor optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
ME1312 committed May 19, 2021
1 parent 3d27ddb commit cfd121a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
26 changes: 14 additions & 12 deletions src/main/java/uk/co/thinkofdeath/vanillacord/TypeChecker.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,21 @@ public MethodVisitor visitMethod(int access, final String name, final String des

@Override
public void visitLdcInsn(Object cst) {
if (secure) {
if (hasTID && "Payload may not be larger than 1048576 bytes".equals(cst)) {
cbQuery = fCount == 2;
sbQuery = fCount == 3;
if (cst instanceof String) {
if (secure) {
if (hasTID && "Payload may not be larger than 1048576 bytes".equals(cst)) {
cbQuery = fCount == 2;
sbQuery = fCount == 3;
}
}
if ("multiplayer.disconnect.outdated_server".equals(cst) || "multiplayer.disconnect.incompatible".equals(cst)) {
handshakeListener = true;
hsName = name;
hsDesc = desc;
}
if ("Unexpected hello packet".equals(cst)) {
loginListener = true;
}
}
if (cst instanceof String && (((String) cst).startsWith("multiplayer.disconnect.outdated_server") || ((String) cst).startsWith("multiplayer.disconnect.incompatible"))) {
handshakeListener = true;
hsName = name;
hsDesc = desc;
}
if ("Unexpected hello packet".equals(cst)) {
loginListener = true;
}
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import static uk.co.thinkofdeath.vanillacord.helper.BungeeHelper.UUID_KEY;
import static uk.co.thinkofdeath.vanillacord.helper.BungeeHelper.PROPERTIES_KEY;

@SuppressWarnings("JavaReflectionInvocation")
public class VelocityHelper {

private static final Object NAMESPACE;
Expand Down Expand Up @@ -150,6 +149,7 @@ public static void completeTransaction(Object networkManager, Object loginManage
try {
NAMESPACE = NamespacedKey.constructor.newInstance("velocity", "player_info");
} catch (Exception e) {
e.printStackTrace();
if (e instanceof RuntimeException) {
throw (RuntimeException) e;
}
Expand Down

0 comments on commit cfd121a

Please sign in to comment.