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:
Ursprung
f74d36a1f9
Commit
94f2ea9b57
@ -35,7 +35,6 @@ import java.util.UUID;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when {@link ResourcePack}'s and {@link ResourcePackCDNEntry}'s are loaded within Geyser.
|
* Called when {@link ResourcePack}'s and {@link ResourcePackCDNEntry}'s are loaded within Geyser.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public abstract class GeyserDefineResourcePacksEvent implements Event {
|
public abstract class GeyserDefineResourcePacksEvent implements Event {
|
||||||
|
|
||||||
|
@ -39,5 +39,5 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public record GeyserLoadResourcePacksEvent(@Deprecated @NonNull List<Path> resourcePacks) implements Event {
|
public record GeyserLoadResourcePacksEvent(@NonNull List<Path> resourcePacks) implements Event {
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,7 @@ public interface GeyserConfiguration {
|
|||||||
|
|
||||||
boolean isForceResourcePacks();
|
boolean isForceResourcePacks();
|
||||||
|
|
||||||
List<String> getCdnResourcePacks();
|
List<String> getResourcePackUrls();
|
||||||
|
|
||||||
boolean isXboxAchievementsEnabled();
|
boolean isXboxAchievementsEnabled();
|
||||||
|
|
||||||
|
@ -137,8 +137,8 @@ public abstract class GeyserJacksonConfiguration implements GeyserConfiguration
|
|||||||
@JsonProperty("force-resource-packs")
|
@JsonProperty("force-resource-packs")
|
||||||
private boolean forceResourcePacks = true;
|
private boolean forceResourcePacks = true;
|
||||||
|
|
||||||
@JsonProperty("cdn-resource-packs")
|
@JsonProperty("resource-pack-urls")
|
||||||
private List<String> cdnResourcePacks = new ArrayList<>();
|
private List<String> resourcePackUrls = new ArrayList<>();
|
||||||
|
|
||||||
@JsonProperty("xbox-achievements-enabled")
|
@JsonProperty("xbox-achievements-enabled")
|
||||||
private boolean xboxAchievementsEnabled = false;
|
private boolean xboxAchievementsEnabled = false;
|
||||||
|
@ -62,8 +62,6 @@ public class ResourcePackLoader implements RegistryLoader<Path, Map<String, Reso
|
|||||||
|
|
||||||
static final PathMatcher PACK_MATCHER = FileSystems.getDefault().getPathMatcher("glob:**.{zip,mcpack}");
|
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"));
|
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<>();
|
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);
|
resourcePacks.add(skullResourcePack);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final Path cachedCdnPacksDirectory = GeyserImpl.getInstance().getBootstrap().getConfigFolder().resolve("cache").resolve("cdn-packs");
|
||||||
|
|
||||||
// Download CDN packs to get the pack uuid's
|
// Download CDN packs to get the pack uuid's
|
||||||
if (!Files.exists(CACHED_CDN_PACKS_DIRECTORY)) {
|
if (!Files.exists(cachedCdnPacksDirectory)) {
|
||||||
try {
|
try {
|
||||||
Files.createDirectories(CACHED_CDN_PACKS_DIRECTORY);
|
Files.createDirectories(cachedCdnPacksDirectory);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
GeyserImpl.getInstance().getLogger().error("Could not create cached packs directory", 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) {
|
for (String url: cdnPacks) {
|
||||||
int packHash = url.hashCode();
|
int packHash = url.hashCode();
|
||||||
Path cachedPath = CACHED_CDN_PACKS_DIRECTORY.resolve(packHash + ".zip");
|
Path cachedPath = cachedCdnPacksDirectory.resolve(packHash + ".zip");
|
||||||
WebUtils.downloadFile(url, cachedPath.toString());
|
WebUtils.downloadFile(url, cachedPath.toString());
|
||||||
|
|
||||||
ResourcePack cdnpack = readPack(cachedPath);
|
ResourcePack cdnpack = readPack(cachedPath);
|
||||||
|
@ -177,7 +177,7 @@ force-resource-packs: true
|
|||||||
|
|
||||||
# A list of links to send to the client to download resource packs from.
|
# 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.
|
# 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
|
# Example: GeyserOptionalPack
|
||||||
- "https://ci.opencollab.dev/job/GeyserMC/job/GeyserOptionalPack/job/master/lastSuccessfulBuild/artifact/GeyserOptionalPack.mcpack"
|
- "https://ci.opencollab.dev/job/GeyserMC/job/GeyserOptionalPack/job/master/lastSuccessfulBuild/artifact/GeyserOptionalPack.mcpack"
|
||||||
|
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren