mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-11-24 03:25:24 +01:00
Should fix broken config generation some people have been getting
This commit is contained in:
parent
94c794de6f
commit
38c30f5ecd
@ -102,7 +102,7 @@ public ConfigurationManager(WorldGuardPlugin plugin) {
|
||||
*/
|
||||
public void load() {
|
||||
// Create the default configuration file
|
||||
WorldGuardPlugin.createDefaultConfiguration(
|
||||
plugin.createDefaultConfiguration(
|
||||
new File(plugin.getDataFolder(), "config.yml"), "config.yml");
|
||||
|
||||
Configuration config = plugin.getConfiguration();
|
||||
|
@ -170,8 +170,8 @@ public WorldConfiguration(WorldGuardPlugin plugin, String worldName) {
|
||||
this.worldName = worldName;
|
||||
this.parentConfig = plugin.getConfiguration();
|
||||
|
||||
WorldGuardPlugin.createDefaultConfiguration(configFile, "config_world.yml");
|
||||
WorldGuardPlugin.createDefaultConfiguration(blacklistFile, "blacklist.txt");
|
||||
plugin.createDefaultConfiguration(configFile, "config_world.yml");
|
||||
plugin.createDefaultConfiguration(blacklistFile, "blacklist.txt");
|
||||
|
||||
config = new Configuration(this.configFile);
|
||||
loadConfiguration();
|
||||
|
@ -20,6 +20,7 @@
|
||||
package com.sk89q.worldguard.bukkit;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@ -27,8 +28,10 @@
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.jar.JarFile;
|
||||
import java.util.logging.Filter;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.zip.ZipEntry;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
@ -669,7 +672,7 @@ public LocalPlayer wrapPlayer(Player player) {
|
||||
* @param actual
|
||||
* @param defaultName
|
||||
*/
|
||||
public static void createDefaultConfiguration(File actual,
|
||||
public void createDefaultConfiguration(File actual,
|
||||
String defaultName) {
|
||||
|
||||
// Make parent directories
|
||||
@ -682,8 +685,16 @@ public static void createDefaultConfiguration(File actual,
|
||||
return;
|
||||
}
|
||||
|
||||
InputStream input = WorldGuardPlugin.class
|
||||
.getResourceAsStream("/defaults/" + defaultName);
|
||||
InputStream input =
|
||||
null;
|
||||
try {
|
||||
JarFile file = new JarFile(getFile());
|
||||
ZipEntry copy = file.getEntry("defaults" + File.separator + defaultName);
|
||||
if (copy == null) throw new FileNotFoundException();
|
||||
input = file.getInputStream(copy);
|
||||
} catch (IOException e) {
|
||||
logger.severe(getDescription().getName() + ": Unable to read default configuration: " + defaultName);
|
||||
}
|
||||
|
||||
if (input != null) {
|
||||
FileOutputStream output = null;
|
||||
|
Loading…
Reference in New Issue
Block a user