command changes

This commit is contained in:
Pyrbu 2023-05-10 14:42:23 +01:00
parent 252498c3e4
commit bd22453f76
7 changed files with 12 additions and 21 deletions

@ -15,8 +15,8 @@ import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
import org.bukkit.entity.Player;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
public class CreateCommand implements CommandHandler {
@Override
@ -58,15 +58,8 @@ public class CreateCommand implements CommandHandler {
@Override
public List<String> suggest(CommandContext context) throws CommandExecutionException {
if (context.argSize() == 1) {
return context.suggestLiteral("<npc_id>");
}
if (context.argSize() == 2) {
return context.suggestCollection(NpcTypeImpl.values().stream().map(NpcTypeImpl::getName).collect(Collectors.toList()));
}
if (context.argSize() == 3) {
return context.suggestLiteral("<npc_name>");
}
return CommandHandler.super.suggest(context);
if (context.argSize() == 1) return context.suggestCollection(NpcRegistryImpl.get().modifiableIds());
if (context.argSize() == 2) return context.suggestStream(NpcTypeImpl.values().stream().map(NpcTypeImpl::getName));
return Collections.emptyList();
}
}

@ -9,8 +9,8 @@ import lol.pyr.znpcsplus.npc.NpcRegistryImpl;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
public class DeleteCommand implements CommandHandler {
@Override
@ -31,9 +31,7 @@ public class DeleteCommand implements CommandHandler {
@Override
public List<String> suggest(CommandContext context) throws CommandExecutionException {
if (context.argSize() == 1) {
return context.suggestCollection(NpcRegistryImpl.get().ids().stream().filter(s -> !s.startsWith(ZNpcsPlus.DEBUG_NPC_PREFIX)).collect(Collectors.toList()));
}
return CommandHandler.super.suggest(context);
if (context.argSize() == 1) return context.suggestCollection(NpcRegistryImpl.get().modifiableIds());
return Collections.emptyList();
}
}

@ -1,4 +1,4 @@
package lol.pyr.znpcsplus.commands;
package lol.pyr.znpcsplus.commands.hologram;
import lol.pyr.director.adventure.command.CommandContext;
import lol.pyr.director.adventure.command.CommandHandler;

@ -1,4 +1,4 @@
package lol.pyr.znpcsplus.commands;
package lol.pyr.znpcsplus.commands.hologram;
import lol.pyr.director.adventure.command.CommandContext;
import lol.pyr.director.adventure.command.CommandHandler;

@ -1,4 +1,4 @@
package lol.pyr.znpcsplus.commands;
package lol.pyr.znpcsplus.commands.hologram;
import lol.pyr.director.adventure.command.CommandContext;
import lol.pyr.director.adventure.command.CommandHandler;

@ -1,4 +1,4 @@
package lol.pyr.znpcsplus.commands;
package lol.pyr.znpcsplus.commands.hologram;
import lol.pyr.director.adventure.command.CommandContext;
import lol.pyr.director.adventure.command.CommandHandler;

@ -1,4 +1,4 @@
package lol.pyr.znpcsplus.commands;
package lol.pyr.znpcsplus.commands.hologram;
import lol.pyr.director.adventure.command.CommandContext;
import lol.pyr.director.adventure.command.CommandHandler;