From 45769d6e757b9c935f5fd1d0bc3e733310182910 Mon Sep 17 00:00:00 2001 From: rtm516 Date: Sun, 25 Oct 2020 14:38:40 +0000 Subject: [PATCH] Finally fix default port displaying and added better Jenkins messages --- Jenkinsfile | 33 ++++++++++++++++++- README.md | 14 -------- .../org/geysermc/connect/utils/Server.java | 6 ++-- 3 files changed, 35 insertions(+), 18 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 87deaf7..21dbca6 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -32,9 +32,40 @@ pipeline { post { always { + script { + def changeLogSets = currentBuild.changeSets + def message = "**Changes:**" + + if (changeLogSets.size() == 0) { + message += "\n*No changes.*" + } else { + def repositoryUrl = scm.userRemoteConfigs[0].url.replace(".git", "") + def count = 0; + def extra = 0; + for (int i = 0; i < changeLogSets.size(); i++) { + def entries = changeLogSets[i].items + for (int j = 0; j < entries.length; j++) { + if (count <= 10) { + def entry = entries[j] + def commitId = entry.commitId.substring(0, 6) + message += "\n - [`${commitId}`](${repositoryUrl}/commit/${entry.commitId}) ${entry.msg}" + count++ + } else { + extra++; + } + } + } + + if (extra != 0) { + message += "\n - ${extra} more commits" + } + } + + env.changes = message + } deleteDir() withCredentials([string(credentialsId: 'geyser-discord-webhook', variable: 'DISCORD_WEBHOOK')]) { - discordSend description: "**Build:** [${currentBuild.id}](${env.BUILD_URL})\n**Status:** [${currentBuild.currentResult}](${env.BUILD_URL})\n\n[**Artifacts on Jenkins**](https://ci.nukkitx.com/job/GeyserMC/job/GeyserConnect)", footer: 'NukkitX Jenkins', link: env.BUILD_URL, successful: currentBuild.resultIsBetterOrEqualTo('SUCCESS'), title: "${env.JOB_NAME} #${currentBuild.id}", webhookURL: DISCORD_WEBHOOK + discordSend description: "**Build:** [${currentBuild.id}](${env.BUILD_URL})\n**Status:** [${currentBuild.currentResult}](${env.BUILD_URL})\n${changes}\n\n[**Artifacts on Jenkins**](https://ci.nukkitx.com/job/GeyserMC/job/GeyserConnect)", footer: 'Cloudburst Jenkins', link: env.BUILD_URL, successful: currentBuild.resultIsBetterOrEqualTo('SUCCESS'), title: "${env.JOB_NAME} #${currentBuild.id}", webhookURL: DISCORD_WEBHOOK } } } diff --git a/README.md b/README.md index dabfd4b..f394d34 100644 --- a/README.md +++ b/README.md @@ -17,17 +17,3 @@ GeyserConnect is a server that Minecraft: Bedrock Edition clients can connect to If you wish to run this in docker and/or use DNS redirection please see the appropriate folders in this repo. #### Docker: [here](docker) #### DNS: [here](bind9) - -## TODO -- [x] Auto start Geyser instance -- [x] Transfer player to Geyser instance and connect to correct server -- [x] Server list - - [x] View - - [x] Add - - [x] Remove - - [x] Edit -- [x] Stop Geyser server after its idle for a while -- [x] Config file -- [x] Fix server images not loading straight away on Win10 -- [x] Per server online/offline mode -- [x] Add option to add a bedrock server diff --git a/src/main/java/org/geysermc/connect/utils/Server.java b/src/main/java/org/geysermc/connect/utils/Server.java index dd1392d..73ff139 100644 --- a/src/main/java/org/geysermc/connect/utils/Server.java +++ b/src/main/java/org/geysermc/connect/utils/Server.java @@ -35,13 +35,13 @@ import lombok.NoArgsConstructor; public class Server { private String address; - private int port = 25565; + private int port = -1; private boolean online = true; private boolean bedrock = false; private String name = null; public Server(String address) { - this(address, 25565); + this(address, -1); } public Server(String address, int port) { @@ -62,6 +62,6 @@ public class Server { @Override public String toString() { - return name != null ? name : address + (port != defaultPort() ? ":" + port : ""); + return name != null ? name : address + (getPort() != defaultPort() ? ":" + getPort() : ""); } }