Skip to content

Commit

Permalink
fix: fixed a few crashes
Browse files Browse the repository at this point in the history
  • Loading branch information
meza committed Apr 2, 2024
1 parent 9999486 commit e3d4781
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/client/java/gg/meza/SoundsBeGoneClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@
import net.minecraft.world.WorldEvents;

import java.util.*;
import java.util.concurrent.ConcurrentHashMap;

public class SoundsBeGoneClient implements ClientModInitializer {

public static Map<String, Date> SoundMap = new HashMap<String, Date>();
public static Map<String, Date> SoundMap = new ConcurrentHashMap<String, Date>();
private int tickCounter = 0;
public static Config config = new Config();
public static Analytics analytics;
Expand Down
6 changes: 3 additions & 3 deletions src/client/java/gg/meza/analytics/Analytics.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
import net.minecraft.client.MinecraftClient;
import org.apache.commons.codec.digest.DigestUtils;

import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import static gg.meza.SoundsBeGone.LOGGER;

public class Analytics {
private static final String POSTHOG_API_KEY = "POSTHOG_API_KEY_REPL";
private static final String POSTHOG_HOST = "https://eu.posthog.com";
private final PostHog posthog;
private final Map<String, Integer> blockedSoundsCount = new HashMap<>();
private final Map<String, Integer> blockedSoundsCount = new ConcurrentHashMap<>();

// Not actually sending any user info, just using the uuid to create a new uuid that cannot be traced back to the user
private final String uuid = DigestUtils.sha256Hex(MinecraftClient.getInstance().getSession().getUsername());
Expand All @@ -37,7 +37,7 @@ private void sendEvent(String event, String sound, Map<String, Object> extraProp
return;
}

Map<String, Object> baseProps = new HashMap<>(Map.of(
Map<String, Object> baseProps = new ConcurrentHashMap<>(Map.of(
"sound", sound,
"Minecraft Version", MC_VERSION,
"OS", OS_NAME,
Expand Down

0 comments on commit e3d4781

Please sign in to comment.