Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Lucky3028 opened this issue Nov 2, 2020 · 12 comments
Labels
enhancement New feature or request

Comments

@Lucky3028
Copy link
Member

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

@Lucky3028 Lucky3028 added the enhancement New feature or request label Nov 2, 2020
@Megumiso
Copy link
Contributor

😢

[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
Copy link
Member

ガッ

@KisaragiEffective
Copy link
Member

KisaragiEffective commented Nov 14, 2020

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
Copy link
Member

ということで、 ThirtyVirus/ShulkerBox_BackPacks#2 としてPRを出したけど、何も反応がない

@Lucky3028
Copy link
Member Author

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

@KisaragiEffective
Copy link
Member

ありです!

@Lucky3028
Copy link
Member Author

じゃ、そうします?

@KisaragiEffective
Copy link
Member

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

@Lucky3028
Copy link
Member Author

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

@Lucky3028
Copy link
Member Author

Lucky3028 commented Nov 27, 2020

@Lucky3028
Copy link
Member Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants