@@ -394,6 +394,7 @@ public class Logic implements ApplicationListener{
|
||||
@Override
|
||||
public void dispose(){
|
||||
//save the settings before quitting
|
||||
netServer.admins.forceSave();
|
||||
Core.settings.manualSave();
|
||||
}
|
||||
|
||||
@@ -403,6 +404,7 @@ public class Logic implements ApplicationListener{
|
||||
universe.updateGlobal();
|
||||
|
||||
if(Core.settings.modified() && !state.isPlaying()){
|
||||
netServer.admins.forceSave();
|
||||
Core.settings.forceSave();
|
||||
}
|
||||
|
||||
|
||||
@@ -192,7 +192,8 @@ public class Map implements Comparable<Map>, Publishable{
|
||||
|
||||
@Override
|
||||
public Fi createSteamPreview(String id){
|
||||
return previewFile();
|
||||
//I have no idea what the hell I was even thinking with this preview stuff
|
||||
return Vars.mapPreviewDirectory.child((workshop && file.parent().exists() && file.parent().extEquals(".png") ? file.parent().name() : file.nameWithoutExtension()) + "_v2.png");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -24,6 +24,8 @@ public class Administration{
|
||||
public ObjectSet<String> dosBlacklist = new ObjectSet<>();
|
||||
public ObjectMap<String, Long> kickedIPs = new ObjectMap<>();
|
||||
|
||||
|
||||
private boolean modified, loaded;
|
||||
/** All player info. Maps UUIDs to info. This persists throughout restarts. Do not access directly. */
|
||||
private ObjectMap<String, PlayerInfo> playerInfo = new ObjectMap<>();
|
||||
|
||||
@@ -448,15 +450,23 @@ public class Administration{
|
||||
}
|
||||
|
||||
public void save(){
|
||||
Core.settings.putJson("player-data", playerInfo);
|
||||
Core.settings.putJson("ip-kicks", kickedIPs);
|
||||
Core.settings.putJson("ip-bans", String.class, bannedIPs);
|
||||
Core.settings.putJson("whitelist-ids", String.class, whitelist);
|
||||
Core.settings.putJson("banned-subnets", String.class, subnetBans);
|
||||
modified = true;
|
||||
}
|
||||
|
||||
public void forceSave(){
|
||||
if(modified && loaded){
|
||||
Core.settings.putJson("player-data", playerInfo);
|
||||
Core.settings.putJson("ip-kicks", kickedIPs);
|
||||
Core.settings.putJson("ip-bans", String.class, bannedIPs);
|
||||
Core.settings.putJson("whitelist-ids", String.class, whitelist);
|
||||
Core.settings.putJson("banned-subnets", String.class, subnetBans);
|
||||
modified = false;
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void load(){
|
||||
loaded = true;
|
||||
//load default data
|
||||
playerInfo = Core.settings.getJson("player-data", ObjectMap.class, ObjectMap::new);
|
||||
kickedIPs = Core.settings.getJson("ip-kicks", ObjectMap.class, ObjectMap::new);
|
||||
|
||||
@@ -227,13 +227,11 @@ public class MapsDialog extends BaseDialog{
|
||||
t.button("@custom", Styles.flatTogglet, () -> {
|
||||
showCustom = !showCustom;
|
||||
Core.settings.put("editorshowcustommaps", showCustom);
|
||||
Core.settings.forceSave();
|
||||
rebuildMaps();
|
||||
}).size(150f, 60f).checked(showCustom);
|
||||
t.button("@builtin", Styles.flatTogglet, () -> {
|
||||
showBuiltIn = !showBuiltIn;
|
||||
Core.settings.put("editorshowbuiltinmaps", showBuiltIn);
|
||||
Core.settings.forceSave();
|
||||
rebuildMaps();
|
||||
}).size(150f, 60f).checked(showBuiltIn);
|
||||
}).padBottom(10f);
|
||||
@@ -244,13 +242,11 @@ public class MapsDialog extends BaseDialog{
|
||||
t.button("@editor.filters.author", Styles.flatTogglet, () -> {
|
||||
searchAuthor = !searchAuthor;
|
||||
Core.settings.put("editorsearchauthor", searchAuthor);
|
||||
Core.settings.forceSave();
|
||||
rebuildMaps();
|
||||
}).size(150f, 60f).checked(searchAuthor);
|
||||
t.button("@editor.filters.description", Styles.flatTogglet, () -> {
|
||||
searchDescription = !searchDescription;
|
||||
Core.settings.put("editorsearchdescription", searchDescription);
|
||||
Core.settings.forceSave();
|
||||
rebuildMaps();
|
||||
}).size(150f, 60f).checked(searchDescription);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user