diff --git a/PlotSquared/pom.xml b/PlotSquared/pom.xml index 63c836f3b..2accbf031 100644 --- a/PlotSquared/pom.xml +++ b/PlotSquared/pom.xml @@ -8,7 +8,7 @@ UTF-8 PlotSquared - 2.11.11 + 2.11.13 PlotSquared jar diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/plotme/ClassicPlotMeConnector.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/plotme/ClassicPlotMeConnector.java index b7fdab3e9..468886f41 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/plotme/ClassicPlotMeConnector.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/plotme/ClassicPlotMeConnector.java @@ -1,6 +1,12 @@ package com.intellectualcrafters.plot.database.plotme; 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.DriverManager; import java.sql.PreparedStatement; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/plotme/LikePlotMeConverter.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/plotme/LikePlotMeConverter.java index b02104e23..88167032c 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/plotme/LikePlotMeConverter.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/plotme/LikePlotMeConverter.java @@ -22,6 +22,11 @@ package com.intellectualcrafters.plot.database.plotme; 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.util.ArrayList; import java.util.Arrays; @@ -85,6 +90,17 @@ public class LikePlotMeConverter { 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) { try { String dataFolder = getPlotMePath(); @@ -113,6 +129,9 @@ public class LikePlotMeConverter { sendMessage(" - " + dbPrefix + "Plots"); final Set worlds = getPlotMeWorlds(plotConfig); + sendMessage("Updating bukkit.yml"); + updateBukkitYml(plugin); + for (final String world : plotConfig.getConfigurationSection("worlds").getKeys(false)) { sendMessage("Copying config for: " + world); try {