Conform all factory prefixes and echoes. Bump version

This commit is contained in:
PikaMug 2020-04-02 05:23:44 -04:00
parent 9cc7945935
commit 6510a7b235
8 changed files with 37 additions and 45 deletions

2
dist/pom.xml vendored
View File

@ -5,7 +5,7 @@
<parent>
<groupId>me.blackvein.quests</groupId>
<artifactId>quests-parent</artifactId>
<version>3.9.1</version>
<version>3.9.2</version>
</parent>
<artifactId>quests-dist</artifactId>
<packaging>pom</packaging>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>me.blackvein.quests</groupId>
<artifactId>quests-parent</artifactId>
<version>3.9.1</version>
<version>3.9.2</version>
</parent>
<artifactId>quests-main</artifactId>

View File

@ -173,14 +173,20 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
getCommand("questadmin").setExecutor(cmdExecutor);
getCommand("quest").setExecutor(cmdExecutor);
// 9 - Setup conversation factory after timeout has loaded
this.conversationFactory = new ConversationFactory(this).withModality(false).withPrefix(new QuestsPrefix())
// 9 - Build conversation factories
this.conversationFactory = new ConversationFactory(this).withModality(false)
.withPrefix(new ConversationPrefix() {
@Override
public String getPrefix(ConversationContext context) {
return ChatColor.GRAY.toString();
}
})
.withFirstPrompt(new QuestAcceptPrompt()).withTimeout(settings.getAcceptTimeout())
.thatExcludesNonPlayersWithMessage("Console may not perform this conversation!")
.addConversationAbandonedListener(this);
this.npcConversationFactory = new ConversationFactory(this).withModality(false)
.withFirstPrompt(new QuestOfferPrompt(this))
.withTimeout(settings.getAcceptTimeout()).withLocalEcho(false).addConversationAbandonedListener(this);
.withFirstPrompt(new QuestOfferPrompt(this)).withTimeout(settings.getAcceptTimeout())
.withLocalEcho(false).addConversationAbandonedListener(this);
// 10 - Register listeners
getServer().getPluginManager().registerEvents(playerListener, this);
@ -230,11 +236,12 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
return customRequirements;
}
public Optional<CustomRequirement> getCustomRequirement(String class_name) {
int size=customRequirements.size();
for(int i1=0;i1<size;i1++) {
CustomRequirement o1=customRequirements.get(i1);
if(o1.getClass().getName().equals(class_name)) return Optional.of(o1);
public Optional<CustomRequirement> getCustomRequirement(String className) {
for (int i = 0; i < customRequirements.size(); i++) {
CustomRequirement cr = customRequirements.get(i);
if (cr.getClass().getName().equals(className)) {
return Optional.of(cr);
}
}
return Optional.empty();
}
@ -243,11 +250,12 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
return customRewards;
}
public Optional<CustomReward> getCustomReward(String class_name) {
int size=customRewards.size();
for(int i1=0;i1<size;i1++) {
CustomReward o1=customRewards.get(i1);
if(o1.getClass().getName().equals(class_name)) return Optional.of(o1);
public Optional<CustomReward> getCustomReward(String className) {
for (int i = 0; i < customRewards.size(); i++) {
CustomReward cr = customRewards.get(i);
if (cr.getClass().getName().equals(className)) {
return Optional.of(cr);
}
}
return Optional.empty();
}
@ -256,11 +264,12 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
return customObjectives;
}
public Optional<CustomObjective> getCustomObjective(String class_name) {
int size=customObjectives.size();
for(int i1=0;i1<size;i1++) {
CustomObjective o1=customObjectives.get(i1);
if(o1.getClass().getName().equals(class_name)) return Optional.of(o1);
public Optional<CustomObjective> getCustomObjective(String className) {
for (int i = 0; i < customObjectives.size(); i++) {
CustomObjective co = customObjectives.get(i);
if (co.getClass().getName().equals(className)) {
return Optional.of(co);
}
}
return Optional.empty();
}
@ -378,14 +387,6 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
}
}
}
private class QuestsPrefix implements ConversationPrefix {
@Override
public String getPrefix(ConversationContext context) {
return ChatColor.GRAY.toString();
}
}
/**
* Transfer language files from jar to disk

View File

@ -35,7 +35,6 @@ import org.bukkit.conversations.ConversationAbandonedEvent;
import org.bukkit.conversations.ConversationAbandonedListener;
import org.bukkit.conversations.ConversationContext;
import org.bukkit.conversations.ConversationFactory;
import org.bukkit.conversations.ConversationPrefix;
import org.bukkit.conversations.FixedSetPrompt;
import org.bukkit.conversations.NumericPrompt;
import org.bukkit.conversations.Prompt;
@ -78,8 +77,8 @@ public class ActionFactory implements ConversationAbandonedListener {
this.plugin = plugin;
// Ensure to initialize convoCreator last so that 'this' is fully initialized before it is passed
this.convoCreator = new ConversationFactory(plugin).withModality(false).withLocalEcho(false)
.withPrefix(new QuestCreatorPrefix()).withFirstPrompt(new ActionMenuPrompt(null))
.withTimeout(3600).thatExcludesNonPlayersWithMessage("Console may not perform this operation!")
.withFirstPrompt(new ActionMenuPrompt(null)).withTimeout(3600)
.thatExcludesNonPlayersWithMessage("Console may not perform this operation!")
.addConversationAbandonedListener(this);
}
@ -148,14 +147,6 @@ public class ActionFactory implements ConversationAbandonedListener {
selectedTeleportLocations.remove(player.getUniqueId());
}
private class QuestCreatorPrefix implements ConversationPrefix {
@Override
public String getPrefix(ConversationContext context) {
return "";
}
}
public class ActionMenuPrompt extends ActionsEditorNumericPrompt {
public ActionMenuPrompt(ConversationContext context) {
super(context);

View File

@ -6,12 +6,12 @@
<groupId>me.blackvein.quests</groupId>
<artifactId>quests-parent</artifactId>
<version>3.9.1</version>
<version>3.9.2</version>
<name>quests</name>
<url>https://github.com/PikaMug/Quests/</url>
<properties>
<revision>3.9.1</revision>
<revision>3.9.2</revision>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>me.blackvein.quests</groupId>
<artifactId>quests-parent</artifactId>
<version>3.9.1</version>
<version>3.9.2</version>
</parent>
<properties>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>me.blackvein.quests</groupId>
<artifactId>quests-parent</artifactId>
<version>3.9.1</version>
<version>3.9.2</version>
</parent>
<properties>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>me.blackvein.quests</groupId>
<artifactId>quests-parent</artifactId>
<version>3.9.1</version>
<version>3.9.2</version>
</parent>
<properties>