{"action":"created","issue":{"url":"https://api.github.com/repos/SpongePowered/SpongeCommon/issues/331","labels_url":"https://api.github.com/repos/SpongePowered/SpongeCommon/issues/331/labels{/name}","comments_url":"https://api.github.com/repos/SpongePowered/SpongeCommon/issues/331/comments","events_url":"https://api.github.com/repos/SpongePowered/SpongeCommon/issues/331/events","html_url":"https://github.com/SpongePowered/SpongeCommon/issues/331","id":122506480,"number":331,"title":"Bug \"Get ImmutableSignData from ChangeBlockEvent.Break\"","user":{"login":"Azatik","id":10154956,"avatar_url":"https://avatars.githubusercontent.com/u/10154956?v=3","gravatar_id":"","url":"https://api.github.com/users/Azatik","html_url":"https://github.com/Azatik","followers_url":"https://api.github.com/users/Azatik/followers","following_url":"https://api.github.com/users/Azatik/following{/other_user}","gists_url":"https://api.github.com/users/Azatik/gists{/gist_id}","starred_url":"https://api.github.com/users/Azatik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Azatik/subscriptions","organizations_url":"https://api.github.com/users/Azatik/orgs","repos_url":"https://api.github.com/users/Azatik/repos","events_url":"https://api.github.com/users/Azatik/events{/privacy}","received_events_url":"https://api.github.com/users/Azatik/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-12-16T13:47:05Z","updated_at":"2015-12-16T18:30:39Z","closed_at":null,"body":"Bug \"Get ImmutableSignData from ChangeBlockEvent.Break\".\r\n\r\nCode:\r\n```\r\n@Listener\r\n    public void onChangeGrave(ChangeBlockEvent.Break event) {\r\n        boolean playerCause = event.getCause().first(Player.class).isPresent();\r\n        if (playerCause) {\r\n            Player player = event.getCause().first(Player.class).get();\r\n            event.getTransactions().stream().forEach((trans) -> {\r\n                if (trans.getOriginal().getState().getType().equals(BlockTypes.WALL_SIGN)) {\r\n\r\n                    SignManipulator dataofsign = new SignManipulator();\r\n                    ImmutableSignData data = trans.getOriginal().getOrCreate(ImmutableSignData.class).get();\r\n                    ArrayList<String> signLines = dataofsign.getLines(data);\r\n                    Text msg2 = Texts.of(TextColors.GRAY, \"First Line: \" + signLines.get(0));\r\n                    player.sendMessages(msg2);\r\n                }\r\n            });\r\n        }\r\n    }\r\n}\r\n```\r\n\r\nError:\r\n```\r\n[18:37:26] [Server thread/ERROR] [Sponge]: Could not pass ChangeBlockEvent$Break$Impl to Plugin{id=grave, name=Grave, version=0.1}\r\njava.util.NoSuchElementException: No value present\r\n\tat java.util.Optional.get(Unknown Source) ~[?:1.8.0_66]\r\n\tat io.github.azatik.grave.events.EventChangeGrave.lambda$onChangeGrave$3(EventChangeGrave.java:85) ~[EventChangeGrave.class:?]\r\n\tat java.util.Iterator.forEachRemaining(Unknown Source) ~[?:1.8.0_66]\r\n\tat java.util.Spliterators$IteratorSpliterator.forEachRemaining(Unknown Source) ~[?:1.8.0_66]\r\n\tat java.util.stream.ReferencePipeline$Head.forEach(Unknown Source) ~[?:1.8.0_66]\r\n\tat io.github.azatik.grave.events.EventChangeGrave.onChangeGrave(EventChangeGrave.java:59) ~[EventChangeGrave.class:?]\r\n\tat org.spongepowered.common.event.listener.BreakListener_EventChangeGrave_onChangeGrave10.handle(Unknown Source) ~[?:?]\r\n\tat org.spongepowered.common.event.RegisteredListener.handle(RegisteredListener.java:86) ~[RegisteredListener.class:1.8-2.1-DEV-93]\r\n\tat org.spongepowered.common.event.SpongeEventManager.post(SpongeEventManager.java:247) [SpongeEventManager.class:1.8-2.1-DEV-93]\r\n\tat org.spongepowered.common.event.SpongeEventManager.post(SpongeEventManager.java:258) [SpongeEventManager.class:1.8-2.1-DEV-93]\r\n\tat org.spongepowered.common.SpongeImpl.postEvent(SpongeImpl.java:111) [SpongeImpl.class:1.8-2.1-DEV-93]\r\n\tat net.minecraft.world.World.handlePostTickCaptures(SourceFile:813) [aqu.class:?]\r\n\tat net.minecraft.network.PacketThreadUtil$1.onProcessPacket(SourceFile:87) [ih.class:?]\r\n\tat net.minecraft.network.PacketThreadUtil$1.run(SourceFile:13) [ih.class:?]\r\n\tat java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.8.0_66]\r\n\tat java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0_66]\r\n\tat net.minecraft.server.MinecraftServer.func_71190_q(SourceFile:111) [MinecraftServer.class:?]\r\n\tat net.minecraft.server.dedicated.DedicatedServer.func_71190_q(SourceFile:305) [po.class:?]\r\n\tat net.minecraft.server.MinecraftServer.func_71217_p(SourceFile:531) [MinecraftServer.class:?]\r\n\tat net.minecraft.server.MinecraftServer.run(SourceFile:447) [MinecraftServer.class:?]\r\n\tat java.lang.Thread.run(Unknown Source) [?:1.8.0_66]\r\n```\r\n\r\nNote: Tried different variants. Result - this error.\r\nError because of the line: `ImmutableSignData data = trans.getOriginal().getOrCreate(ImmutableSignData.class).get();`\r\nForum topic: https://forums.spongepowered.org/t/how-to-get-target-tileentity-from-changeblockevent-break/10252"},"comment":{"url":"https://api.github.com/repos/SpongePowered/SpongeCommon/issues/comments/165204668","html_url":"https://github.com/SpongePowered/SpongeCommon/issues/331#issuecomment-165204668","issue_url":"https://api.github.com/repos/SpongePowered/SpongeCommon/issues/331","id":165204668,"user":{"login":"Aaron1011","id":1408859,"avatar_url":"https://avatars.githubusercontent.com/u/1408859?v=3","gravatar_id":"","url":"https://api.github.com/users/Aaron1011","html_url":"https://github.com/Aaron1011","followers_url":"https://api.github.com/users/Aaron1011/followers","following_url":"https://api.github.com/users/Aaron1011/following{/other_user}","gists_url":"https://api.github.com/users/Aaron1011/gists{/gist_id}","starred_url":"https://api.github.com/users/Aaron1011/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Aaron1011/subscriptions","organizations_url":"https://api.github.com/users/Aaron1011/orgs","repos_url":"https://api.github.com/users/Aaron1011/repos","events_url":"https://api.github.com/users/Aaron1011/events{/privacy}","received_events_url":"https://api.github.com/users/Aaron1011/received_events","type":"User","site_admin":false},"created_at":"2015-12-16T18:30:39Z","updated_at":"2015-12-16T18:30:39Z","body":"Since this is a sign, you'd need to get the `SignData` from the `Sign` tile entity."}}