Skip to content

Commit

Permalink
fix: node data trying to place skull profiles over non-skull blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
Wertik committed Oct 25, 2024
1 parent 5d73125 commit 923316b
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.bukkit.Axis;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.Skull;
import org.bukkit.block.data.*;
import org.bukkit.block.data.type.Stairs;

Expand Down Expand Up @@ -42,7 +43,7 @@ public boolean check(Block block) {

log.fine(String.format("Checking against data %s", this));

if (this.skull != null) {
if (this.skull != null && block.getState() instanceof Skull) {
try {
String profileString = XSkull.of(block).getProfileString();

Expand Down Expand Up @@ -92,10 +93,8 @@ public boolean check(Block block) {
public void load(Block block) {
BlockData data = block.getBlockData();

try {
if (block.getState() instanceof Skull) {
this.skull = XSkull.of(block).getProfileString();
} catch (InvalidProfileContainerException e) {
// not a skull
}

if (data instanceof Directional directional) {
Expand Down Expand Up @@ -147,7 +146,7 @@ public void place(Block block) {

block.setBlockData(blockData);

if (this.skull != null) {
if (this.skull != null && block.getState() instanceof Skull) {
XSkull.of(block)
.profile(Profileable.detect(this.skull))
.apply();
Expand Down

0 comments on commit 923316b

Please sign in to comment.