Skip to content

Commit

Permalink
fix(shulker-proxy-directory): don't remove lobby from server list
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremylvln committed Mar 12, 2022
1 parent 4470140 commit 127541a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
21 changes: 12 additions & 9 deletions internal/resource/proxy/configmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,20 +77,23 @@ type configYml struct {
}

type configListenerYml struct {
Host string `yaml:"host"`
QueryPort int16 `yaml:"query_port"`
Motd string `yaml:"motd"`
MaxPlayers int64 `yaml:"max_players"`
Priorities []string `yaml:"priorities"`
Host string `yaml:"host"`
QueryPort int16 `yaml:"query_port"`
Motd string `yaml:"motd"`
MaxPlayers int64 `yaml:"max_players"`
ForceDefaultServer bool `yaml:"force_default_server"`
Priorities []string `yaml:"priorities"`
}

func (b *ProxyDeploymentConfigMapBuilder) getConfigYmlFile() (string, error) {
configYml := configYml{
Listeners: []configListenerYml{{
Host: "0.0.0.0:25577",
QueryPort: int16(25577),
Motd: b.Instance.Spec.Motd,
MaxPlayers: *b.Instance.Spec.MaxPlayers,
Host: "0.0.0.0:25577",
QueryPort: int16(25577),
Motd: b.Instance.Spec.Motd,
MaxPlayers: *b.Instance.Spec.MaxPlayers,
ForceDefaultServer: true,
Priorities: []string{"lobby"},
}},
Groups: map[string]interface{}{},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public ServerConnectListener(ShulkerProxyDirectory plugin) {

@EventHandler(priority = EventPriority.LOWEST)
public void onServerConnect(ServerConnectEvent event) {
this.plugin.getLogger().info(event.getTarget().getName());
if (!event.getTarget().getName().equals("lobby")) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ private synchronized void updateServerDirectory(List<MinecraftClusterStatus.Serv
.map(MinecraftClusterStatus.ServerPoolEntry::getName).toList();

new HashSet<>(proxyServers.keySet()).stream()
.filter((serverName) -> !serverPoolNames.contains(serverName))
.filter((serverName) -> !serverName.equals("lobby") && !serverPoolNames.contains(serverName))
.peek((serverName) -> this.getLogger().info(String.format("Removing server %s from directory", serverName)))
.forEach(proxyServers::remove);

Expand Down

0 comments on commit 127541a

Please sign in to comment.