Fix naming convention for the logger

This commit is contained in:
Sollace 2024-07-25 15:44:59 +02:00
parent 36c3136067
commit eb25692aef
No known key found for this signature in database
GPG key ID: E52FACE7B5C773DB
5 changed files with 14 additions and 14 deletions

View file

@ -39,7 +39,7 @@ public class MineLittlePony implements ClientModInitializer {
private static MineLittlePony instance;
public static final Logger logger = LogManager.getLogger("MineLittlePony");
public static final Logger LOGGER = LogManager.getLogger("MineLittlePony");
private PonyManagerImpl ponyManager;
private VariatedTextureSupplier variatedTextures;

View file

@ -46,7 +46,7 @@ public class PonyDataLoader {
try {
return res.getMetadata().decode(SERIALIZER);
} catch (IOException e) {
MineLittlePony.logger.warn("Unable to read {} metadata", identifier, e);
MineLittlePony.LOGGER.warn("Unable to read {} metadata", identifier, e);
}
return Optional.empty();
}).map(PonyDataLoader::loaded).orElseGet(() -> {
@ -54,7 +54,7 @@ public class PonyDataLoader {
NativeUtil.parseImage(identifier, image -> {
callback.accept(new PonyData(image, noSkin));
}, e -> {
MineLittlePony.logger.fatal("Unable to read {} metadata", identifier, e);
MineLittlePony.LOGGER.fatal("Unable to read {} metadata", identifier, e);
callback.accept(PonyData.NULL);
});
});

View file

@ -34,16 +34,16 @@ public class PonyManagerImpl implements PonyManager, SimpleSynchronousResourceRe
.build(CacheLoader.from(key -> new Pony(key.texture(), PonyDataLoader.parse(key.texture(), key.defaulted()))));
private final WeakHashMap<UUID, Pony> playerPonies = new WeakHashMap<>();
record Key(Identifier texture, @Nullable UUID uuid, boolean defaulted) {}
record Key(Identifier texture, boolean defaulted) {}
public PonyManagerImpl(PonyConfig config) {
this.config = config;
Instance.instance = this;
}
private Pony loadPony(Identifier resource, @Nullable UUID uuid, boolean defaulted) {
private Pony loadPony(Identifier resource, boolean defaulted) {
try {
return poniesCache.get(new Key(resource, uuid, defaulted));
return poniesCache.get(new Key(resource, defaulted));
} catch (ExecutionException e) {
return new Pony(resource, PonyDataLoader.NULL);
}
@ -89,10 +89,10 @@ public class PonyManagerImpl implements PonyManager, SimpleSynchronousResourceRe
@Override
public Pony getPony(@Nullable Identifier resource, @Nullable UUID uuid) {
if (resource == null) {
return uuid == null ? loadPony(DefaultSkinHelper.getTexture(), uuid, true) : getBackgroundPony(uuid);
return uuid == null ? loadPony(DefaultSkinHelper.getTexture(), true) : getBackgroundPony(uuid);
}
Pony pony = loadPony(resource, uuid, false);
Pony pony = loadPony(resource, false);
if (uuid != null && PonyConfig.getInstance().ponyLevel.get() == PonyLevel.PONIES && pony.metadata().race().isHuman()) {
return getBackgroundPony(uuid);
@ -103,9 +103,9 @@ public class PonyManagerImpl implements PonyManager, SimpleSynchronousResourceRe
@Override
public Pony getBackgroundPony(@Nullable UUID uuid) {
if (config.ponyLevel.get() == PonyLevel.PONIES) {
return loadPony(MineLittlePony.getInstance().getVariatedTextures().get(VariatedTextureSupplier.BACKGROUND_PONIES_POOL, uuid).orElse(DefaultSkinHelper.getSkinTextures(uuid).texture()), uuid, true);
return loadPony(MineLittlePony.getInstance().getVariatedTextures().get(VariatedTextureSupplier.BACKGROUND_PONIES_POOL, uuid).orElse(DefaultSkinHelper.getSkinTextures(uuid).texture()), true);
}
return loadPony(DefaultSkinHelper.getSkinTextures(uuid).texture(), uuid, true);
return loadPony(DefaultSkinHelper.getSkinTextures(uuid).texture(), true);
}
@Nullable
@ -128,7 +128,7 @@ public class PonyManagerImpl implements PonyManager, SimpleSynchronousResourceRe
}
public void clearCache() {
MineLittlePony.logger.info("Turned {} cached ponies into cupcakes.", poniesCache.size());
MineLittlePony.LOGGER.info("Turned {} cached ponies into cupcakes.", poniesCache.size());
poniesCache.invalidateAll();
}

View file

@ -75,7 +75,7 @@ public class VariatedTextureSupplier implements SimpleSynchronousResourceReloadL
public void reloadAll(ResourceManager resourceManager) {
textures.clear();
textures.addAll(resourceManager.findResources(id.getPath(), path -> path.getPath().endsWith(".png")).keySet());
MineLittlePony.logger.info("Detected {} ponies installed at {}.", textures.size(), id);
MineLittlePony.LOGGER.info("Detected {} ponies installed at {}.", textures.size(), id);
}
static boolean isUser(UUID uuid) {

View file

@ -26,13 +26,13 @@ class GuiSkinsMineLP extends GuiSkins {
public GuiSkinsMineLP(Screen parent, SkinServerList servers) {
super(parent, servers);
chooser.addSkinChangedEventListener(type -> {
MineLittlePony.logger.debug("Invalidating old local skin, checking updated local skin");
MineLittlePony.LOGGER.debug("Invalidating old local skin, checking updated local skin");
if (type == SkinType.SKIN) {
MineLittlePony.getInstance().getManager().removePony(previewer.getLocal().getSkins().get(SkinType.SKIN).getId());
}
});
uploader.addSkinLoadedEventListener((type, location, profileTexture) -> {
MineLittlePony.logger.debug("Invalidating old remote skin, checking updated remote skin");
MineLittlePony.LOGGER.debug("Invalidating old remote skin, checking updated remote skin");
if (type == SkinType.SKIN) {
MineLittlePony.getInstance().getManager().removePony(location);
}