mirror of
https://github.com/PaperMC/Waterfall.git
synced 2024-12-26 18:47:43 +01:00
Reuse existing ServerInfo object when reloading config
Prior to this command, greload would replace the ServerInfo stored in bungee, this leads to the /glist counters being out of sync, but also potentially highlights futher complications in replacing live server objects, in that code doesn't generally expect/account for it to occur. This behavior is not as ideal as being able to use the new server info, which will have updated settings such as the motd, however, this change offers better expected behavior. We may wish to revisit this in the future, e.g. system property to force using the new objects at the risk of breaking the player count on reload?
This commit is contained in:
parent
b346845ec2
commit
ae319ce090
@ -1,4 +1,4 @@
|
||||
From 795dcb51d78f36d9beedc797720c9cf556231ddd Mon Sep 17 00:00:00 2001
|
||||
From 0bab27125230a455e4ca9f5664ac7ce02f15feb6 Mon Sep 17 00:00:00 2001
|
||||
From: Techcable <Techcable@outlook.com>
|
||||
Date: Thu, 28 Jan 2016 15:13:29 -0700
|
||||
Subject: [PATCH] Allow removing servers or changing addresses on reload
|
||||
@ -10,7 +10,7 @@ Kicks players on failure to move.
|
||||
Original Issue: https://github.com/WaterfallMC/Waterfall-Old/issues/17
|
||||
|
||||
diff --git a/proxy/src/main/java/net/md_5/bungee/conf/Configuration.java b/proxy/src/main/java/net/md_5/bungee/conf/Configuration.java
|
||||
index 886f3b4c..7c915e88 100644
|
||||
index 886f3b4c..193d8bce 100644
|
||||
--- a/proxy/src/main/java/net/md_5/bungee/conf/Configuration.java
|
||||
+++ b/proxy/src/main/java/net/md_5/bungee/conf/Configuration.java
|
||||
@@ -11,12 +11,15 @@ import java.util.UUID;
|
||||
@ -29,7 +29,7 @@ index 886f3b4c..7c915e88 100644
|
||||
import net.md_5.bungee.util.CaseInsensitiveMap;
|
||||
import net.md_5.bungee.util.CaseInsensitiveSet;
|
||||
|
||||
@@ -105,18 +108,31 @@ public abstract class Configuration implements ProxyConfig
|
||||
@@ -105,20 +108,38 @@ public abstract class Configuration implements ProxyConfig
|
||||
servers = new CaseInsensitiveMap<>( newServers );
|
||||
} else
|
||||
{
|
||||
@ -39,7 +39,6 @@ index 886f3b4c..7c915e88 100644
|
||||
- Preconditions.checkArgument( newServers.containsKey( oldServer.getName() ), "Server %s removed on reload!", oldServer.getName() );
|
||||
- }
|
||||
+ Map<String, ServerInfo> oldServers = this.servers;
|
||||
+ this.servers = new CaseInsensitiveMap<>(newServers);
|
||||
|
||||
- // Add new servers
|
||||
- for ( Map.Entry<String, ServerInfo> newServer : newServers.entrySet() )
|
||||
@ -68,9 +67,17 @@ index 886f3b4c..7c915e88 100644
|
||||
+ }
|
||||
+ });
|
||||
+ }
|
||||
+ } else {
|
||||
+ // This server isn't new or removed, we'll use bungees behavior of just ignoring
|
||||
+ // any changes to info outside of the address, this is not ideal, but the alternative
|
||||
+ // requires resetting multiple objects of which have no proper identity
|
||||
+ newServers.put(oldServer.getName(), oldServer);
|
||||
}
|
||||
}
|
||||
+ this.servers = new CaseInsensitiveMap<>(newServers);
|
||||
}
|
||||
|
||||
for ( ListenerInfo listener : listeners )
|
||||
--
|
||||
2.20.1
|
||||
2.21.0
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
From c8593999b470857ca5d9f5bd6515eae071558aa0 Mon Sep 17 00:00:00 2001
|
||||
From 2c75e17fb5b997014b548a5c9f6a8899c94c7453 Mon Sep 17 00:00:00 2001
|
||||
From: Troy Frew <fuzzy_bot@arenaga.me>
|
||||
Date: Wed, 29 Jun 2016 04:29:25 +0200
|
||||
Subject: [PATCH] Add dynamic server addition/removal api.
|
||||
@ -144,7 +144,7 @@ index 262b29c8..d7ed3e11 100644
|
||||
{
|
||||
int index = path.indexOf( SEPARATOR );
|
||||
diff --git a/module/cmd-server/src/main/java/net/md_5/bungee/module/cmd/server/CommandServer.java b/module/cmd-server/src/main/java/net/md_5/bungee/module/cmd/server/CommandServer.java
|
||||
index ebf9a12d..489b0018 100644
|
||||
index 794d571f..54e85b0f 100644
|
||||
--- a/module/cmd-server/src/main/java/net/md_5/bungee/module/cmd/server/CommandServer.java
|
||||
+++ b/module/cmd-server/src/main/java/net/md_5/bungee/module/cmd/server/CommandServer.java
|
||||
@@ -84,7 +84,7 @@ public class CommandServer extends Command implements TabExecutor
|
||||
@ -181,7 +181,7 @@ index 7c437c75..ef6d2028 100644
|
||||
|
||||
@Override
|
||||
diff --git a/proxy/src/main/java/net/md_5/bungee/conf/Configuration.java b/proxy/src/main/java/net/md_5/bungee/conf/Configuration.java
|
||||
index 7c915e88..92093602 100644
|
||||
index 193d8bce..2ec6c23c 100644
|
||||
--- a/proxy/src/main/java/net/md_5/bungee/conf/Configuration.java
|
||||
+++ b/proxy/src/main/java/net/md_5/bungee/conf/Configuration.java
|
||||
@@ -1,6 +1,7 @@
|
||||
@ -222,10 +222,10 @@ index 7c915e88..92093602 100644
|
||||
{
|
||||
- Map<String, ServerInfo> oldServers = this.servers;
|
||||
+ Map<String, ServerInfo> oldServers = getServersCopy();
|
||||
this.servers = new CaseInsensitiveMap<>(newServers);
|
||||
|
||||
for ( ServerInfo oldServer : oldServers.values() )
|
||||
@@ -166,4 +170,71 @@ public abstract class Configuration implements ProxyConfig
|
||||
{
|
||||
@@ -171,4 +175,71 @@ public abstract class Configuration implements ProxyConfig
|
||||
{
|
||||
return favicon;
|
||||
}
|
||||
@ -298,5 +298,5 @@ index 7c915e88..92093602 100644
|
||||
+ // Waterfall end
|
||||
}
|
||||
--
|
||||
2.20.1
|
||||
2.21.0
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user