adapt bossbar save
This commit is contained in:
@@ -23,6 +23,7 @@ public class BossBarManager implements I_BossBarManager {
|
||||
public void saveBossBarData(List<World> worlds){
|
||||
File file = new File(plugin.getDataFolder(),"world_data.yml");
|
||||
YamlConfiguration yml = new YamlConfiguration();
|
||||
char split = yml.options().pathSeparator();
|
||||
worlds.forEach(world -> {
|
||||
try{
|
||||
Object edb = DragonManager.getEnderDragonBattle(world);
|
||||
@@ -30,10 +31,13 @@ public class BossBarManager implements I_BossBarManager {
|
||||
if(BossBattleServer == null) BossBattleServer = edb.getClass().getDeclaredField("c");
|
||||
BossBattleServer.setAccessible(true);
|
||||
BossBattleServer bbs = (BossBattleServer) BossBattleServer.get(edb);
|
||||
String path = world.getName() + yml.options().pathSeparator();
|
||||
String path = world.getName() + split;
|
||||
yml.set(path+"title",bbs.title.getText());
|
||||
yml.set(path+"color",bbs.color.name());
|
||||
yml.set(path+"style",bbs.style.name());
|
||||
yml.set(path+"create_frog",bbs.p());
|
||||
yml.set(path+"darken_sky",bbs.n());
|
||||
yml.set(path+"play_boss_music",bbs.o());
|
||||
}catch (ReflectiveOperationException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -50,6 +54,7 @@ public class BossBarManager implements I_BossBarManager {
|
||||
if(!file.exists()) return;
|
||||
Lang.info("Enabling BossBar fix...");
|
||||
YamlConfiguration yml = new YamlConfiguration();
|
||||
char split = yml.options().pathSeparator();
|
||||
try{
|
||||
yml.load(file);
|
||||
}catch (InvalidConfigurationException | IOException e) {
|
||||
@@ -63,10 +68,13 @@ public class BossBarManager implements I_BossBarManager {
|
||||
if(BossBattleServer == null) BossBattleServer = edb.getClass().getDeclaredField("c");
|
||||
BossBattleServer.setAccessible(true);
|
||||
BossBattleServer bbs = (BossBattleServer) BossBattleServer.get(edb);
|
||||
String path = world.getName()+".";
|
||||
String path = world.getName()+split;
|
||||
bbs.title = CraftChatMessage.fromString(yml.getString(path+"title"), true)[0];
|
||||
bbs.color = BossBattle.BarColor.valueOf(yml.getString(path+"color"));
|
||||
bbs.style = BossBattle.BarStyle.valueOf(yml.getString(path+"style"));
|
||||
bbs.setCreateFog(yml.getBoolean(path+"create_frog",true));
|
||||
bbs.setDarkenSky(yml.getBoolean(path+"darken_sky",true));
|
||||
bbs.setPlayMusic(yml.getBoolean(path+"play_boss_music",true));
|
||||
}catch (ReflectiveOperationException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user