Skip to content

Commit

Permalink
More javadoc fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
fullwall committed May 12, 2019
1 parent eba2270 commit 4463f32
Show file tree
Hide file tree
Showing 11 changed files with 48 additions and 46 deletions.
2 changes: 1 addition & 1 deletion src/main/java/net/citizensnpcs/api/CitizensAPI.java
Expand Up @@ -172,7 +172,7 @@ public static void registerEvents(Listener listener) {
*
* @since 2.0.8
* @param name
* The name previously given to {@link #createNamedNPCRegistry(String)}
* The name previously given to {@link #createNamedNPCRegistry(String, NPCDataStore)}
*/
public static void removeNamedNPCRegistry(String name) {
getImplementation().removeNamedNPCRegistry(name);
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/net/citizensnpcs/api/CitizensPlugin.java
Expand Up @@ -43,8 +43,6 @@ public interface CitizensPlugin extends Plugin {

/**
* Get all registered {@link NPCRegistry}s.
*
* @return
*/
public Iterable<NPCRegistry> getNPCRegistries();

Expand Down
Expand Up @@ -5,26 +5,26 @@
/**
* Represents the NPCs speech abilities using VocalChords registered with the {@link SpeechFactory}. Uses
* {@link SpeechContext}s which contain messages and recipients.
*
*
*/
public interface SpeechController {

/**
* Sends the speechController's {@link NPC} and {@link SpeechContext} to the current default {@link VocalChord} for
* the NPC. If none, the default {@link ChatVocalChord} is used.
*
* the NPC. If none, the default {@link VocalChord} is used.
*
* @param message
* The message to speak
*/
public void speak(SpeechContext message);

/**
* Sends the speechController's {@link NPC} and {@link SpeechContext} to the specified {@link VocalChord}.
*
*
* @param message
* The message to speak
* @param vocalChord
*
*
*/
public void speak(SpeechContext message, String vocalChordName);

Expand Down
40 changes: 24 additions & 16 deletions src/main/java/net/citizensnpcs/api/ai/speech/SpeechFactory.java
Expand Up @@ -5,71 +5,79 @@

/**
* SpeechFactory keeps track of and creates new VocalChord instances, necessary for NPC Speech.
*
*
*/
public interface SpeechFactory {

/**
* Creates a new instance of a VocalChord
*
* @param name
*
* @param clazz
* The class of the desired VocalChord
* @return a new instance of this VocalChord
*
*
*/
public VocalChord getVocalChord(Class<? extends VocalChord> clazz);

/**
* Creates a new instance of a {@link VocalChord}
*
*
* @param name
* The name of the desired VocalChord
* @return a new instance of this VocalChord, ornull if a VocalChord is not registered with this name
*
*
*/
public VocalChord getVocalChord(String name);

/**
* Returns the registered name of a {@link VocalChord} class
*
*
* @param clazz
* The VocalChord class
* @return the registered name, null if not registered
*
*
*/
public String getVocalChordName(Class<? extends VocalChord> clazz);

/**
* Checks whether the supplied {@link VocalChord} name is registered.
*
*
* @param name
* The name of the VocalChord to check
* @return true if the VocalChord name is registered
*
*
*/
public boolean isRegistered(String name);

/**
* Creates a new Talkable entity and returns it
*
* @param livingEntity
* the livingEntity to use
*
*
* @param entity
* the entity to use
*
* @return a Talkable entity
*/
public Talkable newTalkableEntity(Entity entity);

/**
* Creates a new Talkable entity and returns it
*
* @param entity
* the livingEntity to use
*
* @return a Talkable entity
*/
public Talkable newTalkableEntity(LivingEntity entity);

/**
* Registers a {@link VocalChord} class with the SpeechController, making it available for use within. Requires a
* 'name', which should generally describe the intent of the VocalChord.
*
*
* @param clazz
* The VocalChord class
* @param name
* The name of the VocalChord
*
*
*/
public void register(Class<? extends VocalChord> clazz, String name);
}
Expand Up @@ -60,7 +60,7 @@ public void setCancelled(boolean cancelled) {
/**
* Sets the name of the {@link VocalChord} to be used.
*
* @param vocalChordName
* @param name
* A valid registered VocalChord name
*/
public void setVocalChord(String name) {
Expand Down
22 changes: 10 additions & 12 deletions src/main/java/net/citizensnpcs/api/ai/speech/event/SpeechEvent.java
@@ -1,16 +1,16 @@
package net.citizensnpcs.api.ai.speech.event;

import net.citizensnpcs.api.ai.speech.SpeechContext;
import net.citizensnpcs.api.ai.speech.Talkable;
import net.citizensnpcs.api.ai.speech.VocalChord;

import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;

import net.citizensnpcs.api.ai.speech.SpeechContext;
import net.citizensnpcs.api.ai.speech.Talkable;
import net.citizensnpcs.api.ai.speech.VocalChord;

/**
* Represents an event where a {@link Talkable} entity speaks at/near a {@link Talkable} entity.
*
*
*/
public class SpeechEvent extends Event implements Cancellable {

Expand All @@ -30,7 +30,7 @@ public SpeechEvent(Talkable target, SpeechContext context, String message, Vocal

/**
* Gets the {@link SpeechContext} associated with the SpeechEvent.
*
*
* @return the SpeechContext
*/
public SpeechContext getContext() {
Expand All @@ -45,7 +45,7 @@ public HandlerList getHandlers() {
/**
* The final message to be sent to the bystander. Note: This may differ from the message contained in the
* SpeechContext, as formatting may have occurred.
*
*
* @return the message to be sent to the {@link Talkable} bystander.
*/
public String getMessage() {
Expand All @@ -54,7 +54,7 @@ public String getMessage() {

/**
* Returns the name of the {@link VocalChord} that called this event.
*
*
* @return name of the VocalChord being used
*/
public String getVocalChordName() {
Expand All @@ -74,16 +74,14 @@ public void setCancelled(boolean cancelled) {
/**
* Sets the message to be sent to the bystander. Note: This may differ from the message contained in the
* SpeechContext, as formatting may have occurred.
*
* @return the message to be sent
*/
public void setMessage(String formattedMessage) {
this.message = formattedMessage;
}

private static final HandlerList handlers = new HandlerList();

public static HandlerList getHandlerList() {
return handlers;
}

private static final HandlerList handlers = new HandlerList();
}
4 changes: 2 additions & 2 deletions src/main/java/net/citizensnpcs/api/npc/MetadataStore.java
Expand Up @@ -16,7 +16,7 @@ public interface MetadataStore {
<T> T get(String key);

/**
* Fetches metadata from the given key. Sets the default value provided via {@link #set(String, Object) if the
* Fetches metadata from the given key. Sets the default value provided via {@link #set(String, Object)} if the
* metadata is not already stored.
*
* @param key
Expand All @@ -25,7 +25,7 @@ public interface MetadataStore {
* The default value to return
* @return The metadata at the given key, or def if not found
*/
<T> T get(String string, T def);
<T> T get(String key, T def);

/**
* Returns whether the metadata exists.
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/citizensnpcs/api/npc/NPC.java
Expand Up @@ -281,7 +281,7 @@ public interface NPC extends Agent, Cloneable {
public boolean spawn(Location location, SpawnReason reason);

/**
* An alternative to {{@link #getBukkitEntity().getLocation()} that teleports passengers as well.
* An alternative to <code>npc.getEntity().getLocation()</code> that teleports passengers as well.
*
* @param location
* The destination location
Expand Down
Expand Up @@ -8,8 +8,8 @@
/**
* Delegates persistence to a given {@link Persister}, which will be used to create and save instances.
*
* @see {@link Persist}
* @see {@link Persister}
* @see Persist
* @see Persister
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
Expand Down
Expand Up @@ -80,8 +80,8 @@ public boolean canCompile(File file) {
/**
* Create a builder to compile the given files.
*
* @param files
* The files to compile
* @param file
* The file to compile
* @return The {@link CompileTaskBuilder}
*/
public CompileTaskBuilder compile(File file) {
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/net/citizensnpcs/api/trait/trait/Speech.java
Expand Up @@ -29,8 +29,6 @@ public String getDefaultVocalChord() {

/**
* Sets the name of the default {@link VocalChord} for this NPC.
*
* @return The name of the VocalChord
*/
public void setDefaultVocalChord(Class<VocalChord> clazz) {
defaultVocalChord = CitizensAPI.getSpeechFactory().getVocalChordName(clazz);
Expand Down

0 comments on commit 4463f32

Please sign in to comment.