-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #168 from KevinDaGame/develop
v8.8.0
- Loading branch information
Showing
13 changed files
with
102 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
VoxelSniperCore/src/main/java/com/github/kevindagame/service/GithubService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.github.kevindagame.service | ||
|
||
import com.github.kevindagame.util.Release | ||
import com.github.kevindagame.util.VersionChecker | ||
import com.google.gson.Gson | ||
import java.io.InputStreamReader | ||
import java.net.HttpURLConnection | ||
import java.net.URL | ||
|
||
class GithubService { | ||
private val releasesApiUrl = "https://api.github.com/repos/${VersionChecker.REPOSITORY_OWNER}/${VersionChecker.REPOSITORY_NAME}/releases" | ||
|
||
/** | ||
* Gets the latest version info from the GitHub API. | ||
* @return The latest version info as a list of releases. | ||
*/ | ||
fun getReleasesFromApi(): List<Release> { | ||
return try { | ||
val conn = URL(releasesApiUrl).openConnection() as HttpURLConnection | ||
conn.addRequestProperty("User-Agent", "Mozilla/5.0") | ||
val reader = InputStreamReader(conn.inputStream) | ||
val releases = Gson().fromJson(reader, Array<Release>::class.java) | ||
reader.close() | ||
conn.disconnect() | ||
releases.filterNot { it.prerelease }.toList() | ||
} catch (e: Exception) { | ||
System.err.println("Failed to check for a new version of VoxelSniper-Reimagined.") | ||
emptyList() | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
VoxelSniperCore/src/test/java/com/github/kevindagame/voxelsniper/biome/VoxelBiomeTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.github.kevindagame.voxelsniper.biome; | ||
|
||
import com.github.kevindagame.voxelsniper.Version; | ||
import junit.framework.TestCase; | ||
|
||
public class VoxelBiomeTest extends TestCase { | ||
|
||
public void testTestToString() { | ||
VoxelBiome namespaced = new VoxelBiome("namespace", "key", Version.V1_16); | ||
VoxelBiome onlyKey = new VoxelBiome("key"); | ||
assertEquals("namespace:key", namespaced.toString()); | ||
assertEquals("key", onlyKey.toString()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
voxelsniper.version=8.8.0 |