Skip to content

Commit

Permalink
修改特性,commandBot
Browse files Browse the repository at this point in the history
  • Loading branch information
Gu-ZT committed Oct 25, 2024
1 parent eb55fba commit 99700ca
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/main/java/dev/dubhe/gugle/carpet/commands/BotCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.level.GameType;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.storage.LevelResource;
Expand Down Expand Up @@ -218,13 +219,14 @@ private static int loadBot(CommandContext<CommandSourceStack> context) {
private static int addBot(CommandContext<CommandSourceStack> context) throws CommandSyntaxException {
BotCommand.init(context);
CommandSourceStack source = context.getSource();
if (!(EntityArgument.getEntity(context, "player") instanceof EntityPlayerMPFake player)) {
source.sendFailure(Component.literal("%s is not a fake player."));
ServerPlayer p;
if (!((p = EntityArgument.getPlayer(context, "player")) instanceof EntityPlayerMPFake player)) {
source.sendFailure(Component.literal("%s is not a fake player.".formatted(p.getGameProfile().getName())));
return 0;
}
String name = player.getGameProfile().getName();
if (BOT_INFO_MAP.containsKey(name)) {
source.sendFailure(Component.literal("%s is already save."));
source.sendFailure(Component.literal("%s is already save.".formatted(name)));
return 0;
}
BotCommand.BOT_INFO_MAP.put(
Expand Down

0 comments on commit 99700ca

Please sign in to comment.