Compare commits

...

8 Commits

Author SHA1 Message Date
chris 670cf22515
Merge 21f596b52e into 8addcadb71 2024-05-05 17:49:51 +07:00
AJ Ferguson 8addcadb71
Bump MCPL to increase NBT max depth (#4639) 2024-05-05 02:24:28 -04:00
Camotoy 5770c96f48
Indicate support for 1.20.81 2024-05-05 01:29:37 -04:00
onebeastchris 21f596b52e Add ping() method to GeyserConnection in api 2023-10-01 16:29:45 +02:00
onebeastchris 7c194a0b74 Cleanup, use lang strings 2023-09-19 00:37:00 +02:00
onebeastchris d62470b408 Use RTT as that seems to vary less wildly compared to getPing() 2023-09-18 15:39:23 +02:00
onebeastchris c75c5b4fb9 Block just console execution, not everything but console senders 2023-09-18 15:35:06 +02:00
onebeastchris 4bf2a4303a Init: Add /geyser ping command 2023-09-18 15:31:39 +02:00
7 changed files with 76 additions and 5 deletions

View File

@ -14,7 +14,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!
### Currently supporting Minecraft Bedrock 1.20.40 - 1.20.80 and Minecraft Java 1.20.5/1.20.6
### Currently supporting Minecraft Bedrock 1.20.40 - 1.20.80/81 and Minecraft Java 1.20.5/1.20.6
## Setting Up
Take a look [here](https://wiki.geysermc.org/geyser/setup/) for how to set up Geyser.

View File

@ -132,4 +132,9 @@ public interface GeyserConnection extends Connection, CommandSource {
@Deprecated
@NonNull
Set<String> fogEffects();
/**
* Returns the current ping of the connection.
*/
int ping();
}

View File

@ -45,6 +45,7 @@ import org.geysermc.geyser.command.defaults.ExtensionsCommand;
import org.geysermc.geyser.command.defaults.HelpCommand;
import org.geysermc.geyser.command.defaults.ListCommand;
import org.geysermc.geyser.command.defaults.OffhandCommand;
import org.geysermc.geyser.command.defaults.PingCommand;
import org.geysermc.geyser.command.defaults.ReloadCommand;
import org.geysermc.geyser.command.defaults.SettingsCommand;
import org.geysermc.geyser.command.defaults.StatisticsCommand;
@ -65,7 +66,7 @@ import java.util.Map;
public class GeyserCommandManager {
@Getter
private final Map<String, Command> commands = new Object2ObjectOpenHashMap<>(12);
private final Map<String, Command> commands = new Object2ObjectOpenHashMap<>(13);
private final Map<Extension, Map<String, Command>> extensionCommands = new Object2ObjectOpenHashMap<>(0);
private final GeyserImpl geyser;
@ -82,6 +83,7 @@ public class GeyserCommandManager {
registerBuiltInCommand(new AdvancementsCommand("advancements", "geyser.commands.advancements.desc", "geyser.command.advancements"));
registerBuiltInCommand(new AdvancedTooltipsCommand("tooltips", "geyser.commands.advancedtooltips.desc", "geyser.command.tooltips"));
registerBuiltInCommand(new ConnectionTestCommand(geyser, "connectiontest", "geyser.commands.connectiontest.desc", "geyser.command.connectiontest"));
registerBuiltInCommand(new PingCommand("ping", "geyser.commands.ping.desc", "geyser.command.ping"));
if (this.geyser.getPlatformType() == PlatformType.STANDALONE) {
registerBuiltInCommand(new StopCommand(geyser, "stop", "geyser.commands.stop.desc", "geyser.command.stop"));
}

View File

@ -0,0 +1,54 @@
/*
* 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.command.defaults;
import org.geysermc.geyser.command.GeyserCommand;
import org.geysermc.geyser.command.GeyserCommandSource;
import org.geysermc.geyser.session.GeyserSession;
import org.geysermc.geyser.text.GeyserLocale;
public class PingCommand extends GeyserCommand {
public PingCommand(String name, String description, String permission) {
super(name, description, permission);
}
@Override
public void execute(GeyserSession session, GeyserCommandSource sender, String[] args) {
if (session == null) return;
sender.sendMessage(GeyserLocale.getPlayerLocaleString("geyser.commands.ping.message", sender.locale(), session.ping()));
}
@Override
public boolean isBedrockOnly() {
return true;
}
@Override
public boolean isExecutableOnConsole() {
return false;
}
}

View File

@ -50,7 +50,9 @@ public final class GameProtocol {
* Default Bedrock codec that should act as a fallback. Should represent the latest available
* release of the game that Geyser supports.
*/
public static final BedrockCodec DEFAULT_BEDROCK_CODEC = CodecProcessor.processCodec(Bedrock_v671.CODEC);
public static final BedrockCodec DEFAULT_BEDROCK_CODEC = CodecProcessor.processCodec(Bedrock_v671.CODEC.toBuilder()
.minecraftVersion("1.20.81")
.build());
/**
* A list of all supported Bedrock versions that can join Geyser
@ -77,7 +79,7 @@ public final class GameProtocol {
.minecraftVersion("1.20.70/1.20.73")
.build()));
SUPPORTED_BEDROCK_CODECS.add(CodecProcessor.processCodec(DEFAULT_BEDROCK_CODEC.toBuilder()
.minecraftVersion("1.20.80")
.minecraftVersion("1.20.80/1.20.81")
.build()));
}

View File

@ -76,6 +76,8 @@ import org.checkerframework.checker.nullness.qual.Nullable;
import org.checkerframework.common.value.qual.IntRange;
import org.cloudburstmc.math.vector.*;
import org.cloudburstmc.nbt.NbtMap;
import org.cloudburstmc.netty.channel.raknet.RakChildChannel;
import org.cloudburstmc.netty.handler.codec.raknet.common.RakSessionCodec;
import org.cloudburstmc.protocol.bedrock.BedrockDisconnectReasons;
import org.cloudburstmc.protocol.bedrock.BedrockServerSession;
import org.cloudburstmc.protocol.bedrock.data.*;
@ -2063,6 +2065,12 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource {
return this.cameraData.fogEffects();
}
@Override
public int ping() {
RakSessionCodec rakSessionCodec = ((RakChildChannel) getUpstream().getSession().getPeer().getChannel()).rakPipeline().get(RakSessionCodec.class);
return (int) Math.floor(rakSessionCodec.getPing());
}
public void addCommandEnum(String name, String enums) {
softEnumPacket(name, SoftEnumUpdateType.ADD, enums);
}

View File

@ -15,7 +15,7 @@ protocol-connection = "3.0.0.Beta1-20240411.165033-128"
raknet = "1.0.0.CR3-20240416.144209-1"
blockstateupdater="1.20.80-20240411.142413-1"
mcauthlib = "d9d773e"
mcprotocollib = "c1786e2" # Revert from jitpack after release
mcprotocollib = "1234962" # Revert from jitpack after release
adventure = "4.14.0"
adventure-platform = "4.3.0"
junit = "5.9.2"