-
-
Notifications
You must be signed in to change notification settings - Fork 710
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/master' into feature/forge-pla…
…tform # Conflicts: # build-logic/src/main/kotlin/geyser.base-conventions.gradle.kts
- Loading branch information
Showing
17 changed files
with
562 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
dependencies { | ||
api(projects.core) | ||
} | ||
|
||
platformRelocate("net.kyori") | ||
platformRelocate("org.yaml") | ||
platformRelocate("it.unimi.dsi.fastutil") | ||
platformRelocate("org.cloudburstmc.netty") | ||
|
||
// These dependencies are already present on the platform | ||
provided(libs.viaproxy) | ||
|
||
application { | ||
mainClass.set("org.geysermc.geyser.platform.viaproxy.GeyserViaProxyMain") | ||
} | ||
|
||
tasks.withType<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar> { | ||
archiveBaseName.set("Geyser-ViaProxy") | ||
|
||
dependencies { | ||
exclude(dependency("com.google.*:.*")) | ||
exclude(dependency("io.netty:.*")) | ||
exclude(dependency("org.slf4j:.*")) | ||
exclude(dependency("org.ow2.asm:.*")) | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
...roxy/src/main/java/org/geysermc/geyser/platform/viaproxy/GeyserViaProxyConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
* | ||
* @author GeyserMC | ||
* @link https://github.com/GeyserMC/Geyser | ||
*/ | ||
package org.geysermc.geyser.platform.viaproxy; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import net.raphimc.vialegacy.api.LegacyProtocolVersion; | ||
import net.raphimc.viaproxy.cli.options.Options; | ||
import org.geysermc.geyser.configuration.GeyserJacksonConfiguration; | ||
|
||
import java.io.File; | ||
import java.nio.file.Path; | ||
|
||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
public class GeyserViaProxyConfiguration extends GeyserJacksonConfiguration { | ||
|
||
@Override | ||
public Path getFloodgateKeyPath() { | ||
return new File(GeyserViaProxyPlugin.ROOT_FOLDER, this.getFloodgateKeyFile()).toPath(); | ||
} | ||
|
||
@Override | ||
public int getPingPassthroughInterval() { | ||
int interval = super.getPingPassthroughInterval(); | ||
if (interval < 15 && Options.PROTOCOL_VERSION != null && Options.PROTOCOL_VERSION.olderThanOrEqualTo(LegacyProtocolVersion.r1_6_4)) { | ||
// <= 1.6.4 servers sometimes block incoming connections from an IP address if too many connections are made | ||
interval = 15; | ||
} | ||
return interval; | ||
} | ||
|
||
} |
67 changes: 67 additions & 0 deletions
67
.../viaproxy/src/main/java/org/geysermc/geyser/platform/viaproxy/GeyserViaProxyDumpInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* | ||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
* | ||
* @author GeyserMC | ||
* @link https://github.com/GeyserMC/Geyser | ||
*/ | ||
package org.geysermc.geyser.platform.viaproxy; | ||
|
||
import lombok.Getter; | ||
import net.raphimc.viaproxy.ViaProxy; | ||
import net.raphimc.viaproxy.cli.options.Options; | ||
import net.raphimc.viaproxy.plugins.ViaProxyPlugin; | ||
import org.geysermc.geyser.dump.BootstrapDumpInfo; | ||
import org.geysermc.geyser.text.AsteriskSerializer; | ||
|
||
import java.net.InetSocketAddress; | ||
import java.util.ArrayList; | ||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
@Getter | ||
public class GeyserViaProxyDumpInfo extends BootstrapDumpInfo { | ||
|
||
private final String platformVersion; | ||
private final boolean onlineMode; | ||
|
||
@AsteriskSerializer.Asterisk(isIp = true) | ||
private final String serverIP; | ||
private final int serverPort; | ||
private final List<PluginInfo> plugins; | ||
|
||
public GeyserViaProxyDumpInfo() { | ||
this.platformVersion = ViaProxy.VERSION; | ||
this.onlineMode = Options.ONLINE_MODE; | ||
if (Options.BIND_ADDRESS instanceof InetSocketAddress inetSocketAddress) { | ||
this.serverIP = inetSocketAddress.getHostString(); | ||
this.serverPort = inetSocketAddress.getPort(); | ||
} else { | ||
this.serverIP = "unsupported"; | ||
this.serverPort = 0; | ||
} | ||
this.plugins = new ArrayList<>(); | ||
|
||
for (ViaProxyPlugin plugin : ViaProxy.getPluginManager().getPlugins()) { | ||
this.plugins.add(new PluginInfo(true, plugin.getName(), plugin.getVersion(), "unknown", Collections.singletonList(plugin.getAuthor()))); | ||
} | ||
} | ||
|
||
} |
88 changes: 88 additions & 0 deletions
88
...ap/viaproxy/src/main/java/org/geysermc/geyser/platform/viaproxy/GeyserViaProxyLogger.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
/* | ||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
* | ||
* @author GeyserMC | ||
* @link https://github.com/GeyserMC/Geyser | ||
*/ | ||
package org.geysermc.geyser.platform.viaproxy; | ||
|
||
import net.raphimc.viaproxy.cli.ConsoleFormatter; | ||
import org.apache.logging.log4j.Logger; | ||
import org.geysermc.geyser.GeyserLogger; | ||
import org.geysermc.geyser.command.GeyserCommandSource; | ||
|
||
public class GeyserViaProxyLogger implements GeyserLogger, GeyserCommandSource { | ||
|
||
private final Logger logger; | ||
private boolean debug; | ||
|
||
public GeyserViaProxyLogger(Logger logger) { | ||
this.logger = logger; | ||
} | ||
|
||
@Override | ||
public void severe(String message) { | ||
this.logger.fatal(ConsoleFormatter.convert(message)); | ||
} | ||
|
||
@Override | ||
public void severe(String message, Throwable error) { | ||
this.logger.fatal(ConsoleFormatter.convert(message), error); | ||
} | ||
|
||
@Override | ||
public void error(String message) { | ||
this.logger.error(ConsoleFormatter.convert(message)); | ||
} | ||
|
||
@Override | ||
public void error(String message, Throwable error) { | ||
this.logger.error(ConsoleFormatter.convert(message), error); | ||
} | ||
|
||
@Override | ||
public void warning(String message) { | ||
this.logger.warn(ConsoleFormatter.convert(message)); | ||
} | ||
|
||
@Override | ||
public void info(String message) { | ||
this.logger.info(ConsoleFormatter.convert(message)); | ||
} | ||
|
||
@Override | ||
public void debug(String message) { | ||
if (this.debug) { | ||
this.logger.debug(ConsoleFormatter.convert(message)); | ||
} | ||
} | ||
|
||
@Override | ||
public void setDebug(boolean debug) { | ||
this.debug = debug; | ||
} | ||
|
||
@Override | ||
public boolean isDebug() { | ||
return this.debug; | ||
} | ||
|
||
} |
45 changes: 45 additions & 0 deletions
45
...trap/viaproxy/src/main/java/org/geysermc/geyser/platform/viaproxy/GeyserViaProxyMain.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
* | ||
* @author GeyserMC | ||
* @link https://github.com/GeyserMC/Geyser | ||
*/ | ||
|
||
package org.geysermc.geyser.platform.viaproxy; | ||
|
||
import net.raphimc.viaproxy.plugins.PluginManager; | ||
import org.geysermc.geyser.GeyserMain; | ||
|
||
public class GeyserViaProxyMain extends GeyserMain { | ||
|
||
public static void main(String[] args) { | ||
new GeyserViaProxyMain().displayMessage(); | ||
} | ||
|
||
public String getPluginType() { | ||
return "ViaProxy"; | ||
} | ||
|
||
public String getPluginFolder() { | ||
return PluginManager.PLUGINS_DIR.getName(); | ||
} | ||
|
||
} |
Oops, something went wrong.