mirror of
https://github.com/PikaMug/Quests.git
synced 2024-12-24 10:09:49 +01:00
Move quests/actions file objects from global
This commit is contained in:
parent
3e06037e29
commit
f02d179399
@ -73,11 +73,9 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
private HashSet<Player> selectingNpcs = new HashSet<Player>();
|
||||
private List<String> names = new LinkedList<String>();
|
||||
private ConversationFactory convoCreator;
|
||||
private File questsFile;
|
||||
|
||||
public QuestFactory(Quests plugin) {
|
||||
this.plugin = plugin;
|
||||
questsFile = new File(plugin.getDataFolder(), "quests.yml");
|
||||
// Ensure to initialize convoCreator last so that 'this' is fully initialized before it is passed
|
||||
this.convoCreator = new ConversationFactory(plugin).withModality(false).withLocalEcho(false)
|
||||
.withFirstPrompt(new QuestMenuPrompt(plugin, null)).withTimeout(3600)
|
||||
@ -1048,6 +1046,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
|
||||
private void deleteQuest(ConversationContext context) {
|
||||
YamlConfiguration data = new YamlConfiguration();
|
||||
File questsFile = new File(plugin.getDataFolder(), "quests.yml");
|
||||
try {
|
||||
data.load(questsFile);
|
||||
} catch (IOException e) {
|
||||
|
@ -73,11 +73,9 @@ public class ActionFactory implements ConversationAbandonedListener {
|
||||
private Map<UUID, Block> selectedTeleportLocations = new HashMap<UUID, Block>();
|
||||
private List<String> names = new LinkedList<String>();
|
||||
private ConversationFactory convoCreator;
|
||||
private File actionsFile;
|
||||
|
||||
public ActionFactory(Quests plugin) {
|
||||
this.plugin = plugin;
|
||||
actionsFile = new File(plugin.getDataFolder(), "actions.yml");
|
||||
// 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(plugin, null))
|
||||
@ -1140,8 +1138,8 @@ public class ActionFactory implements ConversationAbandonedListener {
|
||||
|
||||
private void deleteAction(ConversationContext context) {
|
||||
YamlConfiguration data = new YamlConfiguration();
|
||||
File actionsFile = new File(plugin.getDataFolder(), "actions.yml");
|
||||
try {
|
||||
actionsFile = new File(plugin.getDataFolder(), "actions.yml");
|
||||
data.load(actionsFile);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
@ -1173,8 +1171,8 @@ public class ActionFactory implements ConversationAbandonedListener {
|
||||
|
||||
private void saveAction(ConversationContext context) {
|
||||
YamlConfiguration data = new YamlConfiguration();
|
||||
File actionsFile = new File(plugin.getDataFolder(), "actions.yml");
|
||||
try {
|
||||
actionsFile = new File(plugin.getDataFolder(), "actions.yml");
|
||||
data.load(actionsFile);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
|
Loading…
Reference in New Issue
Block a user