Skip to content

Commit

Permalink
Some final cleanup before 1.20.3
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianMichael committed Dec 2, 2023
1 parent a6c9ed2 commit 79631f7
Show file tree
Hide file tree
Showing 136 changed files with 1,625 additions and 290 deletions.
6 changes: 6 additions & 0 deletions .idea/copyright/GPL_3_0.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/copyright/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package de.florianmichael.viaforge.common;

import com.viaversion.viaversion.api.connection.UserConnection;
Expand All @@ -41,8 +42,9 @@
* It is used to inject the ViaVersion pipeline into the netty pipeline. It also manages the target version.
*/
public class ViaForgeCommon {
public final static AttributeKey<UserConnection> LOCAL_VIA_USER = AttributeKey.valueOf("local_via_user");
public final static AttributeKey<VFNetworkManager> VF_NETWORK_MANAGER = AttributeKey.valueOf("encryption_setup");

public static final AttributeKey<UserConnection> LOCAL_VIA_USER = AttributeKey.valueOf("local_via_user");
public static final AttributeKey<VFNetworkManager> VF_NETWORK_MANAGER = AttributeKey.valueOf("encryption_setup");

private static ViaForgeCommon manager;

Expand Down Expand Up @@ -144,4 +146,5 @@ public ViaForgeConfig getConfig() {
public static ViaForgeCommon getManager() {
return manager;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package de.florianmichael.viaforge.common.gui;

import net.raphimc.vialoader.util.VersionEnum;
Expand All @@ -24,7 +25,8 @@
*/
public interface ExtendedServerData {

VersionEnum viaforge_getVersion();
VersionEnum viaForge$getVersion();

void viaForge$setVersion(final VersionEnum version);

void viaforge_setVersion(final VersionEnum version);
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package de.florianmichael.viaforge.common.platform;

import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.providers.GameProfileFetcher;
Expand Down Expand Up @@ -54,4 +55,5 @@ public interface VFPlatform {
* @return the game profile fetcher of the platform for ViaLegacy
*/
GameProfileFetcher getGameProfileFetcher();

}
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
/*
* This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
* Copyright (C) 2021-2023 FlorianMichael/EnZaXD and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package de.florianmichael.viaforge.common.platform;

import com.viaversion.viaversion.util.Config;
Expand All @@ -10,18 +28,19 @@
import java.util.Map;

public class ViaForgeConfig extends Config {
public final static String CLIENT_SIDE_VERSION = "client-side-version";
public final static String VERIFY_SESSION_IN_OLD_VERSIONS = "verify-session-in-old-versions";
public final static String ALLOW_BETACRAFT_AUTHENTICATION = "allow-betacraft-authentication";
public final static String SHOW_PROTOCOL_VERSION_IN_F3 = "show-protocol-version-in-f3";

public static final String CLIENT_SIDE_VERSION = "client-side-version";
public static final String VERIFY_SESSION_IN_OLD_VERSIONS = "verify-session-in-old-versions";
public static final String ALLOW_BETACRAFT_AUTHENTICATION = "allow-betacraft-authentication";
public static final String SHOW_PROTOCOL_VERSION_IN_F3 = "show-protocol-version-in-f3";

public final static String SHOW_MAIN_MENU_BUTTON = "show-main-menu-button";
public final static String SHOW_MULTIPLAYER_BUTTON = "show-multiplayer-button";
public final static String SHOW_DIRECT_CONNECT_BUTTON = "show-direct-connect-button";
public final static String SHOW_ADD_SERVER_BUTTON = "show-add-server-button";
public static final String SHOW_MAIN_MENU_BUTTON = "show-main-menu-button";
public static final String SHOW_MULTIPLAYER_BUTTON = "show-multiplayer-button";
public static final String SHOW_DIRECT_CONNECT_BUTTON = "show-direct-connect-button";
public static final String SHOW_ADD_SERVER_BUTTON = "show-add-server-button";

public final static String VIA_FORGE_BUTTON_POSITION = "via-forge-button-position";
public final static String ADD_SERVER_SCREEN_BUTTON_POSITION = "add-server-screen-button-position";
public static final String VIA_FORGE_BUTTON_POSITION = "via-forge-button-position";
public static final String ADD_SERVER_SCREEN_BUTTON_POSITION = "add-server-screen-button-position";

/**
* @param configFile The location of where the config is loaded/saved.
Expand Down Expand Up @@ -117,6 +136,8 @@ public Pair<Integer, Integer> getPosition(int width, int height) {
public interface PositionInvoker {

Pair<Integer, Integer> invoke(int width, int height);

}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package de.florianmichael.viaforge.common.protocolhack;

import net.raphimc.vialoader.impl.viaversion.VLInjector;
Expand All @@ -31,4 +32,5 @@ public String getDecoderName() {
public String getEncoderName() {
return VLLegacyPipeline.VIA_ENCODER_NAME;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package de.florianmichael.viaforge.common.protocolhack;

import com.viaversion.viaversion.api.Via;
Expand Down Expand Up @@ -44,10 +45,11 @@ public void load() {
final ViaProviders providers = Via.getManager().getProviders();

providers.use(VersionProvider.class, new ViaForgeVersionProvider());
providers.use(MovementTransmitterProvider.class, new DummyMovementTransmitter());
providers.use(MovementTransmitterProvider.class, new ViaForgeMovementTransmitterProvider());
providers.use(OldAuthProvider.class, new ViaForgeOldAuthProvider());
providers.use(GameProfileFetcher.class, platform.getGameProfileFetcher());
providers.use(EncryptionProvider.class, new ViaForgeEncryptionProvider());
providers.use(ClassicMPPassProvider.class, new ViaForgeClassicMPPassProvider());
}

}
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
/*
* This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
* Copyright (C) 2021-2023 FlorianMichael/EnZaXD and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package de.florianmichael.viaforge.common.protocolhack.netty;

import net.raphimc.vialoader.util.VersionEnum;
Expand All @@ -8,17 +26,18 @@ public interface VFNetworkManager {
* API method to setup the decryption side of the pipeline.
* This method is called by the {@link de.florianmichael.viaforge.common.protocolhack.provider.ViaForgeEncryptionProvider} class.
*/
void viaforge_setupPreNettyDecryption();
void viaForge$setupPreNettyDecryption();

/**
* @return the target version of the connection
*/
VersionEnum viaforge_getTrackedVersion();
VersionEnum viaForge$getTrackedVersion();

/**
* Sets the target version of the connection.
*
* @param version the target version
*/
void viaforge_setTrackedVersion(final VersionEnum version);
void viaForge$setTrackedVersion(final VersionEnum version);

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package de.florianmichael.viaforge.common.protocolhack.netty;

import com.viaversion.viaversion.api.connection.UserConnection;
Expand Down Expand Up @@ -56,4 +57,5 @@ protected String lengthSplitterName() {
protected String lengthPrependerName() {
return "prepender";
}

}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
/*
* This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
* Copyright (C) 2021-2023 FlorianMichael/EnZaXD and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package de.florianmichael.viaforge.common.protocolhack.provider;

import com.viaversion.viaversion.api.Via;
Expand Down Expand Up @@ -66,4 +84,5 @@ private static String sha1(final byte[] input) {
return null;
}
}

}
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
/*
* This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
* Copyright (C) 2021-2023 FlorianMichael/EnZaXD and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package de.florianmichael.viaforge.common.protocolhack.provider;

import com.viaversion.viaversion.api.connection.UserConnection;
Expand All @@ -8,6 +26,7 @@ public class ViaForgeEncryptionProvider extends EncryptionProvider {

@Override
public void enableDecryption(UserConnection user) {
user.getChannel().attr(ViaForgeCommon.VF_NETWORK_MANAGER).getAndRemove().viaforge_setupPreNettyDecryption();
user.getChannel().attr(ViaForgeCommon.VF_NETWORK_MANAGER).getAndRemove().viaForge$setupPreNettyDecryption();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
* Copyright (C) 2021-2023 FlorianMichael/EnZaXD and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package de.florianmichael.viaforge.common.protocolhack.provider;

import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.protocols.protocol1_9to1_8.providers.MovementTransmitterProvider;

public class ViaForgeMovementTransmitterProvider extends MovementTransmitterProvider {

@Override
public void sendPlayer(UserConnection userConnection) {
// We are on the client side, so we can handle the idle packet properly
}

}
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
/*
* This file is part of ViaForge - https://github.com/FlorianMichael/ViaForge
* Copyright (C) 2021-2023 FlorianMichael/EnZaXD and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package de.florianmichael.viaforge.common.protocolhack.provider;

import com.viaversion.viaversion.api.connection.UserConnection;
Expand All @@ -12,7 +30,7 @@ public void sendAuthRequest(UserConnection user, String serverId) throws Throwab
if (!common.getConfig().isVerifySessionInOldVersions()) {
return;
}

common.getPlatform().joinServer(serverId);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package de.florianmichael.viaforge.common.protocolhack.provider;

import com.viaversion.viaversion.api.connection.UserConnection;
Expand All @@ -32,9 +33,9 @@ public int getClosestServerProtocol(UserConnection connection) throws Exception
} catch (Exception e) {
e.printStackTrace();
}
return connection.getChannel().attr(ViaForgeCommon.VF_NETWORK_MANAGER).get().viaforge_getTrackedVersion().getVersion();
return connection.getChannel().attr(ViaForgeCommon.VF_NETWORK_MANAGER).get().viaForge$getTrackedVersion().getVersion();
}

return super.getClosestServerProtocol(connection);
}

}
Loading

0 comments on commit 79631f7

Please sign in to comment.