File tree Expand file tree Collapse file tree
src/main/java/net/azisaba/kuvel Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1414 if : ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}
1515 name : Build with Java 17
1616 runs-on : ubuntu-latest
17- timeout-minutes : 10
1817 permissions :
1918 contents : read
2019 steps :
Original file line number Diff line number Diff line change 6464 </build >
6565
6666 <repositories >
67+ <repository >
68+ <id >central</id >
69+ <url >https://repo.maven.apache.org/maven2</url >
70+ </repository >
6771 <repository >
6872 <id >velocity</id >
69- <url >https://nexus.velocitypowered.com /repository/maven-public/</url >
73+ <url >https://repo.papermc.io /repository/maven-public/</url >
7074 </repository >
7175 </repositories >
7276
Original file line number Diff line number Diff line change @@ -221,7 +221,17 @@ public void shutdown() {
221221 * @param serverName The name of the server.
222222 */
223223 public void registerPod (Pod pod , String serverName ) {
224+ var currentServer = plugin .getProxy ().getServer (serverName );
225+
226+ if (currentServer .isPresent () && podUidAndServerNameMap .getUidFromServerName (serverName ) == null ) {
227+ plugin
228+ .getLogger ()
229+ .warn ("Skipped registering server " + serverName + " because the name is already used" );
230+ return ;
231+ }
232+
224233 InetSocketAddress address = new InetSocketAddress (pod .getStatus ().getPodIP (), 25565 );
234+ currentServer .ifPresent (server -> plugin .getProxy ().unregisterServer (server .getServerInfo ()));
225235 plugin .getProxy ().registerServer (new ServerInfo (serverName , address ));
226236 podUidAndServerNameMap .register (pod .getMetadata ().getUid (), serverName );
227237
You can’t perform that action at this time.
0 commit comments