Merge pull request #3175 from lucko/master

Fix for removed methods in Bukkit 1.12
This commit is contained in:
t00thpick1 2017-06-07 21:22:00 -04:00 committed by GitHub
commit 2cbd8789d8
5 changed files with 16 additions and 5 deletions

View File

@ -135,7 +135,7 @@
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.11.2-R0.1-SNAPSHOT</version>
<version>1.12-pre2-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>

View File

@ -25,7 +25,7 @@ public abstract class AutoUpdateConfigLoader extends ConfigLoader {
@Override
protected void loadFile() {
super.loadFile();
FileConfiguration internalConfig = YamlConfiguration.loadConfiguration(plugin.getResource(fileName));
FileConfiguration internalConfig = YamlConfiguration.loadConfiguration(plugin.getResourceAsReader(fileName));
Set<String> configKeys = config.getKeys(true);
Set<String> internalConfigKeys = internalConfig.getKeys(true);

View File

@ -1,5 +1,7 @@
package com.gmail.nossr50.config;
import java.io.InputStreamReader;
import org.bukkit.configuration.file.YamlConfiguration;
import com.gmail.nossr50.mcMMO;
@ -29,8 +31,9 @@ public class HiddenConfig {
}
public void load() {
if (mcMMO.p.getResource(fileName) != null) {
config = YamlConfiguration.loadConfiguration(mcMMO.p.getResource(fileName));
InputStreamReader reader = mcMMO.p.getResourceAsReader(fileName);
if (reader != null) {
config = YamlConfiguration.loadConfiguration(reader);
chunkletsEnabled = config.getBoolean("Options.Chunklets", true);
conversionRate = config.getInt("Options.ConversionRate", 1);
useEnchantmentBuffs = config.getBoolean("Options.EnchantmentBuffs", true);

View File

@ -2,6 +2,8 @@ package com.gmail.nossr50;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
@ -64,6 +66,7 @@ import com.gmail.nossr50.util.experience.FormulaManager;
import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
import com.gmail.nossr50.util.upgrade.UpgradeManager;
import com.google.common.base.Charsets;
import net.shatteredlands.shatt.backup.ZipLibrary;
@ -508,4 +511,9 @@ public class mcMMO extends JavaPlugin {
getLogger().info("To enable, set Mods.Entity_Mods_Enabled to TRUE in config.yml.");
}
}
public InputStreamReader getResourceAsReader(String fileName) {
InputStream in = getResource(fileName);
return in == null ? null : new InputStreamReader(in, Charsets.UTF_8);
}
}

View File

@ -16,7 +16,7 @@ public class ChildConfig extends AutoUpdateConfigLoader {
@Override
protected void loadKeys() {
config.setDefaults(YamlConfiguration.loadConfiguration(plugin.getResource("child.yml")));
config.setDefaults(YamlConfiguration.loadConfiguration(plugin.getResourceAsReader("child.yml")));
FamilyTree.clearRegistrations(); // when reloading, need to clear statics