2022-07-31 20:41:56 +02:00
|
|
|
/*
|
2022-07-30 15:21:11 +02:00
|
|
|
* Copyright (C) 2022 FalsePattern
|
|
|
|
|
* All Rights Reserved
|
|
|
|
|
*
|
|
|
|
|
* The above copyright notice, this permission notice and the word "SNEED"
|
|
|
|
|
* shall be included in all copies or substantial portions of the Software.
|
|
|
|
|
*
|
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU Lesser General Public License as published by
|
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
2022-06-09 20:14:11 +02:00
|
|
|
package com.falsepattern.lib.updates;
|
|
|
|
|
|
2022-06-10 00:15:08 +02:00
|
|
|
import com.falsepattern.lib.StableAPI;
|
2022-06-09 20:14:11 +02:00
|
|
|
import lombok.Data;
|
2022-06-10 00:09:13 +02:00
|
|
|
import lombok.NonNull;
|
|
|
|
|
import org.apache.logging.log4j.Logger;
|
2022-06-09 20:14:11 +02:00
|
|
|
|
2023-07-16 12:31:04 +02:00
|
|
|
/**
|
|
|
|
|
* Information about a new version of a mod.
|
|
|
|
|
*/
|
2022-06-09 20:14:11 +02:00
|
|
|
@Data
|
2022-06-10 00:15:08 +02:00
|
|
|
@StableAPI(since = "0.8.0")
|
2022-06-09 20:14:11 +02:00
|
|
|
public class ModUpdateInfo {
|
2022-07-31 20:41:56 +02:00
|
|
|
@NonNull
|
2022-08-06 13:12:55 +02:00
|
|
|
@StableAPI.Expose
|
2022-07-31 20:41:56 +02:00
|
|
|
public final String modID;
|
|
|
|
|
@NonNull
|
2022-08-06 13:12:55 +02:00
|
|
|
@StableAPI.Expose
|
2022-07-31 20:41:56 +02:00
|
|
|
public final String currentVersion;
|
|
|
|
|
@NonNull
|
2022-08-06 13:12:55 +02:00
|
|
|
@StableAPI.Expose
|
2022-07-31 20:41:56 +02:00
|
|
|
public final String latestVersion;
|
|
|
|
|
@NonNull
|
2022-08-06 13:12:55 +02:00
|
|
|
@StableAPI.Expose
|
2022-07-31 20:41:56 +02:00
|
|
|
public final String updateURL;
|
2022-06-10 00:09:13 +02:00
|
|
|
|
2022-08-06 13:12:55 +02:00
|
|
|
@StableAPI.Expose
|
2022-06-10 00:09:13 +02:00
|
|
|
public void log(Logger logger) {
|
|
|
|
|
logger.info("Updates are available for mod {}: Currently installed version is {}, " +
|
2022-07-31 20:41:56 +02:00
|
|
|
"latest available version is {}. Update URL: {}", modID, currentVersion, latestVersion,
|
|
|
|
|
updateURL.isEmpty() ? "unavailable" : updateURL);
|
2022-06-10 00:09:13 +02:00
|
|
|
}
|
2022-06-09 20:14:11 +02:00
|
|
|
}
|