mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2024-11-28 21:48:43 +01:00
Fix /dxl msg if no map config exists; resolves #144
This commit is contained in:
parent
258e115a38
commit
48744a2175
@ -61,7 +61,7 @@ public class MsgCommand extends BRCommand {
|
|||||||
try {
|
try {
|
||||||
int id = Integer.parseInt(args[1]);
|
int id = Integer.parseInt(args[1]);
|
||||||
|
|
||||||
WorldConfig config = editWorld.getResource().getConfig();
|
WorldConfig config = editWorld.getResource().getConfig(true);
|
||||||
|
|
||||||
if (args.length == 2) {
|
if (args.length == 2) {
|
||||||
String msg = config.getMessage(id);
|
String msg = config.getMessage(id);
|
||||||
|
@ -25,6 +25,7 @@ import io.github.dre2n.dungeonsxl.player.DEditPlayer;
|
|||||||
import io.github.dre2n.dungeonsxl.task.BackupResourceTask;
|
import io.github.dre2n.dungeonsxl.task.BackupResourceTask;
|
||||||
import io.github.dre2n.dungeonsxl.util.worldloader.WorldLoader;
|
import io.github.dre2n.dungeonsxl.util.worldloader.WorldLoader;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.WorldCreator;
|
import org.bukkit.WorldCreator;
|
||||||
@ -103,6 +104,27 @@ public class DResourceWorld {
|
|||||||
* @return the WorldConfig
|
* @return the WorldConfig
|
||||||
*/
|
*/
|
||||||
public WorldConfig getConfig() {
|
public WorldConfig getConfig() {
|
||||||
|
return getConfig(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param generate
|
||||||
|
* if a config should be generated if none exists
|
||||||
|
* @return the WorldConfig
|
||||||
|
*/
|
||||||
|
public WorldConfig getConfig(boolean generate) {
|
||||||
|
if (config == null) {
|
||||||
|
File file = new File(folder, "config.yml");
|
||||||
|
if (file.exists()) {
|
||||||
|
try {
|
||||||
|
file.createNewFile();
|
||||||
|
} catch (IOException exception) {
|
||||||
|
exception.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
config = new WorldConfig(file);
|
||||||
|
}
|
||||||
|
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user