From b12732d8053d41930c95b0b93083af819da3cfa6 Mon Sep 17 00:00:00 2001 From: fullwall Date: Wed, 8 May 2024 21:32:43 +0800 Subject: [PATCH] Manually update to adventure snapshots to fix 1.20.6 adventure --- main/pom.xml | 14 ++-- .../main/java/net/citizensnpcs/Citizens.java | 28 +++++--- .../net/citizensnpcs/trait/HologramTrait.java | 65 +++++++++++++++++-- main/src/main/resources/ko-kr.json | 17 +++++ .../nms/v1_12_R1/entity/EntityHumanNPC.java | 10 +-- v1_20_R4/pom.xml | 2 +- .../nms/v1_20_R4/entity/CamelController.java | 2 - 7 files changed, 105 insertions(+), 33 deletions(-) diff --git a/main/pom.xml b/main/pom.xml index 5354a4982..1b4325f1d 100644 --- a/main/pom.xml +++ b/main/pom.xml @@ -14,7 +14,7 @@ 1.20.6-R0.1-SNAPSHOT 2.11.5 ${project.version} - 7.1.0-SNAPSHOT + 7.1.0-SNAPSHOT @@ -45,6 +45,10 @@ AlessioDP https://repo.alessiodp.com/releases/ + + sonatype-oss-snapshots1 + https://s01.oss.sonatype.org/content/repositories/snapshots/ + @@ -53,7 +57,7 @@ ${craftbukkit.version} jar provided - + net.sf.trove4j trove4j @@ -111,13 +115,13 @@ net.kyori adventure-text-minimessage - 4.16.0 + 4.17.0 provided net.kyori adventure-platform-bukkit - 4.3.2 + 4.3.3-SNAPSHOT provided @@ -144,7 +148,7 @@ *.json LICENSE - + diff --git a/main/src/main/java/net/citizensnpcs/Citizens.java b/main/src/main/java/net/citizensnpcs/Citizens.java index 391ab24fd..51c93c136 100644 --- a/main/src/main/java/net/citizensnpcs/Citizens.java +++ b/main/src/main/java/net/citizensnpcs/Citizens.java @@ -293,21 +293,27 @@ public class Citizens extends JavaPlugin implements CitizensPlugin { lib.loadLibrary(Library.builder().groupId("net{}sf{}trove4j").artifactId("trove4j").version("3.0.3") .relocate("gnu{}trove", "clib{}trove").build()); lib.loadLibrary(Library.builder().groupId("net{}kyori").artifactId("adventure-text-minimessage") - .version("4.16.0").relocate("net{}kyori", "clib{}net{}kyori").build()); - lib.loadLibrary(Library.builder().groupId("net{}kyori").artifactId("adventure-api").version("4.16.0") + .version("4.17.0").relocate("net{}kyori", "clib{}net{}kyori").build()); + lib.loadLibrary(Library.builder().groupId("net{}kyori").artifactId("adventure-api").version("4.17.0") .relocate("net{}kyori", "clib{}net{}kyori").build()); - lib.loadLibrary(Library.builder().groupId("net{}kyori").artifactId("adventure-key").version("4.16.0") + lib.loadLibrary(Library.builder().groupId("net{}kyori").artifactId("adventure-key").version("4.17.0") .relocate("net{}kyori", "clib{}net{}kyori").build()); lib.loadLibrary(Library.builder().groupId("net{}kyori").artifactId("examination-api").version("1.3.0") .relocate("net{}kyori", "clib{}net{}kyori").build()); lib.loadLibrary(Library.builder().groupId("net{}kyori").artifactId("examination-string").version("1.3.0") .relocate("net{}kyori", "clib{}net{}kyori").build()); - lib.loadLibrary(Library.builder().groupId("net{}kyori").artifactId("adventure-platform-bukkit").version("4.3.2") + lib.loadLibrary(Library.builder().groupId("net{}kyori").artifactId("adventure-platform-bukkit") + .version("4.3.3-SNAPSHOT") + .url("https://s01.oss.sonatype.org/content/repositories/snapshots/net/kyori/adventure-platform-bukkit/4.3.3-SNAPSHOT/adventure-platform-bukkit-4.3.3-20240507.021326-6.jar") .relocate("net{}kyori", "clib{}net{}kyori").build()); - lib.loadLibrary(Library.builder().groupId("net{}kyori").artifactId("adventure-platform-api").version("4.3.2") + lib.loadLibrary(Library.builder().groupId("net{}kyori").artifactId("adventure-platform-api") + .version("4.3.3-SNAPSHOT") + .url("https://s01.oss.sonatype.org/content/repositories/snapshots/net/kyori/adventure-platform-api/4.3.3-SNAPSHOT/adventure-platform-api-4.3.3-20240507.021326-6.jar") .relocate("net{}kyori", "clib{}net{}kyori").build()); lib.loadLibrary(Library.builder().groupId("net{}kyori").artifactId("adventure-text-serializer-bungeecord") - .version("4.3.2").relocate("net{}kyori", "clib{}net{}kyori").build()); + .version("4.3.3-SNAPSHOT") + .url("https://s01.oss.sonatype.org/content/repositories/snapshots/net/kyori/adventure-text-serializer-bungeecord/4.3.3-SNAPSHOT/adventure-text-serializer-bungeecord-4.3.3-20240507.021326-6.jar") + .relocate("net{}kyori", "clib{}net{}kyori").build()); lib.loadLibrary(Library.builder().groupId("net{}kyori").artifactId("adventure-text-serializer-legacy") .version("4.13.1").relocate("net{}kyori", "clib{}net{}kyori").build()); lib.loadLibrary(Library.builder().groupId("net{}kyori").artifactId("adventure-nbt").version("4.13.1") @@ -316,10 +322,12 @@ public class Citizens extends JavaPlugin implements CitizensPlugin { .version("4.13.1").relocate("net{}kyori", "clib{}net{}kyori").build()); lib.loadLibrary(Library.builder().groupId("net{}kyori").artifactId("adventure-text-serializer-gson-legacy-impl") .version("4.13.1").relocate("net{}kyori", "clib{}net{}kyori").build()); - lib.loadLibrary(Library.builder().groupId("net{}kyori").artifactId("adventure-platform-facet").version("4.3.2") - .relocate("net{}kyori", "clib{}net{}kyori").build()); - lib.loadLibrary(Library.builder().groupId("net{}kyori").artifactId("adventure-platform-viaversion") - .version("4.3.2").relocate("net{}kyori", "clib{}net{}kyori").build()); + lib.loadLibrary(Library.builder().groupId("net{}kyori").artifactId("adventure-platform-facet").url( + "https://s01.oss.sonatype.org/content/repositories/snapshots/net/kyori/adventure-platform-facet/4.3.3-SNAPSHOT/adventure-platform-facet-4.3.3-20240507.021326-6.jar") + .version("4.3.3-SNAPSHOT").relocate("net{}kyori", "clib{}net{}kyori").build()); + lib.loadLibrary(Library.builder().groupId("net{}kyori").artifactId("adventure-platform-viaversion").url( + "https://s01.oss.sonatype.org/content/repositories/snapshots/net/kyori/adventure-platform-viaversion/4.3.3-SNAPSHOT/adventure-platform-viaversion-4.3.3-20240507.021326-6.jar") + .version("4.3.3-SNAPSHOT").relocate("net{}kyori", "clib{}net{}kyori").build()); try { Class.forName("org.joml.Vector3f"); } catch (Throwable t) { diff --git a/main/src/main/java/net/citizensnpcs/trait/HologramTrait.java b/main/src/main/java/net/citizensnpcs/trait/HologramTrait.java index ccf22fe5f..53fe1e318 100644 --- a/main/src/main/java/net/citizensnpcs/trait/HologramTrait.java +++ b/main/src/main/java/net/citizensnpcs/trait/HologramTrait.java @@ -3,6 +3,7 @@ package net.citizensnpcs.trait; import java.util.Collection; import java.util.Collections; import java.util.List; +import java.util.Objects; import java.util.Set; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -21,6 +22,7 @@ import org.bukkit.entity.EntityType; import org.bukkit.entity.ItemDisplay; import org.bukkit.entity.Player; import org.bukkit.entity.TextDisplay; +import org.bukkit.event.HandlerList; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; import org.bukkit.inventory.ItemStack; import org.bukkit.util.Transformation; @@ -34,6 +36,7 @@ import net.citizensnpcs.Settings.Setting; import net.citizensnpcs.api.CitizensAPI; import net.citizensnpcs.api.command.Arg.CompletionsProvider; import net.citizensnpcs.api.command.CommandContext; +import net.citizensnpcs.api.event.NPCEvent; import net.citizensnpcs.api.npc.MemoryNPCDataStore; import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.api.npc.NPCRegistry; @@ -115,20 +118,37 @@ public class HologramTrait extends Trait { } private HologramRenderer createDefaultHologramRenderer() { + HologramRenderer renderer; String hologramSetting = Setting.DEFAULT_HOLOGRAM_RENDERER.asString(); - if (!SUPPORTS_DISPLAY || hologramSetting.equalsIgnoreCase("armorstand")) - return new ArmorstandRenderer(); - return hologramSetting.equalsIgnoreCase("interaction") ? new InteractionVehicleRenderer() - : new TextDisplayRenderer(); + if (!SUPPORTS_DISPLAY || hologramSetting.equalsIgnoreCase("armorstand")) { + renderer = new ArmorstandRenderer(); + } else { + renderer = hologramSetting.equalsIgnoreCase("interaction") ? new InteractionVehicleRenderer() + : new TextDisplayRenderer(); + } + if (HologramRendererCreateEvent.handlers.getRegisteredListeners().length > 0) { + HologramRendererCreateEvent event = new HologramRendererCreateEvent(npc, renderer, false); + Bukkit.getPluginManager().callEvent(event); + renderer = event.getRenderer(); + } + return renderer; } private HologramRenderer createNameRenderer() { + HologramRenderer renderer; if (SpigotUtil.getVersion()[1] >= 20) { - return new TextDisplayVehicleRenderer(); + renderer = new TextDisplayVehicleRenderer(); } else if (SpigotUtil.getVersion()[1] == 19) { - return new InteractionVehicleRenderer(); + renderer = new InteractionVehicleRenderer(); + } else { + renderer = new ArmorstandVehicleRenderer(); } - return new ArmorstandVehicleRenderer(); + if (HologramRendererCreateEvent.handlers.getRegisteredListeners().length > 0) { + HologramRendererCreateEvent event = new HologramRendererCreateEvent(npc, renderer, true); + Bukkit.getPluginManager().callEvent(event); + renderer = event.getRenderer(); + } + return renderer; } private double getHeight(int lineNumber) { @@ -514,6 +534,37 @@ public class HologramTrait extends Trait { void updateText(NPC parent, String text); } + public static class HologramRendererCreateEvent extends NPCEvent { + private final boolean nameRenderer; + private HologramRenderer renderer; + + protected HologramRendererCreateEvent(NPC npc, HologramRenderer renderer, boolean nameRenderer) { + super(npc); + this.renderer = renderer; + this.nameRenderer = nameRenderer; + } + + @Override + public HandlerList getHandlers() { + return handlers; + } + + public HologramRenderer getRenderer() { + return renderer; + } + + public boolean isNameRenderer() { + return nameRenderer; + } + + public void setRenderer(HologramRenderer renderer) { + Objects.requireNonNull(renderer); + this.renderer = renderer; + } + + private static final HandlerList handlers = new HandlerList(); + } + public class InteractionVehicleRenderer extends SingleEntityHologramRenderer { private Vector3d lastOffset; diff --git a/main/src/main/resources/ko-kr.json b/main/src/main/resources/ko-kr.json index 99844652b..cdfcbada1 100644 --- a/main/src/main/resources/ko-kr.json +++ b/main/src/main/resources/ko-kr.json @@ -38,7 +38,11 @@ "citizens.commands.npc.anchor.invalid-name" : "유효하지 않은 앵커 이름입니다.", "citizens.commands.npc.anchor.missing" : "앵커 [[{1}]]이(가) 존재하지 않습니다.", "citizens.commands.npc.anchor.removed" : "앵커가 제거되었습니다.", + "citizens.commands.npc.armadillo.state-set" : "상태가 [[{0}]]로 설정됨", "citizens.commands.npc.armorstand.description" : "아머스탠드 속성 설정 ", + "citizens.commands.npc.attribute.description" : "다양한 NPC 속성 설정", + "citizens.commands.npc.attribute.reset" : "속성 [[{0}]]이 기본값으로 재설정되었습니다.", + "citizens.commands.npc.attribute.set" : "속성 [[{0}]]이(가) 기본 값 [[{1}]]으로 설정되었습니다.", "citizens.commands.npc.axolotl.description" : "아홀로틀 타입 부여", "citizens.commands.npc.axolotl.invalid-variant" : "유효하지 않은 변종입니다. 유효한 변종은 [[{0}]]입니다.", "citizens.commands.npc.axolotl.playing-dead" : "[[{0}]]은(는) 이제 죽은 척을 합니다.", @@ -51,6 +55,8 @@ "citizens.commands.npc.bee.invalid-anger" : "분노는 0보다 커야 합니다.", "citizens.commands.npc.bee.no-nectar" : "[[{0}]]이(가) 꿀을 가지고 있지 않습니다.", "citizens.commands.npc.bee.not-stung" : "[[{0}]]이(가) 더 이상 쏘지 않았습니다.", + "citizens.commands.npc.boat.description" : "보트 수정자를 설정합니다.", + "citizens.commands.npc.boat.type-set" : "보트 유형이 [[{0}]](으)로 설정되었습니다.", "citizens.commands.npc.bossbar.description" : "보스바 속성 설정", "citizens.commands.npc.camel.description" : "낙타 타입 부여", "citizens.commands.npc.camel.pose-set" : "자세가 [{0}]로 설정되었습니다.", @@ -140,8 +146,14 @@ "citizens.commands.npc.fox.crouching-set" : "[[{0}]]이(가) 앉았습니다.", "citizens.commands.npc.fox.crouching-unset" : "[[{0}]]이(가) 더 이상 앉지 않습니다.", "citizens.commands.npc.fox.description" : "여우 타입 부여", + "citizens.commands.npc.fox.faceplanted-set" : "[[{0}]]이(가) 이제 페이스플랜트되었습니다.", + "citizens.commands.npc.fox.faceplanted-unset" : "\n[[{0}]]은(는) 더 이상 페이스플랜트되지 않습니다.", "citizens.commands.npc.fox.fox-type-set" : "여우 몹 유형이 [{0}]로 설정되었습니다.", + "citizens.commands.npc.fox.interested-set" : "\n[[{0}]]님이 이제 관심을 갖고 있습니다.", + "citizens.commands.npc.fox.interested-unset" : "[[{0}]]님은 더 이상 관심이 없습니다.", "citizens.commands.npc.fox.invalid-fox-type" : "유효하지 않은 여우 몹 유형이 지정되었습니다. 유효한 유형은 [[{0}]]입니다.", + "citizens.commands.npc.fox.pouncing-set" : "[[{0}]]이(가) 지금 덤벼들고 있습니다.", + "citizens.commands.npc.fox.pouncing-unset" : "[[{0}]]은(는) 더 이상 덤벼들지 않습니다.", "citizens.commands.npc.fox.sitting-set" : "[[{0}]]이(가) 앉았습니다.", "citizens.commands.npc.fox.sitting-unset" : "[[{0}]]이(가) 더 이상 앉지 않습니다.", "citizens.commands.npc.fox.sleeping-set" : "[[{0}]]이(가) 잠자리에 들었습니다.", @@ -203,6 +215,11 @@ "citizens.commands.npc.id.description" : "선택한 NPC의 ID를 발신자에게 전송합니다.", "citizens.commands.npc.inventory.description" : "NPC의 인벤토리 보기", "citizens.commands.npc.item.description" : "NPC의 아이템을 설정합니다.", + "citizens.commands.npc.itemframe.description" : "아이템프레임 수정자를 설정합니다.", + "citizens.commands.npc.itemframe.fixed-set" : "고정(항목 회전 가능 여부)이 [[{0}]]로 설정되었습니다.", + "citizens.commands.npc.itemframe.item-set" : "\n[[{0}]](으)로 설정된 항목", + "citizens.commands.npc.itemframe.rotation-set" : "회전이 [[{0}]]로 설정됨", + "citizens.commands.npc.itemframe.visible-set" : "표시가 [[{0}]]로 설정됨", "citizens.commands.npc.item.item-set" : "NPC 아이템이 [{0}]로 설정되었습니다.", "citizens.commands.npc.item.unknown-material" : "알 수 없는 재료가 제공되었습니다.", "citizens.commands.npc.jump.description" : "NPC를 점프하게 만듭니다.", diff --git a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/EntityHumanNPC.java b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/EntityHumanNPC.java index 99a51e123..e23e6e92d 100644 --- a/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/EntityHumanNPC.java +++ b/v1_12_R1/src/main/java/net/citizensnpcs/nms/v1_12_R1/entity/EntityHumanNPC.java @@ -180,14 +180,8 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable if (dead) return; super.die(damagesource); - Bukkit.getScheduler().runTaskLater(CitizensAPI.getPlugin(), () -> world.removeEntity(EntityHumanNPC.this), 35); // give - // enough - // time - // for - // death - // and - // smoke - // animation + Bukkit.getScheduler().runTaskLater(CitizensAPI.getPlugin(), () -> world.removeEntity(EntityHumanNPC.this), 35); + // give enough time for death and smoke animation } @Override diff --git a/v1_20_R4/pom.xml b/v1_20_R4/pom.xml index e022441fa..270dafe75 100644 --- a/v1_20_R4/pom.xml +++ b/v1_20_R4/pom.xml @@ -9,7 +9,7 @@ citizens-v1_20_R4 UTF-8 - 1.20.5-R0.1-SNAPSHOT + 1.20.6-R0.1-SNAPSHOT diff --git a/v1_20_R4/src/main/java/net/citizensnpcs/nms/v1_20_R4/entity/CamelController.java b/v1_20_R4/src/main/java/net/citizensnpcs/nms/v1_20_R4/entity/CamelController.java index e3c4449ed..f3c88e62d 100644 --- a/v1_20_R4/src/main/java/net/citizensnpcs/nms/v1_20_R4/entity/CamelController.java +++ b/v1_20_R4/src/main/java/net/citizensnpcs/nms/v1_20_R4/entity/CamelController.java @@ -60,9 +60,7 @@ public class CamelController extends MobEntityController { public static class EntityCamelNPC extends Camel implements NPCHolder { private double baseMovementSpeed; - private final CitizensNPC npc; - private boolean riding; public EntityCamelNPC(EntityType types, Level level) {