mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-08-05 12:02:53 +00:00
Update home names to prepend "home" to numeric home names
This commit is contained in:
parent
3ea3d18922
commit
79a44b919c
1 changed files with 32 additions and 0 deletions
|
@ -15,6 +15,7 @@ import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
|
||||||
|
@ -789,6 +790,36 @@ public class EssentialsUpgrade
|
||||||
doneFile.save();
|
doneFile.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateNumberedHomeNames()
|
||||||
|
{
|
||||||
|
if (doneFile.getBoolean("numberedHomeNames"))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
File[] files = new File(ess.getDataFolder(), "userdata").listFiles();
|
||||||
|
for(File file : files)
|
||||||
|
{
|
||||||
|
EssentialsConf config = new EssentialsConf(file);
|
||||||
|
config.load();
|
||||||
|
Set<String> homes = config.getConfigurationSection("homes").getKeys(true);
|
||||||
|
for(String s : homes)
|
||||||
|
{
|
||||||
|
if(!s.contains(".") && Util.isInt(s))
|
||||||
|
{
|
||||||
|
ConfigurationSection home = config.getConfigurationSection("homes." + s);
|
||||||
|
double x = home.getDouble("x"), y = home.getDouble("y"), z = home.getDouble("z"), yaw = home.getDouble("yaw"), pitch = home.getDouble("pitch");
|
||||||
|
config.setProperty("homes.home" + s, new Location(ess.getServer().getWorld(home.getString("world")), home.getDouble("x"), home.getDouble("y"), home.getDouble("z"), (float)home.getDouble("yaw"), (float)home.getDouble("pitch")));
|
||||||
|
config.removeProperty("homes." + s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
config.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
doneFile.setProperty("numberedHomeNames", true);
|
||||||
|
doneFile.save();
|
||||||
|
}
|
||||||
|
|
||||||
public void beforeSettings()
|
public void beforeSettings()
|
||||||
{
|
{
|
||||||
if (!ess.getDataFolder().exists())
|
if (!ess.getDataFolder().exists())
|
||||||
|
@ -811,6 +842,7 @@ public class EssentialsUpgrade
|
||||||
deleteOldItemsCsv();
|
deleteOldItemsCsv();
|
||||||
updateSpawnsToNewSpawnsConfig();
|
updateSpawnsToNewSpawnsConfig();
|
||||||
updateJailsToNewJailsConfig();
|
updateJailsToNewJailsConfig();
|
||||||
|
updateNumberedHomeNames();
|
||||||
warnMetrics();
|
warnMetrics();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue