1
0
mirror of https://github.com/GeyserMC/Floodgate.git synced 2025-12-19 14:59:20 +00:00

Fixes #303 and changed some metrics

This commit is contained in:
Tim203
2022-05-27 18:24:40 +02:00
parent 7bd1bb0962
commit e6bf250a1d
2 changed files with 8 additions and 9 deletions

View File

@@ -90,6 +90,10 @@ public final class LinkAccountCommand implements FloodgateCommand {
return; 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 // when the player is a Bedrock player
if (api.isFloodgatePlayer(sender.uuid())) { if (api.isFloodgatePlayer(sender.uuid())) {
if (!context.contains("code")) { if (!context.contains("code")) {
@@ -97,8 +101,6 @@ public final class LinkAccountCommand implements FloodgateCommand {
return; return;
} }
UserAudience targetUser = context.get("player");
String targetName = targetUser.username();
String code = context.get("code"); String code = context.get("code");
link.verifyLinkRequest(sender.uuid(), targetName, sender.username(), code) link.verifyLinkRequest(sender.uuid(), targetName, sender.username(), code)
@@ -137,9 +139,6 @@ public final class LinkAccountCommand implements FloodgateCommand {
return; return;
} }
ProfileAudience targetUser = context.get("player");
String targetName = targetUser.username();
link.createLinkRequest(sender.uuid(), sender.username(), targetName) link.createLinkRequest(sender.uuid(), sender.username(), targetName)
.whenComplete((result, throwable) -> { .whenComplete((result, throwable) -> {
if (throwable != null || result == LinkRequestResult.UNKNOWN_ERROR) { if (throwable != null || result == LinkRequestResult.UNKNOWN_ERROR) {

View File

@@ -81,8 +81,8 @@ public final class Metrics {
String categoryName = category + " - " + (category + 4); String categoryName = category + " - " + (category + 4);
return Collections.singletonMap( return Collections.singletonMap(
categoryName, implementationName,
Collections.singletonMap(implementationName, 1) Collections.singletonMap(categoryName, 1)
); );
}) })
); );
@@ -106,8 +106,8 @@ public final class Metrics {
new DrilldownPie("minecraft_version", () -> { new DrilldownPie("minecraft_version", () -> {
// e.g.: 1.16.5 => (Spigot, 1) // e.g.: 1.16.5 => (Spigot, 1)
return Collections.singletonMap( return Collections.singletonMap(
platformUtils.minecraftVersion(), implementationName,
Collections.singletonMap(implementationName, 1) Collections.singletonMap(platformUtils.minecraftVersion(), 1)
); );
}) })
); );