@@ -7,7 +7,7 @@ import org.apache.commons.lang.BooleanUtils;
|
||||
* BooleanPrompt is the base class for any prompt that requires a boolean
|
||||
* response from the user.
|
||||
*/
|
||||
public abstract class BooleanPrompt extends ValidatingPrompt{
|
||||
public abstract class BooleanPrompt extends ValidatingPrompt {
|
||||
|
||||
public BooleanPrompt() {
|
||||
super();
|
||||
|
||||
@@ -217,7 +217,7 @@ public class Conversation {
|
||||
}
|
||||
|
||||
// Test for conversation abandonment based on input
|
||||
for(ConversationCanceller canceller : cancellers) {
|
||||
for (ConversationCanceller canceller : cancellers) {
|
||||
if (canceller.cancelBasedOnInput(context, input)) {
|
||||
abandon(new ConversationAbandonedEvent(this, canceller));
|
||||
return;
|
||||
|
||||
@@ -35,8 +35,7 @@ public class ConversationFactory {
|
||||
*
|
||||
* @param plugin The plugin that owns the factory.
|
||||
*/
|
||||
public ConversationFactory(Plugin plugin)
|
||||
{
|
||||
public ConversationFactory(Plugin plugin) {
|
||||
this.plugin = plugin;
|
||||
isModal = true;
|
||||
localEchoEnabled = true;
|
||||
@@ -58,8 +57,7 @@ public class ConversationFactory {
|
||||
* @param modal The modality of all conversations to be created.
|
||||
* @return This object.
|
||||
*/
|
||||
public ConversationFactory withModality(boolean modal)
|
||||
{
|
||||
public ConversationFactory withModality(boolean modal) {
|
||||
isModal = modal;
|
||||
return this;
|
||||
}
|
||||
@@ -141,7 +139,6 @@ public class ConversationFactory {
|
||||
return withConversationCanceller(new ExactMatchConversationCanceller(escapeSequence));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds a {@link ConversationCanceller} to constructed conversations.
|
||||
*
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package org.bukkit.conversations;
|
||||
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
/**
|
||||
@@ -48,7 +47,7 @@ public class InactivityConversationCanceller implements ConversationCanceller {
|
||||
public void run() {
|
||||
if (conversation.getState() == Conversation.ConversationState.UNSTARTED) {
|
||||
startTimer();
|
||||
} else if (conversation.getState() == Conversation.ConversationState.STARTED) {
|
||||
} else if (conversation.getState() == Conversation.ConversationState.STARTED) {
|
||||
cancelling(conversation);
|
||||
conversation.abandon(new ConversationAbandonedEvent(conversation, InactivityConversationCanceller.this));
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ package org.bukkit.conversations;
|
||||
* ConversationAbandonedEvent} to indicate that the conversation was manually
|
||||
* abandoned by programmatically calling the abandon() method on it.
|
||||
*/
|
||||
public class ManuallyAbandonedConversationCanceller implements ConversationCanceller{
|
||||
public class ManuallyAbandonedConversationCanceller implements ConversationCanceller {
|
||||
public void setConversation(Conversation conversation) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ package org.bukkit.conversations;
|
||||
* MessagePrompt is the base class for any prompt that only displays a message
|
||||
* to the user and requires no input.
|
||||
*/
|
||||
public abstract class MessagePrompt implements Prompt{
|
||||
public abstract class MessagePrompt implements Prompt {
|
||||
|
||||
public MessagePrompt() {
|
||||
super();
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
package org.bukkit.conversations;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
/**
|
||||
* NullConversationPrefix is a {@link ConversationPrefix} implementation that
|
||||
* displays nothing in front of conversation output.
|
||||
*/
|
||||
public class NullConversationPrefix implements ConversationPrefix{
|
||||
public class NullConversationPrefix implements ConversationPrefix {
|
||||
|
||||
/**
|
||||
* Prepends each conversation message with an empty string.
|
||||
|
||||
@@ -6,7 +6,7 @@ import org.apache.commons.lang.math.NumberUtils;
|
||||
* NumericPrompt is the base class for any prompt that requires a {@link
|
||||
* Number} response from the user.
|
||||
*/
|
||||
public abstract class NumericPrompt extends ValidatingPrompt{
|
||||
public abstract class NumericPrompt extends ValidatingPrompt {
|
||||
public NumericPrompt() {
|
||||
super();
|
||||
}
|
||||
@@ -30,8 +30,7 @@ public abstract class NumericPrompt extends ValidatingPrompt{
|
||||
|
||||
@Override
|
||||
protected Prompt acceptValidatedInput(ConversationContext context, String input) {
|
||||
try
|
||||
{
|
||||
try {
|
||||
return acceptValidatedInput(context, NumberUtils.createNumber(input));
|
||||
} catch (NumberFormatException e) {
|
||||
return acceptValidatedInput(context, NumberUtils.INTEGER_ZERO);
|
||||
|
||||
@@ -7,7 +7,7 @@ import org.bukkit.plugin.Plugin;
|
||||
* PlayerNamePrompt is the base class for any prompt that requires the player
|
||||
* to enter another player's name.
|
||||
*/
|
||||
public abstract class PlayerNamePrompt extends ValidatingPrompt{
|
||||
public abstract class PlayerNamePrompt extends ValidatingPrompt {
|
||||
private Plugin plugin;
|
||||
|
||||
public PlayerNamePrompt(Plugin plugin) {
|
||||
@@ -18,7 +18,6 @@ public abstract class PlayerNamePrompt extends ValidatingPrompt{
|
||||
@Override
|
||||
protected boolean isInputValid(ConversationContext context, String input) {
|
||||
return plugin.getServer().getPlayer(input) != null;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -4,7 +4,7 @@ package org.bukkit.conversations;
|
||||
* StringPrompt is the base class for any prompt that accepts an arbitrary
|
||||
* string from the user.
|
||||
*/
|
||||
public abstract class StringPrompt implements Prompt{
|
||||
public abstract class StringPrompt implements Prompt {
|
||||
|
||||
/**
|
||||
* Ensures that the prompt waits for the user to provide input.
|
||||
|
||||
Reference in New Issue
Block a user