From 135c77cfb5073cb4b94e16d2f732abd17d32ff66 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Sun, 18 Jun 2023 15:03:51 +0100 Subject: [PATCH] chore: minor changes - null check get tile in ThreadUnsafeCharBlocks - 0 to reserved ID --- .../adapter/impl/fawe/v1_17_R1_2/PaperweightGetBlocks.java | 2 +- .../bukkit/adapter/impl/fawe/v1_18_R2/PaperweightGetBlocks.java | 2 +- .../bukkit/adapter/impl/fawe/v1_19_R1/PaperweightGetBlocks.java | 2 +- .../bukkit/adapter/impl/fawe/v1_19_R2/PaperweightGetBlocks.java | 2 +- .../bukkit/adapter/impl/fawe/v1_19_R3/PaperweightGetBlocks.java | 2 +- .../bukkit/adapter/impl/fawe/v1_20_R1/PaperweightGetBlocks.java | 2 +- .../core/history/changeset/SimpleChangeSetSummary.java | 2 +- .../queue/implementation/blocks/ThreadUnsafeCharBlocks.java | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/worldedit-bukkit/adapters/adapter-1_17_1/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_17_R1_2/PaperweightGetBlocks.java b/worldedit-bukkit/adapters/adapter-1_17_1/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_17_R1_2/PaperweightGetBlocks.java index 09fa8f7a5..85be84901 100644 --- a/worldedit-bukkit/adapters/adapter-1_17_1/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_17_R1_2/PaperweightGetBlocks.java +++ b/worldedit-bukkit/adapters/adapter-1_17_1/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_17_R1_2/PaperweightGetBlocks.java @@ -415,7 +415,7 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc } int ordinal = set.getBlock(lx, ly, lz).getOrdinal(); - if (ordinal != 0) { + if (ordinal != BlockTypesCache.ReservedIDs.__RESERVED__) { BlockEntity tile = entry.getValue(); if (PaperLib.isPaper() && tile instanceof BeaconBlockEntity) { if (beacons == null) { diff --git a/worldedit-bukkit/adapters/adapter-1_18_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_18_R2/PaperweightGetBlocks.java b/worldedit-bukkit/adapters/adapter-1_18_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_18_R2/PaperweightGetBlocks.java index 06a74cfd1..4e435e7ee 100644 --- a/worldedit-bukkit/adapters/adapter-1_18_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_18_R2/PaperweightGetBlocks.java +++ b/worldedit-bukkit/adapters/adapter-1_18_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_18_R2/PaperweightGetBlocks.java @@ -408,7 +408,7 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc } int ordinal = set.getBlock(lx, ly, lz).getOrdinal(); - if (ordinal != 0) { + if (ordinal != BlockTypesCache.ReservedIDs.__RESERVED__) { BlockEntity tile = entry.getValue(); if (PaperLib.isPaper() && tile instanceof BeaconBlockEntity) { if (beacons == null) { diff --git a/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/PaperweightGetBlocks.java b/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/PaperweightGetBlocks.java index e0a851c1b..6466ea828 100644 --- a/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/PaperweightGetBlocks.java +++ b/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/PaperweightGetBlocks.java @@ -406,7 +406,7 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc } int ordinal = set.getBlock(lx, ly, lz).getOrdinal(); - if (ordinal != 0) { + if (ordinal != BlockTypesCache.ReservedIDs.__RESERVED__) { BlockEntity tile = entry.getValue(); if (PaperLib.isPaper() && tile instanceof BeaconBlockEntity) { if (beacons == null) { diff --git a/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/PaperweightGetBlocks.java b/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/PaperweightGetBlocks.java index 3ee8314fd..9edb79974 100644 --- a/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/PaperweightGetBlocks.java +++ b/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/PaperweightGetBlocks.java @@ -408,7 +408,7 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc } int ordinal = set.getBlock(lx, ly, lz).getOrdinal(); - if (ordinal != 0) { + if (ordinal != BlockTypesCache.ReservedIDs.__RESERVED__) { BlockEntity tile = entry.getValue(); if (PaperLib.isPaper() && tile instanceof BeaconBlockEntity) { if (beacons == null) { diff --git a/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightGetBlocks.java b/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightGetBlocks.java index 1b10ddd77..ba1bfe574 100644 --- a/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightGetBlocks.java +++ b/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightGetBlocks.java @@ -408,7 +408,7 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc } int ordinal = set.getBlock(lx, ly, lz).getOrdinal(); - if (ordinal != 0) { + if (ordinal != BlockTypesCache.ReservedIDs.__RESERVED__) { BlockEntity tile = entry.getValue(); if (PaperLib.isPaper() && tile instanceof BeaconBlockEntity) { if (beacons == null) { diff --git a/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightGetBlocks.java b/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightGetBlocks.java index 38c871ea8..0dd292207 100644 --- a/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightGetBlocks.java +++ b/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightGetBlocks.java @@ -386,7 +386,7 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc } int ordinal = set.getBlock(lx, ly, lz).getOrdinal(); - if (ordinal != 0) { + if (ordinal != BlockTypesCache.ReservedIDs.__RESERVED__) { BlockEntity tile = entry.getValue(); if (PaperLib.isPaper() && tile instanceof BeaconBlockEntity) { if (beacons == null) { diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/changeset/SimpleChangeSetSummary.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/changeset/SimpleChangeSetSummary.java index 7b6565355..dadb7ee83 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/changeset/SimpleChangeSetSummary.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/changeset/SimpleChangeSetSummary.java @@ -50,7 +50,7 @@ public class SimpleChangeSetSummary implements ChangeSetSummary { public Map getBlocks() { HashMap map = new HashMap<>(); for (int i = 0; i < blocks.length; i++) { - if (blocks[i] != 0) { + if (blocks[i] != BlockTypesCache.ReservedIDs.__RESERVED__) { BlockState state = BlockTypesCache.states[i]; map.put(state, blocks[i]); } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/blocks/ThreadUnsafeCharBlocks.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/blocks/ThreadUnsafeCharBlocks.java index f3dda058f..ca0dd3442 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/blocks/ThreadUnsafeCharBlocks.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/blocks/ThreadUnsafeCharBlocks.java @@ -122,7 +122,7 @@ public class ThreadUnsafeCharBlocks implements IChunkSet, IBlocks { @Override public CompoundTag getTile(int x, int y, int z) { - return tiles.get(x, y, z); + return tiles == null ? null : tiles.get(x, y, z); } @Override