Skip to content

Commit

Permalink
Fix not working logger, add few logs about current state
Browse files Browse the repository at this point in the history
  • Loading branch information
CDFN committed Jan 25, 2021
1 parent cd00b18 commit 14069d2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
6 changes: 3 additions & 3 deletions src/main/java/pl/cdfn/fabricord/Fabricord.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package pl.cdfn.fabricord;

import java.util.logging.LogManager;
import java.util.logging.Logger;
import net.fabricmc.api.ModInitializer;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

public class Fabricord implements ModInitializer {
public static final Logger LOGGER = LogManager.getLogManager().getLogger("Fabricord");
public static final Logger LOGGER = LogManager.getLogger();

@Override
public void onInitialize() {}
Expand Down
14 changes: 6 additions & 8 deletions src/main/java/pl/cdfn/fabricord/discord/DiscordServiceImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,32 @@

import net.arikia.dev.drpc.DiscordEventHandlers;
import net.arikia.dev.drpc.DiscordRPC;
import net.arikia.dev.drpc.DiscordRichPresence;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.client.MinecraftClient;
import net.minecraft.server.world.ServerWorld;
import org.apache.commons.lang3.text.WordUtils;
import org.apache.logging.log4j.Level;
import pl.cdfn.fabricord.Fabricord;
import pl.cdfn.fabricord.discord.key.AssetKey;
import pl.cdfn.fabricord.discord.key.DimensionAssetKey;
import pl.cdfn.fabricord.discord.rpc.RichPresenceRenderer;

import java.util.logging.Level;

public class DiscordServiceImpl implements DiscordService {
private static final DiscordEventHandlers HANDLERS = new DiscordEventHandlers.Builder()
.setReadyEventHandler(user -> Fabricord.LOGGER.log(Level.INFO, "Discord RPC is ready: {0} {1}", new Object[]{user.username, user.discriminator}))
.setDisconnectedEventHandler((errorCode, message) -> Fabricord.LOGGER.log(Level.WARNING, "Discord RPC has disconnected: {0} {1}", new Object[]{errorCode, message}))
.build();
.setReadyEventHandler(user -> Fabricord.LOGGER.info("Discord RPC is ready: {} {}", user.username, user.discriminator))
.setDisconnectedEventHandler((errorCode, message) -> Fabricord.LOGGER.warn("Discord RPC has disconnected: {} {}", errorCode, message))
.build();

private boolean isLocalhost = false;

@Override
public void initialize() {
Fabricord.LOGGER.info("Discord RPC initialization started");
DiscordRPC.discordInitialize("802579600856055878", HANDLERS, true);
DiscordRPC.discordUpdatePresence(RichPresenceRenderer.renderLoading());
}

@Override
public void enabled(MinecraftClient client) {
Fabricord.LOGGER.info("Discord RPC started successfully");
DiscordRPC.discordUpdatePresence(RichPresenceRenderer.renderIdle());
}

Expand Down

0 comments on commit 14069d2

Please sign in to comment.