Skip to content

Commit 7754077

Browse files
committed
Merge remote-tracking branch 'upstream/master' into feature/forge-platform
# Conflicts: # build-logic/src/main/kotlin/geyser.base-conventions.gradle.kts
2 parents 0a755e4 + aca368e commit 7754077

File tree

17 files changed

+562
-22
lines changed

17 files changed

+562
-22
lines changed

.github/workflows/build.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,13 @@ jobs:
8484
name: Geyser Velocity
8585
path: bootstrap/velocity/build/libs/Geyser-Velocity.jar
8686
if-no-files-found: error
87+
- name: Archive artifacts (Geyser ViaProxy)
88+
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32
89+
if: success()
90+
with:
91+
name: Geyser ViaProxy
92+
path: bootstrap/viaproxy/build/libs/Geyser-ViaProxy.jar
93+
if-no-files-found: error
8794

8895
- name: Publish to Maven Repository
8996
if: ${{ success() && github.repository == 'GeyserMC/Geyser' && github.ref_name == 'master' }}

.github/workflows/pullrequest.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,3 +94,10 @@ jobs:
9494
name: Geyser Velocity
9595
path: geyser/bootstrap/velocity/build/libs/Geyser-Velocity.jar
9696
if-no-files-found: error
97+
- name: Archive artifacts (Geyser ViaProxy)
98+
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32
99+
if: success()
100+
with:
101+
name: Geyser ViaProxy
102+
path: geyser/bootstrap/viaproxy/build/libs/Geyser-ViaProxy.jar
103+
if-no-files-found: error

api/src/main/java/org/geysermc/geyser/api/util/PlatformType.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,5 @@ public record PlatformType(String platformName) {
4141
public static final PlatformType SPONGE = new PlatformType("Sponge");
4242
public static final PlatformType STANDALONE = new PlatformType("Standalone");
4343
public static final PlatformType VELOCITY = new PlatformType("Velocity");
44+
public static final PlatformType VIAPROXY = new PlatformType("ViaProxy");
4445
}

