Prevent logins

This commit is contained in:
Braydon 2024-04-26 15:13:09 -04:00
parent fce1fa24b1
commit 00a9dc0ce8

@ -2,10 +2,13 @@ package cc.restfulmc.demo;
import cc.restfulmc.demo.listener.ServerPingListener;
import com.google.inject.Inject;
import com.velocitypowered.api.event.PostOrder;
import com.velocitypowered.api.event.Subscribe;
import com.velocitypowered.api.event.connection.PreLoginEvent;
import com.velocitypowered.api.event.proxy.ProxyInitializeEvent;
import com.velocitypowered.api.plugin.Plugin;
import com.velocitypowered.api.proxy.ProxyServer;
import net.kyori.adventure.text.Component;
/**
* @author Braydon
@ -23,4 +26,9 @@ public final class DemoPlugin {
public void onProxyInitialize(ProxyInitializeEvent event) {
server.getEventManager().register(this, new ServerPingListener());
}
@Subscribe(order = PostOrder.FIRST)
public void onLogin(PreLoginEvent event) {
event.setResult(PreLoginEvent.PreLoginComponentResult.denied(Component.text("§cYou can't join a demo server :(")));
}
}