Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-12-26 00:00:41 +01:00
Merge branch 'master' of https://github.com/GeyserMC/Geyser into server-inventory
Dieser Commit ist enthalten in:
Commit
aaeca23f54
@ -32,6 +32,7 @@ import com.fasterxml.jackson.databind.introspect.AnnotatedField;
|
|||||||
import com.fasterxml.jackson.databind.introspect.BeanPropertyDefinition;
|
import com.fasterxml.jackson.databind.introspect.BeanPropertyDefinition;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import net.minecrell.terminalconsole.TerminalConsoleAppender;
|
import net.minecrell.terminalconsole.TerminalConsoleAppender;
|
||||||
|
import org.apache.logging.log4j.Level;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.core.Appender;
|
import org.apache.logging.log4j.core.Appender;
|
||||||
import org.apache.logging.log4j.core.Logger;
|
import org.apache.logging.log4j.core.Logger;
|
||||||
@ -167,11 +168,6 @@ public class GeyserStandaloneBootstrap implements GeyserBootstrap {
|
|||||||
this.onEnable();
|
this.onEnable();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onEnable(boolean useGui) {
|
|
||||||
this.useGui = useGui;
|
|
||||||
this.onEnable();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
Logger logger = (Logger) LogManager.getRootLogger();
|
Logger logger = (Logger) LogManager.getRootLogger();
|
||||||
@ -213,6 +209,9 @@ public class GeyserStandaloneBootstrap implements GeyserBootstrap {
|
|||||||
}
|
}
|
||||||
GeyserConfiguration.checkGeyserConfiguration(geyserConfig, geyserLogger);
|
GeyserConfiguration.checkGeyserConfiguration(geyserConfig, geyserLogger);
|
||||||
|
|
||||||
|
// Allow libraries like Protocol to have their debug information passthrough
|
||||||
|
logger.get().setLevel(geyserConfig.isDebugMode() ? Level.DEBUG : Level.INFO);
|
||||||
|
|
||||||
connector = GeyserConnector.start(PlatformType.STANDALONE, this);
|
connector = GeyserConnector.start(PlatformType.STANDALONE, this);
|
||||||
geyserCommandManager = new GeyserCommandManager(connector);
|
geyserCommandManager = new GeyserCommandManager(connector);
|
||||||
|
|
||||||
|
@ -56,10 +56,7 @@ import org.geysermc.connector.network.translators.world.WorldManager;
|
|||||||
import org.geysermc.connector.network.translators.world.block.BlockTranslator;
|
import org.geysermc.connector.network.translators.world.block.BlockTranslator;
|
||||||
import org.geysermc.connector.network.translators.world.block.entity.BlockEntityTranslator;
|
import org.geysermc.connector.network.translators.world.block.entity.BlockEntityTranslator;
|
||||||
import org.geysermc.connector.network.translators.world.block.entity.SkullBlockEntityTranslator;
|
import org.geysermc.connector.network.translators.world.block.entity.SkullBlockEntityTranslator;
|
||||||
import org.geysermc.connector.utils.DimensionUtils;
|
import org.geysermc.connector.utils.*;
|
||||||
import org.geysermc.connector.utils.LanguageUtils;
|
|
||||||
import org.geysermc.connector.utils.LocaleUtils;
|
|
||||||
import org.geysermc.connector.utils.ResourcePack;
|
|
||||||
|
|
||||||
import javax.naming.directory.Attribute;
|
import javax.naming.directory.Attribute;
|
||||||
import javax.naming.directory.InitialDirContext;
|
import javax.naming.directory.InitialDirContext;
|
||||||
@ -190,6 +187,7 @@ public class GeyserConnector {
|
|||||||
remoteServer = new RemoteServer(config.getRemote().getAddress(), remotePort);
|
remoteServer = new RemoteServer(config.getRemote().getAddress(), remotePort);
|
||||||
authType = AuthType.getByName(config.getRemote().getAuthType());
|
authType = AuthType.getByName(config.getRemote().getAuthType());
|
||||||
|
|
||||||
|
CooldownUtils.setShowCooldown(config.isShowCooldown());
|
||||||
DimensionUtils.changeBedrockNetherId(config.isAboveBedrockNetherBuilding()); // Apply End dimension ID workaround to Nether
|
DimensionUtils.changeBedrockNetherId(config.isAboveBedrockNetherBuilding()); // Apply End dimension ID workaround to Nether
|
||||||
SkullBlockEntityTranslator.ALLOW_CUSTOM_SKULLS = config.isAllowCustomSkulls();
|
SkullBlockEntityTranslator.ALLOW_CUSTOM_SKULLS = config.isAllowCustomSkulls();
|
||||||
|
|
||||||
|
@ -59,6 +59,8 @@ public interface GeyserConfiguration {
|
|||||||
|
|
||||||
int getPingPassthroughInterval();
|
int getPingPassthroughInterval();
|
||||||
|
|
||||||
|
boolean isForwardPlayerPing();
|
||||||
|
|
||||||
int getMaxPlayers();
|
int getMaxPlayers();
|
||||||
|
|
||||||
boolean isDebugMode();
|
boolean isDebugMode();
|
||||||
|
@ -74,6 +74,9 @@ public abstract class GeyserJacksonConfiguration implements GeyserConfiguration
|
|||||||
@JsonProperty("ping-passthrough-interval")
|
@JsonProperty("ping-passthrough-interval")
|
||||||
private int pingPassthroughInterval = 3;
|
private int pingPassthroughInterval = 3;
|
||||||
|
|
||||||
|
@JsonProperty("forward-player-ping")
|
||||||
|
private boolean forwardPlayerPing = false;
|
||||||
|
|
||||||
@JsonProperty("max-players")
|
@JsonProperty("max-players")
|
||||||
private int maxPlayers = 100;
|
private int maxPlayers = 100;
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ public class BoatEntity extends Entity {
|
|||||||
*/
|
*/
|
||||||
private static final String BUOYANCY_DATA = "{\"apply_gravity\":true,\"base_buoyancy\":1.0,\"big_wave_probability\":0.02999999932944775," +
|
private static final String BUOYANCY_DATA = "{\"apply_gravity\":true,\"base_buoyancy\":1.0,\"big_wave_probability\":0.02999999932944775," +
|
||||||
"\"big_wave_speed\":10.0,\"drag_down_on_buoyancy_removed\":0.0,\"liquid_blocks\":[\"minecraft:water\"," +
|
"\"big_wave_speed\":10.0,\"drag_down_on_buoyancy_removed\":0.0,\"liquid_blocks\":[\"minecraft:water\"," +
|
||||||
"\"minecraft:flowing_water\"],\"simulate_waves\":false}}";
|
"\"minecraft:flowing_water\"],\"simulate_waves\":false}";
|
||||||
|
|
||||||
private boolean isPaddlingLeft;
|
private boolean isPaddlingLeft;
|
||||||
private float paddleTimeLeft;
|
private float paddleTimeLeft;
|
||||||
|
@ -203,6 +203,9 @@ public class GeyserSession implements CommandSender {
|
|||||||
@Setter
|
@Setter
|
||||||
private boolean sprinting;
|
private boolean sprinting;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Not updated if cache chunks is enabled.
|
||||||
|
*/
|
||||||
@Setter
|
@Setter
|
||||||
private boolean jumping;
|
private boolean jumping;
|
||||||
|
|
||||||
@ -611,8 +614,10 @@ public class GeyserSession implements CommandSender {
|
|||||||
downstream.getSession().setFlag(BuiltinFlags.ENABLE_CLIENT_PROXY_PROTOCOL, true);
|
downstream.getSession().setFlag(BuiltinFlags.ENABLE_CLIENT_PROXY_PROTOCOL, true);
|
||||||
downstream.getSession().setFlag(BuiltinFlags.CLIENT_PROXIED_ADDRESS, upstream.getAddress());
|
downstream.getSession().setFlag(BuiltinFlags.CLIENT_PROXIED_ADDRESS, upstream.getAddress());
|
||||||
}
|
}
|
||||||
|
if (connector.getConfig().isForwardPlayerPing()) {
|
||||||
// Let Geyser handle sending the keep alive
|
// Let Geyser handle sending the keep alive
|
||||||
downstream.getSession().setFlag(MinecraftConstants.AUTOMATIC_KEEP_ALIVE_MANAGEMENT, false);
|
downstream.getSession().setFlag(MinecraftConstants.AUTOMATIC_KEEP_ALIVE_MANAGEMENT, false);
|
||||||
|
}
|
||||||
downstream.getSession().addListener(new SessionAdapter() {
|
downstream.getSession().addListener(new SessionAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void packetSending(PacketSendingEvent event) {
|
public void packetSending(PacketSendingEvent event) {
|
||||||
|
@ -30,6 +30,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.server.world.ServerUpdate
|
|||||||
import com.github.steveice10.packetlib.packet.Packet;
|
import com.github.steveice10.packetlib.packet.Packet;
|
||||||
import com.nukkitx.protocol.bedrock.BedrockPacket;
|
import com.nukkitx.protocol.bedrock.BedrockPacket;
|
||||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||||
|
import org.geysermc.common.PlatformType;
|
||||||
import org.geysermc.connector.GeyserConnector;
|
import org.geysermc.connector.GeyserConnector;
|
||||||
import org.geysermc.connector.network.session.GeyserSession;
|
import org.geysermc.connector.network.session.GeyserSession;
|
||||||
import org.geysermc.connector.utils.FileUtils;
|
import org.geysermc.connector.utils.FileUtils;
|
||||||
@ -89,13 +90,16 @@ public class PacketTranslatorRegistry<T> {
|
|||||||
public <P extends T> boolean translate(Class<? extends P> clazz, P packet, GeyserSession session) {
|
public <P extends T> boolean translate(Class<? extends P> clazz, P packet, GeyserSession session) {
|
||||||
if (!session.getUpstream().isClosed() && !session.isClosed()) {
|
if (!session.getUpstream().isClosed() && !session.isClosed()) {
|
||||||
try {
|
try {
|
||||||
if (translators.containsKey(clazz)) {
|
PacketTranslator<P> translator = (PacketTranslator<P>) translators.get(clazz);
|
||||||
((PacketTranslator<P>) translators.get(clazz)).translate(packet, session);
|
if (translator != null) {
|
||||||
|
translator.translate(packet, session);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
if (!IGNORED_PACKETS.contains(clazz))
|
if ((GeyserConnector.getInstance().getPlatformType() != PlatformType.STANDALONE || !(packet instanceof BedrockPacket)) && !IGNORED_PACKETS.contains(clazz)) {
|
||||||
|
// Other debug logs already take care of Bedrock packets for us if on standalone
|
||||||
GeyserConnector.getInstance().getLogger().debug("Could not find packet for " + (packet.toString().length() > 25 ? packet.getClass().getSimpleName() : packet));
|
GeyserConnector.getInstance().getLogger().debug("Could not find packet for " + (packet.toString().length() > 25 ? packet.getClass().getSimpleName() : packet));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} catch (Throwable ex) {
|
} catch (Throwable ex) {
|
||||||
GeyserConnector.getInstance().getLogger().error(LanguageUtils.getLocaleStringLog("geyser.network.translator.packet.failed", packet.getClass().getSimpleName()), ex);
|
GeyserConnector.getInstance().getLogger().error(LanguageUtils.getLocaleStringLog("geyser.network.translator.packet.failed", packet.getClass().getSimpleName()), ex);
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
|
@ -33,13 +33,14 @@ import org.geysermc.connector.network.translators.Translator;
|
|||||||
import org.geysermc.floodgate.util.DeviceOS;
|
import org.geysermc.floodgate.util.DeviceOS;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to send the keep alive packet back to the server
|
* Used to send the forwarded keep alive packet back to the server
|
||||||
*/
|
*/
|
||||||
@Translator(packet = NetworkStackLatencyPacket.class)
|
@Translator(packet = NetworkStackLatencyPacket.class)
|
||||||
public class BedrockNetworkStackLatencyTranslator extends PacketTranslator<NetworkStackLatencyPacket> {
|
public class BedrockNetworkStackLatencyTranslator extends PacketTranslator<NetworkStackLatencyPacket> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(NetworkStackLatencyPacket packet, GeyserSession session) {
|
public void translate(NetworkStackLatencyPacket packet, GeyserSession session) {
|
||||||
|
if (session.getConnector().getConfig().isForwardPlayerPing()) {
|
||||||
long pingId;
|
long pingId;
|
||||||
// so apparently, as of 1.16.200
|
// so apparently, as of 1.16.200
|
||||||
// PS4 divides the network stack latency timestamp FOR US!!!
|
// PS4 divides the network stack latency timestamp FOR US!!!
|
||||||
@ -52,4 +53,5 @@ public class BedrockNetworkStackLatencyTranslator extends PacketTranslator<Netwo
|
|||||||
}
|
}
|
||||||
session.sendDownstreamPacket(new ClientKeepAlivePacket(pingId));
|
session.sendDownstreamPacket(new ClientKeepAlivePacket(pingId));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -204,10 +204,11 @@ public class BedrockActionTranslator extends PacketTranslator<PlayerActionPacket
|
|||||||
session.getEntityCache().updateBossBars();
|
session.getEntityCache().updateBossBars();
|
||||||
break;
|
break;
|
||||||
case JUMP:
|
case JUMP:
|
||||||
|
if (!session.getConnector().getConfig().isCacheChunks()) {
|
||||||
|
// Save the jumping status for determining teleport status
|
||||||
session.setJumping(true);
|
session.setJumping(true);
|
||||||
session.getConnector().getGeneralThreadPool().schedule(() -> {
|
session.getConnector().getGeneralThreadPool().schedule(() -> session.setJumping(false), 1, TimeUnit.SECONDS);
|
||||||
session.setJumping(false);
|
}
|
||||||
}, 1, TimeUnit.SECONDS);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,6 +39,9 @@ public class JavaKeepAliveTranslator extends PacketTranslator<ServerKeepAlivePac
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void translate(ServerKeepAlivePacket packet, GeyserSession session) {
|
public void translate(ServerKeepAlivePacket packet, GeyserSession session) {
|
||||||
|
if (!session.getConnector().getConfig().isForwardPlayerPing()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
NetworkStackLatencyPacket latencyPacket = new NetworkStackLatencyPacket();
|
NetworkStackLatencyPacket latencyPacket = new NetworkStackLatencyPacket();
|
||||||
latencyPacket.setFromServer(true);
|
latencyPacket.setFromServer(true);
|
||||||
latencyPacket.setTimestamp(packet.getPingId() * 1000);
|
latencyPacket.setTimestamp(packet.getPingId() * 1000);
|
||||||
|
@ -26,7 +26,6 @@
|
|||||||
package org.geysermc.connector.utils;
|
package org.geysermc.connector.utils;
|
||||||
|
|
||||||
import com.nukkitx.protocol.bedrock.packet.SetTitlePacket;
|
import com.nukkitx.protocol.bedrock.packet.SetTitlePacket;
|
||||||
import org.geysermc.connector.GeyserConnector;
|
|
||||||
import org.geysermc.connector.network.session.GeyserSession;
|
import org.geysermc.connector.network.session.GeyserSession;
|
||||||
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
@ -36,11 +35,10 @@ import java.util.concurrent.TimeUnit;
|
|||||||
* Much of the work here is from the wonderful folks from ViaRewind: https://github.com/ViaVersion/ViaRewind
|
* Much of the work here is from the wonderful folks from ViaRewind: https://github.com/ViaVersion/ViaRewind
|
||||||
*/
|
*/
|
||||||
public class CooldownUtils {
|
public class CooldownUtils {
|
||||||
|
private static boolean SHOW_COOLDOWN;
|
||||||
|
|
||||||
private final static boolean SHOW_COOLDOWN;
|
public static void setShowCooldown(boolean showCooldown) {
|
||||||
|
SHOW_COOLDOWN = showCooldown;
|
||||||
static {
|
|
||||||
SHOW_COOLDOWN = GeyserConnector.getInstance().getConfig().isShowCooldown();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -116,5 +114,4 @@ public class CooldownUtils {
|
|||||||
}
|
}
|
||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -101,7 +101,7 @@ public class LocaleUtils {
|
|||||||
ASSET_MAP.put(entry.getKey(), asset);
|
ASSET_MAP.put(entry.getKey(), asset);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
GeyserConnector.getInstance().getLogger().info(LanguageUtils.getLocaleStringLog("geyser.locale.fail.asset_cache", (!e.getMessage().isEmpty() ? e.getMessage() : e.getStackTrace())));
|
GeyserConnector.getInstance().getLogger().error(LanguageUtils.getLocaleStringLog("geyser.locale.fail.asset_cache", (!e.getMessage().isEmpty() ? e.getMessage() : e.getStackTrace())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -260,7 +260,7 @@ public class LocaleUtils {
|
|||||||
// Delete the nolonger needed client/server jar
|
// Delete the nolonger needed client/server jar
|
||||||
Files.delete(tmpFilePath);
|
Files.delete(tmpFilePath);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new AssertionError(LanguageUtils.getLocaleStringLog("geyser.locale.fail.en_us"), e);
|
GeyserConnector.getInstance().getLogger().error(LanguageUtils.getLocaleStringLog("geyser.locale.fail.en_us"), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,7 +81,11 @@ legacy-ping-passthrough: false
|
|||||||
# Increase if you are getting BrokenPipe errors.
|
# Increase if you are getting BrokenPipe errors.
|
||||||
ping-passthrough-interval: 3
|
ping-passthrough-interval: 3
|
||||||
|
|
||||||
# Maximum amount of players that can connect
|
# Whether to forward player ping to the server. While enabling this will allow Bedrock players to have more accurate
|
||||||
|
# ping, it may also cause players to time out more easily.
|
||||||
|
forward-player-ping: false
|
||||||
|
|
||||||
|
# Maximum amount of players that can connect. This is only visual at this time and does not actually limit player count.
|
||||||
max-players: 100
|
max-players: 100
|
||||||
|
|
||||||
# If debug messages should be sent through console
|
# If debug messages should be sent through console
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren