auto restart system

master
Alex 2021-12-27 17:14:33 +01:00
parent f9814721f1
commit df39c12033
1 changed files with 19 additions and 1 deletions

View File

@ -1,6 +1,11 @@
package net.krakatoa.proxy.command; package net.krakatoa.proxy.command;
import de.dytanic.cloudnet.driver.CloudNetDriver;
import de.dytanic.cloudnet.driver.service.ServiceInfoSnapshot;
import de.dytanic.cloudnet.driver.service.ServiceTask;
import de.dytanic.cloudnet.ext.bridge.BridgeServiceProperty;
import de.dytanic.cloudnet.ext.bridge.ServiceInfoSnapshotUtil; import de.dytanic.cloudnet.ext.bridge.ServiceInfoSnapshotUtil;
import de.dytanic.cloudnet.ext.bridge.player.ServicePlayer;
import java.security.SecureRandom; import java.security.SecureRandom;
import net.md_5.bungee.api.CommandSender; import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.chat.TextComponent; import net.md_5.bungee.api.chat.TextComponent;
@ -44,8 +49,21 @@ public class CodeCommand extends Command {
System.out.println("players " + ServiceInfoSnapshotUtil.getGroupOnlineCount("lobby-1")); System.out.println("players " + ServiceInfoSnapshotUtil.getGroupOnlineCount("lobby-1"));
ServiceTask a = CloudNetDriver.getInstance().getServiceTaskProvider()
.getServiceTask("lobby-1");
ServiceInfoSnapshot serviceInfoSnapshot = CloudNetDriver.getInstance()
.getCloudServiceProvider().getCloudServiceByName("lobby-1");
assert serviceInfoSnapshot != null;
serviceInfoSnapshot.getProperty(BridgeServiceProperty.PLAYERS).ifPresent(players -> {
for (ServicePlayer player : players) {
System.out.println("player " + player);
}
});
proxiedPlayer.sendMessage( proxiedPlayer.sendMessage(
new TextComponent("players " + ServiceInfoSnapshotUtil.getGroupOnlineCount("lobby-1"))); new TextComponent("players "));
} }
} }