mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2024-11-15 10:45:35 +01:00
updated C4J usage
This commit is contained in:
parent
08e36ba02f
commit
9b3a2bc7e9
@ -16,7 +16,7 @@ archives_base_name=viafabricplus
|
||||
# base lib
|
||||
vialoadingbase_version=ff86e681d7
|
||||
raknet_transport_version=1.0.0.CR1-SNAPSHOT
|
||||
classic4j_version=1.1.0
|
||||
classic4j_version=1.2.0
|
||||
|
||||
# viaversion (and required) libs
|
||||
viaversion_version=4.7.0-23w16a-SNAPSHOT
|
||||
|
@ -17,8 +17,8 @@
|
||||
*/
|
||||
package de.florianmichael.viafabricplus.injection.mixin.classic4j;
|
||||
|
||||
import de.florianmichael.classic4j.handler.classicube.auth.base.CCAuthenticationResponse;
|
||||
import de.florianmichael.classic4j.model.classicube.highlevel.CCError;
|
||||
import de.florianmichael.classic4j.request.classicube.auth.base.CCAuthenticationResponse;
|
||||
import de.florianmichael.viafabricplus.integration.Classic4JImpl;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
|
@ -18,14 +18,13 @@
|
||||
package de.florianmichael.viafabricplus.integration;
|
||||
|
||||
import com.mojang.authlib.exceptions.AuthenticationException;
|
||||
import de.florianmichael.classic4j.Classic4J;
|
||||
import de.florianmichael.classic4j.api.JoinServerInterface;
|
||||
import de.florianmichael.classic4j.model.classicube.highlevel.CCError;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
public class Classic4JImpl {
|
||||
|
||||
public final static Classic4J INSTANCE = new Classic4J(serverId -> {
|
||||
public final static JoinServerInterface JOIN_SERVER_CALL = serverId -> {
|
||||
final MinecraftClient mc = MinecraftClient.getInstance();
|
||||
|
||||
try {
|
||||
@ -33,7 +32,7 @@ public class Classic4JImpl {
|
||||
} catch (AuthenticationException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
public static Text fromError(final CCError error) {
|
||||
switch (error) {
|
||||
|
@ -18,6 +18,7 @@
|
||||
package de.florianmichael.viafabricplus.protocolhack.provider.vialegacy;
|
||||
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import de.florianmichael.classic4j.JSPBetaCraftHandler;
|
||||
import de.florianmichael.viafabricplus.integration.Classic4JImpl;
|
||||
import de.florianmichael.viafabricplus.settings.groups.AuthenticationSettings;
|
||||
import net.raphimc.vialegacy.protocols.classic.protocola1_0_15toc0_28_30.providers.ClassicMPPassProvider;
|
||||
@ -35,7 +36,7 @@ public class ViaFabricPlusClassicMPPassProvider extends ClassicMPPassProvider {
|
||||
|
||||
if (AuthenticationSettings.INSTANCE.useBetaCraftAuthentication.getValue()) {
|
||||
final HandshakeStorage handshakeStorage = user.get(HandshakeStorage.class);
|
||||
return Classic4JImpl.INSTANCE.betaCraftHandler().requestMPPass(user.getProtocolInfo().getUsername(), handshakeStorage.getHostname(), handshakeStorage.getPort());
|
||||
return JSPBetaCraftHandler.requestMPPass(user.getProtocolInfo().getUsername(), handshakeStorage.getHostname(), handshakeStorage.getPort(), Classic4JImpl.JOIN_SERVER_CALL);
|
||||
} else {
|
||||
return super.getMpPass(user);
|
||||
}
|
||||
|
@ -19,9 +19,9 @@ package de.florianmichael.viafabricplus.screen;
|
||||
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.classic4j.BetaCraftHandler;
|
||||
import de.florianmichael.classic4j.model.classicube.highlevel.CCAccount;
|
||||
import de.florianmichael.viafabricplus.definition.c0_30.ClassiCubeAccountHandler;
|
||||
import de.florianmichael.viafabricplus.integration.Classic4JImpl;
|
||||
import de.florianmichael.viafabricplus.screen.classicube.ClassiCubeLoginScreen;
|
||||
import de.florianmichael.viafabricplus.screen.classicube.ClassiCubeServerListScreen;
|
||||
import de.florianmichael.viafabricplus.screen.settings.SettingsScreen;
|
||||
@ -77,7 +77,7 @@ public class ProtocolSelectionScreen extends Screen {
|
||||
this.addDrawableChild(classiCubeBuilder.build());
|
||||
ButtonWidget.Builder betaCraftBuilder = ButtonWidget.builder(Text.literal("BetaCraft"), button -> {
|
||||
if (BetaCraftScreen.SERVER_LIST == null) {
|
||||
Classic4JImpl.INSTANCE.betaCraftHandler().requestServerList(bcServerList -> {
|
||||
BetaCraftHandler.requestServerList(bcServerList -> {
|
||||
BetaCraftScreen.SERVER_LIST = bcServerList;
|
||||
|
||||
RenderSystem.recordRenderCall(() -> client.setScreen(BetaCraftScreen.get(this)));
|
||||
|
@ -18,6 +18,7 @@
|
||||
package de.florianmichael.viafabricplus.screen.classicube;
|
||||
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import de.florianmichael.classic4j.ClassiCubeHandler;
|
||||
import de.florianmichael.classic4j.api.LoginProcessHandler;
|
||||
import de.florianmichael.classic4j.model.classicube.highlevel.CCAccount;
|
||||
import de.florianmichael.viafabricplus.definition.c0_30.ClassiCubeAccountHandler;
|
||||
@ -69,7 +70,7 @@ public class ClassiCubeLoginScreen extends Screen {
|
||||
ClassiCubeAccountHandler.INSTANCE.setAccount(new CCAccount(nameField.getText(), passwordField.getText()));
|
||||
status = Text.translatable("classicube.viafabricplus.loading");
|
||||
|
||||
Classic4JImpl.INSTANCE.classiCubeHandler().requestAuthentication(ClassiCubeAccountHandler.INSTANCE.getAccount(), null, new LoginProcessHandler() {
|
||||
ClassiCubeHandler.requestAuthentication(ClassiCubeAccountHandler.INSTANCE.getAccount(), null, new LoginProcessHandler() {
|
||||
@Override
|
||||
public void handleMfa(CCAccount account) {
|
||||
RenderSystem.recordRenderCall(() -> MinecraftClient.getInstance().setScreen(ClassiCubeMFAScreen.get(prevScreen)));
|
||||
|
@ -18,6 +18,7 @@
|
||||
package de.florianmichael.viafabricplus.screen.classicube;
|
||||
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import de.florianmichael.classic4j.ClassiCubeHandler;
|
||||
import de.florianmichael.classic4j.api.LoginProcessHandler;
|
||||
import de.florianmichael.classic4j.model.classicube.highlevel.CCAccount;
|
||||
import de.florianmichael.classic4j.model.classicube.highlevel.CCError;
|
||||
@ -64,7 +65,7 @@ public class ClassiCubeMFAScreen extends Screen {
|
||||
status = Text.translatable("classicube.viafabricplus.loading");
|
||||
final CCAccount account = ClassiCubeAccountHandler.INSTANCE.getAccount();
|
||||
|
||||
Classic4JImpl.INSTANCE.classiCubeHandler().requestAuthentication(account, mfaField.getText(), new LoginProcessHandler() {
|
||||
ClassiCubeHandler.requestAuthentication(account, mfaField.getText(), new LoginProcessHandler() {
|
||||
@Override
|
||||
public void handleMfa(CCAccount account) {
|
||||
// Not implemented in this case
|
||||
|
@ -18,8 +18,8 @@
|
||||
package de.florianmichael.viafabricplus.screen.classicube;
|
||||
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import de.florianmichael.classic4j.ClassiCubeHandler;
|
||||
import de.florianmichael.classic4j.api.LoginProcessHandler;
|
||||
import de.florianmichael.classic4j.handler.classicube.server.CCServerListRequest;
|
||||
import de.florianmichael.classic4j.model.classicube.CCServerInfo;
|
||||
import de.florianmichael.viafabricplus.definition.c0_30.ClassiCubeAccountHandler;
|
||||
import de.florianmichael.viafabricplus.injection.access.IServerInfo;
|
||||
@ -60,7 +60,7 @@ public class ClassiCubeServerListScreen extends Screen {
|
||||
}
|
||||
|
||||
public static void open(final Screen prevScreen, final LoginProcessHandler loginProcessHandler) {
|
||||
Classic4JImpl.INSTANCE.classiCubeHandler().requestServerList(ClassiCubeAccountHandler.INSTANCE.getAccount(), ccServerList -> {
|
||||
ClassiCubeHandler.requestServerList(ClassiCubeAccountHandler.INSTANCE.getAccount(), ccServerList -> {
|
||||
ClassiCubeServerListScreen.SERVERS.addAll(ccServerList.servers());
|
||||
RenderSystem.recordRenderCall(() -> MinecraftClient.getInstance().setScreen(ClassiCubeServerListScreen.get(prevScreen)));
|
||||
}, loginProcessHandler::handleException);
|
||||
|
Loading…
Reference in New Issue
Block a user