Added bukkit.yml to conversion

This commit is contained in:
boy0001 2015-06-06 16:59:46 +10:00
parent eeea1f2d2d
commit a2480c0458
3 changed files with 26 additions and 1 deletions

View File

@ -8,7 +8,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> </properties>
<artifactId>PlotSquared</artifactId> <artifactId>PlotSquared</artifactId>
<version>2.11.11</version> <version>2.11.13</version>
<name>PlotSquared</name> <name>PlotSquared</name>
<packaging>jar</packaging> <packaging>jar</packaging>
<build> <build>

View File

@ -1,6 +1,12 @@
package com.intellectualcrafters.plot.database.plotme; package com.intellectualcrafters.plot.database.plotme;
import java.io.File; import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.sql.Connection; import java.sql.Connection;
import java.sql.DriverManager; import java.sql.DriverManager;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;

View File

@ -22,6 +22,11 @@ package com.intellectualcrafters.plot.database.plotme;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.sql.Connection; import java.sql.Connection;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@ -85,6 +90,17 @@ public class LikePlotMeConverter {
return plotConfig.getConfigurationSection("worlds").getKeys(false); return plotConfig.getConfigurationSection("worlds").getKeys(false);
} }
public void updateBukkitYml(String plugin) {
try {
Path path = Paths.get("bukkit.yml");
Charset charset = StandardCharsets.UTF_8;
String content = new String(Files.readAllBytes(path), charset);
content = content.replaceAll("PlotMe-DefaultGenerator", "PlotSquared");
content = content.replaceAll(plugin, "PlotSquared");
Files.write(path, content.getBytes(charset));
} catch (Exception e) {};
}
public boolean run(final APlotMeConnector connector) { public boolean run(final APlotMeConnector connector) {
try { try {
String dataFolder = getPlotMePath(); String dataFolder = getPlotMePath();
@ -113,6 +129,9 @@ public class LikePlotMeConverter {
sendMessage(" - " + dbPrefix + "Plots"); sendMessage(" - " + dbPrefix + "Plots");
final Set<String> worlds = getPlotMeWorlds(plotConfig); final Set<String> worlds = getPlotMeWorlds(plotConfig);
sendMessage("Updating bukkit.yml");
updateBukkitYml(plugin);
for (final String world : plotConfig.getConfigurationSection("worlds").getKeys(false)) { for (final String world : plotConfig.getConfigurationSection("worlds").getKeys(false)) {
sendMessage("Copying config for: " + world); sendMessage("Copying config for: " + world);
try { try {