mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-23 21:56:45 +01:00
fix: attempt to recover from IllegalStateException when restoring block tags (#3838)
- Fixes #3801
This commit is contained in:
parent
25ce7a83f1
commit
52bb561689
@ -44,6 +44,7 @@ public class LimitedRegionWrapperQueue extends DelegateQueueCoordinator {
|
|||||||
private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + LimitedRegionWrapperQueue.class.getSimpleName());
|
private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + LimitedRegionWrapperQueue.class.getSimpleName());
|
||||||
|
|
||||||
private final LimitedRegion limitedRegion;
|
private final LimitedRegion limitedRegion;
|
||||||
|
private boolean useOtherRestoreTagMethod = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @since 6.9.0
|
* @since 6.9.0
|
||||||
@ -65,10 +66,18 @@ public class LimitedRegionWrapperQueue extends DelegateQueueCoordinator {
|
|||||||
CompoundTag tag = id.getNbtData();
|
CompoundTag tag = id.getNbtData();
|
||||||
StateWrapper sw = new StateWrapper(tag);
|
StateWrapper sw = new StateWrapper(tag);
|
||||||
try {
|
try {
|
||||||
sw.restoreTag(limitedRegion.getBlockState(x, y, z).getBlock());
|
if (useOtherRestoreTagMethod && getWorld() != null) {
|
||||||
|
sw.restoreTag(getWorld().getName(), x, y, z);
|
||||||
|
} else {
|
||||||
|
sw.restoreTag(limitedRegion.getBlockState(x, y, z).getBlock());
|
||||||
|
}
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
LOGGER.error("Error attempting to populate tile entity into the world at location {},{},{}", x, y, z, e);
|
LOGGER.error("Error attempting to populate tile entity into the world at location {},{},{}", x, y, z, e);
|
||||||
return false;
|
return false;
|
||||||
|
} catch (IllegalStateException e) {
|
||||||
|
useOtherRestoreTagMethod = true;
|
||||||
|
LOGGER.warn("IllegalStateException attempting to populate tile entity into the world at location {},{},{}. " +
|
||||||
|
"Possibly on <=1.17.1, switching to secondary method.", x, y, z, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
Loading…
Reference in New Issue
Block a user