Offer Mod Info Screen
This commit is contained in:
parent
9d7fa9f925
commit
b959e17c18
7 changed files with 41 additions and 18 deletions
|
@ -40,6 +40,9 @@ import java.util.stream.Collectors;
|
|||
* For Details refer to {@link HelloServer}
|
||||
*/
|
||||
public class HelloClient extends DataHandler.FromServer {
|
||||
public interface IServerModMap extends Map<String, Pair<String, Integer>> {}
|
||||
public static class ServerModMap extends HashMap<String, Pair<String, Integer>> implements IServerModMap {}
|
||||
|
||||
public static DataHandlerDescriptor DESCRIPTOR = new DataHandlerDescriptor(new ResourceLocation(BCLib.MOD_ID, "hello_client"), HelloClient::new, false, false);
|
||||
|
||||
public HelloClient() {
|
||||
|
@ -132,7 +135,8 @@ public class HelloClient extends DataHandler.FromServer {
|
|||
}
|
||||
|
||||
String bclibVersion = "0.0.0";
|
||||
Map<String, Pair<String, Integer>> modVersion = new HashMap<>();
|
||||
|
||||
IServerModMap modVersion = new ServerModMap();
|
||||
List<AutoSync.AutoSyncTriple> autoSyncedFiles = null;
|
||||
List<SyncFolderDescriptor> autoSynFolders = null;
|
||||
|
||||
|
@ -145,7 +149,7 @@ public class HelloClient extends DataHandler.FromServer {
|
|||
|
||||
|
||||
//read Plugin Versions
|
||||
modVersion = new HashMap<>();
|
||||
modVersion = new ServerModMap();
|
||||
int count = buf.readInt();
|
||||
for (int i = 0; i < count; i++) {
|
||||
final String id = readString(buf);
|
||||
|
@ -374,7 +378,7 @@ public class HelloClient extends DataHandler.FromServer {
|
|||
}
|
||||
}
|
||||
|
||||
client.setScreen(new SyncFilesScreen(modFiles, configFiles, singleFiles, folderFiles, filesToRemove.size(), (downloadMods, downloadConfigs, downloadFiles, removeFiles) -> {
|
||||
client.setScreen(new SyncFilesScreen(modFiles, configFiles, singleFiles, folderFiles, filesToRemove.size(), modVersion, (downloadMods, downloadConfigs, downloadFiles, removeFiles) -> {
|
||||
if (downloadMods || downloadConfigs || downloadFiles) {
|
||||
BCLib.LOGGER.info("Updating local Files:");
|
||||
List<AutoSyncID.WithContentOverride> localChanges = new ArrayList<>(files.toArray().length);
|
||||
|
|
|
@ -156,7 +156,8 @@ public class SendFiles extends DataHandler.FromServer {
|
|||
if (e instanceof AutoFileSyncEntry.ForModFileRequest mase){
|
||||
removeAfter = path;
|
||||
int count = 0;
|
||||
String name = "bclib_synced_" + mase.modID + "_" + mase.version.replace(".", "_") + ".jar";
|
||||
final String prefix = "_bclib_synced";
|
||||
String name = prefix + mase.modID + "_" + mase.version.replace(".", "_") + ".jar";
|
||||
do {
|
||||
if (path != null) {
|
||||
//move to the same directory as the existing Mod
|
||||
|
@ -168,7 +169,7 @@ public class SendFiles extends DataHandler.FromServer {
|
|||
path = PathUtil.MOD_FOLDER.resolve(name);
|
||||
}
|
||||
count++;
|
||||
name = "bclib_synced_" + mase.modID + "_" + mase.version.replace(".", "_") + "__" + String.format("%03d", count) + ".jar";
|
||||
name = prefix + mase.modID + "_" + mase.version.replace(".", "_") + "__" + String.format("%03d", count) + ".jar";
|
||||
} while (path.toFile().exists());
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue