Fix 1.12 support (Fixes #119)

This commit is contained in:
games647 2017-06-04 20:06:38 +02:00 committed by zml
parent 28718bb5f1
commit 0917a6b4d6
2 changed files with 21 additions and 13 deletions

23
pom.xml
View File

@ -30,10 +30,10 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version> <version>3.6.1</version>
<configuration> <configuration>
<source>1.6</source> <source>1.8</source>
<target>1.6</target> <target>1.8</target>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>
@ -63,22 +63,29 @@
</plugin> </plugin>
</plugins> </plugins>
</build> </build>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.bukkit</groupId> <groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId> <artifactId>bukkit</artifactId>
<version>1.9-R0.1-SNAPSHOT</version> <version>1.12-pre2-SNAPSHOT</version>
<type>jar</type> <type>jar</type>
</dependency> </dependency>
<dependency> <dependency>
<groupId>ru.tehkode</groupId> <groupId>ru.tehkode</groupId>
<artifactId>PermissionsEx</artifactId> <artifactId>PermissionsEx</artifactId>
<version>1.22</version> <version>1.23.1</version>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>net.milkbowl.vault</groupId> <groupId>net.milkbowl.vault</groupId>
<artifactId>VaultAPI</artifactId> <artifactId>VaultAPI</artifactId>
<version>1.5</version> <version>1.6</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
</dependencies> </dependencies>
@ -89,11 +96,11 @@
</repository> </repository>
<repository> <repository>
<id>vault-repo</id> <id>vault-repo</id>
<url>http://nexus.theyeticave.net/content/repositories/pub_releases</url> <url>http://nexus.hc.to/content/repositories/pub_releases</url>
</repository> </repository>
<repository> <repository>
<id>pex-repo</id> <id>pex-repo</id>
<url>http://pex-repo.aoeu.xyz</url> <url>https://pex-repo.aoeu.xyz/</url>
</repository> </repository>
</repositories> </repositories>
<properties> <properties>

View File

@ -18,6 +18,7 @@
*/ */
package ru.tehkode.modifyworld.bukkit; package ru.tehkode.modifyworld.bukkit;
import java.io.InputStreamReader;
import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.InvalidConfigurationException; import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;
@ -132,7 +133,7 @@ public class Modifyworld extends JavaPlugin {
if (load != null) { if (load != null) {
YamlConfiguration conf = new YamlConfiguration(); YamlConfiguration conf = new YamlConfiguration();
conf.options().copyDefaults(true); conf.options().copyDefaults(true);
conf.load(load); conf.load(new InputStreamReader(load));
YamlConfiguration def = loadUnlocalized(path); YamlConfiguration def = loadUnlocalized(path);
if (def != null) { if (def != null) {
conf.setDefaults(def); conf.setDefaults(def);
@ -146,7 +147,7 @@ public class Modifyworld extends JavaPlugin {
InputStream load = getResource(path); InputStream load = getResource(path);
if (load != null) { if (load != null) {
YamlConfiguration conf = new YamlConfiguration(); YamlConfiguration conf = new YamlConfiguration();
conf.load(load); conf.load(new InputStreamReader(load));
return conf; return conf;
} }
return null; return null;
@ -160,7 +161,7 @@ public class Modifyworld extends JavaPlugin {
YamlConfiguration base = new YamlConfiguration(); YamlConfiguration base = new YamlConfiguration();
InputStream load = getResource("lang/" + locale.toString() + "/" + path); // Country-specific InputStream load = getResource("lang/" + locale.toString() + "/" + path); // Country-specific
if (load != null) { if (load != null) {
base.load(load); base.load(new InputStreamReader(load));
base.options().copyDefaults(true); base.options().copyDefaults(true);
YamlConfiguration def = loadBaseLanguage(path, locale); YamlConfiguration def = loadBaseLanguage(path, locale);
if (def == null) { if (def == null) {
@ -208,7 +209,7 @@ public class Modifyworld extends JavaPlugin {
InputStream defConfigStream = getLocalizedResource("config.yml"); InputStream defConfigStream = getLocalizedResource("config.yml");
if (defConfigStream != null) { if (defConfigStream != null) {
try { try {
this.config.load(defConfigStream); this.config.load(new InputStreamReader(defConfigStream));
} catch (Exception de) { } catch (Exception de) {
this.getLogger().severe("Default config file is broken. Please tell this to Modifyworld author."); this.getLogger().severe("Default config file is broken. Please tell this to Modifyworld author.");
} }
@ -219,7 +220,7 @@ public class Modifyworld extends JavaPlugin {
InputStream defConfigStream = getLocalizedResource("config.yml"); InputStream defConfigStream = getLocalizedResource("config.yml");
if (defConfigStream != null) { if (defConfigStream != null) {
this.config.setDefaults(YamlConfiguration.loadConfiguration(defConfigStream)); this.config.setDefaults(YamlConfiguration.loadConfiguration(new InputStreamReader(defConfigStream)));
} }
} }
} }