Add Override annotations where appropriate

By: md_5 <git@md-5.net>
This commit is contained in:
Bukkit/Spigot
2019-04-28 11:37:52 +10:00
parent d66310a2f1
commit 82854b7bd7
176 changed files with 503 additions and 0 deletions

View File

@@ -225,6 +225,7 @@ public class ConversationFactory {
private class NotPlayerMessagePrompt extends MessagePrompt {
@Override
@NotNull
public String getPromptText(@NotNull ConversationContext context) {
return playerOnlyMessage;

View File

@@ -19,12 +19,15 @@ public class ExactMatchConversationCanceller implements ConversationCanceller {
this.escapeSequence = escapeSequence;
}
@Override
public void setConversation(@NotNull Conversation conversation) {}
@Override
public boolean cancelBasedOnInput(@NotNull ConversationContext context, @NotNull String input) {
return input.equals(escapeSequence);
}
@Override
@NotNull
public ConversationCanceller clone() {
return new ExactMatchConversationCanceller(escapeSequence);

View File

@@ -24,11 +24,13 @@ public class InactivityConversationCanceller implements ConversationCanceller {
this.timeoutSeconds = timeoutSeconds;
}
@Override
public void setConversation(@NotNull Conversation conversation) {
this.conversation = conversation;
startTimer();
}
@Override
public boolean cancelBasedOnInput(@NotNull ConversationContext context, @NotNull String input) {
// Reset the inactivity timer
stopTimer();
@@ -36,6 +38,7 @@ public class InactivityConversationCanceller implements ConversationCanceller {
return false;
}
@Override
@NotNull
public ConversationCanceller clone() {
return new InactivityConversationCanceller(plugin, timeoutSeconds);
@@ -46,6 +49,7 @@ public class InactivityConversationCanceller implements ConversationCanceller {
*/
private void startTimer() {
taskId = plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
@Override
public void run() {
if (conversation.getState() == Conversation.ConversationState.UNSTARTED) {
startTimer();

View File

@@ -8,14 +8,17 @@ import org.jetbrains.annotations.NotNull;
* abandoned by programmatically calling the abandon() method on it.
*/
public class ManuallyAbandonedConversationCanceller implements ConversationCanceller {
@Override
public void setConversation(@NotNull Conversation conversation) {
throw new UnsupportedOperationException();
}
@Override
public boolean cancelBasedOnInput(@NotNull ConversationContext context, @NotNull String input) {
throw new UnsupportedOperationException();
}
@Override
@NotNull
public ConversationCanceller clone() {
throw new UnsupportedOperationException();

View File

@@ -19,6 +19,7 @@ public abstract class MessagePrompt implements Prompt {
* @param context Context information about the conversation.
* @return Always false.
*/
@Override
public boolean blocksForInput(@NotNull ConversationContext context) {
return false;
}
@@ -31,6 +32,7 @@ public abstract class MessagePrompt implements Prompt {
* @param input Ignored.
* @return The next prompt in the prompt graph.
*/
@Override
@Nullable
public Prompt acceptInput(@NotNull ConversationContext context, @Nullable String input) {
return getNextPrompt(context);

View File

@@ -14,6 +14,7 @@ public class NullConversationPrefix implements ConversationPrefix {
* @param context Context information about the conversation.
* @return An empty string.
*/
@Override
@NotNull
public String getPrefix(@NotNull ConversationContext context) {
return "";

View File

@@ -34,6 +34,7 @@ public class PluginNameConversationPrefix implements ConversationPrefix {
* @param context Context information about the conversation.
* @return An empty string.
*/
@Override
@NotNull
public String getPrefix(@NotNull ConversationContext context) {
return cachedPrefix;

View File

@@ -14,6 +14,7 @@ public abstract class StringPrompt implements Prompt {
* @param context Context information about the conversation.
* @return True.
*/
@Override
public boolean blocksForInput(@NotNull ConversationContext context) {
return true;
}

View File

@@ -23,6 +23,7 @@ public abstract class ValidatingPrompt implements Prompt {
* @param input The input text from the user.
* @return This prompt or the next Prompt in the prompt graph.
*/
@Override
@Nullable
public Prompt acceptInput(@NotNull ConversationContext context, @Nullable String input) {
if (isInputValid(context, input)) {
@@ -43,6 +44,7 @@ public abstract class ValidatingPrompt implements Prompt {
* @param context Context information about the conversation.
* @return True.
*/
@Override
public boolean blocksForInput(@NotNull ConversationContext context) {
return true;
}