@@ -394,6 +394,7 @@ public class Logic implements ApplicationListener{
|
|||||||
@Override
|
@Override
|
||||||
public void dispose(){
|
public void dispose(){
|
||||||
//save the settings before quitting
|
//save the settings before quitting
|
||||||
|
netServer.admins.forceSave();
|
||||||
Core.settings.manualSave();
|
Core.settings.manualSave();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -403,6 +404,7 @@ public class Logic implements ApplicationListener{
|
|||||||
universe.updateGlobal();
|
universe.updateGlobal();
|
||||||
|
|
||||||
if(Core.settings.modified() && !state.isPlaying()){
|
if(Core.settings.modified() && !state.isPlaying()){
|
||||||
|
netServer.admins.forceSave();
|
||||||
Core.settings.forceSave();
|
Core.settings.forceSave();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -192,7 +192,8 @@ public class Map implements Comparable<Map>, Publishable{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Fi createSteamPreview(String id){
|
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
|
@Override
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ public class Administration{
|
|||||||
public ObjectSet<String> dosBlacklist = new ObjectSet<>();
|
public ObjectSet<String> dosBlacklist = new ObjectSet<>();
|
||||||
public ObjectMap<String, Long> kickedIPs = new ObjectMap<>();
|
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. */
|
/** All player info. Maps UUIDs to info. This persists throughout restarts. Do not access directly. */
|
||||||
private ObjectMap<String, PlayerInfo> playerInfo = new ObjectMap<>();
|
private ObjectMap<String, PlayerInfo> playerInfo = new ObjectMap<>();
|
||||||
|
|
||||||
@@ -448,15 +450,23 @@ public class Administration{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void save(){
|
public void save(){
|
||||||
Core.settings.putJson("player-data", playerInfo);
|
modified = true;
|
||||||
Core.settings.putJson("ip-kicks", kickedIPs);
|
}
|
||||||
Core.settings.putJson("ip-bans", String.class, bannedIPs);
|
|
||||||
Core.settings.putJson("whitelist-ids", String.class, whitelist);
|
public void forceSave(){
|
||||||
Core.settings.putJson("banned-subnets", String.class, subnetBans);
|
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")
|
@SuppressWarnings("unchecked")
|
||||||
private void load(){
|
private void load(){
|
||||||
|
loaded = true;
|
||||||
//load default data
|
//load default data
|
||||||
playerInfo = Core.settings.getJson("player-data", ObjectMap.class, ObjectMap::new);
|
playerInfo = Core.settings.getJson("player-data", ObjectMap.class, ObjectMap::new);
|
||||||
kickedIPs = Core.settings.getJson("ip-kicks", 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, () -> {
|
t.button("@custom", Styles.flatTogglet, () -> {
|
||||||
showCustom = !showCustom;
|
showCustom = !showCustom;
|
||||||
Core.settings.put("editorshowcustommaps", showCustom);
|
Core.settings.put("editorshowcustommaps", showCustom);
|
||||||
Core.settings.forceSave();
|
|
||||||
rebuildMaps();
|
rebuildMaps();
|
||||||
}).size(150f, 60f).checked(showCustom);
|
}).size(150f, 60f).checked(showCustom);
|
||||||
t.button("@builtin", Styles.flatTogglet, () -> {
|
t.button("@builtin", Styles.flatTogglet, () -> {
|
||||||
showBuiltIn = !showBuiltIn;
|
showBuiltIn = !showBuiltIn;
|
||||||
Core.settings.put("editorshowbuiltinmaps", showBuiltIn);
|
Core.settings.put("editorshowbuiltinmaps", showBuiltIn);
|
||||||
Core.settings.forceSave();
|
|
||||||
rebuildMaps();
|
rebuildMaps();
|
||||||
}).size(150f, 60f).checked(showBuiltIn);
|
}).size(150f, 60f).checked(showBuiltIn);
|
||||||
}).padBottom(10f);
|
}).padBottom(10f);
|
||||||
@@ -244,13 +242,11 @@ public class MapsDialog extends BaseDialog{
|
|||||||
t.button("@editor.filters.author", Styles.flatTogglet, () -> {
|
t.button("@editor.filters.author", Styles.flatTogglet, () -> {
|
||||||
searchAuthor = !searchAuthor;
|
searchAuthor = !searchAuthor;
|
||||||
Core.settings.put("editorsearchauthor", searchAuthor);
|
Core.settings.put("editorsearchauthor", searchAuthor);
|
||||||
Core.settings.forceSave();
|
|
||||||
rebuildMaps();
|
rebuildMaps();
|
||||||
}).size(150f, 60f).checked(searchAuthor);
|
}).size(150f, 60f).checked(searchAuthor);
|
||||||
t.button("@editor.filters.description", Styles.flatTogglet, () -> {
|
t.button("@editor.filters.description", Styles.flatTogglet, () -> {
|
||||||
searchDescription = !searchDescription;
|
searchDescription = !searchDescription;
|
||||||
Core.settings.put("editorsearchdescription", searchDescription);
|
Core.settings.put("editorsearchdescription", searchDescription);
|
||||||
Core.settings.forceSave();
|
|
||||||
rebuildMaps();
|
rebuildMaps();
|
||||||
}).size(150f, 60f).checked(searchDescription);
|
}).size(150f, 60f).checked(searchDescription);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -164,7 +164,10 @@ public class SWorkshop implements SteamUGCCallback{
|
|||||||
tags.add(p.steamTag());
|
tags.add(p.steamTag());
|
||||||
|
|
||||||
ugc.setItemTags(h, tags.toArray(String.class));
|
ugc.setItemTags(h, tags.toArray(String.class));
|
||||||
ugc.setItemPreview(h, p.createSteamPreview(sid).absolutePath());
|
String path = p.createSteamPreview(sid).absolutePath();
|
||||||
|
|
||||||
|
Log.info("PREVIEW @ @ @", ugc.setItemPreview(h, path), path, Fi.get(path).exists());
|
||||||
|
|
||||||
ugc.setItemContent(h, p.createSteamFolder(sid).absolutePath());
|
ugc.setItemContent(h, p.createSteamFolder(sid).absolutePath());
|
||||||
if(changelog == null){
|
if(changelog == null){
|
||||||
ugc.setItemVisibility(h, PublishedFileVisibility.Private);
|
ugc.setItemVisibility(h, PublishedFileVisibility.Private);
|
||||||
|
|||||||
@@ -116,6 +116,8 @@ public class ServerControl implements ApplicationListener{
|
|||||||
|
|
||||||
registerCommands();
|
registerCommands();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Core.app.post(() -> {
|
Core.app.post(() -> {
|
||||||
//try to load auto-update save if possible
|
//try to load auto-update save if possible
|
||||||
if(Config.autoUpdate.bool()){
|
if(Config.autoUpdate.bool()){
|
||||||
@@ -255,7 +257,10 @@ public class ServerControl implements ApplicationListener{
|
|||||||
|
|
||||||
//autosave settings once a minute
|
//autosave settings once a minute
|
||||||
float saveInterval = 60;
|
float saveInterval = 60;
|
||||||
Timer.schedule(() -> Core.settings.forceSave(), saveInterval, saveInterval);
|
Timer.schedule(() -> {
|
||||||
|
netServer.admins.forceSave();
|
||||||
|
Core.settings.forceSave();
|
||||||
|
}, saveInterval, saveInterval);
|
||||||
|
|
||||||
if(!mods.list().isEmpty()){
|
if(!mods.list().isEmpty()){
|
||||||
info("@ mods loaded.", mods.list().size);
|
info("@ mods loaded.", mods.list().size);
|
||||||
|
|||||||
Reference in New Issue
Block a user