Skip to content

Commit

Permalink
Bump Classic4J to use maven central release.
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianMichael committed Oct 14, 2023
1 parent fd58471 commit 32b8dc4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ archives_base_name=viafabricplus

# base lib
raknet_transport_version=1.0.0.CR1-SNAPSHOT
classic4j_version=2.0.1-SNAPSHOT
classic4j_version=2.0.1

# viaversion (and required) libs
viaversion_version=4.9.0-23w40a-SNAPSHOT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ public void init() {
// Load overriding jars first so other code can access the new classes
ViaJarReplacer.loadOverridingJars();

// PreLoad Callback (for example to register new protocols)
PreLoadCallback.EVENT.invoker().onLoad();

// Classic Stuff
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,28 @@

import com.viaversion.viaversion.api.connection.UserConnection;
import de.florianmichael.classic4j.BetaCraftHandler;
import de.florianmichael.viafabricplus.ViaFabricPlus;
import de.florianmichael.viafabricplus.integration.Classic4JImpl;
import de.florianmichael.viafabricplus.base.settings.groups.AuthenticationSettings;
import net.raphimc.vialegacy.protocols.classic.protocola1_0_15toc0_28_30.providers.ClassicMPPassProvider;
import net.raphimc.vialegacy.protocols.release.protocol1_7_2_5to1_6_4.storage.HandshakeStorage;

public class ViaFabricPlusClassicMPPassProvider extends ClassicMPPassProvider {

public static String classiCubeMPPass;

@Override
public String getMpPass(UserConnection user) {
if (classiCubeMPPass != null) return classiCubeMPPass;
if (classiCubeMPPass != null) {
return classiCubeMPPass;
}

if (AuthenticationSettings.INSTANCE.useBetaCraftAuthentication.getValue()) {
final HandshakeStorage handshakeStorage = user.get(HandshakeStorage.class);
return BetaCraftHandler.requestMPPass(user.getProtocolInfo().getUsername(), handshakeStorage.getHostname(), handshakeStorage.getPort(), Classic4JImpl.JOIN_SERVER_CALL);
if (handshakeStorage == null) {
return super.getMpPass(user);
}
return BetaCraftHandler.requestMPPass(user.getProtocolInfo().getUsername(), handshakeStorage.getHostname(), handshakeStorage.getPort(), Classic4JImpl.JOIN_SERVER_CALL, throwable ->
ViaFabricPlus.LOGGER.error("Error occurred while requesting the MP-Pass to verify session", throwable));
} else {
return super.getMpPass(user);
}
Expand Down

0 comments on commit 32b8dc4

Please sign in to comment.