mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-26 07:06:44 +01:00
*And this
This commit is contained in:
parent
7bdcde6d24
commit
a2a43816ad
@ -452,10 +452,10 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
|||||||
TaskManager.runTaskLaterAsync(new Runnable() {
|
TaskManager.runTaskLaterAsync(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (new LikePlotMeConverter().run(new ClassicPlotMeConnector())) {
|
if (new LikePlotMeConverter("PlotMe").run(new ClassicPlotMeConnector())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (new LikePlotMeConverter().run(new PlotMeConnector_017())) {
|
if (new LikePlotMeConverter("PlotMe").run(new PlotMeConnector_017())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,12 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
|||||||
|
|
||||||
public class LikePlotMeConverter {
|
public class LikePlotMeConverter {
|
||||||
|
|
||||||
|
private final String plugin;
|
||||||
|
|
||||||
|
public LikePlotMeConverter(String plugin) {
|
||||||
|
this.plugin = plugin;
|
||||||
|
}
|
||||||
|
|
||||||
public static String getWorld(String world) {
|
public static String getWorld(String world) {
|
||||||
for (World newWorld : Bukkit.getWorlds()) {
|
for (World newWorld : Bukkit.getWorlds()) {
|
||||||
if (newWorld.getName().equalsIgnoreCase(world)) {
|
if (newWorld.getName().equalsIgnoreCase(world)) {
|
||||||
@ -48,7 +54,7 @@ public class LikePlotMeConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getPlotMePath() {
|
public String getPlotMePath() {
|
||||||
return new File(".").getAbsolutePath() + File.separator + "plugins" + File.separator + "PlotMe" + File.separator;
|
return new File(".").getAbsolutePath() + File.separator + "plugins" + File.separator + plugin + File.separator;
|
||||||
}
|
}
|
||||||
|
|
||||||
public FileConfiguration getPlotMeConfig(String dataFolder) {
|
public FileConfiguration getPlotMeConfig(String dataFolder) {
|
||||||
@ -66,7 +72,7 @@ public class LikePlotMeConverter {
|
|||||||
public void mergeWorldYml(FileConfiguration plotConfig) {
|
public void mergeWorldYml(FileConfiguration plotConfig) {
|
||||||
try {
|
try {
|
||||||
File genConfig =
|
File genConfig =
|
||||||
new File("plugins" + File.separator + "PlotMe" + File.separator + "PlotMe-DefaultGenerator" + File.separator + "config.yml");
|
new File("plugins" + File.separator + plugin + File.separator + "PlotMe-DefaultGenerator" + File.separator + "config.yml");
|
||||||
if (genConfig.exists()) {
|
if (genConfig.exists()) {
|
||||||
YamlConfiguration yml = YamlConfiguration.loadConfiguration(genConfig);
|
YamlConfiguration yml = YamlConfiguration.loadConfiguration(genConfig);
|
||||||
for (String key : yml.getKeys(true)) {
|
for (String key : yml.getKeys(true)) {
|
||||||
@ -91,8 +97,10 @@ public class LikePlotMeConverter {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String content = new String(Files.readAllBytes(path), StandardCharsets.UTF_8);
|
String content = new String(Files.readAllBytes(path), StandardCharsets.UTF_8);
|
||||||
content = content.replaceAll("PlotMe-DefaultGenerator", "PlotSquared");
|
content = content.replace("PlotMe-DefaultGenerator", "PlotSquared");
|
||||||
content = content.replaceAll("PlotMe", "PlotSquared");
|
content = content.replace("PlotMe", "PlotSquared");
|
||||||
|
content = content.replace("AthionPlots", "PlotSquared");
|
||||||
|
content = content.replace("PlotZWorld", "PlotSquared");
|
||||||
Files.write(path, content.getBytes(StandardCharsets.UTF_8));
|
Files.write(path, content.getBytes(StandardCharsets.UTF_8));
|
||||||
} catch (IOException ignored) {}
|
} catch (IOException ignored) {}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user