Async Operation Catching
Catch and throw an exception when a potentially unsafe operation occurs on a thread other than the main server thread. By: md_5 <git@md-5.net>
This commit is contained in:
@@ -17,9 +17,14 @@
|
||||
|
||||
public abstract class BlockBehaviour implements FeatureElement {
|
||||
|
||||
@@ -158,6 +161,12 @@
|
||||
@@ -156,9 +159,18 @@
|
||||
|
||||
protected void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify) {}
|
||||
protected void neighborChanged(BlockState state, Level world, BlockPos pos, Block sourceBlock, @Nullable Orientation wireOrientation, boolean notify) {}
|
||||
|
||||
- protected void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify) {}
|
||||
+ protected void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify) {
|
||||
+ org.spigotmc.AsyncCatcher.catchOp("block onPlace"); // Spigot
|
||||
+ }
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ protected void onPlace(BlockState iblockdata, Level world, BlockPos blockposition, BlockState iblockdata1, boolean flag, @Nullable UseOnContext context) {
|
||||
@@ -28,9 +33,11 @@
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
protected void onRemove(BlockState state, Level world, BlockPos pos, BlockState newState, boolean moved) {
|
||||
+ org.spigotmc.AsyncCatcher.catchOp("block remove"); // Spigot
|
||||
if (state.hasBlockEntity() && !state.is(newState.getBlock())) {
|
||||
world.removeBlockEntity(pos);
|
||||
@@ -174,8 +183,10 @@
|
||||
}
|
||||
@@ -174,8 +186,10 @@
|
||||
BlockEntity tileentity = state.hasBlockEntity() ? world.getBlockEntity(pos) : null;
|
||||
LootParams.Builder lootparams_a = (new LootParams.Builder(world)).withParameter(LootContextParams.ORIGIN, Vec3.atCenterOf(pos)).withParameter(LootContextParams.TOOL, ItemStack.EMPTY).withOptionalParameter(LootContextParams.BLOCK_ENTITY, tileentity).withOptionalParameter(LootContextParams.THIS_ENTITY, explosion.getDirectSourceEntity());
|
||||
|
||||
@@ -43,7 +50,7 @@
|
||||
}
|
||||
|
||||
state.spawnAfterBreak(world, pos, ItemStack.EMPTY, flag);
|
||||
@@ -1125,9 +1136,15 @@
|
||||
@@ -1125,9 +1139,15 @@
|
||||
}
|
||||
|
||||
public void onPlace(Level world, BlockPos pos, BlockState state, boolean notify) {
|
||||
|
||||
Reference in New Issue
Block a user