refactor: Tackle a few Semgrep and ErrorProne violations (#1520)

* refactor: Tackle a few Semgrep and ErrorProne violations

* Address comments
This commit is contained in:
Alex
2022-01-07 12:45:53 +01:00
committed by GitHub
parent f27959e49a
commit 64442a8051
22 changed files with 55 additions and 400 deletions

View File

@ -799,7 +799,6 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
// Pre-gen all the chunks
for (BlockVector2 chunk : region.getChunks()) {
try {
//noinspection unchecked
chunkLoadings.add(
((CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>>)
getChunkFutureMainThreadMethod.invoke(chunkManager, chunk.getX(), chunk.getZ(), ChunkStatus.FEATURES, true))

View File

@ -394,6 +394,7 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
}
@Override
@SuppressWarnings("rawtypes")
public synchronized <T extends Future<T>> T call(IChunkSet set, Runnable finalizer) {
forceLoadSections = false;
copy = createCopy ? new PaperweightGetBlocks_Copy(serverLevel) : null;

View File

@ -247,6 +247,7 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
}
}
@SuppressWarnings("deprecation")
public static void sendChunk(ServerLevel nmsWorld, int chunkX, int chunkZ, boolean lighting) {
ChunkHolder chunkHolder = getPlayerChunk(nmsWorld, chunkX, chunkZ);
if (chunkHolder == null) {
@ -279,8 +280,7 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
false // last false is to not bother with x-ray
);
} else {
// deprecated on paper
//noinspection deprecation
// deprecated on paper - deprecation suppressed
packet = new ClientboundLevelChunkWithLightPacket(
levelChunk,
nmsWorld.getChunkSource().getLightEngine(),