Resolve fallout

This commit is contained in:
Kas-tle 2022-08-24 04:53:13 +00:00 committed by GitHub
parent 9232310b4d
commit e35f3785b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 27 additions and 17 deletions

View file

@ -26,11 +26,11 @@
package org.geysermc.geyser;
import net.kyori.adventure.text.Component;
import org.geysermc.geyser.command.CommandSender;
import org.geysermc.geyser.command.GeyserCommandSource;
import javax.annotation.Nullable;
public interface GeyserLogger extends CommandSender {
public interface GeyserLogger extends GeyserCommandSource {
/**
* Logs a severe message to console

View file

@ -54,7 +54,7 @@ import org.geysermc.geyser.inventory.Inventory;
import org.geysermc.geyser.inventory.PlayerInventory;
import org.geysermc.geyser.inventory.click.Click;
import org.geysermc.geyser.level.block.BlockStateValues;
import org.geysermc.geyser.network.MinecraftProtocol;
import org.geysermc.geyser.network.GameProtocol;
import org.geysermc.geyser.registry.BlockRegistries;
import org.geysermc.geyser.registry.type.ItemMapping;
import org.geysermc.geyser.registry.type.ItemMappings;
@ -467,7 +467,7 @@ public class BedrockInventoryTransactionTranslator extends PacketTranslator<Inve
InteractAction.ATTACK, session.isSneaking());
session.sendDownstreamPacket(attackPacket);
if (MinecraftProtocol.supports1_19_10(session)) {
if (GameProtocol.supports1_19_10(session)) {
// Since 1.19.10, LevelSoundEventPackets are no longer sent by the client when attacking entities
CooldownUtils.sendCooldown(session);
}

View file

@ -34,8 +34,8 @@ import net.kyori.adventure.text.format.TextDecoration;
import org.geysermc.geyser.Constants;
import org.geysermc.geyser.GeyserImpl;
import org.geysermc.geyser.GeyserLogger;
import org.geysermc.geyser.command.CommandSender;
import org.geysermc.geyser.network.MinecraftProtocol;
import org.geysermc.geyser.command.GeyserCommandSource;
import org.geysermc.geyser.network.GameProtocol;
import org.geysermc.geyser.text.GeyserLocale;
import java.util.concurrent.CompletableFuture;
@ -54,13 +54,13 @@ public final class VersionCheckUtils {
}
}
public static void checkForGeyserUpdate(Supplier<CommandSender> recipient) {
public static void checkForGeyserUpdate(Supplier<GeyserCommandSource> recipient) {
CompletableFuture.runAsync(() -> {
try {
JsonNode json = WebUtils.getJson("https://api.geysermc.org/v2/versions/geyser");
JsonNode bedrock = json.get("bedrock").get("protocol");
int protocolVersion = bedrock.get("id").asInt();
if (MinecraftProtocol.getBedrockCodec(protocolVersion) != null) {
if (GameProtocol.getBedrockCodec(protocolVersion) != null) {
// We support the latest version! No need to print a message.
return;
}
@ -68,11 +68,11 @@ public final class VersionCheckUtils {
final String newBedrockVersion = bedrock.get("name").asText();
// Delayed for two reasons: save unnecessary processing, and wait to load locale if this is on join.
CommandSender sender = recipient.get();
GeyserCommandSource sender = recipient.get();
// Overarching component is green - geyser.version.new component cannot be green or else the link blue is overshadowed
Component message = Component.text().color(NamedTextColor.GREEN)
.append(Component.text(GeyserLocale.getPlayerLocaleString("geyser.version.new", sender.getLocale(), newBedrockVersion))
.append(Component.text(GeyserLocale.getPlayerLocaleString("geyser.version.new", sender.locale(), newBedrockVersion))
.replaceText(TextReplacementConfig.builder()
.match("\\{1\\}") // Replace "Download here: {1}" so we can use fancy text component yesyes
.replacement(Component.text()