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> <parent>
<groupId>me.blackvein.quests</groupId> <groupId>me.blackvein.quests</groupId>
<artifactId>quests-parent</artifactId> <artifactId>quests-parent</artifactId>
<version>3.9.1</version> <version>3.9.2</version>
</parent> </parent>
<artifactId>quests-dist</artifactId> <artifactId>quests-dist</artifactId>
<packaging>pom</packaging> <packaging>pom</packaging>

View File

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

View File

@ -173,14 +173,20 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
getCommand("questadmin").setExecutor(cmdExecutor); getCommand("questadmin").setExecutor(cmdExecutor);
getCommand("quest").setExecutor(cmdExecutor); getCommand("quest").setExecutor(cmdExecutor);
// 9 - Setup conversation factory after timeout has loaded // 9 - Build conversation factories
this.conversationFactory = new ConversationFactory(this).withModality(false).withPrefix(new QuestsPrefix()) 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()) .withFirstPrompt(new QuestAcceptPrompt()).withTimeout(settings.getAcceptTimeout())
.thatExcludesNonPlayersWithMessage("Console may not perform this conversation!") .thatExcludesNonPlayersWithMessage("Console may not perform this conversation!")
.addConversationAbandonedListener(this); .addConversationAbandonedListener(this);
this.npcConversationFactory = new ConversationFactory(this).withModality(false) this.npcConversationFactory = new ConversationFactory(this).withModality(false)
.withFirstPrompt(new QuestOfferPrompt(this)) .withFirstPrompt(new QuestOfferPrompt(this)).withTimeout(settings.getAcceptTimeout())
.withTimeout(settings.getAcceptTimeout()).withLocalEcho(false).addConversationAbandonedListener(this); .withLocalEcho(false).addConversationAbandonedListener(this);
// 10 - Register listeners // 10 - Register listeners
getServer().getPluginManager().registerEvents(playerListener, this); getServer().getPluginManager().registerEvents(playerListener, this);
@ -230,11 +236,12 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
return customRequirements; return customRequirements;
} }
public Optional<CustomRequirement> getCustomRequirement(String class_name) { public Optional<CustomRequirement> getCustomRequirement(String className) {
int size=customRequirements.size(); for (int i = 0; i < customRequirements.size(); i++) {
for(int i1=0;i1<size;i1++) { CustomRequirement cr = customRequirements.get(i);
CustomRequirement o1=customRequirements.get(i1); if (cr.getClass().getName().equals(className)) {
if(o1.getClass().getName().equals(class_name)) return Optional.of(o1); return Optional.of(cr);
}
} }
return Optional.empty(); return Optional.empty();
} }
@ -243,11 +250,12 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
return customRewards; return customRewards;
} }
public Optional<CustomReward> getCustomReward(String class_name) { public Optional<CustomReward> getCustomReward(String className) {
int size=customRewards.size(); for (int i = 0; i < customRewards.size(); i++) {
for(int i1=0;i1<size;i1++) { CustomReward cr = customRewards.get(i);
CustomReward o1=customRewards.get(i1); if (cr.getClass().getName().equals(className)) {
if(o1.getClass().getName().equals(class_name)) return Optional.of(o1); return Optional.of(cr);
}
} }
return Optional.empty(); return Optional.empty();
} }
@ -256,11 +264,12 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
return customObjectives; return customObjectives;
} }
public Optional<CustomObjective> getCustomObjective(String class_name) { public Optional<CustomObjective> getCustomObjective(String className) {
int size=customObjectives.size(); for (int i = 0; i < customObjectives.size(); i++) {
for(int i1=0;i1<size;i1++) { CustomObjective co = customObjectives.get(i);
CustomObjective o1=customObjectives.get(i1); if (co.getClass().getName().equals(className)) {
if(o1.getClass().getName().equals(class_name)) return Optional.of(o1); return Optional.of(co);
}
} }
return Optional.empty(); 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 * 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.ConversationAbandonedListener;
import org.bukkit.conversations.ConversationContext; import org.bukkit.conversations.ConversationContext;
import org.bukkit.conversations.ConversationFactory; import org.bukkit.conversations.ConversationFactory;
import org.bukkit.conversations.ConversationPrefix;
import org.bukkit.conversations.FixedSetPrompt; import org.bukkit.conversations.FixedSetPrompt;
import org.bukkit.conversations.NumericPrompt; import org.bukkit.conversations.NumericPrompt;
import org.bukkit.conversations.Prompt; import org.bukkit.conversations.Prompt;
@ -78,8 +77,8 @@ public class ActionFactory implements ConversationAbandonedListener {
this.plugin = plugin; this.plugin = plugin;
// Ensure to initialize convoCreator last so that 'this' is fully initialized before it is passed // Ensure to initialize convoCreator last so that 'this' is fully initialized before it is passed
this.convoCreator = new ConversationFactory(plugin).withModality(false).withLocalEcho(false) this.convoCreator = new ConversationFactory(plugin).withModality(false).withLocalEcho(false)
.withPrefix(new QuestCreatorPrefix()).withFirstPrompt(new ActionMenuPrompt(null)) .withFirstPrompt(new ActionMenuPrompt(null)).withTimeout(3600)
.withTimeout(3600).thatExcludesNonPlayersWithMessage("Console may not perform this operation!") .thatExcludesNonPlayersWithMessage("Console may not perform this operation!")
.addConversationAbandonedListener(this); .addConversationAbandonedListener(this);
} }
@ -148,14 +147,6 @@ public class ActionFactory implements ConversationAbandonedListener {
selectedTeleportLocations.remove(player.getUniqueId()); selectedTeleportLocations.remove(player.getUniqueId());
} }
private class QuestCreatorPrefix implements ConversationPrefix {
@Override
public String getPrefix(ConversationContext context) {
return "";
}
}
public class ActionMenuPrompt extends ActionsEditorNumericPrompt { public class ActionMenuPrompt extends ActionsEditorNumericPrompt {
public ActionMenuPrompt(ConversationContext context) { public ActionMenuPrompt(ConversationContext context) {
super(context); super(context);

View File

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

View File

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

View File

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

View File

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