Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connect API Query all active servers #27

Closed
U1F984 opened this issue Aug 8, 2015 · 5 comments
Closed

Connect API Query all active servers #27

U1F984 opened this issue Aug 8, 2015 · 5 comments

Comments

@U1F984
Copy link
Contributor

U1F984 commented Aug 8, 2015

When managing a server network, it would be nice if there was a way to see which servers are online at the moment (possibly with playercount?).

@AlfieC
Copy link
Contributor

AlfieC commented Aug 8, 2015

This is something the API can offer. Please look into this, it provides useful events such as ServerAddEvent, and once you know the servers on the network you can send a request to find out how many players they have. This is not within the scope of the LilyPad project - so you'll need to develop this by yourself.

@U1F984
Copy link
Contributor Author

U1F984 commented Aug 9, 2015

ServerAddEvent is called when a server connects to the cloud (I would assume). This is not working for my at the moment (probably my own stupidity), but I need to get the current state of the network when the server boots up. How would I go about that?

@AlfieC
Copy link
Contributor

AlfieC commented Aug 9, 2015

Are you sure you're using
@EventListener instead of @EventHandler?

@U1F984
Copy link
Contributor Author

U1F984 commented Aug 9, 2015

In onEnable:

connect = Bukkit.getServicesManager().getRegistration(Connect.class).getProvider();
connect.registerEvents(this);

Same class:

@EventListener
public void serverAdd(ServerAddEvent event) {
    System.out.println("Adding: " + event.getServer());
}

@EventListener
public void serverRemove(ServerRemoveEvent event) {
    System.out.println("Removing: " + event.getServer());
}

Starting up or stopping a second server does nothing (both servers are connected and accessible).

@U1F984
Copy link
Contributor Author

U1F984 commented Oct 12, 2015

Solved it by sending a periodic "I am alive" message.

@U1F984 U1F984 closed this as completed Oct 12, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants