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

@ -4,6 +4,8 @@ plugins {
dependencies { dependencies {
api(projects.api) api(projects.api)
implementation("net.kyori", "adventure-text-serializer-legacy", Versions.adventureVersion)
} }
publishing { publishing {

View file

@ -2,6 +2,8 @@ val bungeeVersion = "a7c6ede";
dependencies { dependencies {
api(projects.core) api(projects.core)
implementation("net.kyori", "adventure-text-serializer-bungeecord", Versions.adventurePlatformVersion)
} }
platformRelocate("net.md_5.bungee.jni") platformRelocate("net.md_5.bungee.jni")

View file

@ -31,7 +31,7 @@ import net.md_5.bungee.api.plugin.Listener;
import net.md_5.bungee.event.EventHandler; import net.md_5.bungee.event.EventHandler;
import org.geysermc.geyser.Constants; import org.geysermc.geyser.Constants;
import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.GeyserImpl;
import org.geysermc.geyser.platform.bungeecord.command.BungeeCommandSender; import org.geysermc.geyser.platform.bungeecord.command.BungeeCommandSource;
import org.geysermc.geyser.util.VersionCheckUtils; import org.geysermc.geyser.util.VersionCheckUtils;
public final class GeyserBungeeUpdateListener implements Listener { public final class GeyserBungeeUpdateListener implements Listener {
@ -41,7 +41,7 @@ public final class GeyserBungeeUpdateListener implements Listener {
if (GeyserImpl.getInstance().getConfig().isNotifyOnNewBedrockUpdate()) { if (GeyserImpl.getInstance().getConfig().isNotifyOnNewBedrockUpdate()) {
final ProxiedPlayer player = event.getPlayer(); final ProxiedPlayer player = event.getPlayer();
if (player.hasPermission(Constants.UPDATE_PERMISSION)) { if (player.hasPermission(Constants.UPDATE_PERMISSION)) {
VersionCheckUtils.checkForGeyserUpdate(() -> new BungeeCommandSender(player)); VersionCheckUtils.checkForGeyserUpdate(() -> new BungeeCommandSource(player));
} }
} }
} }

View file

@ -1,7 +1,7 @@
val paperVersion = "1.19-R0.1-SNAPSHOT" val paperVersion = "1.19-R0.1-SNAPSHOT"
val viaVersion = "4.0.0" val viaVersion = "4.0.0"
val adaptersVersion = "1.5-SNAPSHOT" val adaptersVersion = "1.5-SNAPSHOT"
val commodoreVersion = "1.13" val commodoreVersion = "2.2"
dependencies { dependencies {
api(projects.core) api(projects.core)
@ -10,6 +10,8 @@ dependencies {
implementation("me.lucko", "commodore", commodoreVersion) implementation("me.lucko", "commodore", commodoreVersion)
implementation("net.kyori", "adventure-text-serializer-bungeecord", Versions.adventurePlatformVersion)
// Both paper-api and paper-mojangapi only provide Java 17 versions for 1.19 // Both paper-api and paper-mojangapi only provide Java 17 versions for 1.19
compileOnly("io.papermc.paper", "paper-api", paperVersion) { compileOnly("io.papermc.paper", "paper-api", paperVersion) {
attributes { attributes {
@ -61,5 +63,8 @@ tasks.withType<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar> {
// Commodore includes Brigadier // Commodore includes Brigadier
exclude(dependency("com.mojang:.*")) exclude(dependency("com.mojang:.*"))
// Adventure slf4j
exclude(dependency("net.kyori.adventure.text.logger.slf4j:ComponentLogger"))
} }
} }

View file

@ -31,7 +31,7 @@ import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerJoinEvent;
import org.geysermc.geyser.Constants; import org.geysermc.geyser.Constants;
import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.GeyserImpl;
import org.geysermc.geyser.platform.spigot.command.SpigotCommandSender; import org.geysermc.geyser.platform.spigot.command.SpigotCommandSource;
import org.geysermc.geyser.util.VersionCheckUtils; import org.geysermc.geyser.util.VersionCheckUtils;
public final class GeyserSpigotUpdateListener implements Listener { public final class GeyserSpigotUpdateListener implements Listener {
@ -41,7 +41,7 @@ public final class GeyserSpigotUpdateListener implements Listener {
if (GeyserImpl.getInstance().getConfig().isNotifyOnNewBedrockUpdate()) { if (GeyserImpl.getInstance().getConfig().isNotifyOnNewBedrockUpdate()) {
final Player player = event.getPlayer(); final Player player = event.getPlayer();
if (player.hasPermission(Constants.UPDATE_PERMISSION)) { if (player.hasPermission(Constants.UPDATE_PERMISSION)) {
VersionCheckUtils.checkForGeyserUpdate(() -> new SpigotCommandSender(player)); VersionCheckUtils.checkForGeyserUpdate(() -> new SpigotCommandSource(player));
} }
} }
} }

View file

@ -30,7 +30,7 @@ import com.velocitypowered.api.event.connection.PostLoginEvent;
import com.velocitypowered.api.proxy.Player; import com.velocitypowered.api.proxy.Player;
import org.geysermc.geyser.Constants; import org.geysermc.geyser.Constants;
import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.GeyserImpl;
import org.geysermc.geyser.platform.velocity.command.VelocityCommandSender; import org.geysermc.geyser.platform.velocity.command.VelocityCommandSource;
import org.geysermc.geyser.util.VersionCheckUtils; import org.geysermc.geyser.util.VersionCheckUtils;
public final class GeyserVelocityUpdateListener { public final class GeyserVelocityUpdateListener {
@ -40,7 +40,7 @@ public final class GeyserVelocityUpdateListener {
if (GeyserImpl.getInstance().getConfig().isNotifyOnNewBedrockUpdate()) { if (GeyserImpl.getInstance().getConfig().isNotifyOnNewBedrockUpdate()) {
final Player player = event.getPlayer(); final Player player = event.getPlayer();
if (player.hasPermission(Constants.UPDATE_PERMISSION)) { if (player.hasPermission(Constants.UPDATE_PERMISSION)) {
VersionCheckUtils.checkForGeyserUpdate(() -> new VelocityCommandSender(player)); VersionCheckUtils.checkForGeyserUpdate(() -> new VelocityCommandSource(player));
} }
} }
} }

View file

@ -39,6 +39,7 @@ object Versions {
const val mcprotocollibversion = "9f78bd5" const val mcprotocollibversion = "9f78bd5"
const val packetlibVersion = "3.0" const val packetlibVersion = "3.0"
const val adventureVersion = "4.9.3" const val adventureVersion = "4.9.3"
const val adventurePlatformVersion = "4.1.2"
const val junitVersion = "4.13.1" const val junitVersion = "4.13.1"
const val checkerQualVersion = "3.19.0" const val checkerQualVersion = "3.19.0"
const val cumulusVersion = "1.1.1" const val cumulusVersion = "1.1.1"

View file

@ -26,11 +26,11 @@
package org.geysermc.geyser; package org.geysermc.geyser;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import org.geysermc.geyser.command.CommandSender; import org.geysermc.geyser.command.GeyserCommandSource;
import javax.annotation.Nullable; import javax.annotation.Nullable;
public interface GeyserLogger extends CommandSender { public interface GeyserLogger extends GeyserCommandSource {
/** /**
* Logs a severe message to console * 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.PlayerInventory;
import org.geysermc.geyser.inventory.click.Click; import org.geysermc.geyser.inventory.click.Click;
import org.geysermc.geyser.level.block.BlockStateValues; 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.BlockRegistries;
import org.geysermc.geyser.registry.type.ItemMapping; import org.geysermc.geyser.registry.type.ItemMapping;
import org.geysermc.geyser.registry.type.ItemMappings; import org.geysermc.geyser.registry.type.ItemMappings;
@ -467,7 +467,7 @@ public class BedrockInventoryTransactionTranslator extends PacketTranslator<Inve
InteractAction.ATTACK, session.isSneaking()); InteractAction.ATTACK, session.isSneaking());
session.sendDownstreamPacket(attackPacket); 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 // Since 1.19.10, LevelSoundEventPackets are no longer sent by the client when attacking entities
CooldownUtils.sendCooldown(session); 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.Constants;
import org.geysermc.geyser.GeyserImpl; import org.geysermc.geyser.GeyserImpl;
import org.geysermc.geyser.GeyserLogger; import org.geysermc.geyser.GeyserLogger;
import org.geysermc.geyser.command.CommandSender; import org.geysermc.geyser.command.GeyserCommandSource;
import org.geysermc.geyser.network.MinecraftProtocol; import org.geysermc.geyser.network.GameProtocol;
import org.geysermc.geyser.text.GeyserLocale; import org.geysermc.geyser.text.GeyserLocale;
import java.util.concurrent.CompletableFuture; 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(() -> { CompletableFuture.runAsync(() -> {
try { try {
JsonNode json = WebUtils.getJson("https://api.geysermc.org/v2/versions/geyser"); JsonNode json = WebUtils.getJson("https://api.geysermc.org/v2/versions/geyser");
JsonNode bedrock = json.get("bedrock").get("protocol"); JsonNode bedrock = json.get("bedrock").get("protocol");
int protocolVersion = bedrock.get("id").asInt(); 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. // We support the latest version! No need to print a message.
return; return;
} }
@ -68,11 +68,11 @@ public final class VersionCheckUtils {
final String newBedrockVersion = bedrock.get("name").asText(); final String newBedrockVersion = bedrock.get("name").asText();
// Delayed for two reasons: save unnecessary processing, and wait to load locale if this is on join. // 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 // 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) 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() .replaceText(TextReplacementConfig.builder()
.match("\\{1\\}") // Replace "Download here: {1}" so we can use fancy text component yesyes .match("\\{1\\}") // Replace "Download here: {1}" so we can use fancy text component yesyes
.replacement(Component.text() .replacement(Component.text()