|
| 1 | +/* |
| 2 | + * Copyright (C) 2025 Sonar Contributors |
| 3 | + * |
| 4 | + * This program is free software: you can redistribute it and/or modify |
| 5 | + * it under the terms of the GNU General Public License as published by |
| 6 | + * the Free Software Foundation, either version 3 of the License, or |
| 7 | + * (at your option) any later version. |
| 8 | + * |
| 9 | + * This program is distributed in the hope that it will be useful, |
| 10 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | + * GNU General Public License for more details. |
| 13 | + * |
| 14 | + * You should have received a copy of the GNU General Public License |
| 15 | + * along with this program. If not, see <https://www.gnu.org/licenses/>. |
| 16 | + */ |
| 17 | + |
| 18 | +package xyz.jonesdev.sonar.common.util; |
| 19 | + |
| 20 | +import io.netty.channel.Channel; |
| 21 | +import io.netty.util.AttributeKey; |
| 22 | +import lombok.experimental.UtilityClass; |
| 23 | +import org.jetbrains.annotations.NotNull; |
| 24 | + |
| 25 | +@UtilityClass |
| 26 | +public class EaglerUtil { |
| 27 | + // https://github.com/lax1dude/eaglerxserver/blob/main/core/src/main/java/net/lax1dude/eaglercraft/backend/server/adapter/PipelineAttributes.java |
| 28 | + public static final AttributeKey<Object> EAGLER_LISTENER_DATA = AttributeKey.valueOf("$eagler0"); |
| 29 | + public static final AttributeKey<Object> EAGLER_PIPELINE_DATA = AttributeKey.valueOf("$eagler1"); |
| 30 | + |
| 31 | + public boolean isEaglerConnection(final @NotNull Channel channel) { |
| 32 | + return channel.attr(EAGLER_LISTENER_DATA).get() != null |
| 33 | + || channel.attr(EAGLER_PIPELINE_DATA).get() != null; |
| 34 | + } |
| 35 | +} |
0 commit comments