mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2025-02-16 20:31:30 +01:00
Streamline default vocal chord in preparation for speech API simplification
This commit is contained in:
parent
45114dc7b5
commit
c03160e73e
@ -63,7 +63,6 @@ import net.citizensnpcs.editor.Editor;
|
||||
import net.citizensnpcs.npc.CitizensNPCRegistry;
|
||||
import net.citizensnpcs.npc.CitizensTraitFactory;
|
||||
import net.citizensnpcs.npc.NPCSelector;
|
||||
import net.citizensnpcs.npc.ai.speech.Chat;
|
||||
import net.citizensnpcs.npc.ai.speech.CitizensSpeechFactory;
|
||||
import net.citizensnpcs.npc.profile.ProfileFetcher;
|
||||
import net.citizensnpcs.npc.skin.Skin;
|
||||
@ -338,11 +337,10 @@ public class Citizens extends JavaPlugin implements CitizensPlugin {
|
||||
return;
|
||||
}
|
||||
|
||||
speechFactory = new CitizensSpeechFactory();
|
||||
npcRegistry = new CitizensNPCRegistry(saves, "citizens");
|
||||
traitFactory = new CitizensTraitFactory();
|
||||
selector = new NPCSelector(this);
|
||||
speechFactory = new CitizensSpeechFactory();
|
||||
speechFactory.register(Chat.class, "chat");
|
||||
|
||||
Bukkit.getPluginManager().registerEvents(new EventListen(storedRegistries), this);
|
||||
if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
|
||||
|
@ -15,6 +15,10 @@ import net.citizensnpcs.api.ai.speech.VocalChord;
|
||||
public class CitizensSpeechFactory implements SpeechFactory {
|
||||
private final Map<String, Class<? extends VocalChord>> registered = new HashMap<String, Class<? extends VocalChord>>();
|
||||
|
||||
public CitizensSpeechFactory() {
|
||||
register(Chat.class, "chat");
|
||||
}
|
||||
|
||||
@Override
|
||||
public VocalChord getVocalChord(Class<? extends VocalChord> clazz) {
|
||||
Preconditions.checkNotNull(clazz, "class cannot be null");
|
||||
@ -33,6 +37,9 @@ public class CitizensSpeechFactory implements SpeechFactory {
|
||||
public VocalChord getVocalChord(String name) {
|
||||
Preconditions.checkNotNull(name, "name cannot be null");
|
||||
// Check if VocalChord name is a registered type
|
||||
if (name.equalsIgnoreCase("chat")) {
|
||||
return new Chat();
|
||||
}
|
||||
if (isRegistered(name)) {
|
||||
// Return a new instance of the VocalChord specified
|
||||
try {
|
||||
|
Loading…
Reference in New Issue
Block a user