use of cloud.timo.TimoCloud.api.objects.ProxyObject in project TimoCloud by TimoCloud.
the class TimoCloudUniversalAPIStorageUpdateListener method onProxyUnregisterEvent.
@EventHandler
public void onProxyUnregisterEvent(ProxyUnregisterEvent event) {
ProxyObject proxy = event.getProxy();
api.getProxyStorage().remove(proxy);
((ProxyGroupObjectBasicImplementation) proxy.getGroup()).removeProxyInternally(((ProxyObjectBasicImplementation) proxy).toLink());
}
use of cloud.timo.TimoCloud.api.objects.ProxyObject in project TimoCloud by TimoCloud.
the class TimoCloudUniversalAPIStorageUpdateListener method onProxyRegisterEvent.
@EventHandler
public void onProxyRegisterEvent(ProxyRegisterEvent event) {
ProxyObject proxy = event.getProxy();
api.getProxyStorage().add(proxy);
((ProxyGroupObjectBasicImplementation) proxy.getGroup()).addProxyInternally(((ProxyObjectBasicImplementation) proxy).toLink());
}
use of cloud.timo.TimoCloud.api.objects.ProxyObject in project TimoCloud by TimoCloud.
the class ProxyPing method onProxyPingEvent.
@Subscribe(order = PostOrder.EARLY)
public void onProxyPingEvent(ProxyPingEvent event) {
ProxyObject proxyObject = TimoCloudAPI.getBungeeAPI().getThisProxy();
ServerPing serverPing = event.getPing();
serverPing = serverPing.asBuilder().maximumPlayers(proxyObject.getGroup().getMaxPlayerCount()).onlinePlayers(proxyObject.getGroup().getOnlinePlayerCount()).build();
if (TimoCloudVelocity.getInstance().getFileManager().getConfig().getBoolean("useGlobalMotd"))
serverPing = serverPing.asBuilder().description(Component.text(ChatColorUtil.translateAlternateColorCodes('&', proxyObject.getGroup().getMotd()))).build();
event.setPing(serverPing);
}
use of cloud.timo.TimoCloud.api.objects.ProxyObject in project TimoCloud by TimoCloud.
the class CoreEventManager method onPlayerDisconnect.
@EventHandler
public void onPlayerDisconnect(PlayerDisconnectEvent event) {
((PlayerObjectBasicImplementation) event.getPlayer()).setOnline(false);
ProxyObject proxyObject = event.getPlayer().getProxy();
if (proxyObject != null) {
Proxy proxy = TimoCloudCore.getInstance().getInstanceManager().getProxyByProxyObject(proxyObject);
if (proxy != null)
proxy.onPlayerDisconnect(event.getPlayer());
}
ServerObject serverObject = event.getPlayer().getServer();
if (serverObject != null) {
Server server = TimoCloudCore.getInstance().getInstanceManager().getServerByServerObject(serverObject);
if (server != null)
server.onPlayerDisconnect(event.getPlayer());
}
}
use of cloud.timo.TimoCloud.api.objects.ProxyObject in project TimoCloud by TimoCloud.
the class CoreEventManager method onPlayerConnectEvent.
@EventHandler
public void onPlayerConnectEvent(PlayerConnectEvent event) {
ProxyObject proxyObject = event.getPlayer().getProxy();
if (proxyObject != null) {
Proxy proxy = TimoCloudCore.getInstance().getInstanceManager().getProxyByProxyObject(proxyObject);
if (proxy != null)
proxy.onPlayerConnect(event.getPlayer());
}
ServerObject serverObject = event.getPlayer().getServer();
if (serverObject != null) {
Server server = TimoCloudCore.getInstance().getInstanceManager().getServerByServerObject(serverObject);
if (server != null)
server.onPlayerConnect(event.getPlayer());
}
}
Aggregations