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

Store inventory title inside VirtualHolder #30

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Store inventory title inside VirtualHolder #30

wants to merge 2 commits into from

Conversation

Murreey
Copy link

@Murreey Murreey commented Sep 22, 2019

The close and open events are currently failing in 1.14 trying to get the window title.

Stacktrace
[12:13:43] [Server thread/ERROR]: Could not pass event InventoryCloseEvent to CommandHelper v3.3.4-SNAPSHOT
java.lang.ClassCastException: com.entityreborn.chvirtualchests.VirtualHolder$Holder cannot be cast to org.bukkit.Nameable
	at com.laytonsmith.abstraction.bukkit.BukkitMCInventory.getTitle(BukkitMCInventory.java:165) ~[?:?]
	at com.entityreborn.chvirtualchests.VirtualChests.toCArray(VirtualChests.java:130) ~[?:?]
	at com.entityreborn.chvirtualchests.events.Events$virtualchest_closed.evaluate(Events.java:182) ~[?:?]
	at com.laytonsmith.core.events.EventUtils.FireListeners(EventUtils.java:306) ~[?:?]
	at com.laytonsmith.core.events.EventUtils.TriggerListener(EventUtils.java:294) ~[?:?]
	at com.entityreborn.chvirtualchests.events.Events.onClose(Events.java:85) ~[?:?]
	at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor25.execute(Unknown Source) ~[?:?]
	at org.bukkit.plugin.EventExecutor.lambda$create$1(EventExecutor.java:69) ~[patched_1.14.4.jar:git-Paper-192]
	at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:80) ~[patched_1.14.4.jar:git-Paper-192]
	at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[patched_1.14.4.jar:git-Paper-192]
	at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:545) ~[patched_1.14.4.jar:git-Paper-192]
	at org.bukkit.craftbukkit.v1_14_R1.event.CraftEventFactory.handleInventoryCloseEvent(CraftEventFactory.java:1344) ~[patched_1.14.4.jar:git-Paper-192]
	at net.minecraft.server.v1_14_R1.PlayerConnection.a(PlayerConnection.java:2089) ~[patched_1.14.4.jar:git-Paper-192]
	at net.minecraft.server.v1_14_R1.PacketPlayInCloseWindow.a(PacketPlayInCloseWindow.java:18) ~[patched_1.14.4.jar:git-Paper-192]
	at net.minecraft.server.v1_14_R1.PacketPlayInCloseWindow.a(PacketPlayInCloseWindow.java:5) ~[patched_1.14.4.jar:git-Paper-192]
	at net.minecraft.server.v1_14_R1.PlayerConnectionUtils.lambda$ensureMainThread$0(PlayerConnectionUtils.java:23) ~[patched_1.14.4.jar:git-Paper-192]
	at net.minecraft.server.v1_14_R1.TickTask.run(SourceFile:18) ~[patched_1.14.4.jar:git-Paper-192]
	at net.minecraft.server.v1_14_R1.IAsyncTaskHandler.executeTask(IAsyncTaskHandler.java:136) ~[patched_1.14.4.jar:git-Paper-192]
	at net.minecraft.server.v1_14_R1.IAsyncTaskHandlerReentrant.executeTask(SourceFile:23) ~[patched_1.14.4.jar:git-Paper-192]
	at net.minecraft.server.v1_14_R1.IAsyncTaskHandler.executeNext(IAsyncTaskHandler.java:109) ~[patched_1.14.4.jar:git-Paper-192]
	at net.minecraft.server.v1_14_R1.MinecraftServer.aX(MinecraftServer.java:1013) ~[patched_1.14.4.jar:git-Paper-192]
	at net.minecraft.server.v1_14_R1.MinecraftServer.executeNext(MinecraftServer.java:1006) ~[patched_1.14.4.jar:git-Paper-192]
	at net.minecraft.server.v1_14_R1.IAsyncTaskHandler.awaitTasks(IAsyncTaskHandler.java:119) ~[patched_1.14.4.jar:git-Paper-192]
	at net.minecraft.server.v1_14_R1.MinecraftServer.sleepForTick(MinecraftServer.java:990) ~[patched_1.14.4.jar:git-Paper-192]
	at net.minecraft.server.v1_14_R1.MinecraftServer.run(MinecraftServer.java:923) ~[patched_1.14.4.jar:git-Paper-192]
	at java.lang.Thread.run(Unknown Source) [?:1.8.0_221]

getTitle() was changed to use the title from the inventory holder rather than the inventory directly, which is expected to be a Nameable.

This makes VirtualHolder nameable, and sets the name to the inventory title.


public VirtualHolder(String i) {
public VirtualHolder(String i, String title) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This parameter doesn't get used.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops thanks, fixed.

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

Successfully merging this pull request may close these issues.

2 participants