diff --git a/core/src/main/java/org/geysermc/floodgate/command/LinkAccountCommand.java b/core/src/main/java/org/geysermc/floodgate/command/LinkAccountCommand.java index 4f51c51c..fe8695fd 100644 --- a/core/src/main/java/org/geysermc/floodgate/command/LinkAccountCommand.java +++ b/core/src/main/java/org/geysermc/floodgate/command/LinkAccountCommand.java @@ -90,6 +90,10 @@ public final class LinkAccountCommand implements FloodgateCommand { return; } + ProfileAudience targetUser = context.get("player"); + // allowUuid is false so username cannot be null + String targetName = targetUser.username(); + // when the player is a Bedrock player if (api.isFloodgatePlayer(sender.uuid())) { if (!context.contains("code")) { @@ -97,8 +101,6 @@ public final class LinkAccountCommand implements FloodgateCommand { return; } - UserAudience targetUser = context.get("player"); - String targetName = targetUser.username(); String code = context.get("code"); link.verifyLinkRequest(sender.uuid(), targetName, sender.username(), code) @@ -137,9 +139,6 @@ public final class LinkAccountCommand implements FloodgateCommand { return; } - ProfileAudience targetUser = context.get("player"); - String targetName = targetUser.username(); - link.createLinkRequest(sender.uuid(), sender.username(), targetName) .whenComplete((result, throwable) -> { if (throwable != null || result == LinkRequestResult.UNKNOWN_ERROR) { diff --git a/core/src/main/java/org/geysermc/floodgate/util/Metrics.java b/core/src/main/java/org/geysermc/floodgate/util/Metrics.java index be7ff315..008d215e 100644 --- a/core/src/main/java/org/geysermc/floodgate/util/Metrics.java +++ b/core/src/main/java/org/geysermc/floodgate/util/Metrics.java @@ -81,8 +81,8 @@ public final class Metrics { String categoryName = category + " - " + (category + 4); return Collections.singletonMap( - categoryName, - Collections.singletonMap(implementationName, 1) + implementationName, + Collections.singletonMap(categoryName, 1) ); }) ); @@ -106,8 +106,8 @@ public final class Metrics { new DrilldownPie("minecraft_version", () -> { // e.g.: 1.16.5 => (Spigot, 1) return Collections.singletonMap( - platformUtils.minecraftVersion(), - Collections.singletonMap(implementationName, 1) + implementationName, + Collections.singletonMap(platformUtils.minecraftVersion(), 1) ); }) );