ProxioDev / ValioBungee

Synchronize players data between BungeeCord / Velocity proxies
Eclipse Public License 1.0
200 stars 51 forks source link

Placeholder request #17

Closed BOT-Neil closed 2 years ago

BOT-Neil commented 3 years ago

What is your question?

Hello, could you add %redisbungeegroup% because the normal approach would be to add together all servers.

Also having a list of tracked servers is abit too manually intensive because of you need to update placehoderapi config.yml with each server change on each bukkit server...

Right now I just edited the redis bungee expansion but I think for it to be efficient you need to edit redis bungee and do the calculations on bungee instead of spigot.

The reason for the feature request is for tracking playercounts for minigame clusters.

This is what I wrote so far for myself

if (identifier.startsWith("group_")){
            String groupidentifier = identifier.replace("group_","");
            AtomicInteger total2= new AtomicInteger();
            for (Map.Entry<String, Integer> entry : servers.entrySet()) {
                if (entry.getKey().startsWith(groupidentifier)) {
                    total2.addAndGet(entry.getValue());
                    //return String.valueOf(entry.getValue());
                }

            }
            return String.valueOf(total2);
        }

What I wrote isn't what is needed, since I wrote this little bit of code for the papiexpansion but I think you need to edit both the expansion and redisbungee and do it completely different. What I wrote is inefficient but it works

ham1255 commented 3 years ago

What will group output would be and also could you explain more?

BOT-Neil commented 3 years ago

For example if you have 100 BedWars servers with the names starting from BedWars1 -> BedWars100 and you want to calculate the player count of all servers then you would do %redisbungee_group_BedWars% instead of %redisbungee_BedWars1%+%redisbungee_BedWars2%

For displaying the playercount of multiple servers in a placeholder as efficiently as possible

ham1255 commented 3 years ago

tbh i dont think redis bungee should handle this on the proxy server should do the calculation on the spigot server using async task. and why async task here is if Servers size were high and it could cause the server to freeze on every single request.

and how to do it is using HashMap with String and an int

and we could reuse the run when task timer runs.

when calculation is down we put that in groupServers.put("GroupName", 10 /* calculated number */)

and also we could make config option for the papi expansion which called options how it should be.

Groups:
    - "BedWars"
    - "SkyWars"