-
Notifications
You must be signed in to change notification settings - Fork 0
/
get-core.ps1
62 lines (53 loc) · 1.48 KB
/
get-core.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
param (
[string]$proj = "paper"
)
function Get {
param (
[string]$url = $null
)
Try {
$jsonContent = Invoke-RestMethod -Uri $url
}
Catch {
if ($_.ErrorDetails.Message) {
Write-Host $_.ErrorDetails.Message
}
else {
Write-Host $_
}
exit 1
}
$versions = $jsonContent.versions
if ($null -eq $versions -or $versions.Count -eq 0) {
Write-Host "Error: No versions found in the API response."
exit 1
}
$getPapermcScript = Join-Path -Path (Join-Path -Path $PSScriptRoot -ChildPath "lib") -ChildPath "get-bukkit.ps1"
foreach ($version in $versions) {
Write-Host "Processing version $version..."
& $getPapermcScript $proj $version
}
Write-Host "All versions have been processed."
}
function Get-Spigot {
$getSpigotScript = Join-Path -Path (Join-Path -Path $PSScriptRoot -ChildPath "lib") -ChildPath "get-bukkit.ps1"
& $getSpigotScript $proj
}
switch ($proj) {
"purpur" {
Get "https://api.purpurmc.org/v2/purpur"
}
"paper" { Get "https://api.papermc.io/v2/projects/$proj" }
"folia" { Get "https://api.papermc.io/v2/projects/$proj" }
"shreddedpaper" { Get "https://api.multipaper.io/v2/projects/$proj" }
"spigot" {
Get-Spigot
}
"luminol" {
Get "https://api.luminolmc.com/v2/projects/luminol"
}
default {
Write-Error "Unknown Minecraft Server: $proj"
exit 1
}
}