3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-11-19 22:40:18 +01:00

Rename cdn-resource-packs to resource-pack-urls, fix test, remove duplicate deprecation annotation

Dieser Commit ist enthalten in:
onebeastchris 2023-10-10 23:02:37 +02:00
Ursprung f74d36a1f9
Commit 94f2ea9b57
6 geänderte Dateien mit 11 neuen und 12 gelöschten Zeilen

Datei anzeigen

@ -35,7 +35,6 @@ import java.util.UUID;
/**
* Called when {@link ResourcePack}'s and {@link ResourcePackCDNEntry}'s are loaded within Geyser.
*
*/
public abstract class GeyserDefineResourcePacksEvent implements Event {

Datei anzeigen

@ -39,5 +39,5 @@ import java.util.List;
*/
@Deprecated
public record GeyserLoadResourcePacksEvent(@Deprecated @NonNull List<Path> resourcePacks) implements Event {
public record GeyserLoadResourcePacksEvent(@NonNull List<Path> resourcePacks) implements Event {
}

Datei anzeigen

@ -96,7 +96,7 @@ public interface GeyserConfiguration {
boolean isForceResourcePacks();
List<String> getCdnResourcePacks();
List<String> getResourcePackUrls();
boolean isXboxAchievementsEnabled();

Datei anzeigen

@ -137,8 +137,8 @@ public abstract class GeyserJacksonConfiguration implements GeyserConfiguration
@JsonProperty("force-resource-packs")
private boolean forceResourcePacks = true;
@JsonProperty("cdn-resource-packs")
private List<String> cdnResourcePacks = new ArrayList<>();
@JsonProperty("resource-pack-urls")
private List<String> resourcePackUrls = new ArrayList<>();
@JsonProperty("xbox-achievements-enabled")
private boolean xboxAchievementsEnabled = false;

Datei anzeigen

@ -62,8 +62,6 @@ public class ResourcePackLoader implements RegistryLoader<Path, Map<String, Reso
static final PathMatcher PACK_MATCHER = FileSystems.getDefault().getPathMatcher("glob:**.{zip,mcpack}");
private static final Path CACHED_CDN_PACKS_DIRECTORY = GeyserImpl.getInstance().getBootstrap().getConfigFolder().resolve("cache").resolve("cdn-packs");
private static final boolean SHOW_RESOURCE_PACK_LENGTH_WARNING = Boolean.parseBoolean(System.getProperty("Geyser.ShowResourcePackLengthWarning", "true"));
public static List<ResourcePackCDNEntry> RESOURCE_PACK_CDN_ENTRY_LIST = new ArrayList<>();
@ -102,19 +100,21 @@ public class ResourcePackLoader implements RegistryLoader<Path, Map<String, Reso
resourcePacks.add(skullResourcePack);
}
final Path cachedCdnPacksDirectory = GeyserImpl.getInstance().getBootstrap().getConfigFolder().resolve("cache").resolve("cdn-packs");
// Download CDN packs to get the pack uuid's
if (!Files.exists(CACHED_CDN_PACKS_DIRECTORY)) {
if (!Files.exists(cachedCdnPacksDirectory)) {
try {
Files.createDirectories(CACHED_CDN_PACKS_DIRECTORY);
Files.createDirectories(cachedCdnPacksDirectory);
} catch (IOException e) {
GeyserImpl.getInstance().getLogger().error("Could not create cached packs directory", e);
}
}
List<String> cdnPacks = GeyserImpl.getInstance().getConfig().getCdnResourcePacks();
List<String> cdnPacks = GeyserImpl.getInstance().getConfig().getResourcePackUrls();
for (String url: cdnPacks) {
int packHash = url.hashCode();
Path cachedPath = CACHED_CDN_PACKS_DIRECTORY.resolve(packHash + ".zip");
Path cachedPath = cachedCdnPacksDirectory.resolve(packHash + ".zip");
WebUtils.downloadFile(url, cachedPath.toString());
ResourcePack cdnpack = readPack(cachedPath);

Datei anzeigen

@ -177,7 +177,7 @@ force-resource-packs: true
# A list of links to send to the client to download resource packs from.
# These must be direct links to the resource pack, not a link to a page containing the resource pack.
cdn-resource-packs:
resource-pack-urls:
# Example: GeyserOptionalPack
- "https://ci.opencollab.dev/job/GeyserMC/job/GeyserOptionalPack/job/master/lastSuccessfulBuild/artifact/GeyserOptionalPack.mcpack"