From e7dba42792afab9883c3a1556522911d3b9616b9 Mon Sep 17 00:00:00 2001 From: RaphiMC <50594595+RaphiMC@users.noreply.github.com> Date: Wed, 4 Jan 2023 21:54:49 +0100 Subject: [PATCH 1/9] Minor changes --- build.gradle | 5 +++++ src/main/java/net/raphimc/viaproxy/ViaProxy.java | 4 +++- src/main/java/net/raphimc/viaproxy/ui/ViaProxyUI.java | 4 ++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 7434328..1c2aabf 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,7 @@ plugins { id "java" id "maven-publish" + id "net.kyori.blossom" version "1.3.1" } java.toolchain.languageVersion = JavaLanguageVersion.of(8) @@ -60,6 +61,10 @@ dependencies { include "net.raphimc.netminecraft:all:2.2.2" } +blossom { + replaceToken("\${version}", project.version, "src/main/java/net/raphimc/viaproxy/ViaProxy.java") +} + java { withSourcesJar() } diff --git a/src/main/java/net/raphimc/viaproxy/ViaProxy.java b/src/main/java/net/raphimc/viaproxy/ViaProxy.java index 24f472f..14f5391 100644 --- a/src/main/java/net/raphimc/viaproxy/ViaProxy.java +++ b/src/main/java/net/raphimc/viaproxy/ViaProxy.java @@ -29,6 +29,8 @@ import java.awt.*; public class ViaProxy { + public static final String VERSION = "${version}"; + public static NetServer currentProxyServer; public static Thread loaderThread; public static ChannelGroup c2pChannels; @@ -46,7 +48,7 @@ public class ViaProxy { public static void injectedMain(String[] args) throws InterruptedException { Logger.setup(); ConsoleHandler.hookConsole(); - Logger.LOGGER.info("Initializing ViaProxy..."); + Logger.LOGGER.info("Initializing ViaProxy v" + VERSION + "..."); VersionEnum.init(); setNettyParameters(); MCPipeline.useOptimizedPipeline(); diff --git a/src/main/java/net/raphimc/viaproxy/ui/ViaProxyUI.java b/src/main/java/net/raphimc/viaproxy/ui/ViaProxyUI.java index 00521bc..76c0c32 100644 --- a/src/main/java/net/raphimc/viaproxy/ui/ViaProxyUI.java +++ b/src/main/java/net/raphimc/viaproxy/ui/ViaProxyUI.java @@ -61,7 +61,7 @@ public class ViaProxyUI extends JFrame { } private void initWindow() { - this.setTitle("ViaProxy"); + this.setTitle("ViaProxy v" + ViaProxy.VERSION); this.setIconImage(this.icon.getImage()); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setSize(500, 370); @@ -131,7 +131,7 @@ public class ViaProxyUI extends JFrame { this.contentPane.add(this.serverVersion); } { - JLabel bindPortLabel = new JLabel("Bind Port:"); + JLabel bindPortLabel = new JLabel("Local Port:"); bindPortLabel.setBounds(10, 150, 100, 20); this.contentPane.add(bindPortLabel); From b91b3f3b2b9c65d59d43ef93f4762bdf1ee4bf59 Mon Sep 17 00:00:00 2001 From: RaphiMC <50594595+RaphiMC@users.noreply.github.com> Date: Wed, 4 Jan 2023 21:54:57 +0100 Subject: [PATCH 2/9] Updated README --- README.md | 53 +++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 47 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 8abedfd..2976083 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,10 @@ # ViaProxy -Standalone proxy which uses ViaVersion to translate between minecraft versions. +Standalone proxy which uses ViaVersion to translate the protocol between minecraft versions. + +ViaProxy allows you to join to essentially any minecraft version server from a modern client. +To download the latest version, go to the [Releases section](#executable-jar-file) and download the latest version. +Using it is very simple, just run the jar file, and it will start an user interface where everything can be configured. +For a full user guide go to the [Usage for Players](#usage-for-players) section or the [Usage for Server Owners](#usage-for-server-owners) section. ## Supported Server versions - Classic (c0.0.15 - c0.30 including [CPE](https://wiki.vg/Classic_Protocol_Extension)) @@ -11,15 +16,51 @@ Standalone proxy which uses ViaVersion to translate between minecraft versions. ## Supported Client versions - Release (1.7.2 - 1.19.3) -- April Fools (3D Shareware) ## Releases +### Executable Jar File +If you want the executable jar file you can download a stable release from [GitHub](https://github.com/RaphiMC/ViaProxy/releases/latest) or the latest version from this [Jenkins](https://build.lenni0451.net/job/ViaProxy/). + ### Gradle/Maven To use ViaProxy with Gradle/Maven you can use this [Maven server](https://maven.lenni0451.net/#/releases/net/raphimc/ViaProxy) or [Jitpack](https://jitpack.io/#RaphiMC/ViaProxy). You can also find instructions how to implement it into your build script there. -### Jar File -If you just want the latest jar file you can download it from this [Jenkins](https://build.lenni0451.net/job/ViaProxy/). +## Usage for Players (GUI) +![ViaProxy GUI](https://i.imgur.com/N2JCvEp.png) +1. Download the latest version from the [Releases section](#executable-jar-file) +2. Put the jar file into a folder (ViaProxy will generate config files and store some data there) +3. Run the jar file +4. Fill in the required fields like server address and version +5. Click on "Start" +6. Join with your minecraft client on the displayed address +7. Have fun! -## Usage -TODO +## Usage for Server owners (CLI) +1. Download the latest version from the [Releases section](#executable-jar-file) +2. Put the jar file into a folder (ViaProxy will generate config files and store some data there) +3. Run the jar file (Using java -jar ViaProxy-whateverversion.jar --help) +4. Look at the available config options and use those you need just like you would in the GUI +5. Start the proxy using the start command and test whether it works (Join using the server's public address and the bind port you configured) +6. Have fun! + +Here is an example command to allow players to join on yourserverip:25568 and connect to a beta 1.7.3 server running on port 25565: +``java -jar ViaProxy-whateverversion.jar --bind_port 25568 --target_ip 127.0.0.1 --target_port 25565 --version b1.7-b1.7.3`` + +## Advanced Usage +### Online Mode +If you want to join online mode servers you need to install the [OpenAuthMod](https://modrinth.com/mod/openauthmod) mod. +When you have the mod installed and select "OpenAuthMod" as authentication type in the GUI / CLI. + +### Configuring the protocol translation +To change the protocol translation settings/features you can look into the ViaProtocolHack folder. +You will find 4 config files there: +- viaversion.yml (ViaVersion) +- config.yml (ViaBackwards) +- viarewind.yml (ViaRewind) +- vialegacy.yml (ViaLegacy) + +## Contact +If you encounter any issues, please report them on the +[issue tracker](https://github.com/RaphiMC/ViaProxy/issues). +If you just want to talk or need help using ViaProxy feel free to join my +[Discord](https://discord.gg/dCzT9XHEWu). \ No newline at end of file From db17ba1bd2a083a12ffa09fc67350a86ce8add8a Mon Sep 17 00:00:00 2001 From: RaphiMC <50594595+RaphiMC@users.noreply.github.com> Date: Wed, 4 Jan 2023 22:17:53 +0100 Subject: [PATCH 3/9] Added optimized default values for Via configs --- .../viaproxy/protocolhack/ProtocolHack.java | 7 ++-- .../ViaProxyViaBackwardsPlatformImpl.java | 23 ++++++++++++ .../impl/ViaProxyViaRewindPlatformImpl.java | 35 +++++++++++++++++++ .../impl/ViaProxyViaVersionPlatformImpl.java | 16 +++++++++ .../viaproxy/config_diff/viabackwards.yml | 4 +++ .../assets/viaproxy/config_diff/viarewind.yml | 4 +++ .../viaproxy/config_diff/viaversion.yml | 6 ++++ 7 files changed, 91 insertions(+), 4 deletions(-) create mode 100644 src/main/java/net/raphimc/viaproxy/protocolhack/impl/ViaProxyViaBackwardsPlatformImpl.java create mode 100644 src/main/java/net/raphimc/viaproxy/protocolhack/impl/ViaProxyViaRewindPlatformImpl.java create mode 100644 src/main/resources/assets/viaproxy/config_diff/viabackwards.yml create mode 100644 src/main/resources/assets/viaproxy/config_diff/viarewind.yml create mode 100644 src/main/resources/assets/viaproxy/config_diff/viaversion.yml diff --git a/src/main/java/net/raphimc/viaproxy/protocolhack/ProtocolHack.java b/src/main/java/net/raphimc/viaproxy/protocolhack/ProtocolHack.java index 21fdf42..4681323 100644 --- a/src/main/java/net/raphimc/viaproxy/protocolhack/ProtocolHack.java +++ b/src/main/java/net/raphimc/viaproxy/protocolhack/ProtocolHack.java @@ -1,14 +1,13 @@ package net.raphimc.viaproxy.protocolhack; import net.raphimc.viaprotocolhack.ViaProtocolHack; -import net.raphimc.viaprotocolhack.impl.platform.*; -import net.raphimc.viaproxy.protocolhack.impl.ViaProxyVPLoader; -import net.raphimc.viaproxy.protocolhack.impl.ViaProxyViaVersionPlatformImpl; +import net.raphimc.viaprotocolhack.impl.platform.ViaLegacyPlatformImpl; +import net.raphimc.viaproxy.protocolhack.impl.*; public class ProtocolHack { public static void init() { - ViaProtocolHack.init(new ViaProxyViaVersionPlatformImpl(), new ViaProxyVPLoader(), null, null, ViaBackwardsPlatformImpl::new, ViaRewindPlatformImpl::new, ViaLegacyPlatformImpl::new); + ViaProtocolHack.init(new ViaProxyViaVersionPlatformImpl(), new ViaProxyVPLoader(), null, null, ViaProxyViaBackwardsPlatformImpl::new, ViaProxyViaRewindPlatformImpl::new, ViaLegacyPlatformImpl::new); } } diff --git a/src/main/java/net/raphimc/viaproxy/protocolhack/impl/ViaProxyViaBackwardsPlatformImpl.java b/src/main/java/net/raphimc/viaproxy/protocolhack/impl/ViaProxyViaBackwardsPlatformImpl.java new file mode 100644 index 0000000..1cccac7 --- /dev/null +++ b/src/main/java/net/raphimc/viaproxy/protocolhack/impl/ViaProxyViaBackwardsPlatformImpl.java @@ -0,0 +1,23 @@ +package net.raphimc.viaproxy.protocolhack.impl; + +import com.viaversion.viabackwards.ViaBackwardsConfig; +import net.raphimc.viaprotocolhack.impl.platform.ViaBackwardsPlatformImpl; + +import java.io.File; +import java.net.URL; + +public class ViaProxyViaBackwardsPlatformImpl extends ViaBackwardsPlatformImpl { + + @Override + public void init(File dataFolder) { + new ViaBackwardsConfig(new File(dataFolder, "config.yml")) { + @Override + public URL getDefaultConfigURL() { + return ViaProxyViaVersionPlatformImpl.class.getClassLoader().getResource("assets/viaproxy/config_diff/viabackwards.yml"); + } + }.reloadConfig(); + + super.init(dataFolder); + } + +} diff --git a/src/main/java/net/raphimc/viaproxy/protocolhack/impl/ViaProxyViaRewindPlatformImpl.java b/src/main/java/net/raphimc/viaproxy/protocolhack/impl/ViaProxyViaRewindPlatformImpl.java new file mode 100644 index 0000000..2aa2d08 --- /dev/null +++ b/src/main/java/net/raphimc/viaproxy/protocolhack/impl/ViaProxyViaRewindPlatformImpl.java @@ -0,0 +1,35 @@ +package net.raphimc.viaproxy.protocolhack.impl; + +import com.viaversion.viaversion.api.Via; +import de.gerrygames.viarewind.api.ViaRewindConfigImpl; +import de.gerrygames.viarewind.api.ViaRewindPlatform; +import net.raphimc.viaprotocolhack.util.JLoggerToSLF4J; +import org.slf4j.LoggerFactory; + +import java.io.File; +import java.net.URL; +import java.util.logging.Logger; + +public class ViaProxyViaRewindPlatformImpl implements ViaRewindPlatform { + + private static final Logger LOGGER = new JLoggerToSLF4J(LoggerFactory.getLogger("ViaRewind")); + + public ViaProxyViaRewindPlatformImpl() { + new ViaRewindConfigImpl(new File(Via.getPlatform().getDataFolder(), "viarewind.yml")) { + @Override + public URL getDefaultConfigURL() { + return ViaProxyViaVersionPlatformImpl.class.getClassLoader().getResource("assets/viaproxy/config_diff/viarewind.yml"); + } + }.reloadConfig(); + + final ViaRewindConfigImpl config = new ViaRewindConfigImpl(new File(Via.getPlatform().getDataFolder(), "viarewind.yml")); + config.reloadConfig(); + this.init(config); + } + + @Override + public Logger getLogger() { + return LOGGER; + } + +} diff --git a/src/main/java/net/raphimc/viaproxy/protocolhack/impl/ViaProxyViaVersionPlatformImpl.java b/src/main/java/net/raphimc/viaproxy/protocolhack/impl/ViaProxyViaVersionPlatformImpl.java index 4b8e7f0..836d1f3 100644 --- a/src/main/java/net/raphimc/viaproxy/protocolhack/impl/ViaProxyViaVersionPlatformImpl.java +++ b/src/main/java/net/raphimc/viaproxy/protocolhack/impl/ViaProxyViaVersionPlatformImpl.java @@ -1,8 +1,12 @@ package net.raphimc.viaproxy.protocolhack.impl; +import com.viaversion.viaversion.configuration.AbstractViaConfig; import net.raphimc.viaprotocolhack.impl.platform.ViaVersionPlatformImpl; +import net.raphimc.viaprotocolhack.impl.viaversion.VPViaConfig; import net.raphimc.viaproxy.cli.ConsoleFormatter; +import java.io.File; +import java.net.URL; import java.util.UUID; public class ViaProxyViaVersionPlatformImpl extends ViaVersionPlatformImpl { @@ -16,4 +20,16 @@ public class ViaProxyViaVersionPlatformImpl extends ViaVersionPlatformImpl { super.sendMessage(uuid, ConsoleFormatter.convert(msg)); } + @Override + protected AbstractViaConfig createConfig() { + new VPViaConfig(new File(this.getDataFolder(), "viaversion.yml")) { + @Override + public URL getDefaultConfigURL() { + return ViaProxyViaVersionPlatformImpl.class.getClassLoader().getResource("assets/viaproxy/config_diff/viaversion.yml"); + } + }.reloadConfig(); + + return super.createConfig(); + } + } diff --git a/src/main/resources/assets/viaproxy/config_diff/viabackwards.yml b/src/main/resources/assets/viaproxy/config_diff/viabackwards.yml new file mode 100644 index 0000000..72558fb --- /dev/null +++ b/src/main/resources/assets/viaproxy/config_diff/viabackwards.yml @@ -0,0 +1,4 @@ +#Overwrite default value +fix-1_13-face-player: true +#Overwrite default value +handle-pings-as-inv-acknowledgements: true diff --git a/src/main/resources/assets/viaproxy/config_diff/viarewind.yml b/src/main/resources/assets/viaproxy/config_diff/viarewind.yml new file mode 100644 index 0000000..4eb05c6 --- /dev/null +++ b/src/main/resources/assets/viaproxy/config_diff/viarewind.yml @@ -0,0 +1,4 @@ +#Overwrite default value +replace-adventure: true +#Overwrite default value +replace-particles: true diff --git a/src/main/resources/assets/viaproxy/config_diff/viaversion.yml b/src/main/resources/assets/viaproxy/config_diff/viaversion.yml new file mode 100644 index 0000000..c35f9ca --- /dev/null +++ b/src/main/resources/assets/viaproxy/config_diff/viaversion.yml @@ -0,0 +1,6 @@ +#Overwrite default value +1_13-tab-complete-delay: 5 +#Overwrite default value +no-delay-shield-blocking: true +#Overwrite default value +chunk-border-fix: true From 7ce4ee082727bfdc955f2409bf19568fedcd9e7d Mon Sep 17 00:00:00 2001 From: RaphiMC <50594595+RaphiMC@users.noreply.github.com> Date: Wed, 4 Jan 2023 22:27:26 +0100 Subject: [PATCH 4/9] Updated README --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2976083..f42d44f 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,8 @@ Standalone proxy which uses ViaVersion to translate the protocol between minecra ViaProxy allows you to join to essentially any minecraft version server from a modern client. To download the latest version, go to the [Releases section](#executable-jar-file) and download the latest version. -Using it is very simple, just run the jar file, and it will start an user interface where everything can be configured. -For a full user guide go to the [Usage for Players](#usage-for-players) section or the [Usage for Server Owners](#usage-for-server-owners) section. +Using it is very simple, just run the jar file, and it will start a user interface where everything can be configured. +For a full user guide go to the [Usage for Players](#usage-for-players--gui-) section or the [Usage for Server Owners](#usage-for-server-owners--cli-) section. ## Supported Server versions - Classic (c0.0.15 - c0.30 including [CPE](https://wiki.vg/Classic_Protocol_Extension)) From 32a8c22b23db5b94d33c64276ff986d4aee1d5a7 Mon Sep 17 00:00:00 2001 From: RaphiMC <50594595+RaphiMC@users.noreply.github.com> Date: Wed, 4 Jan 2023 22:35:26 +0100 Subject: [PATCH 5/9] Removed sources jar from build --- build.gradle | 4 ---- 1 file changed, 4 deletions(-) diff --git a/build.gradle b/build.gradle index 1c2aabf..b2ee137 100644 --- a/build.gradle +++ b/build.gradle @@ -65,10 +65,6 @@ blossom { replaceToken("\${version}", project.version, "src/main/java/net/raphimc/viaproxy/ViaProxy.java") } -java { - withSourcesJar() -} - jar { dependsOn configurations.include from { From fed5b015638119a3759acd6313585c71bed5a47b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karen/=E3=81=82=E3=81=91=E3=81=BF?= Date: Thu, 5 Jan 2023 06:38:56 +0900 Subject: [PATCH 6/9] README: Fixed anchor URLs. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f42d44f..92f8d48 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Standalone proxy which uses ViaVersion to translate the protocol between minecra ViaProxy allows you to join to essentially any minecraft version server from a modern client. To download the latest version, go to the [Releases section](#executable-jar-file) and download the latest version. Using it is very simple, just run the jar file, and it will start a user interface where everything can be configured. -For a full user guide go to the [Usage for Players](#usage-for-players--gui-) section or the [Usage for Server Owners](#usage-for-server-owners--cli-) section. +For a full user guide go to the [Usage for Players](#usage-for-players-gui) section or the [Usage for Server Owners](#usage-for-server-owners-cli) section. ## Supported Server versions - Classic (c0.0.15 - c0.30 including [CPE](https://wiki.vg/Classic_Protocol_Extension)) From a229d77208a6a5f3c4220e53a290c27ee3c00a5c Mon Sep 17 00:00:00 2001 From: RaphiMC <50594595+RaphiMC@users.noreply.github.com> Date: Wed, 4 Jan 2023 22:47:29 +0100 Subject: [PATCH 7/9] Fixed issue where ViaProxy wouldn't shut down properly on CLI --- src/main/java/net/raphimc/viaproxy/ViaProxy.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/raphimc/viaproxy/ViaProxy.java b/src/main/java/net/raphimc/viaproxy/ViaProxy.java index 14f5391..6602e5c 100644 --- a/src/main/java/net/raphimc/viaproxy/ViaProxy.java +++ b/src/main/java/net/raphimc/viaproxy/ViaProxy.java @@ -72,7 +72,7 @@ public class ViaProxy { Options.parse(args); } catch (Throwable t) { Logger.LOGGER.fatal("[" + t.getClass().getSimpleName() + "] " + t.getMessage()); - return; + System.exit(0); } loaderThread.start(); From b2c79070039c40d5c6f851629d0a3c4506395fe1 Mon Sep 17 00:00:00 2001 From: RaphiMC <50594595+RaphiMC@users.noreply.github.com> Date: Wed, 4 Jan 2023 22:54:12 +0100 Subject: [PATCH 8/9] Changed label text --- src/main/java/net/raphimc/viaproxy/ui/ViaProxyUI.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/raphimc/viaproxy/ui/ViaProxyUI.java b/src/main/java/net/raphimc/viaproxy/ui/ViaProxyUI.java index 76c0c32..5e4230c 100644 --- a/src/main/java/net/raphimc/viaproxy/ui/ViaProxyUI.java +++ b/src/main/java/net/raphimc/viaproxy/ui/ViaProxyUI.java @@ -142,8 +142,8 @@ public class ViaProxyUI extends JFrame { this.contentPane.add(this.bindPort); } { - JLabel authMethodLabel = new JLabel("Auth Method:"); - authMethodLabel.setBounds(10, 200, 100, 20); + JLabel authMethodLabel = new JLabel("Server Online Mode Auth Method:"); + authMethodLabel.setBounds(10, 200, 250, 20); this.contentPane.add(authMethodLabel); this.authMethod = new JComboBox<>(new String[]{"OpenAuthMod"}); From 73d2955f72778e84b662204ac1360868719068b8 Mon Sep 17 00:00:00 2001 From: RaphiMC <50594595+RaphiMC@users.noreply.github.com> Date: Wed, 4 Jan 2023 23:41:19 +0100 Subject: [PATCH 9/9] Updated README --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 92f8d48..8a3884b 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,10 @@ You will find 4 config files there: - viarewind.yml (ViaRewind) - vialegacy.yml (ViaLegacy) +### Developer Plugin API +ViaProxy has a plugin API which allows you to create plugins for ViaProxy. +You can find the documentation and examples [here](https://github.com/Lenni0451/NoLocalConnections). + ## Contact If you encounter any issues, please report them on the [issue tracker](https://github.com/RaphiMC/ViaProxy/issues).