Merge branch 'Pyrbu:2.0.0' into 2.0.0

This commit is contained in:
D3v1s0m 2023-05-11 11:55:45 +05:30 committed by GitHub
commit a444ff0476
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

@ -28,7 +28,7 @@ dependencies {
implementation "com.github.retrooper.packetevents:spigot:2.0.0-SNAPSHOT"
implementation "space.arim.dazzleconf:dazzleconf-ext-snakeyaml:1.2.1"
implementation "lol.pyr:director-adventure:2.0.6"
implementation "lol.pyr:director-adventure:2.0.7"
implementation project(":api")
}

@ -8,6 +8,7 @@ import lol.pyr.znpcsplus.npc.NpcEntryImpl;
import lol.pyr.znpcsplus.npc.NpcImpl;
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;
@ -24,13 +25,13 @@ public class PropertiesCommand implements CommandHandler {
// TODO: implement all the parsers for the types used in EntityPropertyImpl
Object value = context.parse(property.getType());
npc.UNSAFE_setProperty(property, value);
context.send(Component.text("Set property " + property.getName() + " for NPC " + entry.getId() + " to " + value.toString()));
context.send(Component.text("Set property " + property.getName() + " for NPC " + entry.getId() + " to " + value.toString(), NamedTextColor.GREEN));
}
@Override
public List<String> suggest(CommandContext context) throws CommandExecutionException {
if (context.argSize() == 1) return context.suggestCollection(NpcRegistryImpl.get().modifiableIds());
if (context.argSize() == 2) return context.suggestStream(context.suggestionParse(1, NpcEntryImpl.class)
if (context.argSize() == 2) return context.suggestStream(context.suggestionParse(0, NpcEntryImpl.class)
.getNpc().getType().getAllowedProperties().stream().map(EntityPropertyImpl::getName));
return Collections.emptyList();
}