bootstrap/viaproxy/build.gradle.kts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
dependencies {
2+
api(projects.core)
3+
}
4+
5+
platformRelocate("net.kyori")
6+
platformRelocate("org.yaml")
7+
platformRelocate("it.unimi.dsi.fastutil")
8+
platformRelocate("org.cloudburstmc.netty")
9+
10+
// These dependencies are already present on the platform
11+
provided(libs.viaproxy)
12+
13+
application {
14+
mainClass.set("org.geysermc.geyser.platform.viaproxy.GeyserViaProxyMain")
15+
}
16+
17+
tasks.withType<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar> {
18+
archiveBaseName.set("Geyser-ViaProxy")
19+
20+
dependencies {
21+
exclude(dependency("com.google.*:.*"))
22+
exclude(dependency("io.netty:.*"))
23+
exclude(dependency("org.slf4j:.*"))
24+
exclude(dependency("org.ow2.asm:.*"))
25+
}
26+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*
2+
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a copy
5+
* of this software and associated documentation files (the "Software"), to deal
6+
* in the Software without restriction, including without limitation the rights
7+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
* copies of the Software, and to permit persons to whom the Software is
9+
* furnished to do so, subject to the following conditions:
10+
*
11+
* The above copyright notice and this permission notice shall be included in
12+
* all copies or substantial portions of the Software.
13+
*
14+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20+
* THE SOFTWARE.
21+
*
22+
* @author GeyserMC
23+
* @link https://github.com/GeyserMC/Geyser
24+
*/
25+
package org.geysermc.geyser.platform.viaproxy;
26+
27+
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
28+
import net.raphimc.vialegacy.api.LegacyProtocolVersion;
29+
import net.raphimc.viaproxy.cli.options.Options;
30+
import org.geysermc.geyser.configuration.GeyserJacksonConfiguration;
31+
32+
import java.io.File;
33+
import java.nio.file.Path;
34+
35+
@JsonIgnoreProperties(ignoreUnknown = true)
36+
public class GeyserViaProxyConfiguration extends GeyserJacksonConfiguration {
37+
38+
@Override
39+
public Path getFloodgateKeyPath() {
40+
return new File(GeyserViaProxyPlugin.ROOT_FOLDER, this.getFloodgateKeyFile()).toPath();
41+
}
42+
43+
@Override
44+
public int getPingPassthroughInterval() {
45+
int interval = super.getPingPassthroughInterval();
46+
if (interval < 15 && Options.PROTOCOL_VERSION != null && Options.PROTOCOL_VERSION.olderThanOrEqualTo(LegacyProtocolVersion.r1_6_4)) {
47+
// <= 1.6.4 servers sometimes block incoming connections from an IP address if too many connections are made
48+
interval = 15;
49+
}
50+
return interval;
51+
}
52+
53+
}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
/*
2+
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a copy
5+
* of this software and associated documentation files (the "Software"), to deal
6+
* in the Software without restriction, including without limitation the rights
7+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
* copies of the Software, and to permit persons to whom the Software is
9+
* furnished to do so, subject to the following conditions:
10+
*
11+
* The above copyright notice and this permission notice shall be included in
12+
* all copies or substantial portions of the Software.
13+
*
14+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20+
* THE SOFTWARE.
21+
*
22+
* @author GeyserMC
23+
* @link https://github.com/GeyserMC/Geyser
24+
*/
25+
package org.geysermc.geyser.platform.viaproxy;
26+
27+
import lombok.Getter;
28+
import net.raphimc.viaproxy.ViaProxy;
29+
import net.raphimc.viaproxy.cli.options.Options;
30+
import net.raphimc.viaproxy.plugins.ViaProxyPlugin;
31+
import org.geysermc.geyser.dump.BootstrapDumpInfo;
32+
import org.geysermc.geyser.text.AsteriskSerializer;
33+
34+
import java.net.InetSocketAddress;
35+
import java.util.ArrayList;
36+
import java.util.Collections;
37+
import java.util.List;
38+
39+
@Getter
40+
public class GeyserViaProxyDumpInfo extends BootstrapDumpInfo {
41+
42+
private final String platformVersion;
43+
private final boolean onlineMode;
44+
45+
@AsteriskSerializer.Asterisk(isIp = true)
46+
private final String serverIP;
47+
private final int serverPort;
48+
private final List<PluginInfo> plugins;
49+
50+
public GeyserViaProxyDumpInfo() {
51+
this.platformVersion = ViaProxy.VERSION;
52+
this.onlineMode = Options.ONLINE_MODE;
53+
if (Options.BIND_ADDRESS instanceof InetSocketAddress inetSocketAddress) {
54+
this.serverIP = inetSocketAddress.getHostString();
55+
this.serverPort = inetSocketAddress.getPort();
56+
} else {
57+
this.serverIP = "unsupported";
58+
this.serverPort = 0;
59+
}
60+
this.plugins = new ArrayList<>();
61+
62+
for (ViaProxyPlugin plugin : ViaProxy.getPluginManager().getPlugins()) {
63+
this.plugins.add(new PluginInfo(true, plugin.getName(), plugin.getVersion(), "unknown", Collections.singletonList(plugin.getAuthor())));
64+
}
65+
}
66+
67+
}
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
/*
2+
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a copy
5+
* of this software and associated documentation files (the "Software"), to deal
6+
* in the Software without restriction, including without limitation the rights
7+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
* copies of the Software, and to permit persons to whom the Software is
9+
* furnished to do so, subject to the following conditions:
10+
*
11+
* The above copyright notice and this permission notice shall be included in
12+
* all copies or substantial portions of the Software.
13+
*
14+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20+
* THE SOFTWARE.
21+
*
22+
* @author GeyserMC
23+
* @link https://github.com/GeyserMC/Geyser
24+
*/
25+
package org.geysermc.geyser.platform.viaproxy;
26+
27+
import net.raphimc.viaproxy.cli.ConsoleFormatter;
28+
import org.apache.logging.log4j.Logger;
29+
import org.geysermc.geyser.GeyserLogger;
30+
import org.geysermc.geyser.command.GeyserCommandSource;
31+
32+
public class GeyserViaProxyLogger implements GeyserLogger, GeyserCommandSource {
33+
34+
private final Logger logger;
35+
private boolean debug;
36+
37+
public GeyserViaProxyLogger(Logger logger) {
38+
this.logger = logger;
39+
}
40+
41+
@Override
42+
public void severe(String message) {
43+
this.logger.fatal(ConsoleFormatter.convert(message));
44+
}
45+
46+
@Override
47+
public void severe(String message, Throwable error) {
48+
this.logger.fatal(ConsoleFormatter.convert(message), error);
49+
}
50+
51+
@Override
52+
public void error(String message) {
53+
this.logger.error(ConsoleFormatter.convert(message));
54+
}
55+
56+
@Override
57+
public void error(String message, Throwable error) {
58+
this.logger.error(ConsoleFormatter.convert(message), error);
59+
}
60+
61+
@Override
62+
public void warning(String message) {
63+
this.logger.warn(ConsoleFormatter.convert(message));
64+
}
65+
66+
@Override
67+
public void info(String message) {
68+
this.logger.info(ConsoleFormatter.convert(message));
69+
}
70+
71+
@Override
72+
public void debug(String message) {
73+
if (this.debug) {
74+
this.logger.debug(ConsoleFormatter.convert(message));
75+
}
76+
}
77+
78+
@Override
79+
public void setDebug(boolean debug) {
80+
this.debug = debug;
81+
}
82+
83+
@Override
84+
public boolean isDebug() {
85+
return this.debug;
86+
}
87+
88+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a copy
5+
* of this software and associated documentation files (the "Software"), to deal
6+
* in the Software without restriction, including without limitation the rights
7+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
* copies of the Software, and to permit persons to whom the Software is
9+
* furnished to do so, subject to the following conditions:
10+
*
11+
* The above copyright notice and this permission notice shall be included in
12+
* all copies or substantial portions of the Software.
13+
*
14+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20+
* THE SOFTWARE.
21+
*
22+
* @author GeyserMC
23+
* @link https://github.com/GeyserMC/Geyser
24+
*/
25+
26+
package org.geysermc.geyser.platform.viaproxy;
27+
28+
import net.raphimc.viaproxy.plugins.PluginManager;
29+
import org.geysermc.geyser.GeyserMain;
30+
31+
public class GeyserViaProxyMain extends GeyserMain {
32+
33+
public static void main(String[] args) {
34+
new GeyserViaProxyMain().displayMessage();
35+
}
36+
37+
public String getPluginType() {
38+
return "ViaProxy";
39+
}
40+
41+
public String getPluginFolder() {
42+
return PluginManager.PLUGINS_DIR.getName();
43+
}
44+
45+
}

0 commit comments

Comments
 (0)