This commit is contained in:
Telesphoreo 2022-04-06 23:14:44 -05:00
parent ea862e152f
commit ca18b12164
2 changed files with 34 additions and 10 deletions

16
Jenkinsfile vendored Normal file
View File

@ -0,0 +1,16 @@
pipeline {
agent any
stages {
stage('build') {
steps {
sh './gradlew build javadoc publish --no-daemon'
}
}
}
post {
always {
archiveArtifacts artifacts: 'build/libs/*.jar', fingerprint: true
deleteWs()
}
}
}

View File

@ -66,12 +66,14 @@ public class UpdateChecker extends PlexBase
case "behind" -> obj.get("behind_by").getAsInt(); case "behind" -> obj.get("behind_by").getAsInt();
default -> -1; default -> -1;
}; };
} catch (JsonSyntaxException | NumberFormatException e) }
catch (JsonSyntaxException | NumberFormatException e)
{ {
e.printStackTrace(); e.printStackTrace();
return -1; return -1;
} }
} catch (IOException e) }
catch (IOException e)
{ {
e.printStackTrace(); e.printStackTrace();
return -1; return -1;
@ -84,14 +86,16 @@ public class UpdateChecker extends PlexBase
{ {
distance = fetchDistanceFromGitHub("plexusorg/Plex", "master", Plex.build.head); distance = fetchDistanceFromGitHub("plexusorg/Plex", "master", Plex.build.head);
PlexLog.debug("Never checked for updates, checking now..."); PlexLog.debug("Never checked for updates, checking now...");
} else }
else
{ {
// If the request isn't asked to be cached, fetch it // If the request isn't asked to be cached, fetch it
if (!cached) if (!cached)
{ {
distance = fetchDistanceFromGitHub("plexusorg/Plex", "master", Plex.build.head); distance = fetchDistanceFromGitHub("plexusorg/Plex", "master", Plex.build.head);
PlexLog.debug("We have checked for updates before, but this request was not asked to be cached."); PlexLog.debug("We have checked for updates before, but this request was not asked to be cached.");
} else }
else
{ {
PlexLog.debug("We have checked for updates before, using cache."); PlexLog.debug("We have checked for updates before, using cache.");
} }
@ -121,14 +125,16 @@ public class UpdateChecker extends PlexBase
{ {
distance = fetchDistanceFromGitHub("plexusorg/Plex", "master", Plex.build.head); distance = fetchDistanceFromGitHub("plexusorg/Plex", "master", Plex.build.head);
PlexLog.debug("Never checked for updates, checking now..."); PlexLog.debug("Never checked for updates, checking now...");
} else }
else
{ {
// If the request isn't asked to be cached, fetch it // If the request isn't asked to be cached, fetch it
if (!cached) if (!cached)
{ {
distance = fetchDistanceFromGitHub("plexusorg/Plex", "master", Plex.build.head); distance = fetchDistanceFromGitHub("plexusorg/Plex", "master", Plex.build.head);
PlexLog.debug("We have checked for updates before, but this request was not asked to be cached."); PlexLog.debug("We have checked for updates before, but this request was not asked to be cached.");
} else }
else
{ {
PlexLog.debug("We have checked for updates before, using cache."); PlexLog.debug("We have checked for updates before, using cache.");
} }
@ -174,15 +180,17 @@ public class UpdateChecker extends PlexBase
{ {
FileUtils.copyURLToFile( FileUtils.copyURLToFile(
new URL(DOWNLOAD_PAGE + "lastSuccessfulBuild/artifact/build/libs/" + name), new URL(DOWNLOAD_PAGE + "lastSuccessfulBuild/artifact/build/libs/" + name),
new File(Bukkit.getUpdateFolder(), name) new File(Bukkit.getUpdateFolderFile(), name)
); );
PlexLog.log("Saved new jar. Please restart your server."); PlexLog.log("Saved new jar. Please restart your server.");
} catch (IOException e) }
catch (IOException e)
{ {
e.printStackTrace(); e.printStackTrace();
} }
}); });
} catch (IOException e) }
catch (IOException e)
{ {
e.printStackTrace(); e.printStackTrace();
} }