GiganticMinecraft / SeichiAssist-ExternalLib

ギガンティック☆整地鯖のSeichiAssist外部の構成要素(外部プラグインなど)に関する情報を集約、issue管理する為のリポジトリ
0 stars 2 forks source link

シュルカーボックスをShift+右クリックで開けるようにする #25

Open Lucky3028 opened 3 years ago

Lucky3028 commented 3 years ago

https://www.spigotmc.org/resources/shulkerbox-backpacks-1-11-1-14.61073/

Megumiso commented 3 years ago

😢

[11:51:12 ERROR]: Could not pass event PlayerInteractEvent to ShulkerBoxBackPack
s v1.1.4
org.bukkit.event.EventException: null
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja
va:306) ~[spigot-1.12.2.jar:git-Spigot-79a30d7-acbc348]
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.jav
a:62) ~[spigot-1.12.2.jar:git-Spigot-79a30d7-acbc348]
        at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.j
ava:500) [spigot-1.12.2.jar:git-Spigot-79a30d7-acbc348]
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.j
ava:485) [spigot-1.12.2.jar:git-Spigot-79a30d7-acbc348]
        at org.bukkit.craftbukkit.v1_12_R1.event.CraftEventFactory.callPlayerInt
eractEvent(CraftEventFactory.java:235) [spigot-1.12.2.jar:git-Spigot-79a30d7-acb
c348]
        at org.bukkit.craftbukkit.v1_12_R1.event.CraftEventFactory.callPlayerInt
eractEvent(CraftEventFactory.java:202) [spigot-1.12.2.jar:git-Spigot-79a30d7-acb
c348]
        at org.bukkit.craftbukkit.v1_12_R1.event.CraftEventFactory.callPlayerInt
eractEvent(CraftEventFactory.java:198) [spigot-1.12.2.jar:git-Spigot-79a30d7-acb
c348]
        at net.minecraft.server.v1_12_R1.PlayerConnection.a(PlayerConnection.jav
a:993) [spigot-1.12.2.jar:git-Spigot-79a30d7-acbc348]
        at net.minecraft.server.v1_12_R1.PacketPlayInBlockPlace.a(PacketPlayInBl
ockPlace.java:26) [spigot-1.12.2.jar:git-Spigot-79a30d7-acbc348]
        at net.minecraft.server.v1_12_R1.PacketPlayInBlockPlace.a(PacketPlayInBl
ockPlace.java:1) [spigot-1.12.2.jar:git-Spigot-79a30d7-acbc348]
        at net.minecraft.server.v1_12_R1.PlayerConnectionUtils$1.run(SourceFile:
13) [spigot-1.12.2.jar:git-Spigot-79a30d7-acbc348]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:51
1) [?:1.8.0_212]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_212
]
        at net.minecraft.server.v1_12_R1.SystemUtils.a(SourceFile:46) [spigot-1.
12.2.jar:git-Spigot-79a30d7-acbc348]
        at net.minecraft.server.v1_12_R1.MinecraftServer.D(MinecraftServer.java:
748) [spigot-1.12.2.jar:git-Spigot-79a30d7-acbc348]
        at net.minecraft.server.v1_12_R1.DedicatedServer.D(DedicatedServer.java:
406) [spigot-1.12.2.jar:git-Spigot-79a30d7-acbc348]
        at net.minecraft.server.v1_12_R1.MinecraftServer.C(MinecraftServer.java:
679) [spigot-1.12.2.jar:git-Spigot-79a30d7-acbc348]
        at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.jav
a:577) [spigot-1.12.2.jar:git-Spigot-79a30d7-acbc348]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_212]
Caused by: java.lang.NullPointerException
        at thirtyvirus.sbbp.MenuLoader.createShulkerBoxInventory(MenuLoader.java
:23) ~[?:?]
        at thirtyvirus.sbbp.events.UseItem.onPlayerUse(UseItem.java:43) ~[?:?]
        at sun.reflect.GeneratedMethodAccessor166.invoke(Unknown Source) ~[?:?]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43) ~[?:1.8.0_212]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_212]
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja
va:302) ~[spigot-1.12.2.jar:git-Spigot-79a30d7-acbc348]
        ... 18 more
KisaragiEffective commented 3 years ago

ガッ

KisaragiEffective commented 3 years ago

https://github.com/ThirtyVirus/ShulkerBox_BackPacks/blob/9f678f16c4d4e43b9f2045d9704c7a4a5dd84e3c/src/thirtyvirus/sbbp/MenuLoader.java#L13-L34

KisaragiEffective commented 3 years ago

CraftBukkit (CraftMetaItem.java)の階層まで潜って調べたが、ItemMeta#getDisplayNameのnullabilityが不明確なので向こう側にSpigotがdisplayNameが存在するか確かめるお作法として推奨しているItemMeta#hasDisplayNameを使用するというPRを出す。


CraftMetaItem#hasDisplayNameは以下のような実装になっている:

public boolean hasDisplayName() {
  return !Strings.isNullOrEmpty(this.displayName);
}

ここで、Stringscom.google.common.base.Stringsであり、Strings.isNullOrEmptycom.google.common.base.Platform.stringIsNullOrEmptyに委譲される。そしてPlatform.stringIsNullOrEmpty

boolean stringIsNullOrEmpty(@Nullable String string) {
  return string == null || string.isEmpty();
}

と実装されており、よってCraftMetaItem#displayNameがnullableであると読める。

KisaragiEffective commented 3 years ago

ということで、 https://github.com/ThirtyVirus/ShulkerBox_BackPacks/pull/2 としてPRを出したけど、何も反応がない

Lucky3028 commented 3 years ago

forkして、整地鯖側だけでとりあえずその修正して運用するっていうのはなしです?

KisaragiEffective commented 3 years ago

ありです!

Lucky3028 commented 3 years ago

じゃ、そうします?

KisaragiEffective commented 3 years ago

どのような方向性でもおkです (私としては)

Lucky3028 commented 3 years ago

(確かに) じゃ、やりましょ

Lucky3028 commented 3 years ago

参照: https://github.com/GiganticMinecraft/ShulkerBox_BackPacks https://github.com/GiganticMinecraft/ShulkerBox_BackPacks/pull/1

Lucky3028 commented 1 year ago

よくコードを見たら、config.ymlのapi-versionが1.13になってて草 SpigotMCの対応バージョン間違っとるやんけ! https://github.com/GiganticMinecraft/ShulkerBox_BackPacks/blob/811454335c7e1da705bd9e2560ca0d8767922430/plugin.yml#L4