mirror of
https://github.com/GeyserMC/Geyser.git
synced 2025-12-19 14:59:27 +00:00
Update/fix bootstraps and build
This commit is contained in:
@@ -25,6 +25,6 @@
|
||||
"depends": {
|
||||
"fabricloader": ">=0.16.7",
|
||||
"fabric-api": "*",
|
||||
"minecraft": ">=1.21.5"
|
||||
"minecraft": ">=1.21.6"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,8 @@ import org.geysermc.geyser.api.event.lifecycle.GeyserRegisterPermissionsEvent;
|
||||
import org.geysermc.geyser.api.util.TriState;
|
||||
import org.geysermc.geyser.platform.neoforge.mixin.PermissionNodeMixin;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Common logic for handling the more complicated way we have to register permission on NeoForge
|
||||
*/
|
||||
@@ -69,7 +71,7 @@ public class PermissionUtils {
|
||||
case FALSE -> false;
|
||||
case NOT_SET -> {
|
||||
if (player != null) {
|
||||
yield player.createCommandSourceStack().hasPermission(player.server.getOperatorUserPermissionLevel());
|
||||
yield player.createCommandSourceStack().hasPermission(Objects.requireNonNull(player.getServer()).getOperatorUserPermissionLevel());
|
||||
}
|
||||
yield false; // NeoForge javadocs say player is null in the case of an offline player.
|
||||
}
|
||||
|
||||
@@ -16,12 +16,12 @@ config = "geyser_neoforge.mixins.json"
|
||||
[[dependencies.geyser_neoforge]]
|
||||
modId="neoforge"
|
||||
type="required"
|
||||
versionRange="[21.5.0-beta,)"
|
||||
versionRange="[21.6.0-beta,)"
|
||||
ordering="NONE"
|
||||
side="BOTH"
|
||||
[[dependencies.geyser_neoforge]]
|
||||
modId="minecraft"
|
||||
type="required"
|
||||
versionRange="[1.21.5,)"
|
||||
versionRange="[1.21.6,)"
|
||||
ordering="NONE"
|
||||
side="BOTH"
|
||||
|
||||
@@ -25,22 +25,20 @@
|
||||
|
||||
package org.geysermc.geyser.platform.mod;
|
||||
|
||||
import com.mojang.serialization.JsonOps;
|
||||
import io.netty.channel.ChannelFutureListener;
|
||||
import lombok.AllArgsConstructor;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
||||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||
import net.minecraft.core.RegistryAccess;
|
||||
import net.minecraft.network.Connection;
|
||||
import net.minecraft.network.PacketSendListener;
|
||||
import net.minecraft.network.chat.ComponentSerialization;
|
||||
import net.minecraft.network.protocol.Packet;
|
||||
import net.minecraft.network.protocol.PacketFlow;
|
||||
import net.minecraft.network.protocol.status.ClientboundStatusResponsePacket;
|
||||
import net.minecraft.network.protocol.status.ServerStatus;
|
||||
import net.minecraft.network.protocol.status.ServerStatusPacketListener;
|
||||
import net.minecraft.network.protocol.status.ServerboundStatusRequestPacket;
|
||||
import net.minecraft.resources.RegistryOps;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.network.ServerStatusPacketListenerImpl;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.geysermc.geyser.GeyserLogger;
|
||||
import org.geysermc.geyser.ping.GeyserPingInfo;
|
||||
@@ -52,9 +50,6 @@ import java.util.Objects;
|
||||
@AllArgsConstructor
|
||||
public class ModPingPassthrough implements IGeyserPingPassthrough {
|
||||
|
||||
private static final GsonComponentSerializer GSON_SERIALIZER = GsonComponentSerializer.gson();
|
||||
private static final LegacyComponentSerializer LEGACY_SERIALIZER = LegacyComponentSerializer.legacySection();
|
||||
|
||||
private final MinecraftServer server;
|
||||
private final GeyserLogger logger;
|
||||
|
||||
@@ -81,7 +76,7 @@ public class ModPingPassthrough implements IGeyserPingPassthrough {
|
||||
}
|
||||
|
||||
return new GeyserPingInfo(
|
||||
net.minecraft.network.chat.Component.Serializer.toJson(status.description(), RegistryAccess.EMPTY),
|
||||
ComponentSerialization.CODEC.encodeStart(RegistryOps.create(JsonOps.INSTANCE, server.registryAccess()), status.description()).getOrThrow().toString(),
|
||||
status.players().map(ServerStatus.Players::max).orElse(1),
|
||||
status.players().map(ServerStatus.Players::online).orElse(0)
|
||||
);
|
||||
@@ -99,11 +94,11 @@ public class ModPingPassthrough implements IGeyserPingPassthrough {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void send(@NonNull Packet<?> packet, @Nullable PacketSendListener packetSendListener, boolean bl) {
|
||||
public void send(Packet<?> packet, @org.jetbrains.annotations.Nullable ChannelFutureListener channelFutureListener, boolean bl) {
|
||||
if (packet instanceof ClientboundStatusResponsePacket statusResponse) {
|
||||
status = statusResponse.status();
|
||||
}
|
||||
super.send(packet, packetSendListener, bl);
|
||||
super.send(packet, channelFutureListener, bl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,10 +25,13 @@
|
||||
|
||||
package org.geysermc.geyser.platform.mod.command;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
import com.mojang.serialization.JsonOps;
|
||||
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.core.RegistryAccess;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.ComponentSerialization;
|
||||
import net.minecraft.resources.RegistryOps;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
@@ -36,7 +39,6 @@ import org.geysermc.geyser.GeyserImpl;
|
||||
import org.geysermc.geyser.command.GeyserCommandSource;
|
||||
import org.geysermc.geyser.text.ChatColor;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
|
||||
public class ModCommandSource implements GeyserCommandSource {
|
||||
@@ -65,8 +67,8 @@ public class ModCommandSource implements GeyserCommandSource {
|
||||
@Override
|
||||
public void sendMessage(net.kyori.adventure.text.Component message) {
|
||||
if (source.getEntity() instanceof ServerPlayer player) {
|
||||
String decoded = GsonComponentSerializer.gson().serialize(message);
|
||||
player.displayClientMessage(Objects.requireNonNull(Component.Serializer.fromJson(decoded, RegistryAccess.EMPTY)), false);
|
||||
JsonElement jsonComponent = GsonComponentSerializer.gson().serializeToTree(message);
|
||||
player.displayClientMessage(ComponentSerialization.CODEC.parse(RegistryOps.create(JsonOps.INSTANCE, player.registryAccess()), jsonComponent).getOrThrow(), false);
|
||||
return;
|
||||
}
|
||||
GeyserCommandSource.super.sendMessage(message);
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
|
||||
package org.geysermc.geyser.platform.mod.world;
|
||||
|
||||
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
||||
import net.minecraft.SharedConstants;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
@@ -50,7 +49,6 @@ import java.util.function.Consumer;
|
||||
|
||||
public class GeyserModWorldManager extends GeyserWorldManager {
|
||||
|
||||
private static final GsonComponentSerializer GSON_SERIALIZER = GsonComponentSerializer.gson();
|
||||
private final MinecraftServer server;
|
||||
|
||||
public GeyserModWorldManager(MinecraftServer server) {
|
||||
@@ -62,7 +60,7 @@ public class GeyserModWorldManager extends GeyserWorldManager {
|
||||
// If the protocol version of Geyser and the server are not the
|
||||
// same, fallback to the chunk cache. May be able to update this
|
||||
// in the future to use ViaVersion however, like Spigot does.
|
||||
if (SharedConstants.getCurrentVersion().getProtocolVersion() != GameProtocol.getJavaProtocolVersion()) {
|
||||
if (SharedConstants.getCurrentVersion().protocolVersion() != GameProtocol.getJavaProtocolVersion()) {
|
||||
return super.getBlockAt(session, x, y, z);
|
||||
}
|
||||
|
||||
@@ -96,7 +94,7 @@ public class GeyserModWorldManager extends GeyserWorldManager {
|
||||
|
||||
@Override
|
||||
public boolean hasOwnChunkCache() {
|
||||
return SharedConstants.getCurrentVersion().getProtocolVersion() == GameProtocol.getJavaProtocolVersion();
|
||||
return SharedConstants.getCurrentVersion().protocolVersion() == GameProtocol.getJavaProtocolVersion();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
package org.geysermc.geyser.platform.velocity;
|
||||
|
||||
import com.velocitypowered.api.event.proxy.ProxyPingEvent;
|
||||
import com.velocitypowered.api.network.HandshakeIntent;
|
||||
import com.velocitypowered.api.network.ProtocolState;
|
||||
import com.velocitypowered.api.network.ProtocolVersion;
|
||||
import com.velocitypowered.api.proxy.InboundConnection;
|
||||
@@ -84,6 +85,11 @@ public class GeyserVelocityPingPassthrough implements IGeyserPingPassthrough {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<String> getRawVirtualHost() {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
return false;
|
||||
@@ -98,6 +104,11 @@ public class GeyserVelocityPingPassthrough implements IGeyserPingPassthrough {
|
||||
public ProtocolState getProtocolState() {
|
||||
return ProtocolState.STATUS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandshakeIntent getHandshakeIntent() {
|
||||
return HandshakeIntent.LOGIN;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user