Skip to content

Commit

Permalink
Try using setblock #396
Browse files Browse the repository at this point in the history
  • Loading branch information
bengibbs committed Aug 10, 2024
1 parent 3fab820 commit db020f0
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,16 @@ public void execute(AOneBlock addon, Block block) {
try {
block.setBlockData(Bukkit.createBlockData(blockData));
} catch (IllegalArgumentException e) {
BentoBox.getInstance().logError("Could not set block data " + blockData + " for block " + block.getType());
try {
// Try and place it
String world = "minecraft:" + block.getLocation().getWorld().getName();
String x = String.valueOf(block.getLocation().getBlockX());
String y = String.valueOf(block.getLocation().getBlockY());
String z = String.valueOf(block.getLocation().getBlockZ());
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "execute in " + world + " run setblock " + x + " " + y + " " + z + " " + blockData);
} catch (Exception e2) {
BentoBox.getInstance().logError("Could not set block data " + blockData + " for block " + block.getType());
}
}
}
}

0 comments on commit db020f0

Please sign in to comment.