Make sure server does not offer non-existing config files
This commit is contained in:
parent
0f3df9b229
commit
911ca85b03
3 changed files with 13 additions and 4 deletions
|
@ -26,6 +26,7 @@ import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sent from the Server to the Client.
|
* Sent from the Server to the Client.
|
||||||
|
@ -69,8 +70,15 @@ public class HelloClient extends DataHandler {
|
||||||
BCLib.LOGGER.info(" - Listing Mod " + modID + " v" + ver);
|
BCLib.LOGGER.info(" - Listing Mod " + modID + " v" + ver);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//do only include files that exist on the server
|
||||||
|
final List<AutoFileSyncEntry> autoSyncFiles = DataExchange
|
||||||
|
.getInstance()
|
||||||
|
.autoSyncFiles
|
||||||
|
.stream()
|
||||||
|
.filter(e -> e.fileName.exists())
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
//send config Data
|
//send config Data
|
||||||
final List<AutoFileSyncEntry> autoSyncFiles = DataExchange.getInstance().autoSyncFiles;
|
|
||||||
buf.writeInt(autoSyncFiles.size());
|
buf.writeInt(autoSyncFiles.size());
|
||||||
for (AutoFileSyncEntry entry : autoSyncFiles) {
|
for (AutoFileSyncEntry entry : autoSyncFiles) {
|
||||||
//System.out.println("Serializing " + entry.getFileHash());
|
//System.out.println("Serializing " + entry.getFileHash());
|
||||||
|
@ -123,7 +131,7 @@ public class HelloClient extends DataHandler {
|
||||||
String ver = getModVersion(e.getKey());
|
String ver = getModVersion(e.getKey());
|
||||||
BCLib.LOGGER.info(" - " + e.getKey() + " (client="+ver+", server="+ver+")");
|
BCLib.LOGGER.info(" - " + e.getKey() + " (client="+ver+", server="+ver+")");
|
||||||
}
|
}
|
||||||
|
|
||||||
BCLib.LOGGER.info("Server offered Files to sync.");
|
BCLib.LOGGER.info("Server offered Files to sync.");
|
||||||
for (DataExchange.AutoSyncTriple e : autoSyncedFiles) {
|
for (DataExchange.AutoSyncTriple e : autoSyncedFiles) {
|
||||||
boolean willRequest = false;
|
boolean willRequest = false;
|
||||||
|
|
|
@ -22,6 +22,7 @@ public abstract class Config {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Config(String modID, String group, boolean autoSync) {
|
protected Config(String modID, String group, boolean autoSync) {
|
||||||
|
BCLib.LOGGER.info("Registered Config " + modID+"."+group+" ("+autoSync+")");
|
||||||
this.keeper = new ConfigKeeper(modID, group);
|
this.keeper = new ConfigKeeper(modID, group);
|
||||||
this.registerEntries();
|
this.registerEntries();
|
||||||
this.autoSync = autoSync;
|
this.autoSync = autoSync;
|
||||||
|
|
|
@ -6,9 +6,9 @@
|
||||||
"bclib.datafixer.backupWarning.nofixes": "Continue Without Fixes",
|
"bclib.datafixer.backupWarning.nofixes": "Continue Without Fixes",
|
||||||
"bclib.datafixer.backupWarning.continue": "Continue Without Backup",
|
"bclib.datafixer.backupWarning.continue": "Continue Without Backup",
|
||||||
"bclib.datafixer.bclibmissmatch.title": "Version Mismatch",
|
"bclib.datafixer.bclibmissmatch.title": "Version Mismatch",
|
||||||
"bclib.datafixer.bclibmissmatch.message": "The Version of BCLib on the server and this client do not match. This will cause problems when playing.\n\nDo you want to automatically download the BCLib-Version from the server. You will need to delete the old version from your Mods Directory and restart the game.",
|
"bclib.datafixer.bclibmissmatch.message": "The Version of BCLib on the server and this client do not match. This will cause problems when playing.\n\nDo you want to automatically download the BCLib-Version from the server. You will need to manually delete the old version from your Mods Directory.",
|
||||||
"bclib.datafixer.syncfiles.title": "Mismatching (Config-)Files",
|
"bclib.datafixer.syncfiles.title": "Mismatching (Config-)Files",
|
||||||
"bclib.datafixer.syncfiles.message": "Some Files on the Server doe not match the versions on the client.\n\nDo you want to replace the local versions with the ones from the server?",
|
"bclib.datafixer.syncfiles.message": "Some Files on the Server do not match the versions on the client.\n\nDo you want to replace the local versions with the ones from the server?",
|
||||||
"bclib.datafixer.confirmrestart.title": "Restart Required",
|
"bclib.datafixer.confirmrestart.title": "Restart Required",
|
||||||
"bclib.datafixer.confirmrestart.message": "The requested files were processed. You need o restart Minecraft now."
|
"bclib.datafixer.confirmrestart.message": "The requested files were processed. You need o restart Minecraft now."
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue