mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-30 16:19:03 +01:00
fix more compile issues
This commit is contained in:
parent
b7a964f387
commit
286f49b866
5 changed files with 10 additions and 16 deletions
|
@ -19,8 +19,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+import io.papermc.paper.adventure.PaperAdventure;
|
+import io.papermc.paper.adventure.PaperAdventure;
|
||||||
+import net.kyori.adventure.text.Component;
|
+import net.kyori.adventure.text.Component;
|
||||||
+import net.minecraft.advancements.Advancement;
|
+import net.minecraft.advancements.Advancement;
|
||||||
|
+import net.minecraft.advancements.AdvancementType;
|
||||||
+import net.minecraft.advancements.DisplayInfo;
|
+import net.minecraft.advancements.DisplayInfo;
|
||||||
+import net.minecraft.advancements.FrameType;
|
|
||||||
+import org.bukkit.NamespacedKey;
|
+import org.bukkit.NamespacedKey;
|
||||||
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||||
+import org.bukkit.craftbukkit.util.CraftNamespacedKey;
|
+import org.bukkit.craftbukkit.util.CraftNamespacedKey;
|
||||||
|
@ -32,7 +32,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+
|
+
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public @NotNull Frame frame() {
|
+ public @NotNull Frame frame() {
|
||||||
+ return asPaperFrame(this.handle.getFrame());
|
+ return asPaperFrame(this.handle.getType());
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ @Override
|
+ @Override
|
||||||
|
@ -67,7 +67,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+
|
+
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public @Nullable NamespacedKey backgroundPath() {
|
+ public @Nullable NamespacedKey backgroundPath() {
|
||||||
+ return this.handle.getBackground() == null ? null : CraftNamespacedKey.fromMinecraft(this.handle.getBackground());
|
+ return this.handle.getBackground().map(CraftNamespacedKey::fromMinecraft).orElse(null);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ @Override
|
+ @Override
|
||||||
|
@ -75,7 +75,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ return PaperAdventure.asAdventure(Advancement.decorateName(java.util.Objects.requireNonNull(this.handle, "cannot build display name for null handle, invalid state")));
|
+ return PaperAdventure.asAdventure(Advancement.decorateName(java.util.Objects.requireNonNull(this.handle, "cannot build display name for null handle, invalid state")));
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ public static @NotNull Frame asPaperFrame(@NotNull FrameType frameType) {
|
+ public static @NotNull Frame asPaperFrame(final @NotNull AdvancementType frameType) {
|
||||||
+ return switch (frameType) {
|
+ return switch (frameType) {
|
||||||
+ case TASK -> Frame.TASK;
|
+ case TASK -> Frame.TASK;
|
||||||
+ case CHALLENGE -> Frame.CHALLENGE;
|
+ case CHALLENGE -> Frame.CHALLENGE;
|
||||||
|
|
|
@ -26,7 +26,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+import net.minecraft.network.chat.ComponentContents;
|
+import net.minecraft.network.chat.ComponentContents;
|
||||||
+import net.minecraft.network.chat.MutableComponent;
|
+import net.minecraft.network.chat.MutableComponent;
|
||||||
+import net.minecraft.network.chat.Style;
|
+import net.minecraft.network.chat.Style;
|
||||||
+import net.minecraft.network.chat.contents.LiteralContents;
|
+import net.minecraft.network.chat.contents.PlainTextContents;
|
||||||
+import net.minecraft.util.FormattedCharSequence;
|
+import net.minecraft.util.FormattedCharSequence;
|
||||||
+import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
+import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||||
+import org.jetbrains.annotations.Nullable;
|
+import org.jetbrains.annotations.Nullable;
|
||||||
|
@ -60,7 +60,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public ComponentContents getContents() {
|
+ public ComponentContents getContents() {
|
||||||
+ if (this.adventure instanceof TextComponent) {
|
+ if (this.adventure instanceof TextComponent) {
|
||||||
+ return new LiteralContents(((TextComponent) this.adventure).content());
|
+ return PlainTextContents.create(((TextComponent) this.adventure).content());
|
||||||
+ } else {
|
+ } else {
|
||||||
+ return this.deepConverted().getContents();
|
+ return this.deepConverted().getContents();
|
||||||
+ }
|
+ }
|
||||||
|
|
|
@ -20,9 +20,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
if (this.tickRateManager.isSprinting() || this.haveTime()) {
|
if (this.tickRateManager.isSprinting() || this.haveTime()) {
|
||||||
Iterator iterator = this.getAllLevels().iterator();
|
Iterator iterator = this.getAllLevels().iterator();
|
||||||
|
|
||||||
while (iterator.hasNext()) {
|
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||||
- ServerLevel worldserver = (ServerLevel) iterator.next();
|
ServerLevel worldserver = (ServerLevel) iterator.next();
|
||||||
+ WorldServer worldserver = (WorldServer) iterator.next();
|
|
||||||
|
|
||||||
if (worldserver.getChunkSource().pollTask()) {
|
if (worldserver.getChunkSource().pollTask()) {
|
||||||
- return true;
|
- return true;
|
||||||
|
|
|
@ -15,11 +15,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+
|
+
|
||||||
+ // Paper start
|
+ // Paper start
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public org.bukkit.NamespacedKey getKey() {
|
|
||||||
+ return org.bukkit.craftbukkit.util.CraftNamespacedKey.fromMinecraft(net.minecraft.core.registries.BuiltInRegistries.MOB_EFFECT.getKey(this.handle));
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ @Override
|
|
||||||
+ public java.util.Map<org.bukkit.attribute.Attribute, org.bukkit.attribute.AttributeModifier> getEffectAttributes() {
|
+ public java.util.Map<org.bukkit.attribute.Attribute, org.bukkit.attribute.AttributeModifier> getEffectAttributes() {
|
||||||
+ // re-create map each time because a nms MobEffect can have its attributes modified
|
+ // re-create map each time because a nms MobEffect can have its attributes modified
|
||||||
+ final java.util.Map<org.bukkit.attribute.Attribute, org.bukkit.attribute.AttributeModifier> attributeMap = new java.util.HashMap<>();
|
+ final java.util.Map<org.bukkit.attribute.Attribute, org.bukkit.attribute.AttributeModifier> attributeMap = new java.util.HashMap<>();
|
||||||
|
|
|
@ -44,9 +44,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+
|
+
|
||||||
+ private net.minecraft.nbt.StringTag convert(String json) {
|
+ private net.minecraft.nbt.StringTag convert(String json) {
|
||||||
+ Component component = Component.Serializer.fromJson(json);
|
+ Component component = Component.Serializer.fromJson(json);
|
||||||
+ if (component.getContents() instanceof net.minecraft.network.chat.contents.LiteralContents literalContents && literalContents.text().contains("\u00A7") && component.getSiblings().isEmpty()) {
|
+ if (component.getContents() instanceof final net.minecraft.network.chat.contents.PlainTextContents plainTextContents && plainTextContents.text().contains("\u00A7") && component.getSiblings().isEmpty()) {
|
||||||
+ // Only convert if the root component is a single comp with legacy in it, don't convert already normal components
|
+ // Only convert if the root component is a single comp with legacy in it, don't convert already normal components
|
||||||
+ component = org.bukkit.craftbukkit.util.CraftChatMessage.fromString(literalContents.text())[0];
|
+ component = org.bukkit.craftbukkit.util.CraftChatMessage.fromString(plainTextContents.text())[0];
|
||||||
+ }
|
+ }
|
||||||
+ return net.minecraft.nbt.StringTag.valueOf(org.bukkit.craftbukkit.util.CraftChatMessage.toJSON(component));
|
+ return net.minecraft.nbt.StringTag.valueOf(org.bukkit.craftbukkit.util.CraftChatMessage.toJSON(component));
|
||||||
+ }
|
+ }
|
||||||
|
|
Loading…
Reference in a new issue