diff options
| author | anhgelus <anhgelus.morhtuuzh@proton.me> | 2024-07-26 23:56:07 +0000 |
|---|---|---|
| committer | anhgelus <anhgelus.morhtuuzh@proton.me> | 2024-07-26 23:56:07 +0000 |
| commit | e0d263ba917180d4d5d70a28114576b1602a0965 (patch) | |
| tree | 9ae834679ed8729e7367fcc389c25a9f80c15535 /src/main | |
| parent | e9b97b6caff46cb953015a052b7b571875247722 (diff) | |
fix(command): not good display name in feedback
Diffstat (limited to 'src/main')
| -rw-r--r-- | src/main/java/world/anhgelus/manhunt/Manhunt.java | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/main/java/world/anhgelus/manhunt/Manhunt.java b/src/main/java/world/anhgelus/manhunt/Manhunt.java index ec7aef3..181b3d9 100644 --- a/src/main/java/world/anhgelus/manhunt/Manhunt.java +++ b/src/main/java/world/anhgelus/manhunt/Manhunt.java @@ -5,6 +5,7 @@ import com.mojang.brigadier.builder.LiteralArgumentBuilder; import com.mojang.brigadier.builder.RequiredArgumentBuilder;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
+import net.fabricmc.fabric.api.entity.event.v1.ServerLivingEntityEvents;
import net.fabricmc.fabric.api.entity.event.v1.ServerPlayerEvents;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerEntityEvents;
import net.minecraft.command.EntitySelector;
@@ -63,7 +64,8 @@ public class Manhunt implements ModInitializer { if (player == null) return 2;
map.put(source.getPlayer().getUuid(), tracked.getUuid());
updateCompass(player, tracked);
- context.getSource().sendFeedback(() -> Text.literal("Tracking "+tracked.getDisplayName()), false);
+ assert tracked.getDisplayName() != null;
+ context.getSource().sendFeedback(() -> Text.literal("Tracking "+tracked.getDisplayName().getString()), false);
return Command.SINGLE_SUCCESS;
})
);
@@ -73,14 +75,16 @@ public class Manhunt implements ModInitializer { final var p = (ServerPlayerEntity) EntityArgumentType.getEntity(context, "player");
speedrunners.remove(p.getUuid());
hunters.add(p.getUuid());
- context.getSource().sendFeedback(() -> Text.literal(p.getDisplayName()+" added to hunter"), true);
+ assert p.getDisplayName() != null;
+ context.getSource().sendFeedback(() -> Text.literal(p.getDisplayName().getString()+" added to hunter"), true);
return Command.SINGLE_SUCCESS;
}))
.then(LiteralArgumentBuilder.<ServerCommandSource>literal("speedrunner").executes(context -> {
final var p = (ServerPlayerEntity) EntityArgumentType.getEntity(context, "player");
hunters.remove(p.getUuid());
speedrunners.add(p.getUuid());
- context.getSource().sendFeedback(() -> Text.literal(p.getDisplayName()+" added to speedrunner"), true);
+ assert p.getDisplayName() != null;
+ context.getSource().sendFeedback(() -> Text.literal(p.getDisplayName().getString()+" added to speedrunner"), true);
return Command.SINGLE_SUCCESS;
}));
team.then(teamP);
|
