mirror of
https://github.com/PikaMug/Quests.git
synced 2024-12-20 08:07:57 +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 HashSet<Player> selectingNpcs = new HashSet<Player>();
|
||||||
private List<String> names = new LinkedList<String>();
|
private List<String> names = new LinkedList<String>();
|
||||||
private ConversationFactory convoCreator;
|
private ConversationFactory convoCreator;
|
||||||
private File questsFile;
|
|
||||||
|
|
||||||
public QuestFactory(Quests plugin) {
|
public QuestFactory(Quests plugin) {
|
||||||
this.plugin = 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
|
// 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)
|
||||||
.withFirstPrompt(new QuestMenuPrompt(plugin, null)).withTimeout(3600)
|
.withFirstPrompt(new QuestMenuPrompt(plugin, null)).withTimeout(3600)
|
||||||
@ -1048,6 +1046,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||||||
|
|
||||||
private void deleteQuest(ConversationContext context) {
|
private void deleteQuest(ConversationContext context) {
|
||||||
YamlConfiguration data = new YamlConfiguration();
|
YamlConfiguration data = new YamlConfiguration();
|
||||||
|
File questsFile = new File(plugin.getDataFolder(), "quests.yml");
|
||||||
try {
|
try {
|
||||||
data.load(questsFile);
|
data.load(questsFile);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
@ -73,11 +73,9 @@ public class ActionFactory implements ConversationAbandonedListener {
|
|||||||
private Map<UUID, Block> selectedTeleportLocations = new HashMap<UUID, Block>();
|
private Map<UUID, Block> selectedTeleportLocations = new HashMap<UUID, Block>();
|
||||||
private List<String> names = new LinkedList<String>();
|
private List<String> names = new LinkedList<String>();
|
||||||
private ConversationFactory convoCreator;
|
private ConversationFactory convoCreator;
|
||||||
private File actionsFile;
|
|
||||||
|
|
||||||
public ActionFactory(Quests plugin) {
|
public ActionFactory(Quests plugin) {
|
||||||
this.plugin = 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
|
// 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(plugin, null))
|
.withPrefix(new QuestCreatorPrefix()).withFirstPrompt(new ActionMenuPrompt(plugin, null))
|
||||||
@ -1140,8 +1138,8 @@ public class ActionFactory implements ConversationAbandonedListener {
|
|||||||
|
|
||||||
private void deleteAction(ConversationContext context) {
|
private void deleteAction(ConversationContext context) {
|
||||||
YamlConfiguration data = new YamlConfiguration();
|
YamlConfiguration data = new YamlConfiguration();
|
||||||
|
File actionsFile = new File(plugin.getDataFolder(), "actions.yml");
|
||||||
try {
|
try {
|
||||||
actionsFile = new File(plugin.getDataFolder(), "actions.yml");
|
|
||||||
data.load(actionsFile);
|
data.load(actionsFile);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -1173,8 +1171,8 @@ public class ActionFactory implements ConversationAbandonedListener {
|
|||||||
|
|
||||||
private void saveAction(ConversationContext context) {
|
private void saveAction(ConversationContext context) {
|
||||||
YamlConfiguration data = new YamlConfiguration();
|
YamlConfiguration data = new YamlConfiguration();
|
||||||
|
File actionsFile = new File(plugin.getDataFolder(), "actions.yml");
|
||||||
try {
|
try {
|
||||||
actionsFile = new File(plugin.getDataFolder(), "actions.yml");
|
|
||||||
data.load(actionsFile);
|
data.load(actionsFile);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
Loading…
Reference in New Issue
Block a user