
com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat.getReader(java.io.InputStream)" because "format" is null
ImYenil opened this issue · 4 comments
Server Implementation
Paper
Server Version
1.21.3
Describe the bug
[20:30:01] [Server thread/ERROR]: Could not pass event InventoryClickEvent to BuildBattlePro v1.2.1
java.lang.NullPointerException: Cannot invoke "com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat.getReader(java.io.InputStream)" because "format" is null
at BuildBattlePro.jar/net.minigame.buildbattle.report.BBBuildReport.pasteSchematic(BBBuildReport.java:94) ~[BuildBattlePro.jar:?]
at BuildBattlePro.jar/net.minigame.buildbattle.listeners.PlayerListener.onClick(PlayerListener.java:233) ~[BuildBattlePro.jar:?]
at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:80) ~[paper-api-1.21.4-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[paper-api-1.21.4-R0.1-SNAPSHOT.jar:?]
at io.papermc.paper.plugin.manager.PaperEventManager.callEvent(PaperEventManager.java:54) ~[paper-1.21.4.jar:1.21.4-65-287eb52]
at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.callEvent(PaperPluginManagerImpl.java:131) ~[paper-1.21.4.jar:1.21.4-65-287eb52]
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:628) ~[paper-api-1.21.4-R0.1-SNAPSHOT.jar:?]
at net.minecraft.server.network.ServerGamePacketListenerImpl.handleContainerClick(ServerGamePacketListenerImpl.java:3160) ~[paper-1.21.4.jar:1.21.4-65-287eb52]
at net.minecraft.network.protocol.game.ServerboundContainerClickPacket.handle(ServerboundContainerClickPacket.java:69) ~[paper-1.21.4.jar:1.21.4-65-287eb52]
at net.minecraft.network.protocol.game.ServerboundContainerClickPacket.handle(ServerboundContainerClickPacket.java:14) ~[paper-1.21.4.jar:1.21.4-65-287eb52]
at net.minecraft.network.protocol.PacketUtils.lambda$ensureRunningOnSameThread$0(PacketUtils.java:29) ~[paper-1.21.4.jar:1.21.4-65-287eb52]
at net.minecraft.server.TickTask.run(TickTask.java:18) ~[paper-1.21.4.jar:1.21.4-65-287eb52]
at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:155) ~[paper-1.21.4.jar:1.21.4-65-287eb52]
at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:24) ~[paper-1.21.4.jar:1.21.4-65-287eb52]
at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1448) ~[paper-1.21.4.jar:1.21.4-65-287eb52]
at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:176) ~[paper-1.21.4.jar:1.21.4-65-287eb52]
at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:129) ~[paper-1.21.4.jar:1.21.4-65-287eb52]
at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1428) ~[paper-1.21.4.jar:1.21.4-65-287eb52]
at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1422) ~[paper-1.21.4.jar:1.21.4-65-287eb52]
at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:139) ~[paper-1.21.4.jar:1.21.4-65-287eb52]
at net.minecraft.server.MinecraftServer.managedBlock(MinecraftServer.java:1379) ~[paper-1.21.4.jar:1.21.4-65-287eb52]
at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1387) ~[paper-1.21.4.jar:1.21.4-65-287eb52]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1264) ~[paper-1.21.4.jar:1.21.4-65-287eb52]
at net.minecraft.server.MinecraftServer.lambda$spin$2(MinecraftServer.java:310) ~[paper-1.21.4.jar:1.21.4-65-287eb52]
at java.base/java.lang.Thread.run(Thread.java:1583) ~[?:?]
My Code
public void pasteSchematic(Player p) {
Clipboard clipboard;
ClipboardFormat format = ClipboardFormats.findByFile(this.getSchematic());
if (format == null) {
p.sendMessage(BuildBattle.getInstance().getSettings().getPrefix() + "§cUnsupported schematic format for report §e" + this.reportID + "!");
return;
}
try (ClipboardReader reader = format.getReader(Files.newInputStream(this.getSchematic().toPath()))) {
clipboard = reader.read();
try (EditSession editSession = WorldEdit.getInstance().getEditSessionFactory().getEditSession(BukkitAdapter.adapt(p.getWorld()), -1, BukkitAdapter.adapt(p))) {
Operation operation = new ClipboardHolder(clipboard)
.createPaste(editSession)
.to(BlockVector3.at(p.getLocation().getBlockX(), p.getLocation().getBlockY(), p.getLocation().getBlockZ()))
.copyBiomes(true)
.copyEntities(true)
.build();
Operations.complete(operation);
p.sendMessage(BuildBattle.getInstance().getSettings().getPrefix() + "§aSchematic for Report §e" + this.reportID + " §aparsed!");
} catch (WorldEditException e) {
p.sendMessage(BuildBattle.getInstance().getSettings().getPrefix() + "§cThere are some problem with parsing schematic for report §e" + this.reportID + "!");
e.printStackTrace();
}
} catch (IOException e) {
p.sendMessage(BuildBattle.getInstance().getSettings().getPrefix() + "§cThere are some problem with loading schematic file for report §e" + this.reportID + "!");
e.printStackTrace();
}
}
When using only WorldEdit, no error occurs, but when using Fawe, an error occurs.
To Reproduce
Use Fawe it will happened
Expected behaviour
X
Screenshots / Videos
No response
Error log (if applicable)
No response
Fawe Debugpaste
https://athion.net/ISPaster/paste/view/4bcb5ca59d364ba78813f26d6d04a024
Fawe Version
FastAsyncWorldEdit-Paper-2.12.3-SNAPSHOT-1007
Checklist
- I have included a Fawe debugpaste.
- I am using the newest build from https://ci.athion.net/job/FastAsyncWorldEdit/ and the issue still persists.
Anything else?
No response
Your code doesn't seem to match the exception as format
can't be null after the if with the return.
Your code doesn't seem to match the exception as
format
can't be null after the if with the return.
Are you talking about the file extension?
Are you talking about the file extension?
I'm talking about the code you're showing, which won't produce the exception you're showing