如何设置任何横幅的颜色?

How do I set the color of any banner?

我想放置一个特定颜色的横幅,但我总是收到黑色横幅。

Block block;
// ...
block.setType(Material.STANDING_BANNER);
Banner banner = (Banner)block.getState();
banner.setBaseColor(DyeColor.RED);

这段代码有问题吗,还是 Bukkit 的 bug?

您需要致电Banner.update()

Attempts to update the block represented by this state, setting it to the new values as defined by this state.

Block block;
// ...
block.setType(Material.STANDING_BANNER);
Banner banner = (Banner)block.getState();
banner.setBaseColor(DyeColor.RED);
banner.update();