Skip to content

Commit

Permalink
Merge branch 'master' into AGGRESSIVEfixrenderdistance
Browse files Browse the repository at this point in the history
  • Loading branch information
onebeastchris authored Feb 27, 2025
2 parents 2297ca4 + 50a0e61 commit 50e6b05
Show file tree
Hide file tree
Showing 191 changed files with 24,536 additions and 1,444 deletions.
3 changes: 2 additions & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
name: Bug report
description: Create a report to help us improve
type: Bug
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report for Geyser! Fill out the following form to your best ability to help us fix the problem.
Only use this if you're absolutely sure that you found a bug and can reproduce it. For anything else, use: [our Discord server](https://discord.gg/geysermc), [the FAQ](https://github.com/GeyserMC/Geyser/wiki/FAQ) or the [Common Issues](https://github.com/GeyserMC/Geyser/wiki/Common-Issues).
Only use this if you're absolutely sure that you found a bug and can reproduce it. For anything else, use: [our Discord server](https://discord.gg/geysermc), [the FAQ](https://geysermc.org/wiki/geyser/faq) or the [Common Issues](https://geysermc.org/wiki/geyser/common-issues).
- type: textarea
attributes:
label: Describe the bug
Expand Down
5 changes: 3 additions & 2 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
name: Feature request
description: Suggest an idea for this project
labels: "Feature Request"
type: Feature
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this feature request for Geyser! Please fill out the following form to your best ability to help us understand your feature request and significantly improve the chance of getting added.
For anything else than a feature request, use: [our Discord server](https://discord.gg/geysermc), [the FAQ](https://github.com/GeyserMC/Geyser/wiki/FAQ) or [the Common Issues](https://github.com/GeyserMC/Geyser/wiki/Common-Issues).
For anything else than a feature request, use: [our Discord server](https://discord.gg/geysermc), [the FAQ](https://geysermc.org/wiki/geyser/faq) or the [Common Issues](https://geysermc.org/wiki/geyser/common-issues).
- type: textarea
attributes:
label: What feature do you want to see added?
Expand All @@ -18,4 +19,4 @@ body:
label: Are there any alternatives?
description: List any alternatives you might have tried
validations:
required: true
required: true
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ The ultimate goal of this project is to allow Minecraft: Bedrock Edition users t
Special thanks to the DragonProxy project for being a trailblazer in protocol translation and for all the team members who have joined us here!

## Supported Versions
Geyser is currently supporting Minecraft Bedrock 1.21.40 - 1.21.50 and Minecraft Java 1.21.4. For more information, please see [here](https://geysermc.org/wiki/geyser/supported-versions/).
Geyser is currently supporting Minecraft Bedrock 1.21.40 - 1.21.62 and Minecraft Java 1.21.4. For more information, please see [here](https://geysermc.org/wiki/geyser/supported-versions/).

## Setting Up
Take a look [here](https://geysermc.org/wiki/geyser/setup/) for how to set up Geyser.
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public interface JavaBlockState {
@Nullable String pistonBehavior();

/**
* Gets whether the block state has block entity
* Gets whether the block state has a block entity
*
* @return whether the block state has block entity
* @deprecated Does not have an effect. If you were using this to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public SessionDisconnectEvent(@NonNull GeyserConnection connection, @NonNull Str
}

/**
* Sets the disconnect reason, thereby overriding th original reason.
* Sets the disconnect message shown to the Bedrock client.
*
* @param disconnectReason the reason for the disconnect
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
import java.net.InetSocketAddress;

/**
* Called whenever Geyser gets pinged
* Called whenever Geyser gets pinged by a Bedrock client.
* <p>
* This event allows you to modify/obtain the MOTD, maximum player count, and current number of players online,
* Geyser will reply to the client with what was given.
* This event allows you to modify/obtain the MOTD, maximum player count, and current number of players online.
* Geyser will reply to the client with the information provided in this event.
*/
public interface GeyserBedrockPingEvent extends Event {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* <br>
* This event is mapped to the existence of Brigadier on the server.
*/
public class ServerDefineCommandsEvent extends ConnectionEvent implements Cancellable {
public final class ServerDefineCommandsEvent extends ConnectionEvent implements Cancellable {
private final Set<? extends CommandInfo> commands;
private boolean cancelled;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* Fired when the Java server sends a transfer request to a different Java server.
* Geyser Extensions can listen to this event and set a target server ip/port for Bedrock players to be transferred to.
*/
public class ServerTransferEvent extends ConnectionEvent {
public final class ServerTransferEvent extends ConnectionEvent {

private final String host;
private final int port;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelOutboundHandlerAdapter;
import io.netty.channel.ChannelPromise;
import net.md_5.bungee.netty.LengthPrependerAndCompressor;
import net.md_5.bungee.protocol.packet.LoginSuccess;
import net.md_5.bungee.protocol.packet.SetCompression;

Expand All @@ -40,8 +41,9 @@ public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise)
// Fixes https://github.com/GeyserMC/Geyser/issues/4281
// The server may send a LoginDisconnect packet after compression is set.
if (!compressionDisabled) {
if (ctx.pipeline().get("compress") != null) {
ctx.pipeline().remove("compress");
LengthPrependerAndCompressor compressor = ctx.pipeline().get(LengthPrependerAndCompressor.class);
if (compressor.isCompress()) {
compressor.setCompress(false);
compressionDisabled = true;
}
if (ctx.pipeline().get("decompress") != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,14 @@ protected void initializeLocalChannel0(GeyserBootstrap bootstrap) throws Excepti
throw new UnsupportedOperationException("Geyser does not currently support multiple listeners with injection! " +
"Please reach out to us on our Discord at https://discord.gg/GeyserMC so we can hear feedback on your setup.");
}

// TODO remove
try {
ProxyServer.class.getMethod("unsafe");
} catch (NoSuchMethodException e) {
throw new UnsupportedOperationException("You're using an outdated version of BungeeCord - please update. Thank you!");
}

ListenerInfo listenerInfo = proxy.getConfig().getListeners().stream().findFirst().orElseThrow(IllegalStateException::new);

Class<? extends ProxyServer> proxyClass = proxy.getClass();
Expand Down Expand Up @@ -138,7 +146,7 @@ protected void initChannel(@NonNull Channel ch) throws Exception {
if (channelInitializer == null) {
// Proxy has finished initializing; we can safely grab this variable without fear of plugins modifying it
// (Older versions of ViaVersion replace this to inject)
channelInitializer = PipelineUtils.SERVER_CHILD;
channelInitializer = proxy.unsafe().getFrontendChannelInitializer().getChannelInitializer();
}
initChannel.invoke(channelInitializer, ch);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
package org.geysermc.geyser.platform.bungeecord;

import lombok.AllArgsConstructor;
import net.kyori.adventure.text.serializer.bungeecord.BungeeComponentSerializer;
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.ServerPing;
import net.md_5.bungee.api.chat.BaseComponent;
Expand Down Expand Up @@ -74,7 +76,7 @@ public GeyserPingInfo getPingInformation(InetSocketAddress inetSocketAddress) {

ServerPing response = event.getResponse();
return new GeyserPingInfo(
response.getDescriptionComponent().toLegacyText(),
GsonComponentSerializer.gson().serialize(BungeeComponentSerializer.get().deserialize(new BaseComponent[]{ response.getDescriptionComponent() })),
response.getPlayers().getMax(),
response.getPlayers().getOnline()
);
Expand Down Expand Up @@ -186,6 +188,21 @@ public boolean isConnected() {
return false;
}

@Override
public boolean isTransferred() {
return false;
}

@Override
public CompletableFuture<byte[]> retrieveCookie(String s) {
throw new UnsupportedOperationException();
}

@Override
public CompletableFuture<byte[]> sendData(String s, byte[] bytes) {
throw new UnsupportedOperationException();
}

@Override
public Unsafe unsafe() {
throw new UnsupportedOperationException();
Expand Down
2 changes: 1 addition & 1 deletion bootstrap/mod/fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
],
"depends": {
"fabricloader": ">=0.16.7",
"fabric": "*",
"fabric-api": "*",
"minecraft": ">=1.21.4"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,8 @@ public GeyserPingInfo getPingInformation(InetSocketAddress inetSocketAddress) {
}
}

String jsonDescription = net.minecraft.network.chat.Component.Serializer.toJson(status.description(), RegistryAccess.EMPTY);
String legacyDescription = LEGACY_SERIALIZER.serialize(GSON_SERIALIZER.deserializeOr(jsonDescription, Component.empty()));

return new GeyserPingInfo(
legacyDescription,
net.minecraft.network.chat.Component.Serializer.toJson(status.description(), RegistryAccess.EMPTY),
status.players().map(ServerStatus.Players::max).orElse(1),
status.players().map(ServerStatus.Players::online).orElse(0)
);
Expand Down
7 changes: 7 additions & 0 deletions bootstrap/spigot/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
id("geyser.platform-conventions")
id("geyser.modrinth-uploading-conventions")
alias(libs.plugins.runpaper)
}

dependencies {
Expand Down Expand Up @@ -90,3 +91,9 @@ modrinth {
"1.19.1", "1.19.2", "1.19.3", "1.19.4", "1.20", "1.20.1", "1.20.2", "1.20.3", "1.20.4", "1.20.5", "1.20.6")
loaders.addAll("spigot", "paper")
}

tasks {
runServer {
minecraftVersion(libs.versions.runpaperversion.get())
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@

import com.destroystokyo.paper.event.server.PaperServerListPingEvent;
import com.destroystokyo.paper.network.StatusClient;
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
import org.bukkit.Bukkit;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
Expand Down Expand Up @@ -81,7 +83,10 @@ public GeyserPingInfo getPingInformation(InetSocketAddress inetSocketAddress) {
players = new GeyserPingInfo.Players(event.getMaxPlayers(), event.getNumPlayers());
}

return new GeyserPingInfo(event.getMotd(), players);
return new GeyserPingInfo(
GsonComponentSerializer.gson().serialize(LegacyComponentSerializer.legacySection().deserialize(event.getMotd())),
players
);
} catch (Exception | LinkageError e) { // LinkageError in the event that method/constructor signatures change
logger.debug("Error while getting Paper ping passthrough: " + e);
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

package org.geysermc.geyser.platform.spigot;

import org.geysermc.mcprotocollib.protocol.MinecraftConstants;
import org.geysermc.mcprotocollib.protocol.MinecraftProtocol;
import com.viaversion.viaversion.bukkit.handlers.BukkitChannelInitializer;
import io.netty.bootstrap.ServerBootstrap;
Expand Down Expand Up @@ -176,9 +177,9 @@ private ChannelInitializer<Channel> getChildHandler(GeyserBootstrap bootstrap, C
*/
private void workAroundWeirdBug(GeyserBootstrap bootstrap) {
MinecraftProtocol protocol = new MinecraftProtocol();
LocalSession session = new LocalSession(bootstrap.getGeyserConfig().getRemote().address(),
bootstrap.getGeyserConfig().getRemote().port(), this.serverSocketAddress,
InetAddress.getLoopbackAddress().getHostAddress(), protocol, Runnable::run);
LocalSession session = new LocalSession(this.serverSocketAddress, InetAddress.getLoopbackAddress().getHostAddress(), protocol, Runnable::run);
session.setFlag(MinecraftConstants.CLIENT_HOST, bootstrap.getGeyserConfig().getRemote().address());
session.setFlag(MinecraftConstants.CLIENT_PORT, bootstrap.getGeyserConfig().getRemote().port());
session.connect();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
package org.geysermc.geyser.platform.spigot;

import lombok.AllArgsConstructor;
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.server.ServerListPingEvent;
Expand All @@ -52,7 +54,11 @@ public class GeyserSpigotPingPassthrough implements IGeyserPingPassthrough {
try {
ServerListPingEvent event = new GeyserPingEvent(inetSocketAddress.getAddress(), Bukkit.getMotd(), Bukkit.getOnlinePlayers().size(), Bukkit.getMaxPlayers());
Bukkit.getPluginManager().callEvent(event);
return new GeyserPingInfo(event.getMotd(), event.getMaxPlayers(), event.getNumPlayers());
return new GeyserPingInfo(
GsonComponentSerializer.gson().serialize(LegacyComponentSerializer.legacySection().deserialize(event.getMotd())),
event.getMaxPlayers(),
event.getNumPlayers()
);
} catch (Exception | LinkageError e) { // LinkageError in the event that method/constructor signatures change
logger.debug("Error while getting Bukkit ping passthrough: " + e);
return null;
Expand Down
5 changes: 2 additions & 3 deletions bootstrap/standalone/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ plugins {
id("geyser.platform-conventions")
}

val terminalConsoleVersion = "1.2.0"
val jlineVersion = "3.21.0"

dependencies {
api(projects.core)

Expand Down Expand Up @@ -43,4 +40,6 @@ tasks.named<JavaExec>("run") {
dir.mkdirs()
jvmArgs("-Dio.netty.leakDetection.level=PARANOID")
workingDir = dir

standardInput = System.`in`
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,9 @@
import com.fasterxml.jackson.databind.introspect.BeanPropertyDefinition;
import io.netty.util.ResourceLeakDetector;
import lombok.Getter;
import net.minecrell.terminalconsole.TerminalConsoleAppender;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.core.Appender;
import org.apache.logging.log4j.core.Logger;
import org.apache.logging.log4j.core.appender.ConsoleAppender;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.geysermc.geyser.GeyserBootstrap;
import org.geysermc.geyser.GeyserImpl;
Expand Down Expand Up @@ -92,6 +89,9 @@ public static void main(String[] args) {
ResourceLeakDetector.setLevel(ResourceLeakDetector.Level.DISABLED); // Can eat performance
}

System.setProperty("java.util.logging.manager", "org.apache.logging.log4j.jul.LogManager");
GeyserStandaloneLogger.setupStreams();

GeyserStandaloneBootstrap bootstrap = new GeyserStandaloneBootstrap();
// Set defaults
boolean useGuiOpts = bootstrap.useGui;
Expand Down Expand Up @@ -175,17 +175,10 @@ public static void main(String[] args) {
@Override
public void onGeyserInitialize() {
log4jLogger = (Logger) LogManager.getRootLogger();
for (Appender appender : log4jLogger.getAppenders().values()) {
// Remove the appender that is not in use
// Prevents multiple appenders/double logging and removes harmless errors
if ((useGui && appender instanceof TerminalConsoleAppender) || (!useGui && appender instanceof ConsoleAppender)) {
log4jLogger.removeAppender(appender);
}
}

if (useGui && gui == null) {
gui = new GeyserStandaloneGUI(geyserLogger);
gui.redirectSystemStreams();
gui.addGuiAppender();
gui.startUpdateThread();
}

Expand All @@ -198,7 +191,7 @@ public void onGeyserInitialize() {
public void onGeyserEnable() {
try {
File configFile = FileUtils.fileOrCopiedFromResource(new File(configFilename), "config.yml",
(x) -> x.replaceAll("generateduuid", UUID.randomUUID().toString()), this);
(x) -> x.replaceAll("generateduuid", UUID.randomUUID().toString()), this);
geyserConfig = FileUtils.loadConfig(configFile, GeyserStandaloneConfiguration.class);

handleArgsConfigOptions();
Expand Down Expand Up @@ -246,9 +239,7 @@ public void onGeyserEnable() {

geyserPingPassthrough = GeyserLegacyPingPassthrough.init(geyser);

if (!useGui) {
geyserLogger.start(); // Throws an error otherwise
}
geyserLogger.start();
}

/**
Expand All @@ -261,7 +252,8 @@ private boolean isHeadless() {
Class<?> graphicsEnv = Class.forName("java.awt.GraphicsEnvironment");
Method isHeadless = graphicsEnv.getDeclaredMethod("isHeadless");
return (boolean) isHeadless.invoke(null);
} catch (Exception ignore) { }
} catch (Exception ignore) {
}

return true;
}
Expand Down Expand Up @@ -347,12 +339,12 @@ public static List<BeanPropertyDefinition> getPOJOForClass(Class<?> clazz) {

// Get the ignored properties
Set<String> ignoredProperties = OBJECT_MAPPER.getSerializationConfig().getAnnotationIntrospector()
.findPropertyIgnoralByName(OBJECT_MAPPER.getSerializationConfig() ,beanDescription.getClassInfo()).getIgnored();
.findPropertyIgnoralByName(OBJECT_MAPPER.getSerializationConfig(), beanDescription.getClassInfo()).getIgnored();

// Filter properties removing the ignored ones
return properties.stream()
.filter(property -> !ignoredProperties.contains(property.getName()))
.collect(Collectors.toList());
.filter(property -> !ignoredProperties.contains(property.getName()))
.collect(Collectors.toList());
}

/**
Expand Down
Loading

0 comments on commit 50e6b05

Please sign in to comment.