added ability to register dummy property using api
This commit is contained in:
parent
2128243fa2
commit
a5de0680c8
5 changed files with 29 additions and 0 deletions
|
@ -6,4 +6,5 @@ public interface EntityPropertyRegistry {
|
|||
Collection<EntityProperty<?>> getAll();
|
||||
EntityProperty<?> getByName(String name);
|
||||
<T> EntityProperty<T> getByName(String name, Class<T> type);
|
||||
void registerDummy(String name, Class<?> type);
|
||||
}
|
||||
|
|
|
@ -253,6 +253,7 @@ public class ZNpcsPlus extends JavaPlugin {
|
|||
manager.registerParser(InteractionType.class, new InteractionTypeParser(incorrectUsageMessage));
|
||||
manager.registerParser(Color.class, new ColorParser(incorrectUsageMessage));
|
||||
manager.registerParser(Vector3f.class, new Vector3fParser(incorrectUsageMessage));
|
||||
manager.registerParser(String.class, new StringParser(incorrectUsageMessage));
|
||||
|
||||
// TODO: Need to find a better way to do this
|
||||
registerEnumParser(manager, NpcPose.class, incorrectUsageMessage);
|
||||
|
|
|
@ -569,6 +569,11 @@ public class EntityPropertyRegistryImpl implements EntityPropertyRegistry {
|
|||
return (EntityPropertyImpl<T>) getByName(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerDummy(String name, Class<?> type) {
|
||||
register(new DummyProperty<>(name, type));
|
||||
}
|
||||
|
||||
public EntityPropertyImpl<?> getByName(String name) {
|
||||
return byName.get(name.toLowerCase());
|
||||
}
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
package lol.pyr.znpcsplus.parsers;
|
||||
|
||||
import lol.pyr.director.adventure.command.CommandContext;
|
||||
import lol.pyr.director.adventure.parse.ParserType;
|
||||
import lol.pyr.director.common.command.CommandExecutionException;
|
||||
import lol.pyr.director.common.message.Message;
|
||||
|
||||
import java.util.Deque;
|
||||
|
||||
public class StringParser extends ParserType<String> {
|
||||
public StringParser(Message<CommandContext> message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String parse(Deque<String> deque) throws CommandExecutionException {
|
||||
return deque.pollFirst();
|
||||
}
|
||||
}
|
|
@ -21,6 +21,9 @@ softdepend:
|
|||
- ViaRewind
|
||||
- Geyser-Spigot
|
||||
|
||||
loadbefore:
|
||||
- Quests
|
||||
|
||||
commands:
|
||||
npc:
|
||||
aliases:
|
||||
|
|
Loading…
Reference in a new issue