Ensure executor service isn't null by accessing it via the getter (#4328)

This commit is contained in:
chris 2023-12-06 22:22:21 +01:00 committed by GitHub
parent 94a1cbeb83
commit 9d6dd58fd8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -134,7 +134,7 @@ public class FakeHeadProvider {
session.getPlayerWithCustomHeads().add(entity.getUuid()); session.getPlayerWithCustomHeads().add(entity.getUuid());
String texturesProperty = entity.getTexturesProperty(); String texturesProperty = entity.getTexturesProperty();
SkinProvider.EXECUTOR_SERVICE.execute(() -> { SkinProvider.getExecutorService().execute(() -> {
try { try {
SkinProvider.SkinData mergedSkinData = MERGED_SKINS_LOADING_CACHE.get(new FakeHeadEntry(texturesProperty, fakeHeadSkinUrl, entity)); SkinProvider.SkinData mergedSkinData = MERGED_SKINS_LOADING_CACHE.get(new FakeHeadEntry(texturesProperty, fakeHeadSkinUrl, entity));
SkinManager.sendSkinPacket(session, entity, mergedSkinData); SkinManager.sendSkinPacket(session, entity, mergedSkinData);

View File

@ -58,7 +58,7 @@ import java.util.function.Predicate;
public class SkinProvider { public class SkinProvider {
private static final boolean ALLOW_THIRD_PARTY_CAPES = GeyserImpl.getInstance().getConfig().isAllowThirdPartyCapes(); private static final boolean ALLOW_THIRD_PARTY_CAPES = GeyserImpl.getInstance().getConfig().isAllowThirdPartyCapes();
static ExecutorService EXECUTOR_SERVICE; private static ExecutorService EXECUTOR_SERVICE;
static final Skin EMPTY_SKIN; static final Skin EMPTY_SKIN;
static final Cape EMPTY_CAPE = new Cape("", "no-cape", ByteArrays.EMPTY_ARRAY, -1, true); static final Cape EMPTY_CAPE = new Cape("", "no-cape", ByteArrays.EMPTY_ARRAY, -1, true);
@ -133,7 +133,7 @@ public class SkinProvider {
WEARING_CUSTOM_SKULL_SLIM = new SkinGeometry("{\"geometry\" :{\"default\" :\"geometry.humanoid.wearingCustomSkullSlim\"}}", wearingCustomSkullSlim, false); WEARING_CUSTOM_SKULL_SLIM = new SkinGeometry("{\"geometry\" :{\"default\" :\"geometry.humanoid.wearingCustomSkullSlim\"}}", wearingCustomSkullSlim, false);
} }
private static ExecutorService getExecutorService() { public static ExecutorService getExecutorService() {
if (EXECUTOR_SERVICE == null) { if (EXECUTOR_SERVICE == null) {
EXECUTOR_SERVICE = Executors.newFixedThreadPool(ALLOW_THIRD_PARTY_CAPES ? 21 : 14); EXECUTOR_SERVICE = Executors.newFixedThreadPool(ALLOW_THIRD_PARTY_CAPES ? 21 : 14);
} }