Files
hamster-ball-bridge/src/main/java/cn/hamster3/service/bungee/event/ServiceConnectEvent.java
2025-08-06 01:42:35 +08:00

44 lines
846 B
Java
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package cn.hamster3.service.bungee.event;
import net.md_5.bungee.api.plugin.Event;
/**
* 服务连接事件
*/
@SuppressWarnings("unused")
public class ServiceConnectEvent extends Event {
private final boolean success;
private final Throwable cause;
public ServiceConnectEvent() {
success = true;
cause = null;
}
public ServiceConnectEvent(Throwable cause) {
success = false;
this.cause = cause;
}
/**
* 是否成功连接到服务中心
*
* @return true代表成功
*/
public boolean isSuccess() {
return success;
}
/**
* 如果连接失败了,则返回失败原因
* <p>
* 如果连接成功了则返回null
*
* @return 失败原因
*/
public Throwable getCause() {
return cause;
}
}