Archive eaglerxpaper (plugin, 1.8.8 - 26.x, clean)

This commit is contained in:
2026-11-28 00:51:01 -06:00
parent adf41f633f
commit 44128885cc
1285 changed files with 144679 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
plugins {
id "java-library"
id "maven-publish"
}
dependencies {
api project(":protocol-game")
compileOnly(libs.bundles.netty.api)
compileOnly(libs.gson)
compileOnly(libs.guava)
compileOnly(libs.jsr305)
}
publishing {
publications {
maven(MavenPublication) {
from components.java
pom {
name = "EaglercraftXServer API - Core"
description = "Core API for Eaglercraft servers"
url = providers.gradleProperty("eaglerxserver.url").get()
}
}
}
}
@@ -0,0 +1,89 @@
/*
* Copyright (c) 2025 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
package net.lax1dude.eaglercraft.backend.server.api;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public enum EnumCapabilitySpec {
UPDATE_V0(EnumCapabilityType.UPDATE, 0),
VOICE_V0(EnumCapabilityType.VOICE, 0),
REDIRECT_V0(EnumCapabilityType.REDIRECT, 0),
NOTIFICATION_V0(EnumCapabilityType.NOTIFICATION, 0),
PAUSE_MENU_V0(EnumCapabilityType.PAUSE_MENU, 0),
WEBVIEW_V0(EnumCapabilityType.WEBVIEW, 0),
COOKIE_V0(EnumCapabilityType.COOKIE, 0),
EAGLER_IP_V0(EnumCapabilityType.EAGLER_IP, 0),
OPTIFINE_CIT_V0(EnumCapabilityType.OPTIFINE_CIT, 0);
private final EnumCapabilityType type;
private final int ver;
private EnumCapabilitySpec(EnumCapabilityType type, int ver) {
this.type = type;
this.ver = ver;
}
@Nonnull
public EnumCapabilityType getType() {
return type;
}
public int getId() {
return type.getId();
}
public int getBit() {
return type.getBit();
}
public int getVer() {
return ver;
}
@Nullable
public static EnumCapabilitySpec fromId(int id, int ver) {
if (id >= 0 && id < capsMap.length) {
EnumCapabilitySpec[] cap = capsMap[id];
if (cap != null) {
if (ver >= 0 && ver < cap.length) {
return cap[ver];
}
}
}
return null;
}
private static final EnumCapabilitySpec[][] capsMap = new EnumCapabilitySpec[16][];
static {
for (EnumCapabilitySpec cap : values()) {
int id = cap.type.getId();
EnumCapabilitySpec[] lst = capsMap[id];
if (lst == null) {
capsMap[id] = lst = new EnumCapabilitySpec[16];
}
if (lst.length <= cap.ver) {
EnumCapabilitySpec[] newList = new EnumCapabilitySpec[lst.length << 1];
System.arraycopy(lst, 0, newList, 0, lst.length);
capsMap[id] = lst = newList;
}
lst[cap.ver] = cap;
}
}
}
@@ -0,0 +1,61 @@
/*
* Copyright (c) 2025 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
package net.lax1dude.eaglercraft.backend.server.api;
import javax.annotation.Nullable;
public enum EnumCapabilityType {
UPDATE(0),
VOICE(1),
REDIRECT(2),
NOTIFICATION(3),
PAUSE_MENU(4),
WEBVIEW(5),
COOKIE(6),
EAGLER_IP(7),
OPTIFINE_CIT(8);
private final int id;
private final int bit;
private EnumCapabilityType(int id) {
this.id = id;
this.bit = 1 << id;
}
public int getId() {
return id;
}
public int getBit() {
return bit;
}
@Nullable
public static EnumCapabilityType getById(int id) {
return id >= 0 && id < LOOKUP.length ? LOOKUP[id] : null;
}
private static final EnumCapabilityType[] LOOKUP = new EnumCapabilityType[9];
static {
for (EnumCapabilityType cap : values()) {
LOOKUP[cap.id] = cap;
}
}
}
@@ -0,0 +1,30 @@
/*
* Copyright (c) 2025 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
package net.lax1dude.eaglercraft.backend.server.api;
public enum EnumPipelineEvent {
EAGLER_STATE_HTTP_REQUEST,
EAGLER_STATE_WEBSOCKET_PLAYER,
EAGLER_INJECTED_FRAME_HANDLERS,
EAGLER_STATE_WEBSOCKET_QUERY,
EAGLER_INJECTED_MESSAGE_CONTROLLER,
EAGLER_INJECTED_REWIND_HANDLERS,
EAGLER_OUTBOUND_THROW_REMOVED,
EAGLER_BACKEND_LOGIN_START,
EAGLER_HANDSHAKE_COMPLETE,
EAGLER_ENTERED_PLAY_STATE
}
@@ -0,0 +1,50 @@
/*
* Copyright (c) 2025 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
package net.lax1dude.eaglercraft.backend.server.api;
import javax.annotation.Nonnull;
public enum EnumPlatformType {
BUNGEECORD("BungeeCord", true, false),
VELOCITY("Velocity", true, false),
BUKKIT("Bukkit", false, false),
STANDALONE("Standalone", true, true);
private final String name;
private final boolean proxy;
private final boolean standalone;
private EnumPlatformType(String name, boolean proxy, boolean standalone) {
this.name = name;
this.proxy = proxy;
this.standalone = standalone;
}
@Nonnull
public String getName() {
return name;
}
public boolean isProxy() {
return proxy;
}
public boolean isStandalone() {
return standalone;
}
}
@@ -0,0 +1,76 @@
/*
* Copyright (c) 2025 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
package net.lax1dude.eaglercraft.backend.server.api;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public enum EnumRequestMethod {
GET(0, 1), HEAD(1, 2), PUT(2, 4), DELETE(3, 8), POST(4, 16), PATCH(5, 32), OPTIONS(6, -1);
public static final int bits = 63;
private static final EnumRequestMethod[] VALUES = new EnumRequestMethod[] { GET, HEAD, PUT, DELETE, POST, PATCH, OPTIONS };
private static final EnumRequestMethod[] BIT_LOOKUP = new EnumRequestMethod[] { GET, HEAD, PUT, DELETE, POST, PATCH };
private final int id;
private final int bit;
private EnumRequestMethod(int id, int bit) {
this.id = id;
this.bit = bit;
}
public int id() {
return id;
}
public int bit() {
return bit;
}
public static int toBits(@Nonnull EnumRequestMethod[] methods) {
int r = 0, j;
for (int i = 0; i < methods.length; ++i) {
j = methods[i].bit;
if (j == -1) {
throw new IllegalArgumentException("Cannot have OPTIONS in bitfield!");
}
r |= j;
}
return r;
}
@Nonnull
public static EnumRequestMethod[] fromBits(int bits) {
bits &= EnumRequestMethod.bits;
int cnt = Integer.bitCount(bits);
EnumRequestMethod[] ret = new EnumRequestMethod[cnt];
for (int i = 0; i < cnt; ++i) {
int j = Integer.numberOfTrailingZeros(bits);
ret[i] = BIT_LOOKUP[j];
bits &= ((EnumRequestMethod.bits - 1) << j);
}
return ret;
}
@Nullable
public static EnumRequestMethod fromId(int id) {
return id >= 0 && id < VALUES.length ? VALUES[id] : null;
}
}
@@ -0,0 +1,25 @@
/*
* Copyright (c) 2025 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
package net.lax1dude.eaglercraft.backend.server.api;
public enum EnumWebSocketHeader {
HEADER_ORIGIN,
HEADER_USER_AGENT,
HEADER_HOST,
HEADER_COOKIE,
HEADER_AUTHORIZATION
}
@@ -0,0 +1,106 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.annotation.Nonnull
*/
package net.lax1dude.eaglercraft.backend.server.api;
import java.util.Arrays;
import java.util.UUID;
import javax.annotation.Nonnull;
public final class ExtendedCapabilitySpec {
private final Version[] majorVersions;
@Nonnull
public static ExtendedCapabilitySpec create(@Nonnull UUID majorVersion, int ... minorVersions) {
return new ExtendedCapabilitySpec(ExtendedCapabilitySpec.version(majorVersion, minorVersions));
}
@Nonnull
public static ExtendedCapabilitySpec create(Version ... majorVersions) {
return new ExtendedCapabilitySpec(majorVersions);
}
@Nonnull
public static Version version(@Nonnull UUID majorVersion, int ... minorVersions) {
return new Version(majorVersion, minorVersions);
}
private ExtendedCapabilitySpec(Version ... majorVersions) {
this.majorVersions = majorVersions;
}
@Nonnull
public Version[] getMajorVersions() {
return this.majorVersions;
}
public int hashCode() {
return Arrays.hashCode(this.majorVersions);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof ExtendedCapabilitySpec)) {
return false;
}
ExtendedCapabilitySpec other = (ExtendedCapabilitySpec)obj;
return Arrays.equals(this.majorVersions, other.majorVersions);
}
public static final class Version {
private final UUID majorVersion;
private final int[] minorVersions;
private Version(UUID majorVersion, int ... minorVersions) {
for (int i = 0; i < minorVersions.length; ++i) {
int j = minorVersions[i];
if (j >= 0 && j <= 31) continue;
throw new IllegalArgumentException("Illegal subversion " + minorVersions[i] + ", must be between 0 to 31");
}
this.majorVersion = majorVersion;
this.minorVersions = minorVersions;
}
@Nonnull
public UUID getMajorVersion() {
return this.majorVersion;
}
@Nonnull
public int[] getMinorVersions() {
return this.minorVersions;
}
public int hashCode() {
int result = 31 + (this.majorVersion == null ? 0 : this.majorVersion.hashCode());
result = 31 * result + Arrays.hashCode(this.minorVersions);
return result;
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof Version)) {
return false;
}
Version other = (Version)obj;
if (this.majorVersion == null ? other.majorVersion != null : !this.majorVersion.equals(other.majorVersion)) {
return false;
}
return Arrays.equals(this.minorVersions, other.minorVersions);
}
}
}
@@ -0,0 +1,27 @@
/*
* Copyright (c) 2025 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
package net.lax1dude.eaglercraft.backend.server.api;
import net.lax1dude.eaglercraft.backend.server.api.attribute.IAttributeHolder;
public interface IBaseConnection extends INettyChannel, IAttributeHolder {
boolean isConnected();
void disconnect();
}
@@ -0,0 +1,38 @@
/*
* Copyright (c) 2025 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
package net.lax1dude.eaglercraft.backend.server.api;
import java.util.UUID;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public interface IBaseLoginConnection extends IBasePendingConnection {
@Nonnull
UUID getUniqueId();
@Nonnull
String getUsername();
boolean isOnlineMode();
@Nullable
@Override
IEaglerLoginConnection asEaglerPlayer();
}
@@ -0,0 +1,36 @@
/*
* Copyright (c) 2025 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
package net.lax1dude.eaglercraft.backend.server.api;
import java.net.SocketAddress;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public interface IBasePendingConnection extends IBaseConnection {
int getMinecraftProtocol();
@Nonnull
SocketAddress getPlayerAddress();
boolean isEaglerPlayer();
@Nullable
IEaglerPendingConnection asEaglerPlayer();
}
@@ -0,0 +1,61 @@
/*
* Copyright (c) 2025 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
package net.lax1dude.eaglercraft.backend.server.api;
import java.util.UUID;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.lax1dude.eaglercraft.backend.server.api.brand.IBrandRegistration;
import net.lax1dude.eaglercraft.backend.server.api.skins.ISkinManagerBase;
public interface IBasePlayer<PlayerObject> extends IBaseLoginConnection {
@Nonnull
IEaglerXServerAPI<PlayerObject> getServerAPI();
@Nonnull
PlayerObject getPlayerObject();
@Nullable
String getMinecraftBrand();
@Nonnull
UUID getEaglerBrandUUID();
@Nullable
default IBrandRegistration getEaglerBrandDesc() {
return getServerAPI().getBrandService().lookupRegisteredBrand(getEaglerBrandUUID());
}
@Nullable
@Override
IEaglerPlayer<PlayerObject> asEaglerPlayer();
@Nonnull
ISkinManagerBase<PlayerObject> getSkinManager();
void sendChatMessage(@Nonnull String message);
<ComponentObject> void sendChatMessage(@Nonnull ComponentObject message);
void disconnect(@Nonnull String kickMessage);
<ComponentObject> void disconnect(@Nonnull ComponentObject kickMessage);
}
@@ -0,0 +1,29 @@
/*
* Copyright (c) 2025 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
package net.lax1dude.eaglercraft.backend.server.api;
import java.net.URI;
import java.util.function.Consumer;
import javax.annotation.Nonnull;
public interface IBinaryHTTPClient {
void asyncRequest(@Nonnull EnumRequestMethod method, @Nonnull URI requestURI,
@Nonnull Consumer<IBinaryHTTPResponse> responseCallback);
}
@@ -0,0 +1,48 @@
/*
* Copyright (c) 2025 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
package net.lax1dude.eaglercraft.backend.server.api;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import io.netty.buffer.ByteBuf;
public interface IBinaryHTTPResponse {
boolean isSuccess();
@Nullable
Throwable getFailureReason();
boolean isRedirected();
int getResponseCode();
@Nullable
byte[] getResponseBody();
@Nonnull
NettyUnsafe netty();
public interface NettyUnsafe {
@Nullable
ByteBuf getResponseBodyBuffer();
}
}
@@ -0,0 +1,32 @@
/*
* Copyright (c) 2025 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
package net.lax1dude.eaglercraft.backend.server.api;
import javax.annotation.Nonnull;
public interface IComponentHelper {
@Nonnull
String convertJSONToLegacySection(@Nonnull String json) throws IllegalArgumentException;
@Nonnull
String convertJSONToPlainText(@Nonnull String json) throws IllegalArgumentException;
@Nonnull
String translateAlternateColorCodes(char altColorChar, @Nonnull String textToTranslate);
}
@@ -0,0 +1,65 @@
/*
* Copyright (c) 2025 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
package net.lax1dude.eaglercraft.backend.server.api;
import javax.annotation.Nonnull;
public interface IComponentSerializer<ComponentType> extends IComponentHelper {
@Nonnull
String serializeLegacySection(@Nonnull ComponentType component);
@Nonnull
String serializePlainText(@Nonnull ComponentType component);
/**
* Use for components that do not contain hover events
*/
@Nonnull
String serializeGenericJSON(@Nonnull ComponentType component);
/**
* Use for components that contain hover events, on 1.8 clients
*/
@Nonnull
String serializeLegacyJSON(@Nonnull ComponentType component);
/**
* Use for components that contain hover events, on modern clients
*/
@Nonnull
String serializeModernJSON(@Nonnull ComponentType component);
/**
* Use for components that do not contain hover events
*/
@Nonnull
ComponentType parseGenericJSON(@Nonnull String json) throws IllegalArgumentException;
/**
* Use for components that contain hover events, on 1.8 clients
*/
@Nonnull
ComponentType parseLegacyJSON(@Nonnull String json) throws IllegalArgumentException;
/**
* Use for components that contain hover events, on modern clients
*/
@Nonnull
ComponentType parseModernJSON(@Nonnull String json) throws IllegalArgumentException;
}
@@ -0,0 +1,43 @@
/*
* Copyright (c) 2025 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
package net.lax1dude.eaglercraft.backend.server.api;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public interface IEaglerConnection extends IBaseConnection {
@Nonnull
IEaglerListenerInfo getListenerInfo();
@Nullable
String getRealAddress();
@Nullable
String getWebSocketHeader(@Nonnull EnumWebSocketHeader header);
@Nullable
default String getWebSocketHost() {
return getWebSocketHeader(EnumWebSocketHeader.HEADER_HOST);
}
@Nonnull
String getWebSocketPath();
boolean isWebSocketSecure();
}
@@ -0,0 +1,58 @@
/*
* Copyright (c) 2025 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
package net.lax1dude.eaglercraft.backend.server.api;
import java.net.SocketAddress;
import java.util.List;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.lax1dude.eaglercraft.backend.server.api.attribute.IAttributeHolder;
public interface IEaglerListenerInfo extends IAttributeHolder {
@Nonnull
String getName();
@Nonnull
SocketAddress getAddress();
boolean isDualStack();
boolean isTLSEnabled();
boolean isTLSRequired();
boolean isTLSManagedByPlugin();
@Nonnull
ITLSManager getTLSManager() throws IllegalStateException;
@Nullable
byte[] getServerIcon();
void setServerIcon(@Nullable byte[] pixels);
@Nonnull
List<String> getServerMOTD();
void setServerMOTD(@Nullable List<String> motd);
boolean isForwardIP();
}
@@ -0,0 +1,45 @@
/*
* Copyright (c) 2025 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
package net.lax1dude.eaglercraft.backend.server.api;
import java.util.UUID;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public interface IEaglerLoginConnection extends IBaseLoginConnection, IEaglerPendingConnection {
@Nonnull
@Override
byte[] getAuthUsername();
boolean hasCapability(@Nonnull EnumCapabilitySpec capability);
int getCapability(@Nonnull EnumCapabilityType capability);
boolean hasExtendedCapability(@Nonnull UUID extendedCapability, int version);
int getExtendedCapability(@Nonnull UUID extendedCapability);
boolean isCookieSupported();
boolean isCookieEnabled();
@Nullable
byte[] getCookieData();
}
@@ -0,0 +1,54 @@
/*
* Copyright (c) 2025 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
package net.lax1dude.eaglercraft.backend.server.api;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.lax1dude.eaglercraft.v1_8.socket.protocol.GamePluginMessageProtocol;
public interface IEaglerPendingConnection extends IEaglerConnection, IBasePendingConnection {
boolean isHandshakeAuthEnabled();
@Nullable
byte[] getAuthUsername();
boolean isEaglerXRewindPlayer();
int getRewindProtocolVersion();
@Nonnull
String getEaglerVersionString();
@Nonnull
String getEaglerBrandString();
int getHandshakeEaglerProtocol();
@Nonnull
GamePluginMessageProtocol getEaglerProtocol();
default boolean isProtocolV4() {
return getEaglerProtocol().ver >= 4;
}
default boolean isProtocolV5() {
return getEaglerProtocol().ver >= 5;
}
}
@@ -0,0 +1,107 @@
/*
* Copyright (c) 2025 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
package net.lax1dude.eaglercraft.backend.server.api;
import java.util.concurrent.TimeUnit;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.lax1dude.eaglercraft.backend.server.api.notifications.INotificationManager;
import net.lax1dude.eaglercraft.backend.server.api.pause_menu.IPauseMenuManager;
import net.lax1dude.eaglercraft.backend.server.api.skins.IEaglerPlayerCape;
import net.lax1dude.eaglercraft.backend.server.api.skins.IEaglerPlayerSkin;
import net.lax1dude.eaglercraft.backend.server.api.skins.ISkinManagerEagler;
import net.lax1dude.eaglercraft.backend.server.api.voice.IVoiceManager;
import net.lax1dude.eaglercraft.backend.server.api.webview.IWebViewManager;
import net.lax1dude.eaglercraft.v1_8.socket.protocol.pkt.GameMessagePacket;
public interface IEaglerPlayer<PlayerObject> extends IBasePlayer<PlayerObject>, IEaglerLoginConnection {
void sendEaglerMessage(@Nonnull GameMessagePacket packet);
@Nonnull
@Override
ISkinManagerEagler<PlayerObject> getSkinManager();
@Nonnull
default IEaglerPlayerSkin getEaglerSkin() {
return getSkinManager().getEaglerSkin();
}
@Nonnull
default IEaglerPlayerCape getEaglerCape() {
return getSkinManager().getEaglerCape();
}
boolean isVoiceCapable();
boolean hasVoiceManager();
@Nullable
IVoiceManager<PlayerObject> getVoiceManager();
default void setCookieData(@Nullable byte[] data, long expiresAfter, @Nonnull TimeUnit timeUnit) {
setCookieData(data, timeUnit.toSeconds(expiresAfter), false, true);
}
default void setCookieData(@Nullable byte[] data, long expiresAfter, @Nonnull TimeUnit timeUnit,
boolean revokeQuerySupported) {
setCookieData(data, timeUnit.toSeconds(expiresAfter), revokeQuerySupported, true);
}
default void setCookieData(@Nullable byte[] data, long expiresAfter, @Nonnull TimeUnit timeUnit,
boolean revokeQuerySupported, boolean clientSaveCookieToDisk) {
setCookieData(data, timeUnit.toSeconds(expiresAfter), revokeQuerySupported, clientSaveCookieToDisk);
}
void setCookieData(@Nullable byte[] data, long expiresAfterSec, boolean revokeQuerySupported,
boolean clientSaveCookieToDisk);
default void clearCookieData() {
setCookieData(null, 0l, false, false);
}
boolean isRedirectPlayerSupported();
void redirectPlayerToWebSocket(@Nonnull String webSocketURI);
boolean isNotificationSupported();
@Nullable
INotificationManager<PlayerObject> getNotificationManager();
boolean isPauseMenuSupported();
@Nullable
IPauseMenuManager<PlayerObject> getPauseMenuManager();
boolean isWebViewSupported();
@Nullable
IWebViewManager<PlayerObject> getWebViewManager();
boolean isUpdateSystemSupported();
@Nullable
IUpdateCertificate getUpdateCertificate();
void offerUpdateCertificate(@Nonnull IUpdateCertificate certificate);
void sendUpdateCertificate(@Nonnull IUpdateCertificate certificate);
}
@@ -0,0 +1,297 @@
/*
* Copyright (c) 2025 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
package net.lax1dude.eaglercraft.backend.server.api;
import java.net.SocketAddress;
import java.util.Collection;
import java.util.Set;
import java.util.UUID;
import java.util.function.Consumer;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import io.netty.bootstrap.Bootstrap;
import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.EventLoopGroup;
import net.lax1dude.eaglercraft.backend.server.api.attribute.IAttributeHolder;
import net.lax1dude.eaglercraft.backend.server.api.attribute.IAttributeManager;
import net.lax1dude.eaglercraft.backend.server.api.brand.IBrandService;
import net.lax1dude.eaglercraft.backend.server.api.collect.HPPC;
import net.lax1dude.eaglercraft.backend.server.api.internal.factory.EaglerXServerAPIFactory;
import net.lax1dude.eaglercraft.backend.server.api.internal.factory.IEaglerAPIFactory;
import net.lax1dude.eaglercraft.backend.server.api.nbt.INBTHelper;
import net.lax1dude.eaglercraft.backend.server.api.notifications.INotificationService;
import net.lax1dude.eaglercraft.backend.server.api.pause_menu.IPauseMenuService;
import net.lax1dude.eaglercraft.backend.server.api.query.IQueryServer;
import net.lax1dude.eaglercraft.backend.server.api.rewind.IEaglerXRewindService;
import net.lax1dude.eaglercraft.backend.server.api.skins.IProfileResolver;
import net.lax1dude.eaglercraft.backend.server.api.skins.ISkinService;
import net.lax1dude.eaglercraft.backend.server.api.skins.TexturesProperty;
import net.lax1dude.eaglercraft.backend.server.api.supervisor.ISupervisorService;
import net.lax1dude.eaglercraft.backend.server.api.voice.IVoiceService;
import net.lax1dude.eaglercraft.backend.server.api.webserver.IWebServer;
import net.lax1dude.eaglercraft.backend.server.api.webview.IWebViewService;
import net.lax1dude.eaglercraft.v1_8.socket.protocol.GamePluginMessageProtocol;
public interface IEaglerXServerAPI<PlayerObject> extends IAttributeHolder {
@Nonnull
public static <PlayerObject> IEaglerXServerAPI<PlayerObject> instance(@Nonnull Class<PlayerObject> playerObj) {
return EaglerXServerAPIFactory.INSTANCE.getAPI(playerObj);
}
@Nonnull
public static IEaglerXServerAPI<?> instance() {
return EaglerXServerAPIFactory.INSTANCE.getDefaultAPI();
}
@Nonnull
public static Set<Class<?>> getPlayerTypes() {
return EaglerXServerAPIFactory.INSTANCE.getPlayerTypes();
}
@Nonnull
public static IEaglerAPIFactory getFactoryInstance() {
return EaglerXServerAPIFactory.INSTANCE;
}
@Nonnull
IEaglerAPIFactory getFactory();
@Nonnull
EnumPlatformType getPlatformType();
@Nonnull
Class<PlayerObject> getPlayerClass();
@Nonnull
String getServerBrand();
@Nonnull
String getServerVersion();
@Nonnull
String getServerName();
@Nonnull
UUID getServerUUID();
boolean isAuthenticationEventsEnabled();
boolean isEaglerHandshakeSupported(int vers);
boolean isEaglerProtocolSupported(@Nonnull GamePluginMessageProtocol vers);
boolean isMinecraftProtocolSupported(int vers);
boolean isMinecraftProtocolSupportedV5(int vers);
@Nullable
IBasePlayer<PlayerObject> getPlayer(@Nonnull PlayerObject player);
@Nullable
IBasePlayer<PlayerObject> getPlayerByName(@Nonnull String playerName);
@Nullable
IBasePlayer<PlayerObject> getPlayerByUUID(@Nonnull UUID playerUUID);
@Nullable
IEaglerPlayer<PlayerObject> getEaglerPlayer(@Nonnull PlayerObject player);
@Nullable
IEaglerPlayer<PlayerObject> getEaglerPlayerByName(@Nonnull String playerName);
@Nullable
IEaglerPlayer<PlayerObject> getEaglerPlayerByUUID(@Nonnull UUID playerUUID);
boolean isPlayer(@Nonnull PlayerObject player);
boolean isPlayerByName(@Nonnull String playerName);
boolean isPlayerByUUID(@Nonnull UUID playerUUID);
boolean isEaglerPlayer(@Nonnull PlayerObject player);
boolean isEaglerPlayerByName(@Nonnull String playerName);
boolean isEaglerPlayerByUUID(@Nonnull UUID playerUUID);
void forEachPlayer(@Nonnull Consumer<IBasePlayer<PlayerObject>> callback);
void forEachEaglerPlayer(@Nonnull Consumer<IEaglerPlayer<PlayerObject>> callback);
@Nonnull
Collection<IBasePlayer<PlayerObject>> getAllPlayers();
@Nonnull
Collection<IEaglerPlayer<PlayerObject>> getAllEaglerPlayers();
int getEaglerPlayerCount();
@Nonnull
Collection<IUpdateCertificate> getUpdateCertificates();
@Nonnull
default IUpdateCertificate createUpdateCertificate(@Nonnull byte[] data) {
return createUpdateCertificate(data, 0, data.length);
}
@Nonnull
IUpdateCertificate createUpdateCertificate(@Nonnull byte[] data, int offset, int length);
void addUpdateCertificate(@Nonnull IUpdateCertificate cert);
@Nonnull
Collection<IEaglerListenerInfo> getAllEaglerListeners();
@Nullable
IEaglerListenerInfo getListenerByName(@Nonnull String name);
@Nullable
IEaglerListenerInfo getListenerByAddress(@Nonnull SocketAddress address);
@Nonnull
IProfileResolver getProfileResolver();
@Nullable
TexturesProperty getEaglerPlayersVanillaSkin();
void setEaglerPlayersVanillaSkin(@Nullable TexturesProperty property);
boolean isEaglerPlayerPropertyEnabled();
void setEaglerPlayerProperyEnabled(boolean enable);
void registerExtendedCapability(@Nonnull Object plugin, @Nonnull ExtendedCapabilitySpec capability);
void unregisterExtendedCapability(@Nonnull Object plugin, @Nonnull ExtendedCapabilitySpec capability);
boolean isExtendedCapabilityRegistered(@Nonnull UUID capabilityUUID, int version);
@Nonnull
ISkinService<PlayerObject> getSkinService();
@Nonnull
IVoiceService<PlayerObject> getVoiceService();
@Nonnull
IBrandService<PlayerObject> getBrandService();
@Nonnull
INotificationService<PlayerObject> getNotificationService();
@Nonnull
IPauseMenuService<PlayerObject> getPauseMenuService();
@Nonnull
IWebViewService<PlayerObject> getWebViewService();
@Nonnull
ISupervisorService<PlayerObject> getSupervisorService();
@Nonnull
IEaglerXRewindService<PlayerObject> getEaglerXRewindService();
@Nonnull
IPacketImageLoader getPacketImageLoader();
@Nonnull
IServerIconLoader getServerIconLoader();
@Nonnull
IQueryServer getQueryServer();
@Nonnull
IWebServer getWebServer();
@Nonnull
IScheduler getScheduler();
@Nonnull
Set<Class<?>> getComponentTypes();
@Nonnull
<ComponentObject> IComponentSerializer<ComponentObject> getComponentSerializer(
@Nonnull Class<ComponentObject> componentType);
@Nonnull
IComponentHelper getComponentHelper();
@Nonnull
INBTHelper getNBTHelper();
@Nonnull
IBinaryHTTPClient getBinaryHTTPClient();
@Nonnull
UUID intern(@Nonnull UUID uuid);
@Nonnull
IAttributeManager getAttributeManager();
@Nonnull
HPPC getHPPC();
boolean isNettyPlatform();
@Nonnull
NettyUnsafe netty();
public interface NettyUnsafe {
@Nonnull
default Bootstrap bootstrapClient() {
return bootstrapClient(null);
}
@Nonnull
Bootstrap bootstrapClient(@Nullable SocketAddress remoteAddress);
@Nonnull
default ServerBootstrap bootstrapServer() {
return bootstrapServer(null);
}
@Nonnull
ServerBootstrap bootstrapServer(@Nullable SocketAddress localAddress);
@Nonnull
default Bootstrap setChannelFactory(@Nonnull Bootstrap bootstrap) {
return setChannelFactory(bootstrap, null);
}
@Nonnull
Bootstrap setChannelFactory(@Nonnull Bootstrap boostrap, @Nullable SocketAddress address);
@Nonnull
default ServerBootstrap setServerChannelFactory(@Nonnull ServerBootstrap bootstrap) {
return setServerChannelFactory(bootstrap, null);
}
@Nonnull
ServerBootstrap setServerChannelFactory(@Nonnull ServerBootstrap boostrap, @Nullable SocketAddress address);
@Nullable
EventLoopGroup getBossEventLoopGroup();
@Nonnull
EventLoopGroup getWorkerEventLoopGroup();
}
}
@@ -0,0 +1,53 @@
/*
* Copyright (c) 2025 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
package net.lax1dude.eaglercraft.backend.server.api;
import java.net.SocketAddress;
import javax.annotation.Nonnull;
import io.netty.channel.Channel;
import io.netty.util.ReferenceCountUtil;
public interface INettyChannel {
@Nonnull
SocketAddress getSocketAddress();
@Nonnull
NettyUnsafe netty();
public interface NettyUnsafe {
@Nonnull
Channel getChannel();
default void writePacket(@Nonnull Object packet) {
if (packet == null) {
throw new NullPointerException("packet");
}
Channel channel = getChannel();
if (channel.isActive()) {
channel.writeAndFlush(packet, channel.voidPromise());
} else {
ReferenceCountUtil.release(packet);
}
}
}
}
@@ -0,0 +1,64 @@
/*
* Copyright (c) 2025 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
package net.lax1dude.eaglercraft.backend.server.api;
import java.util.function.Supplier;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public interface IOptional<T> {
boolean isSuccess();
@Nullable
@SuppressWarnings("unchecked")
default T orNull() {
return isSuccess() ? (T) this : null;
}
@Nullable
@SuppressWarnings("unchecked")
default T orDefault(@Nullable T defaultValue) {
if (isSuccess()) {
return (T) this;
} else {
return defaultValue;
}
}
@Nullable
@SuppressWarnings("unchecked")
default T orDefault(@Nonnull Supplier<T> defaultValue) {
if (isSuccess()) {
return (T) this;
} else {
return defaultValue.get();
}
}
@Nonnull
@SuppressWarnings("unchecked")
default T orThrow() throws IllegalStateException {
if (isSuccess()) {
return (T) this;
} else {
throw new IllegalStateException("Resulting value is not successful");
}
}
}
@@ -0,0 +1,58 @@
/*
* Copyright (c) 2025 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
package net.lax1dude.eaglercraft.backend.server.api;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import javax.annotation.Nonnull;
import javax.annotation.WillNotClose;
import net.lax1dude.eaglercraft.v1_8.socket.protocol.util.PacketImageData;
public interface IPacketImageLoader {
@Nonnull
PacketImageData loadPacketImageData(@Nonnull int[] pixelsARGB8, int width, int height);
@Nonnull
default PacketImageData loadPacketImageData(@Nonnull BufferedImage bufferedImage) {
return loadPacketImageData(bufferedImage, 255, 255);
}
@Nonnull
PacketImageData loadPacketImageData(@Nonnull BufferedImage bufferedImage, int maxWidth, int maxHeight);
@Nonnull
default PacketImageData loadPacketImageData(@Nonnull @WillNotClose InputStream inputStream) throws IOException {
return loadPacketImageData(inputStream, 255, 255);
}
@Nonnull
PacketImageData loadPacketImageData(@Nonnull @WillNotClose InputStream inputStream, int maxWidth, int maxHeight) throws IOException;
@Nonnull
default PacketImageData loadPacketImageData(@Nonnull File imageFile) throws IOException {
return loadPacketImageData(imageFile, 255, 255);
}
@Nonnull
PacketImageData loadPacketImageData(@Nonnull File imageFile, int maxWidth, int maxHeight) throws IOException;
}
@@ -0,0 +1,43 @@
/*
* Copyright (c) 2025 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
package net.lax1dude.eaglercraft.backend.server.api;
import javax.annotation.Nonnull;
public interface IScheduler {
void execute(@Nonnull Runnable runnable);
void executeAsync(@Nonnull Runnable runnable);
void executeDelayed(@Nonnull Runnable runnable, long delay);
void executeAsyncDelayed(@Nonnull Runnable runnable, long delay);
@Nonnull
ITask executeDelayedTask(@Nonnull Runnable runnable, long delay);
@Nonnull
ITask executeAsyncDelayedTask(@Nonnull Runnable runnable, long delay);
@Nonnull
ITask executeRepeatingTask(@Nonnull Runnable runnable, long delay, long interval);
@Nonnull
ITask executeAsyncRepeatingTask(@Nonnull Runnable runnable, long delay, long interval);
}
@@ -0,0 +1,41 @@
/*
* Copyright (c) 2025 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
package net.lax1dude.eaglercraft.backend.server.api;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import javax.annotation.Nonnull;
import javax.annotation.WillNotClose;
public interface IServerIconLoader {
@Nonnull
byte[] loadServerIcon(@Nonnull int[] pixelsIn, int width, int height);
@Nonnull
byte[] loadServerIcon(@Nonnull BufferedImage image);
@Nonnull
byte[] loadServerIcon(@Nonnull @WillNotClose InputStream stream) throws IOException;
@Nonnull
byte[] loadServerIcon(@Nonnull File file) throws IOException;
}
@@ -0,0 +1,63 @@
/*
* Copyright (c) 2025 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
package net.lax1dude.eaglercraft.backend.server.api;
import java.io.File;
import java.io.InputStream;
import java.security.PrivateKey;
import java.security.cert.X509Certificate;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.annotation.WillNotClose;
public interface ITLSManager {
@Nonnull
IEaglerListenerInfo getListener();
default void setCertificate(@Nonnull File fullChain, @Nonnull File privateKey) throws TLSManagerException {
setCertificate(fullChain, privateKey, null);
}
void setCertificate(@Nonnull File fullChain, @Nonnull File privateKey, @Nullable String privateKeyPassword)
throws TLSManagerException;
default void setCertificate(@Nonnull @WillNotClose InputStream fullChain,
@Nonnull @WillNotClose InputStream privateKey) throws TLSManagerException {
setCertificate(fullChain, privateKey, null);
}
void setCertificate(@Nonnull InputStream fullChain, @Nonnull InputStream privateKey,
@Nullable String privateKeyPassword) throws TLSManagerException;
default void setCertificate(@Nonnull byte[] fullChain, @Nonnull byte[] privateKey) throws TLSManagerException {
setCertificate(fullChain, privateKey, null);
}
void setCertificate(@Nonnull byte[] fullChain, @Nonnull byte[] privateKey, @Nullable String privateKeyPassword)
throws TLSManagerException;
default void setCertificate(@Nonnull X509Certificate[] fullChain, @Nonnull PrivateKey privateKey)
throws TLSManagerException {
setCertificate(fullChain, privateKey, null);
}
void setCertificate(@Nonnull X509Certificate[] fullChain, @Nonnull PrivateKey privateKey,
@Nullable String privateKeyPassword) throws TLSManagerException;
}
@@ -0,0 +1,23 @@
/*
* Copyright (c) 2025 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
package net.lax1dude.eaglercraft.backend.server.api;
public interface ITask {
void cancel();
}
@@ -0,0 +1,42 @@
/*
* Copyright (c) 2025 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
package net.lax1dude.eaglercraft.backend.server.api;
import javax.annotation.Nonnull;
public interface IUpdateCertificate {
int getLength();
default void getBytes(@Nonnull byte[] dst) {
getBytes(dst, 0);
}
default void getBytes(@Nonnull byte[] dst, int dstOffset) {
getBytes(0, dst, dstOffset, getLength());
}
void getBytes(int srcOffset, @Nonnull byte[] dst, int dstOffset, int length);
@Nonnull
default byte[] toByteArray() {
byte[] ret = new byte[getLength()];
getBytes(ret, 0);
return ret;
}
}
@@ -0,0 +1,157 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.annotation.Nonnull
*/
package net.lax1dude.eaglercraft.backend.server.api;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import javax.annotation.Nonnull;
public final class SHA1Sum {
private final int a;
private final int b;
private final int c;
private final int d;
private final int e;
private static final char[] hex = new char[]{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
@Nonnull
public static SHA1Sum ofData(@Nonnull byte[] data) {
return SHA1Sum.ofData(data, 0, data.length);
}
@Nonnull
public static SHA1Sum ofData(@Nonnull byte[] data, int offset, int length) {
try {
MessageDigest digest = MessageDigest.getInstance("SHA-1");
digest.update(data, offset, length);
byte[] ret = digest.digest();
return SHA1Sum.create(ret, 0);
}
catch (NoSuchAlgorithmException e) {
throw new RuntimeException("Incompatible JRE", e);
}
}
@Nonnull
public static SHA1Sum create(@Nonnull byte[] checksum) {
return SHA1Sum.create(checksum, 0);
}
@Nonnull
public static SHA1Sum create(@Nonnull byte[] checksum, int offset) {
if (offset < 0) {
throw new ArrayIndexOutOfBoundsException(offset);
}
if (offset + 20 > checksum.length) {
throw new ArrayIndexOutOfBoundsException(offset + 20);
}
return SHA1Sum.create(SHA1Sum.intHelper(checksum, offset), SHA1Sum.intHelper(checksum, offset + 4), SHA1Sum.intHelper(checksum, offset + 8), SHA1Sum.intHelper(checksum, offset + 12), SHA1Sum.intHelper(checksum, offset + 16));
}
@Nonnull
public static SHA1Sum create(int a, int b, int c, int d, int e) {
return new SHA1Sum(a, b, c, d, e);
}
private SHA1Sum(int a, int b, int c, int d, int e) {
this.a = a;
this.b = b;
this.c = c;
this.d = d;
this.e = e;
}
public int getBitsA() {
return this.a;
}
public int getBitsB() {
return this.b;
}
public int getBitsC() {
return this.c;
}
public int getBitsD() {
return this.d;
}
public int getBitsE() {
return this.e;
}
@Nonnull
public byte[] asBytes() {
byte[] ret = new byte[20];
this.asBytes(ret, 0);
return ret;
}
public void asBytes(@Nonnull byte[] dst, int off) {
if (off < 0) {
throw new ArrayIndexOutOfBoundsException(off);
}
if (off + 20 > dst.length) {
throw new ArrayIndexOutOfBoundsException(off + 20);
}
SHA1Sum.byteHelper(dst, this.a, off);
SHA1Sum.byteHelper(dst, this.b, off + 4);
SHA1Sum.byteHelper(dst, this.c, off + 8);
SHA1Sum.byteHelper(dst, this.d, off + 12);
SHA1Sum.byteHelper(dst, this.e, off + 16);
}
private static int intHelper(byte[] src, int off) {
return (src[off] & 0xFF) << 24 | (src[off + 1] & 0xFF) << 16 | (src[off + 2] & 0xFF) << 8 | src[off + 3] & 0xFF;
}
private static void byteHelper(byte[] dst, int a, int off) {
dst[off] = (byte)(a >>> 24);
dst[off + 1] = (byte)(a >>> 16);
dst[off + 2] = (byte)(a >>> 8);
dst[off + 3] = (byte)a;
}
@Nonnull
public String toString() {
char[] ret = new char[40];
SHA1Sum.hexHelper(ret, 0, this.a);
SHA1Sum.hexHelper(ret, 8, this.b);
SHA1Sum.hexHelper(ret, 16, this.c);
SHA1Sum.hexHelper(ret, 24, this.d);
SHA1Sum.hexHelper(ret, 32, this.e);
return new String(ret);
}
private static void hexHelper(char[] ret, int i, int j) {
ret[i] = hex[j >>> 28 & 0xF];
ret[i + 1] = hex[j >>> 24 & 0xF];
ret[i + 2] = hex[j >>> 20 & 0xF];
ret[i + 3] = hex[j >>> 16 & 0xF];
ret[i + 4] = hex[j >>> 12 & 0xF];
ret[i + 5] = hex[j >>> 8 & 0xF];
ret[i + 6] = hex[j >>> 4 & 0xF];
ret[i + 7] = hex[j & 0xF];
}
public int hashCode() {
return (((this.a * 31 + this.b) * 31 + this.c) * 31 + this.d) * 31 + this.e;
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof SHA1Sum)) {
return false;
}
SHA1Sum other = (SHA1Sum)obj;
return other.a == this.a && other.b == this.b && other.c == this.c && other.d == this.d && other.e == this.e;
}
}
@@ -0,0 +1,40 @@
/*
* Copyright (c) 2025 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
package net.lax1dude.eaglercraft.backend.server.api;
import javax.annotation.Nullable;
public class TLSManagerException extends Exception {
private static final long serialVersionUID = -8110945929693568131L;
public TLSManagerException() {
}
public TLSManagerException(@Nullable String message, @Nullable Throwable cause) {
super(message, cause);
}
public TLSManagerException(@Nullable String message) {
super(message);
}
public TLSManagerException(@Nullable Throwable cause) {
super(cause);
}
}
@@ -0,0 +1,33 @@
/*
* Copyright (c) 2025 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
package net.lax1dude.eaglercraft.backend.server.api;
import static java.lang.annotation.ElementType.CONSTRUCTOR;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.SOURCE;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
@Retention(SOURCE)
@Target({ CONSTRUCTOR, METHOD, TYPE })
public @interface UnsupportedOn {
EnumPlatformType[] value();
}
@@ -0,0 +1,29 @@
/*
* Copyright (c) 2025 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
package net.lax1dude.eaglercraft.backend.server.api.attribute;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public interface IAttributeHolder {
@Nullable
<T> T get(@Nonnull IAttributeKey<T> key);
<T> void set(@Nonnull IAttributeKey<T> key, @Nullable T value);
}
@@ -0,0 +1,36 @@
/*
* Copyright (c) 2025 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
package net.lax1dude.eaglercraft.backend.server.api.attribute;
import javax.annotation.Nonnull;
public interface IAttributeKey<T> {
@Nonnull
public static IAttributeManager factory() {
return IAttributeManager.instance();
}
boolean isGlobal();
@Nonnull
String getName();
@Nonnull
Class<T> getType();
}
@@ -0,0 +1,39 @@
/*
* Copyright (c) 2025 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
package net.lax1dude.eaglercraft.backend.server.api.attribute;
import javax.annotation.Nonnull;
import net.lax1dude.eaglercraft.backend.server.api.internal.factory.EaglerXServerAPIFactory;
public interface IAttributeManager {
@Nonnull
public static IAttributeManager instance() {
return EaglerXServerAPIFactory.INSTANCE.getGlobalAttributeManager();
}
@Nonnull
<T> IAttributeKey<T> initGlobalAttribute(@Nonnull String name, @Nonnull Class<T> type);
@Nonnull
<T> IAttributeKey<T> initPrivateAttribute(@Nonnull String name, @Nonnull Class<T> type);
@Nonnull
<T> IAttributeKey<T> initPrivateAttribute(@Nonnull Class<T> type);
}
@@ -0,0 +1,39 @@
/*
* Copyright (c) 2025 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
package net.lax1dude.eaglercraft.backend.server.api.brand;
import java.util.UUID;
import javax.annotation.Nonnull;
public interface IBrandRegistration {
@Nonnull
UUID getBrandUUID();
@Nonnull
String getBrandDesc();
boolean isVanillaMinecraft();
boolean isVanillaEagler();
boolean isLegacyClient();
boolean isHackedClient();
}
@@ -0,0 +1,62 @@
/*
* Copyright (c) 2025 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
package net.lax1dude.eaglercraft.backend.server.api.brand;
import java.util.UUID;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public interface IBrandRegistry {
@Nonnull
static final UUID BRAND_NULL = new UUID(0L, 0L);
@Nonnull
static final UUID BRAND_VANILLA = new UUID(0x1DCE015CD384374EL, 0x85030A4DE95E5736L);
@Nonnull
static final UUID BRAND_EAGLERCRAFTX_V4 = new UUID(0x4448369E4E873621L, 0x94F5E28EEB160524L);
@Nonnull
static final UUID BRAND_EAGLERCRAFTX_LEGACY = new UUID(0x71D0C81201C2366AL, 0xA0D23D9AA10846EBL);
@Nonnull
static final UUID BRAND_EAGLERCRAFT_1_12 = new UUID(0x522B2CE5C9B936CFL, 0xBE7C5D90F55E631AL);
@Nonnull
UUID getBrandUUIDClient(@Nonnull String brandString);
@Nonnull
UUID getBrandUUIDClientLegacy(@Nonnull String brandString);
default void registerBrand(@Nonnull UUID brandUUID, @Nonnull String brandDesc) {
registerBrand(brandUUID, brandDesc, false, false);
}
default void registerBrand(@Nonnull UUID brandUUID, @Nonnull String brandDesc, boolean hacked) {
registerBrand(brandUUID, brandDesc, hacked, false);
}
void registerBrand(@Nonnull UUID brandUUID, @Nonnull String brandDesc, boolean hacked, boolean legacy);
void unregisterBrand(@Nonnull UUID brandUUID);
@Nullable
IBrandRegistration lookupRegisteredBrand(@Nonnull UUID brandUUID);
}
@@ -0,0 +1,31 @@
/*
* Copyright (c) 2025 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
package net.lax1dude.eaglercraft.backend.server.api.brand;
import java.util.UUID;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import javax.annotation.Nonnull;
public interface IBrandResolver {
void resolvePlayerBrand(@Nonnull UUID playerUUID, @Nonnull Consumer<UUID> callback);
void resolvePlayerRegisteredBrand(@Nonnull UUID playerUUID, @Nonnull BiConsumer<UUID, IBrandRegistration> callback);
}
@@ -0,0 +1,49 @@
/*
* Copyright (c) 2025 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
package net.lax1dude.eaglercraft.backend.server.api.brand;
import java.util.UUID;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.lax1dude.eaglercraft.backend.server.api.IBasePlayer;
import net.lax1dude.eaglercraft.backend.server.api.IEaglerXServerAPI;
public interface IBrandService<PlayerObject> extends IBrandResolver, IBrandRegistry {
@Nonnull
IEaglerXServerAPI<PlayerObject> getServerAPI();
@Nonnull
default UUID getPlayerBrand(@Nonnull PlayerObject player) {
IBasePlayer<PlayerObject> basePlayer = getServerAPI().getPlayer(player);
return basePlayer != null ? basePlayer.getEaglerBrandUUID() : BRAND_VANILLA;
}
@Nonnull
default UUID getPlayerBrand(@Nonnull IBasePlayer<PlayerObject> player) {
return player.getEaglerBrandUUID();
}
@Nullable
default IBrandRegistration getPlayerRegisteredBrand(@Nonnull PlayerObject player) {
IBasePlayer<PlayerObject> basePlayer = getServerAPI().getPlayer(player);
return lookupRegisteredBrand(basePlayer != null ? basePlayer.getEaglerBrandUUID() : BRAND_VANILLA);
}
}
@@ -0,0 +1,32 @@
/*
* HPPC
*
* Copyright (C) 2010-2024 Carrot Search s.c. and contributors
* All rights reserved.
*
* Refer to the full license file "LICENSE.txt":
* https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt
*/
package net.lax1dude.eaglercraft.backend.server.api.collect;
/**
* Anything that could be accounted for memory usage
*
* <p>
* Partly forked from Lucene tag releases/lucene-solr/8.5.1
*/
public interface Accountable {
/**
* Allocated memory estimation
*
* @return Ram allocated in bytes
*/
long ramBytesAllocated();
/**
* Bytes that is actually been used
*
* @return Ram used in bytes
*/
long ramBytesUsed();
}
@@ -0,0 +1,126 @@
/*
* Copyright (c) 2025 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
package net.lax1dude.eaglercraft.backend.server.api.collect;
import javax.annotation.Nonnull;
public interface HPPC {
int getDefaultExpectedElements();
@Nonnull
IntIndexedContainer createIntArrayList();
@Nonnull
IntIndexedContainer createIntArrayList(int expectedElements);
@Nonnull
IntIndexedContainer createIntArrayList(@Nonnull IntContainer source);
@Nonnull
IntSet createIntHashSet();
@Nonnull
IntSet createIntHashSet(int expectedElements);
@Nonnull
IntSet createIntHashSet(@Nonnull IntContainer source);
@Nonnull
<T> ObjectIndexedContainer<T> createObjectArrayList();
@Nonnull
<T> ObjectIndexedContainer<T> createObjectArrayList(int expectedElements);
@Nonnull
<T> ObjectIndexedContainer<T> createObjectArrayList(@Nonnull ObjectContainer<? extends T> source);
@Nonnull
<T> ObjectSet<T> createObjectHashSet();
@Nonnull
<T> ObjectSet<T> createObjectHashSet(int expectedElements);
@Nonnull
<T> ObjectSet<T> createObjectHashSet(@Nonnull ObjectContainer<? extends T> source);
@Nonnull
<T> ObjectSet<T> createObjectIdentityHashSet();
@Nonnull
<T> ObjectSet<T> createObjectIdentityHashSet(int expectedElements);
@Nonnull
<T> ObjectSet<T> createObjectIdentityHashSet(@Nonnull ObjectContainer<? extends T> source);
@Nonnull
<V> IntObjectMap<V> createIntObjectHashMap();
@Nonnull
<V> IntObjectMap<V> createIntObjectHashMap(int expectedElements);
@Nonnull
<V> IntObjectMap<V> createIntObjectHashMap(@Nonnull IntObjectAssociativeContainer<? extends V> source);
@Nonnull
<K> ObjectIntMap<K> createObjectIntHashMap();
@Nonnull
<K> ObjectIntMap<K> createObjectIntHashMap(int expectedElements);
@Nonnull
<K> ObjectIntMap<K> createObjectIntHashMap(@Nonnull ObjectIntAssociativeContainer<? extends K> source);
@Nonnull
<K> ObjectIntMap<K> createObjectIntIdentityHashMap();
@Nonnull
<K> ObjectIntMap<K> createObjectIntIdentityHashMap(int expectedElements);
@Nonnull
<K> ObjectIntMap<K> createObjectIntIdentityHashMap(@Nonnull ObjectIntAssociativeContainer<? extends K> source);
@Nonnull
IntIntMap createIntIntHashMap();
@Nonnull
IntIntMap createIntIntHashMap(int expectedElements);
@Nonnull
IntIntMap createIntIntHashMap(@Nonnull IntIntAssociativeContainer source);
@Nonnull
<K, V> ObjectObjectMap<K, V> createObjectObjectHashMap();
@Nonnull
<K, V> ObjectObjectMap<K, V> createObjectObjectHashMap(int expectedElements);
@Nonnull
<K, V> ObjectObjectMap<K, V> createObjectObjectHashMap(
@Nonnull ObjectObjectAssociativeContainer<? extends K, ? extends V> source);
@Nonnull
<K, V> ObjectObjectMap<K, V> createObjectObjectIdentityHashMap();
@Nonnull
<K, V> ObjectObjectMap<K, V> createObjectObjectIdentityHashMap(int expectedElements);
@Nonnull
<K, V> ObjectObjectMap<K, V> createObjectObjectIdentityHashMap(
@Nonnull ObjectObjectAssociativeContainer<? extends K, ? extends V> source);
}
@@ -0,0 +1,73 @@
/*
* HPPC
*
* Copyright (C) 2010-2024 Carrot Search s.c. and contributors
* All rights reserved.
*
* Refer to the full license file "LICENSE.txt":
* https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt
*/
package net.lax1dude.eaglercraft.backend.server.api.collect;
/**
* A collection allows basic, efficient operations on sets of elements
* (difference and intersection).
*/
public interface IntCollection extends IntContainer {
/**
* Removes all occurrences of <code>e</code> from this collection.
*
* @param e Element to be removed from this collection, if present.
* @return The number of removed elements as a result of this call.
*/
public int removeAll(int e);
/**
* Removes all elements in this collection that are present in <code>c</code>.
*
* @return Returns the number of removed elements.
*/
public int removeAll(IntLookupContainer c);
/**
* Removes all elements in this collection for which the given predicate returns
* <code>true</code> .
*
* @return Returns the number of removed elements.
*/
public int removeAll(IntPredicate predicate);
/**
* Keeps all elements in this collection that are present in <code>c</code>.
* Runs in time proportional to the number of elements in this collection.
* Equivalent of sets intersection.
*
* @return Returns the number of removed elements.
*/
public int retainAll(IntLookupContainer c);
/**
* Keeps all elements in this collection for which the given predicate returns
* <code>true</code>.
*
* @return Returns the number of removed elements.
*/
public int retainAll(IntPredicate predicate);
/**
* Removes all elements from this collection.
*
* @see #release()
*/
public void clear();
/**
* Removes all elements from the collection and additionally releases any
* internal buffers. Typically, if the object is to be reused, a simple
* {@link #clear()} should be a better alternative since it'll avoid
* reallocation.
*
* @see #clear()
*/
public void release();
}
@@ -0,0 +1,89 @@
/*
* HPPC
*
* Copyright (C) 2010-2024 Carrot Search s.c. and contributors
* All rights reserved.
*
* Refer to the full license file "LICENSE.txt":
* https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt
*/
package net.lax1dude.eaglercraft.backend.server.api.collect;
import java.util.Iterator;
/** A generic container holding <code>int</code>s. */
public interface IntContainer extends Iterable<IntCursor> {
/**
* Returns an iterator to a cursor traversing the collection. The order of
* traversal is not defined. More than one cursor may be active at a time. The
* behavior of iterators is undefined if structural changes are made to the
* underlying collection.
*
* <p>
* The iterator is implemented as a cursor and it returns <b>the same cursor
* instance</b> on every call to {@link Iterator#next()} (to avoid boxing of
* primitive types). To read the current list's value (or index in the list) use
* the cursor's public fields. An example is shown below.
*
* <pre>
* for (IntCursor&lt;int&gt; c : container) {
* System.out.println(&quot;index=&quot; + c.index + &quot; value=&quot; + c.value);
* }
* </pre>
*/
public Iterator<IntCursor> iterator();
/**
* Lookup a given element in the container. This operation has no speed
* guarantees (may be linear with respect to the size of this container).
*
* @return Returns <code>true</code> if this container has an element equal to
* <code>e</code>.
*/
public boolean contains(int e);
/**
* Return the current number of elements in this container. The time for
* calculating the container's size may take <code>O(n)</code> time, although
* implementing classes should try to maintain the current size and return in
* constant time.
*/
public int size();
/** Shortcut for <code>size() == 0</code>. */
public boolean isEmpty();
/**
* Copies all elements of this container to an array.
*
* <p>
* The returned array is always a copy, regardless of the storage used by the
* container.
*/
public int[] toArray();
/**
* Applies a <code>procedure</code> to all container elements. Returns the
* argument (any subclass of {@link IntProcedure}. This lets the caller to call
* methods of the argument by chaining the call (even if the argument is an
* anonymous type) to retrieve computed values, for example (IntContainer):
*
* <pre>
* int count = container.forEach(new IntProcedure() {
* int count; // this is a field declaration in an anonymous class.
*
* public void apply(int value) {
* count++;
* }
* }).count;
* </pre>
*/
public <T extends IntProcedure> T forEach(T procedure);
/**
* Applies a <code>predicate</code> to container elements as long, as the
* predicate returns <code>
* true</code>. The iteration is interrupted otherwise.
*/
public <T extends IntPredicate> T forEach(T predicate);
}
@@ -0,0 +1,28 @@
/*
* HPPC
*
* Copyright (C) 2010-2024 Carrot Search s.c. and contributors
* All rights reserved.
*
* Refer to the full license file "LICENSE.txt":
* https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt
*/
package net.lax1dude.eaglercraft.backend.server.api.collect;
/** A cursor over a collection of <code>ints</code>. */
public final class IntCursor {
/**
* The current value's index in the container this cursor belongs to. The
* meaning of this index is defined by the container (usually it will be an
* index in the underlying storage buffer).
*/
public int index;
/** The current value. */
public int value;
@Override
public String toString() {
return "[cursor, index: " + index + ", value: " + value + "]";
}
}
@@ -0,0 +1,109 @@
/*
* HPPC
*
* Copyright (C) 2010-2024 Carrot Search s.c. and contributors
* All rights reserved.
*
* Refer to the full license file "LICENSE.txt":
* https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt
*/
package net.lax1dude.eaglercraft.backend.server.api.collect;
import java.util.RandomAccess;
import java.util.stream.IntStream;
/**
* An indexed container provides random access to elements based on an
* <code>index</code>. Indexes are zero-based.
*/
public interface IntIndexedContainer extends IntCollection, RandomAccess {
/**
* Removes the first element that equals <code>e1</code>, returning whether an
* element has been removed.
*/
public boolean removeElement(int e1);
/**
* Removes the first element that equals <code>e1</code>, returning its deleted
* position or <code>
* -1</code> if the element was not found.
*/
public int removeFirst(int e1);
/**
* Removes the last element that equals <code>e1</code>, returning its deleted
* position or <code>
* -1</code> if the element was not found.
*/
public int removeLast(int e1);
/**
* Returns the index of the first occurrence of the specified element in this
* list, or -1 if this list does not contain the element.
*/
public int indexOf(int e1);
/**
* Returns the index of the last occurrence of the specified element in this
* list, or -1 if this list does not contain the element.
*/
public int lastIndexOf(int e1);
/**
* Adds an element to the end of this container (the last index is incremented
* by one).
*/
public void add(int e1);
/**
* Inserts the specified element at the specified position in this list.
*
* @param index The index at which the element should be inserted, shifting any
* existing and subsequent elements to the right.
*/
public void insert(int index, int e1);
/**
* Replaces the element at the specified position in this list with the
* specified element.
*
* @return Returns the previous value in the list.
*/
public int set(int index, int e1);
/**
* @return Returns the element at index <code>index</code> from the list.
*/
public int get(int index);
/**
* Removes the element at the specified position in this container and returns
* it.
*
* @see #removeFirst
* @see #removeLast
* @see #removeAll
*/
public int removeAt(int index);
/**
* Removes and returns the last element of this container. This container must
* not be empty.
*/
public int removeLast();
/**
* Removes from this container all of the elements with indexes between
* <code>fromIndex</code>, inclusive, and <code>toIndex</code>, exclusive.
*/
public void removeRange(int fromIndex, int toIndex);
/** Returns this container elements as a stream. */
public IntStream stream();
/** Sorts the elements in this container and returns this container. */
public IntIndexedContainer sort();
/** Reverses the elements in this container and returns this container. */
public IntIndexedContainer reverse();
}
@@ -0,0 +1,123 @@
/*
* HPPC
*
* Copyright (C) 2010-2024 Carrot Search s.c. and contributors
* All rights reserved.
*
* Refer to the full license file "LICENSE.txt":
* https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt
*/
package net.lax1dude.eaglercraft.backend.server.api.collect;
import java.util.Iterator;
/**
* An associative container from keys to (one or possibly more) values.
*
* @see IntContainer
*/
public interface IntIntAssociativeContainer extends Iterable<IntIntCursor> {
/**
* Returns a cursor over the entries (key-value pairs) in this map. The iterator
* is implemented as a cursor and it returns <b>the same cursor instance</b> on
* every call to {@link Iterator#next()}. To read the current key and value use
* the cursor's public fields. An example is shown below.
*
* <pre>
* for (IntShortCursor c : intShortMap) {
* System.out.println(&quot;index=&quot; + c.index + &quot; key=&quot; + c.key + &quot; value=&quot; + c.value);
* }
* </pre>
*
* <p>
* The <code>index</code> field inside the cursor gives the internal index
* inside the container's implementation. The interpretation of this index
* depends on to the container.
*/
@Override
public Iterator<IntIntCursor> iterator();
/**
* Returns <code>true</code> if this container has an association to a value for
* the given key.
*/
public boolean containsKey(int key);
/**
* @return Returns the current size (number of assigned keys) in the container.
*/
public int size();
/**
* @return Return <code>true</code> if this hash map contains no assigned keys.
*/
public boolean isEmpty();
/**
* Removes all keys (and associated values) present in a given container. An
* alias to:
*
* <pre>
* keys().removeAll(container)
* </pre>
*
* but with no additional overhead.
*
* @return Returns the number of elements actually removed as a result of this
* call.
*/
public int removeAll(IntContainer container);
/**
* Removes all keys (and associated values) for which the predicate returns
* <code>true</code>.
*
* @return Returns the number of elements actually removed as a result of this
* call.
*/
public int removeAll(IntPredicate predicate);
/**
* Removes all keys (and associated values) for which the predicate returns
* <code>true</code>.
*
* @return Returns the number of elements actually removed as a result of this
* call.
*/
public int removeAll(IntIntPredicate predicate);
/**
* Applies a given procedure to all keys-value pairs in this container. Returns
* the argument (any subclass of {@link IntIntProcedure}. This lets the caller
* call methods of the argument by chaining the call (even if the argument is an
* anonymous type) to retrieve computed values.
*/
public <T extends IntIntProcedure> T forEach(T procedure);
/**
* Applies a given predicate to all keys-value pairs in this container. Returns
* the argument (any subclass of {@link IntIntPredicate}. This lets the caller
* call methods of the argument by chaining the call (even if the argument is an
* anonymous type) to retrieve computed values.
*
* <p>
* The iteration is continued as long as the predicate returns
* <code>true</code>.
*/
public <T extends IntIntPredicate> T forEach(T predicate);
/**
* Returns a collection of keys of this container. The returned collection is a
* view over the key set and any modifications (if allowed) introduced to the
* collection will propagate to the associative container immediately.
*/
public IntCollection keys();
/**
* Returns a container view of all values present in this container. The
* returned collection is a view over the key set and any modifications (if
* allowed) introduced to the collection will propagate to the associative
* container immediately.
*/
public IntContainer values();
}
@@ -0,0 +1,33 @@
/*
* HPPC
*
* Copyright (C) 2010-2024 Carrot Search s.c. and contributors
* All rights reserved.
*
* Refer to the full license file "LICENSE.txt":
* https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt
*/
package net.lax1dude.eaglercraft.backend.server.api.collect;
/**
* A cursor over entries of an associative container (int keys and int values).
*/
public final class IntIntCursor {
/**
* The current key and value's index in the container this cursor belongs to.
* The meaning of this index is defined by the container (usually it will be an
* index in the underlying storage buffer).
*/
public int index;
/** The current key. */
public int key;
/** The current value. */
public int value;
@Override
public String toString() {
return "[cursor, index: " + index + ", key: " + key + ", value: " + value + "]";
}
}
@@ -0,0 +1,229 @@
/*
* HPPC
*
* Copyright (C) 2010-2024 Carrot Search s.c. and contributors
* All rights reserved.
*
* Refer to the full license file "LICENSE.txt":
* https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt
*/
package net.lax1dude.eaglercraft.backend.server.api.collect;
/** An associative container with unique binding from keys to a single value. */
public interface IntIntMap extends IntIntAssociativeContainer {
/**
* @return Returns the value associated with the given key or the default value
* for the value type, if the key is not associated with any value. For
* numeric value types, this default value is 0, for object types it is
* {@code null}.
*/
public int get(int key);
/**
* @return Returns the value associated with the given key or the provided
* default value if the key is not associated with any value.
*/
public int getOrDefault(int key, int defaultValue);
/**
* Place a given key and value in the container.
*
* @return The value previously stored under the given key in the map is
* returned.
*/
public int put(int key, int value);
/**
* If the specified key is not already associated with a value, associates it
* with the given value.
*
* @return {@code true} if {@code key} did not exist and {@code value} was
* placed in the map, {@code false} otherwise.
*/
public default boolean putIfAbsent(int key, int value) {
int keyIndex = indexOf(key);
if (indexExists(keyIndex)) {
return false;
} else {
indexInsert(keyIndex, key, value);
return true;
}
}
/**
* Puts all keys from another container to this map, replacing the values of
* existing keys, if such keys are present.
*
* @return Returns the number of keys added to the map as a result of this call
* (not previously present in the map). Values of existing keys are
* overwritten.
*/
public int putAll(IntIntAssociativeContainer container);
/**
* Puts all keys from an iterable cursor to this map, replacing the values of
* existing keys, if such keys are present.
*
* @return Returns the number of keys added to the map as a result of this call
* (not previously present in the map). Values of existing keys are
* overwritten.
*/
public int putAll(Iterable<? extends IntIntCursor> iterable);
/**
* If <code>key</code> exists, <code>putValue</code> is inserted into the map,
* otherwise any existing value is incremented by <code>additionValue</code>.
*
* @param key The key of the value to adjust.
* @param putValue The value to put if <code>key</code> does not exist.
* @param incrementValue The value to add to the existing value if
* <code>key</code> exists.
* @return Returns the current value associated with <code>key</code> (after
* changes).
*/
public int putOrAdd(int key, int putValue, int incrementValue);
/**
* An equivalent of calling
*
* <pre>
* putOrAdd(key, additionValue, additionValue);
* </pre>
*
* @param key The key of the value to adjust.
* @param additionValue The value to put or add to the existing value if
* <code>key</code> exists.
* @return Returns the current value associated with <code>key</code> (after
* changes).
*/
public int addTo(int key, int additionValue);
/**
* Remove all values at the given key. The default value for the key type is
* returned if the value does not exist in the map.
*/
public int remove(int key);
/**
* Compares the specified object with this set for equality. Returns
* {@code true} if and only if the specified object is also a {@link IntIntMap}
* and both objects contains exactly the same key-value pairs.
*/
public boolean equals(Object obj);
/**
* @return A hash code of elements stored in the map. The hash code is defined
* as a sum of hash codes of keys and values stored within the set).
* Because sum is commutative, this ensures that different order of
* elements in a set does not affect the hash code.
*/
public int hashCode();
/**
* Returns a logical "index" of a given key that can be used to speed up
* follow-up value setters or getters in certain scenarios (conditional logic).
*
* <p>
* The semantics of "indexes" are not strictly defined. Indexes may (and
* typically won't be) contiguous.
*
* <p>
* The index is valid only between map modifications (it will not be affected by
* read-only operations like iteration or value retrievals).
*
* @see #indexExists
* @see #indexGet
* @see #indexInsert
* @see #indexReplace
* @param key The key to locate in the map.
* @return A non-negative value of the logical "index" of the key in the map or
* a negative value if the key did not exist.
*/
public int indexOf(int key);
/**
* @see #indexOf
* @param index The index of a given key, as returned from {@link #indexOf}.
* @return Returns <code>true</code> if the index corresponds to an existing key
* or false otherwise. This is equivalent to checking whether the index
* is a positive value (existing keys) or a negative value (non-existing
* keys).
*/
public boolean indexExists(int index);
/**
* Returns the value associated with an existing key.
*
* @see #indexOf
* @param index The index of an existing key.
* @return Returns the value currently associated with the key.
* @throws AssertionError If assertions are enabled and the index does not
* correspond to an existing key.
*/
public int indexGet(int index);
/**
* Replaces the value associated with an existing key and returns any previous
* value stored for that key.
*
* @see #indexOf
* @param index The index of an existing key.
* @return Returns the previous value associated with the key.
* @throws AssertionError If assertions are enabled and the index does not
* correspond to an existing key.
*/
public int indexReplace(int index, int newValue);
/**
* Inserts a key-value pair for a key that is not present in the map. This
* method may help in avoiding double recalculation of the key's hash.
*
* @see #indexOf
* @param index The index of a previously non-existing key, as returned from
* {@link #indexOf}.
* @throws AssertionError If assertions are enabled and the index corresponds to
* an existing key.
*/
public void indexInsert(int index, int key, int value);
/**
* Removes a key-value pair at an index previously acquired from
* {@link #indexOf}.
*
* @see #indexOf
* @param index The index of the key to remove, as returned from
* {@link #indexOf}.
* @return Returns the previous value associated with the key.
* @throws AssertionError If assertions are enabled and the index does not
* correspond to an existing key.
*/
public int indexRemove(int index);
/**
* Clear all keys and values in the container.
*
* @see #release()
*/
public void clear();
/**
* Removes all elements from the collection and additionally releases any
* internal buffers. Typically, if the object is to be reused, a simple
* {@link #clear()} should be a better alternative since it'll avoid
* reallocation.
*
* @see #clear()
*/
public void release();
/**
* Visually depict the distribution of keys.
*
* @param characters The number of characters to "squeeze" the entire buffer
* into.
* @return Returns a sequence of characters where '.' depicts an empty fragment
* of the internal buffer and 'X' depicts full or nearly full capacity
* within the buffer's range and anything between 1 and 9 is between.
*/
public String visualizeKeyDistribution(int characters);
}
@@ -0,0 +1,15 @@
/*
* HPPC
*
* Copyright (C) 2010-2024 Carrot Search s.c. and contributors
* All rights reserved.
*
* Refer to the full license file "LICENSE.txt":
* https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt
*/
package net.lax1dude.eaglercraft.backend.server.api.collect;
/** A predicate that applies to <code>int</code>, <code>int</code> pairs. */
public interface IntIntPredicate {
public boolean apply(int key, int value);
}
@@ -0,0 +1,15 @@
/*
* HPPC
*
* Copyright (C) 2010-2024 Carrot Search s.c. and contributors
* All rights reserved.
*
* Refer to the full license file "LICENSE.txt":
* https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt
*/
package net.lax1dude.eaglercraft.backend.server.api.collect;
/** A procedure that applies to <code>int</code>, <code>int</code> pairs. */
public interface IntIntProcedure {
public void apply(int key, int value);
}
@@ -0,0 +1,19 @@
/*
* HPPC
*
* Copyright (C) 2010-2024 Carrot Search s.c. and contributors
* All rights reserved.
*
* Refer to the full license file "LICENSE.txt":
* https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt
*/
package net.lax1dude.eaglercraft.backend.server.api.collect;
/**
* Marker interface for containers that can check if they contain a given object
* in at least time <code>O(log n)</code> and ideally in amortized constant time
* <code>O(1)</code>.
*/
public interface IntLookupContainer extends IntContainer {
public boolean contains(int e);
}
@@ -0,0 +1,123 @@
/*
* HPPC
*
* Copyright (C) 2010-2024 Carrot Search s.c. and contributors
* All rights reserved.
*
* Refer to the full license file "LICENSE.txt":
* https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt
*/
package net.lax1dude.eaglercraft.backend.server.api.collect;
import java.util.Iterator;
/**
* An associative container from keys to (one or possibly more) values.
*
* @see IntContainer
*/
public interface IntObjectAssociativeContainer<VType> extends Iterable<IntObjectCursor<VType>> {
/**
* Returns a cursor over the entries (key-value pairs) in this map. The iterator
* is implemented as a cursor and it returns <b>the same cursor instance</b> on
* every call to {@link Iterator#next()}. To read the current key and value use
* the cursor's public fields. An example is shown below.
*
* <pre>
* for (IntShortCursor c : intShortMap) {
* System.out.println(&quot;index=&quot; + c.index + &quot; key=&quot; + c.key + &quot; value=&quot; + c.value);
* }
* </pre>
*
* <p>
* The <code>index</code> field inside the cursor gives the internal index
* inside the container's implementation. The interpretation of this index
* depends on to the container.
*/
@Override
public Iterator<IntObjectCursor<VType>> iterator();
/**
* Returns <code>true</code> if this container has an association to a value for
* the given key.
*/
public boolean containsKey(int key);
/**
* @return Returns the current size (number of assigned keys) in the container.
*/
public int size();
/**
* @return Return <code>true</code> if this hash map contains no assigned keys.
*/
public boolean isEmpty();
/**
* Removes all keys (and associated values) present in a given container. An
* alias to:
*
* <pre>
* keys().removeAll(container)
* </pre>
*
* but with no additional overhead.
*
* @return Returns the number of elements actually removed as a result of this
* call.
*/
public int removeAll(IntContainer container);
/**
* Removes all keys (and associated values) for which the predicate returns
* <code>true</code>.
*
* @return Returns the number of elements actually removed as a result of this
* call.
*/
public int removeAll(IntPredicate predicate);
/**
* Removes all keys (and associated values) for which the predicate returns
* <code>true</code>.
*
* @return Returns the number of elements actually removed as a result of this
* call.
*/
public int removeAll(IntObjectPredicate<? super VType> predicate);
/**
* Applies a given procedure to all keys-value pairs in this container. Returns
* the argument (any subclass of {@link IntObjectProcedure}. This lets the
* caller call methods of the argument by chaining the call (even if the
* argument is an anonymous type) to retrieve computed values.
*/
public <T extends IntObjectProcedure<? super VType>> T forEach(T procedure);
/**
* Applies a given predicate to all keys-value pairs in this container. Returns
* the argument (any subclass of {@link IntObjectPredicate}. This lets the
* caller call methods of the argument by chaining the call (even if the
* argument is an anonymous type) to retrieve computed values.
*
* <p>
* The iteration is continued as long as the predicate returns
* <code>true</code>.
*/
public <T extends IntObjectPredicate<? super VType>> T forEach(T predicate);
/**
* Returns a collection of keys of this container. The returned collection is a
* view over the key set and any modifications (if allowed) introduced to the
* collection will propagate to the associative container immediately.
*/
public IntCollection keys();
/**
* Returns a container view of all values present in this container. The
* returned collection is a view over the key set and any modifications (if
* allowed) introduced to the collection will propagate to the associative
* container immediately.
*/
public ObjectContainer<VType> values();
}
@@ -0,0 +1,34 @@
/*
* HPPC
*
* Copyright (C) 2010-2024 Carrot Search s.c. and contributors
* All rights reserved.
*
* Refer to the full license file "LICENSE.txt":
* https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt
*/
package net.lax1dude.eaglercraft.backend.server.api.collect;
/**
* A cursor over entries of an associative container (int keys and Object
* values).
*/
public final class IntObjectCursor<VType> {
/**
* The current key and value's index in the container this cursor belongs to.
* The meaning of this index is defined by the container (usually it will be an
* index in the underlying storage buffer).
*/
public int index;
/** The current key. */
public int key;
/** The current value. */
public VType value;
@Override
public String toString() {
return "[cursor, index: " + index + ", key: " + key + ", value: " + value + "]";
}
}
@@ -0,0 +1,202 @@
/*
* HPPC
*
* Copyright (C) 2010-2024 Carrot Search s.c. and contributors
* All rights reserved.
*
* Refer to the full license file "LICENSE.txt":
* https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt
*/
package net.lax1dude.eaglercraft.backend.server.api.collect;
/** An associative container with unique binding from keys to a single value. */
public interface IntObjectMap<VType> extends IntObjectAssociativeContainer<VType> {
/**
* @return Returns the value associated with the given key or the default value
* for the value type, if the key is not associated with any value. For
* numeric value types, this default value is 0, for object types it is
* {@code null}.
*/
public VType get(int key);
/**
* @return Returns the value associated with the given key or the provided
* default value if the key is not associated with any value.
*/
public VType getOrDefault(int key, VType defaultValue);
/**
* Place a given key and value in the container.
*
* @return The value previously stored under the given key in the map is
* returned.
*/
public VType put(int key, VType value);
/**
* If the specified key is not already associated with a value, associates it
* with the given value.
*
* @return {@code true} if {@code key} did not exist and {@code value} was
* placed in the map, {@code false} otherwise.
*/
public default boolean putIfAbsent(int key, VType value) {
int keyIndex = indexOf(key);
if (indexExists(keyIndex)) {
return false;
} else {
indexInsert(keyIndex, key, value);
return true;
}
}
/**
* Puts all keys from another container to this map, replacing the values of
* existing keys, if such keys are present.
*
* @return Returns the number of keys added to the map as a result of this call
* (not previously present in the map). Values of existing keys are
* overwritten.
*/
public int putAll(IntObjectAssociativeContainer<? extends VType> container);
/**
* Puts all keys from an iterable cursor to this map, replacing the values of
* existing keys, if such keys are present.
*
* @return Returns the number of keys added to the map as a result of this call
* (not previously present in the map). Values of existing keys are
* overwritten.
*/
public int putAll(Iterable<? extends IntObjectCursor<? extends VType>> iterable);
/**
* Remove all values at the given key. The default value for the key type is
* returned if the value does not exist in the map.
*/
public VType remove(int key);
/**
* Compares the specified object with this set for equality. Returns
* {@code true} if and only if the specified object is also a
* {@link IntObjectMap} and both objects contains exactly the same key-value
* pairs.
*/
public boolean equals(Object obj);
/**
* @return A hash code of elements stored in the map. The hash code is defined
* as a sum of hash codes of keys and values stored within the set).
* Because sum is commutative, this ensures that different order of
* elements in a set does not affect the hash code.
*/
public int hashCode();
/**
* Returns a logical "index" of a given key that can be used to speed up
* follow-up value setters or getters in certain scenarios (conditional logic).
*
* <p>
* The semantics of "indexes" are not strictly defined. Indexes may (and
* typically won't be) contiguous.
*
* <p>
* The index is valid only between map modifications (it will not be affected by
* read-only operations like iteration or value retrievals).
*
* @see #indexExists
* @see #indexGet
* @see #indexInsert
* @see #indexReplace
* @param key The key to locate in the map.
* @return A non-negative value of the logical "index" of the key in the map or
* a negative value if the key did not exist.
*/
public int indexOf(int key);
/**
* @see #indexOf
* @param index The index of a given key, as returned from {@link #indexOf}.
* @return Returns <code>true</code> if the index corresponds to an existing key
* or false otherwise. This is equivalent to checking whether the index
* is a positive value (existing keys) or a negative value (non-existing
* keys).
*/
public boolean indexExists(int index);
/**
* Returns the value associated with an existing key.
*
* @see #indexOf
* @param index The index of an existing key.
* @return Returns the value currently associated with the key.
* @throws AssertionError If assertions are enabled and the index does not
* correspond to an existing key.
*/
public VType indexGet(int index);
/**
* Replaces the value associated with an existing key and returns any previous
* value stored for that key.
*
* @see #indexOf
* @param index The index of an existing key.
* @return Returns the previous value associated with the key.
* @throws AssertionError If assertions are enabled and the index does not
* correspond to an existing key.
*/
public VType indexReplace(int index, VType newValue);
/**
* Inserts a key-value pair for a key that is not present in the map. This
* method may help in avoiding double recalculation of the key's hash.
*
* @see #indexOf
* @param index The index of a previously non-existing key, as returned from
* {@link #indexOf}.
* @throws AssertionError If assertions are enabled and the index corresponds to
* an existing key.
*/
public void indexInsert(int index, int key, VType value);
/**
* Removes a key-value pair at an index previously acquired from
* {@link #indexOf}.
*
* @see #indexOf
* @param index The index of the key to remove, as returned from
* {@link #indexOf}.
* @return Returns the previous value associated with the key.
* @throws AssertionError If assertions are enabled and the index does not
* correspond to an existing key.
*/
public VType indexRemove(int index);
/**
* Clear all keys and values in the container.
*
* @see #release()
*/
public void clear();
/**
* Removes all elements from the collection and additionally releases any
* internal buffers. Typically, if the object is to be reused, a simple
* {@link #clear()} should be a better alternative since it'll avoid
* reallocation.
*
* @see #clear()
*/
public void release();
/**
* Visually depict the distribution of keys.
*
* @param characters The number of characters to "squeeze" the entire buffer
* into.
* @return Returns a sequence of characters where '.' depicts an empty fragment
* of the internal buffer and 'X' depicts full or nearly full capacity
* within the buffer's range and anything between 1 and 9 is between.
*/
public String visualizeKeyDistribution(int characters);
}
@@ -0,0 +1,15 @@
/*
* HPPC
*
* Copyright (C) 2010-2024 Carrot Search s.c. and contributors
* All rights reserved.
*
* Refer to the full license file "LICENSE.txt":
* https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt
*/
package net.lax1dude.eaglercraft.backend.server.api.collect;
/** A predicate that applies to <code>int</code>, <code>Object</code> pairs. */
public interface IntObjectPredicate<VType> {
public boolean apply(int key, VType value);
}
@@ -0,0 +1,15 @@
/*
* HPPC
*
* Copyright (C) 2010-2024 Carrot Search s.c. and contributors
* All rights reserved.
*
* Refer to the full license file "LICENSE.txt":
* https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt
*/
package net.lax1dude.eaglercraft.backend.server.api.collect;
/** A procedure that applies to <code>int</code>, <code>Object</code> pairs. */
public interface IntObjectProcedure<VType> {
public void apply(int key, VType value);
}
@@ -0,0 +1,15 @@
/*
* HPPC
*
* Copyright (C) 2010-2024 Carrot Search s.c. and contributors
* All rights reserved.
*
* Refer to the full license file "LICENSE.txt":
* https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt
*/
package net.lax1dude.eaglercraft.backend.server.api.collect;
/** A predicate that applies to <code>int</code> objects. */
public interface IntPredicate {
public boolean apply(int value);
}
@@ -0,0 +1,15 @@
/*
* HPPC
*
* Copyright (C) 2010-2024 Carrot Search s.c. and contributors
* All rights reserved.
*
* Refer to the full license file "LICENSE.txt":
* https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt
*/
package net.lax1dude.eaglercraft.backend.server.api.collect;
/** A procedure that applies to <code>int</code> objects. */
public interface IntProcedure {
public void apply(int value);
}
@@ -0,0 +1,43 @@
/*
* HPPC
*
* Copyright (C) 2010-2024 Carrot Search s.c. and contributors
* All rights reserved.
*
* Refer to the full license file "LICENSE.txt":
* https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt
*/
package net.lax1dude.eaglercraft.backend.server.api.collect;
/** A set of <code>int</code>s. */
public interface IntSet extends IntCollection {
/**
* Adds <code>k</code> to the set.
*
* @return Returns <code>true</code> if this element was not part of the set
* before. Returns <code>false</code> if an equal element is already
* part of the set, <b>does not replace the existing element</b> with
* the argument.
*/
public boolean add(int k);
/**
* Visually depict the distribution of keys.
*
* @param characters The number of characters to "squeeze" the entire buffer
* into.
* @return Returns a sequence of characters where '.' depicts an empty fragment
* of the internal buffer and 'X' depicts full or nearly full capacity
* within the buffer's range and anything between 1 and 9 is between.
*/
public String visualizeKeyDistribution(int characters);
/**
* Adds all elements from the given {@link IntContainer} to this set.
*
* @return Returns the number of elements actually added as a result of this
* call (not previously present in the set).
* @since 0.9.1
*/
public int addAll(IntContainer container);
}
@@ -0,0 +1,73 @@
/*
* HPPC
*
* Copyright (C) 2010-2024 Carrot Search s.c. and contributors
* All rights reserved.
*
* Refer to the full license file "LICENSE.txt":
* https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt
*/
package net.lax1dude.eaglercraft.backend.server.api.collect;
/**
* A collection allows basic, efficient operations on sets of elements
* (difference and intersection).
*/
public interface ObjectCollection<KType> extends ObjectContainer<KType> {
/**
* Removes all occurrences of <code>e</code> from this collection.
*
* @param e Element to be removed from this collection, if present.
* @return The number of removed elements as a result of this call.
*/
public int removeAll(KType e);
/**
* Removes all elements in this collection that are present in <code>c</code>.
*
* @return Returns the number of removed elements.
*/
public int removeAll(ObjectLookupContainer<? super KType> c);
/**
* Removes all elements in this collection for which the given predicate returns
* <code>true</code> .
*
* @return Returns the number of removed elements.
*/
public int removeAll(ObjectPredicate<? super KType> predicate);
/**
* Keeps all elements in this collection that are present in <code>c</code>.
* Runs in time proportional to the number of elements in this collection.
* Equivalent of sets intersection.
*
* @return Returns the number of removed elements.
*/
public int retainAll(ObjectLookupContainer<? super KType> c);
/**
* Keeps all elements in this collection for which the given predicate returns
* <code>true</code>.
*
* @return Returns the number of removed elements.
*/
public int retainAll(ObjectPredicate<? super KType> predicate);
/**
* Removes all elements from this collection.
*
* @see #release()
*/
public void clear();
/**
* Removes all elements from the collection and additionally releases any
* internal buffers. Typically, if the object is to be reused, a simple
* {@link #clear()} should be a better alternative since it'll avoid
* reallocation.
*
* @see #clear()
*/
public void release();
}
@@ -0,0 +1,98 @@
/*
* HPPC
*
* Copyright (C) 2010-2024 Carrot Search s.c. and contributors
* All rights reserved.
*
* Refer to the full license file "LICENSE.txt":
* https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt
*/
package net.lax1dude.eaglercraft.backend.server.api.collect;
import java.util.Iterator;
/** A generic container holding <code>Object</code>s. */
public interface ObjectContainer<KType> extends Iterable<ObjectCursor<KType>> {
/**
* Returns an iterator to a cursor traversing the collection. The order of
* traversal is not defined. More than one cursor may be active at a time. The
* behavior of iterators is undefined if structural changes are made to the
* underlying collection.
*
* <p>
* The iterator is implemented as a cursor and it returns <b>the same cursor
* instance</b> on every call to {@link Iterator#next()} (to avoid boxing of
* primitive types). To read the current list's value (or index in the list) use
* the cursor's public fields. An example is shown below.
*
* <pre>
* for (ObjectCursor&lt;Object&gt; c : container) {
* System.out.println(&quot;index=&quot; + c.index + &quot; value=&quot; + c.value);
* }
* </pre>
*/
public Iterator<ObjectCursor<KType>> iterator();
/**
* Lookup a given element in the container. This operation has no speed
* guarantees (may be linear with respect to the size of this container).
*
* @return Returns <code>true</code> if this container has an element equal to
* <code>e</code>.
*/
public boolean contains(KType e);
/**
* Return the current number of elements in this container. The time for
* calculating the container's size may take <code>O(n)</code> time, although
* implementing classes should try to maintain the current size and return in
* constant time.
*/
public int size();
/** Shortcut for <code>size() == 0</code>. */
public boolean isEmpty();
/**
* Copies all elements of this container to an array.
*
* <p>
* The returned array is always a copy, regardless of the storage used by the
* container.
*/
public Object[] toArray();
/**
* Copies all elements of this container to a dynamically created array of the
* given component type.
*
* @throws ArrayStoreException Thrown if this container's elements are not
* assignable to the array's component type.
*/
public <T> T[] toArray(Class<T> componentClass);
/**
* Applies a <code>procedure</code> to all container elements. Returns the
* argument (any subclass of {@link ObjectProcedure}. This lets the caller to
* call methods of the argument by chaining the call (even if the argument is an
* anonymous type) to retrieve computed values, for example (IntContainer):
*
* <pre>
* int count = container.forEach(new IntProcedure() {
* int count; // this is a field declaration in an anonymous class.
*
* public void apply(int value) {
* count++;
* }
* }).count;
* </pre>
*/
public <T extends ObjectProcedure<? super KType>> T forEach(T procedure);
/**
* Applies a <code>predicate</code> to container elements as long, as the
* predicate returns <code>
* true</code>. The iteration is interrupted otherwise.
*/
public <T extends ObjectPredicate<? super KType>> T forEach(T predicate);
}
@@ -0,0 +1,28 @@
/*
* HPPC
*
* Copyright (C) 2010-2024 Carrot Search s.c. and contributors
* All rights reserved.
*
* Refer to the full license file "LICENSE.txt":
* https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt
*/
package net.lax1dude.eaglercraft.backend.server.api.collect;
/** A cursor over a collection of <code>Objects</code>. */
public final class ObjectCursor<KType> {
/**
* The current value's index in the container this cursor belongs to. The
* meaning of this index is defined by the container (usually it will be an
* index in the underlying storage buffer).
*/
public int index;
/** The current value. */
public KType value;
@Override
public String toString() {
return "[cursor, index: " + index + ", value: " + value + "]";
}
}
@@ -0,0 +1,109 @@
/*
* HPPC
*
* Copyright (C) 2010-2024 Carrot Search s.c. and contributors
* All rights reserved.
*
* Refer to the full license file "LICENSE.txt":
* https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt
*/
package net.lax1dude.eaglercraft.backend.server.api.collect;
import java.util.RandomAccess;
import java.util.stream.Stream;
/**
* An indexed container provides random access to elements based on an
* <code>index</code>. Indexes are zero-based.
*/
public interface ObjectIndexedContainer<KType> extends ObjectCollection<KType>, RandomAccess {
/**
* Removes the first element that equals <code>e1</code>, returning whether an
* element has been removed.
*/
public boolean removeElement(KType e1);
/**
* Removes the first element that equals <code>e1</code>, returning its deleted
* position or <code>
* -1</code> if the element was not found.
*/
public int removeFirst(KType e1);
/**
* Removes the last element that equals <code>e1</code>, returning its deleted
* position or <code>
* -1</code> if the element was not found.
*/
public int removeLast(KType e1);
/**
* Returns the index of the first occurrence of the specified element in this
* list, or -1 if this list does not contain the element.
*/
public int indexOf(KType e1);
/**
* Returns the index of the last occurrence of the specified element in this
* list, or -1 if this list does not contain the element.
*/
public int lastIndexOf(KType e1);
/**
* Adds an element to the end of this container (the last index is incremented
* by one).
*/
public void add(KType e1);
/**
* Inserts the specified element at the specified position in this list.
*
* @param index The index at which the element should be inserted, shifting any
* existing and subsequent elements to the right.
*/
public void insert(int index, KType e1);
/**
* Replaces the element at the specified position in this list with the
* specified element.
*
* @return Returns the previous value in the list.
*/
public KType set(int index, KType e1);
/**
* @return Returns the element at index <code>index</code> from the list.
*/
public KType get(int index);
/**
* Removes the element at the specified position in this container and returns
* it.
*
* @see #removeFirst
* @see #removeLast
* @see #removeAll
*/
public KType removeAt(int index);
/**
* Removes and returns the last element of this container. This container must
* not be empty.
*/
public KType removeLast();
/**
* Removes from this container all of the elements with indexes between
* <code>fromIndex</code>, inclusive, and <code>toIndex</code>, exclusive.
*/
public void removeRange(int fromIndex, int toIndex);
/** Returns this container elements as a stream. */
public Stream<KType> stream();
/** Sorts the elements in this container and returns this container. */
public ObjectIndexedContainer<KType> sort();
/** Reverses the elements in this container and returns this container. */
public ObjectIndexedContainer<KType> reverse();
}
@@ -0,0 +1,123 @@
/*
* HPPC
*
* Copyright (C) 2010-2024 Carrot Search s.c. and contributors
* All rights reserved.
*
* Refer to the full license file "LICENSE.txt":
* https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt
*/
package net.lax1dude.eaglercraft.backend.server.api.collect;
import java.util.Iterator;
/**
* An associative container from keys to (one or possibly more) values.
*
* @see ObjectContainer
*/
public interface ObjectIntAssociativeContainer<KType> extends Iterable<ObjectIntCursor<KType>> {
/**
* Returns a cursor over the entries (key-value pairs) in this map. The iterator
* is implemented as a cursor and it returns <b>the same cursor instance</b> on
* every call to {@link Iterator#next()}. To read the current key and value use
* the cursor's public fields. An example is shown below.
*
* <pre>
* for (IntShortCursor c : intShortMap) {
* System.out.println(&quot;index=&quot; + c.index + &quot; key=&quot; + c.key + &quot; value=&quot; + c.value);
* }
* </pre>
*
* <p>
* The <code>index</code> field inside the cursor gives the internal index
* inside the container's implementation. The interpretation of this index
* depends on to the container.
*/
@Override
public Iterator<ObjectIntCursor<KType>> iterator();
/**
* Returns <code>true</code> if this container has an association to a value for
* the given key.
*/
public boolean containsKey(KType key);
/**
* @return Returns the current size (number of assigned keys) in the container.
*/
public int size();
/**
* @return Return <code>true</code> if this hash map contains no assigned keys.
*/
public boolean isEmpty();
/**
* Removes all keys (and associated values) present in a given container. An
* alias to:
*
* <pre>
* keys().removeAll(container)
* </pre>
*
* but with no additional overhead.
*
* @return Returns the number of elements actually removed as a result of this
* call.
*/
public int removeAll(ObjectContainer<? super KType> container);
/**
* Removes all keys (and associated values) for which the predicate returns
* <code>true</code>.
*
* @return Returns the number of elements actually removed as a result of this
* call.
*/
public int removeAll(ObjectPredicate<? super KType> predicate);
/**
* Removes all keys (and associated values) for which the predicate returns
* <code>true</code>.
*
* @return Returns the number of elements actually removed as a result of this
* call.
*/
public int removeAll(ObjectIntPredicate<? super KType> predicate);
/**
* Applies a given procedure to all keys-value pairs in this container. Returns
* the argument (any subclass of {@link ObjectIntProcedure}. This lets the
* caller call methods of the argument by chaining the call (even if the
* argument is an anonymous type) to retrieve computed values.
*/
public <T extends ObjectIntProcedure<? super KType>> T forEach(T procedure);
/**
* Applies a given predicate to all keys-value pairs in this container. Returns
* the argument (any subclass of {@link ObjectIntPredicate}. This lets the
* caller call methods of the argument by chaining the call (even if the
* argument is an anonymous type) to retrieve computed values.
*
* <p>
* The iteration is continued as long as the predicate returns
* <code>true</code>.
*/
public <T extends ObjectIntPredicate<? super KType>> T forEach(T predicate);
/**
* Returns a collection of keys of this container. The returned collection is a
* view over the key set and any modifications (if allowed) introduced to the
* collection will propagate to the associative container immediately.
*/
public ObjectCollection<KType> keys();
/**
* Returns a container view of all values present in this container. The
* returned collection is a view over the key set and any modifications (if
* allowed) introduced to the collection will propagate to the associative
* container immediately.
*/
public IntContainer values();
}
@@ -0,0 +1,34 @@
/*
* HPPC
*
* Copyright (C) 2010-2024 Carrot Search s.c. and contributors
* All rights reserved.
*
* Refer to the full license file "LICENSE.txt":
* https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt
*/
package net.lax1dude.eaglercraft.backend.server.api.collect;
/**
* A cursor over entries of an associative container (Object keys and int
* values).
*/
public final class ObjectIntCursor<KType> {
/**
* The current key and value's index in the container this cursor belongs to.
* The meaning of this index is defined by the container (usually it will be an
* index in the underlying storage buffer).
*/
public int index;
/** The current key. */
public KType key;
/** The current value. */
public int value;
@Override
public String toString() {
return "[cursor, index: " + index + ", key: " + key + ", value: " + value + "]";
}
}
@@ -0,0 +1,230 @@
/*
* HPPC
*
* Copyright (C) 2010-2024 Carrot Search s.c. and contributors
* All rights reserved.
*
* Refer to the full license file "LICENSE.txt":
* https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt
*/
package net.lax1dude.eaglercraft.backend.server.api.collect;
/** An associative container with unique binding from keys to a single value. */
public interface ObjectIntMap<KType> extends ObjectIntAssociativeContainer<KType> {
/**
* @return Returns the value associated with the given key or the default value
* for the value type, if the key is not associated with any value. For
* numeric value types, this default value is 0, for object types it is
* {@code null}.
*/
public int get(KType key);
/**
* @return Returns the value associated with the given key or the provided
* default value if the key is not associated with any value.
*/
public int getOrDefault(KType key, int defaultValue);
/**
* Place a given key and value in the container.
*
* @return The value previously stored under the given key in the map is
* returned.
*/
public int put(KType key, int value);
/**
* If the specified key is not already associated with a value, associates it
* with the given value.
*
* @return {@code true} if {@code key} did not exist and {@code value} was
* placed in the map, {@code false} otherwise.
*/
public default boolean putIfAbsent(KType key, int value) {
int keyIndex = indexOf(key);
if (indexExists(keyIndex)) {
return false;
} else {
indexInsert(keyIndex, key, value);
return true;
}
}
/**
* Puts all keys from another container to this map, replacing the values of
* existing keys, if such keys are present.
*
* @return Returns the number of keys added to the map as a result of this call
* (not previously present in the map). Values of existing keys are
* overwritten.
*/
public int putAll(ObjectIntAssociativeContainer<? extends KType> container);
/**
* Puts all keys from an iterable cursor to this map, replacing the values of
* existing keys, if such keys are present.
*
* @return Returns the number of keys added to the map as a result of this call
* (not previously present in the map). Values of existing keys are
* overwritten.
*/
public int putAll(Iterable<? extends ObjectIntCursor<? extends KType>> iterable);
/**
* If <code>key</code> exists, <code>putValue</code> is inserted into the map,
* otherwise any existing value is incremented by <code>additionValue</code>.
*
* @param key The key of the value to adjust.
* @param putValue The value to put if <code>key</code> does not exist.
* @param incrementValue The value to add to the existing value if
* <code>key</code> exists.
* @return Returns the current value associated with <code>key</code> (after
* changes).
*/
public int putOrAdd(KType key, int putValue, int incrementValue);
/**
* An equivalent of calling
*
* <pre>
* putOrAdd(key, additionValue, additionValue);
* </pre>
*
* @param key The key of the value to adjust.
* @param additionValue The value to put or add to the existing value if
* <code>key</code> exists.
* @return Returns the current value associated with <code>key</code> (after
* changes).
*/
public int addTo(KType key, int additionValue);
/**
* Remove all values at the given key. The default value for the key type is
* returned if the value does not exist in the map.
*/
public int remove(KType key);
/**
* Compares the specified object with this set for equality. Returns
* {@code true} if and only if the specified object is also a
* {@link ObjectIntMap} and both objects contains exactly the same key-value
* pairs.
*/
public boolean equals(Object obj);
/**
* @return A hash code of elements stored in the map. The hash code is defined
* as a sum of hash codes of keys and values stored within the set).
* Because sum is commutative, this ensures that different order of
* elements in a set does not affect the hash code.
*/
public int hashCode();
/**
* Returns a logical "index" of a given key that can be used to speed up
* follow-up value setters or getters in certain scenarios (conditional logic).
*
* <p>
* The semantics of "indexes" are not strictly defined. Indexes may (and
* typically won't be) contiguous.
*
* <p>
* The index is valid only between map modifications (it will not be affected by
* read-only operations like iteration or value retrievals).
*
* @see #indexExists
* @see #indexGet
* @see #indexInsert
* @see #indexReplace
* @param key The key to locate in the map.
* @return A non-negative value of the logical "index" of the key in the map or
* a negative value if the key did not exist.
*/
public int indexOf(KType key);
/**
* @see #indexOf
* @param index The index of a given key, as returned from {@link #indexOf}.
* @return Returns <code>true</code> if the index corresponds to an existing key
* or false otherwise. This is equivalent to checking whether the index
* is a positive value (existing keys) or a negative value (non-existing
* keys).
*/
public boolean indexExists(int index);
/**
* Returns the value associated with an existing key.
*
* @see #indexOf
* @param index The index of an existing key.
* @return Returns the value currently associated with the key.
* @throws AssertionError If assertions are enabled and the index does not
* correspond to an existing key.
*/
public int indexGet(int index);
/**
* Replaces the value associated with an existing key and returns any previous
* value stored for that key.
*
* @see #indexOf
* @param index The index of an existing key.
* @return Returns the previous value associated with the key.
* @throws AssertionError If assertions are enabled and the index does not
* correspond to an existing key.
*/
public int indexReplace(int index, int newValue);
/**
* Inserts a key-value pair for a key that is not present in the map. This
* method may help in avoiding double recalculation of the key's hash.
*
* @see #indexOf
* @param index The index of a previously non-existing key, as returned from
* {@link #indexOf}.
* @throws AssertionError If assertions are enabled and the index corresponds to
* an existing key.
*/
public void indexInsert(int index, KType key, int value);
/**
* Removes a key-value pair at an index previously acquired from
* {@link #indexOf}.
*
* @see #indexOf
* @param index The index of the key to remove, as returned from
* {@link #indexOf}.
* @return Returns the previous value associated with the key.
* @throws AssertionError If assertions are enabled and the index does not
* correspond to an existing key.
*/
public int indexRemove(int index);
/**
* Clear all keys and values in the container.
*
* @see #release()
*/
public void clear();
/**
* Removes all elements from the collection and additionally releases any
* internal buffers. Typically, if the object is to be reused, a simple
* {@link #clear()} should be a better alternative since it'll avoid
* reallocation.
*
* @see #clear()
*/
public void release();
/**
* Visually depict the distribution of keys.
*
* @param characters The number of characters to "squeeze" the entire buffer
* into.
* @return Returns a sequence of characters where '.' depicts an empty fragment
* of the internal buffer and 'X' depicts full or nearly full capacity
* within the buffer's range and anything between 1 and 9 is between.
*/
public String visualizeKeyDistribution(int characters);
}
@@ -0,0 +1,15 @@
/*
* HPPC
*
* Copyright (C) 2010-2024 Carrot Search s.c. and contributors
* All rights reserved.
*
* Refer to the full license file "LICENSE.txt":
* https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt
*/
package net.lax1dude.eaglercraft.backend.server.api.collect;
/** A predicate that applies to <code>Object</code>, <code>int</code> pairs. */
public interface ObjectIntPredicate<KType> {
public boolean apply(KType key, int value);
}
@@ -0,0 +1,15 @@
/*
* HPPC
*
* Copyright (C) 2010-2024 Carrot Search s.c. and contributors
* All rights reserved.
*
* Refer to the full license file "LICENSE.txt":
* https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt
*/
package net.lax1dude.eaglercraft.backend.server.api.collect;
/** A procedure that applies to <code>Object</code>, <code>int</code> pairs. */
public interface ObjectIntProcedure<KType> {
public void apply(KType key, int value);
}
@@ -0,0 +1,19 @@
/*
* HPPC
*
* Copyright (C) 2010-2024 Carrot Search s.c. and contributors
* All rights reserved.
*
* Refer to the full license file "LICENSE.txt":
* https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt
*/
package net.lax1dude.eaglercraft.backend.server.api.collect;
/**
* Marker interface for containers that can check if they contain a given object
* in at least time <code>O(log n)</code> and ideally in amortized constant time
* <code>O(1)</code>.
*/
public interface ObjectLookupContainer<KType> extends ObjectContainer<KType> {
public boolean contains(KType e);
}
@@ -0,0 +1,123 @@
/*
* HPPC
*
* Copyright (C) 2010-2024 Carrot Search s.c. and contributors
* All rights reserved.
*
* Refer to the full license file "LICENSE.txt":
* https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt
*/
package net.lax1dude.eaglercraft.backend.server.api.collect;
import java.util.Iterator;
/**
* An associative container from keys to (one or possibly more) values.
*
* @see ObjectContainer
*/
public interface ObjectObjectAssociativeContainer<KType, VType> extends Iterable<ObjectObjectCursor<KType, VType>> {
/**
* Returns a cursor over the entries (key-value pairs) in this map. The iterator
* is implemented as a cursor and it returns <b>the same cursor instance</b> on
* every call to {@link Iterator#next()}. To read the current key and value use
* the cursor's public fields. An example is shown below.
*
* <pre>
* for (IntShortCursor c : intShortMap) {
* System.out.println(&quot;index=&quot; + c.index + &quot; key=&quot; + c.key + &quot; value=&quot; + c.value);
* }
* </pre>
*
* <p>
* The <code>index</code> field inside the cursor gives the internal index
* inside the container's implementation. The interpretation of this index
* depends on to the container.
*/
@Override
public Iterator<ObjectObjectCursor<KType, VType>> iterator();
/**
* Returns <code>true</code> if this container has an association to a value for
* the given key.
*/
public boolean containsKey(KType key);
/**
* @return Returns the current size (number of assigned keys) in the container.
*/
public int size();
/**
* @return Return <code>true</code> if this hash map contains no assigned keys.
*/
public boolean isEmpty();
/**
* Removes all keys (and associated values) present in a given container. An
* alias to:
*
* <pre>
* keys().removeAll(container)
* </pre>
*
* but with no additional overhead.
*
* @return Returns the number of elements actually removed as a result of this
* call.
*/
public int removeAll(ObjectContainer<? super KType> container);
/**
* Removes all keys (and associated values) for which the predicate returns
* <code>true</code>.
*
* @return Returns the number of elements actually removed as a result of this
* call.
*/
public int removeAll(ObjectPredicate<? super KType> predicate);
/**
* Removes all keys (and associated values) for which the predicate returns
* <code>true</code>.
*
* @return Returns the number of elements actually removed as a result of this
* call.
*/
public int removeAll(ObjectObjectPredicate<? super KType, ? super VType> predicate);
/**
* Applies a given procedure to all keys-value pairs in this container. Returns
* the argument (any subclass of {@link ObjectObjectProcedure}. This lets the
* caller call methods of the argument by chaining the call (even if the
* argument is an anonymous type) to retrieve computed values.
*/
public <T extends ObjectObjectProcedure<? super KType, ? super VType>> T forEach(T procedure);
/**
* Applies a given predicate to all keys-value pairs in this container. Returns
* the argument (any subclass of {@link ObjectObjectPredicate}. This lets the
* caller call methods of the argument by chaining the call (even if the
* argument is an anonymous type) to retrieve computed values.
*
* <p>
* The iteration is continued as long as the predicate returns
* <code>true</code>.
*/
public <T extends ObjectObjectPredicate<? super KType, ? super VType>> T forEach(T predicate);
/**
* Returns a collection of keys of this container. The returned collection is a
* view over the key set and any modifications (if allowed) introduced to the
* collection will propagate to the associative container immediately.
*/
public ObjectCollection<KType> keys();
/**
* Returns a container view of all values present in this container. The
* returned collection is a view over the key set and any modifications (if
* allowed) introduced to the collection will propagate to the associative
* container immediately.
*/
public ObjectContainer<VType> values();
}
@@ -0,0 +1,34 @@
/*
* HPPC
*
* Copyright (C) 2010-2024 Carrot Search s.c. and contributors
* All rights reserved.
*
* Refer to the full license file "LICENSE.txt":
* https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt
*/
package net.lax1dude.eaglercraft.backend.server.api.collect;
/**
* A cursor over entries of an associative container (Object keys and Object
* values).
*/
public final class ObjectObjectCursor<KType, VType> {
/**
* The current key and value's index in the container this cursor belongs to.
* The meaning of this index is defined by the container (usually it will be an
* index in the underlying storage buffer).
*/
public int index;
/** The current key. */
public KType key;
/** The current value. */
public VType value;
@Override
public String toString() {
return "[cursor, index: " + index + ", key: " + key + ", value: " + value + "]";
}
}
@@ -0,0 +1,202 @@
/*
* HPPC
*
* Copyright (C) 2010-2024 Carrot Search s.c. and contributors
* All rights reserved.
*
* Refer to the full license file "LICENSE.txt":
* https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt
*/
package net.lax1dude.eaglercraft.backend.server.api.collect;
/** An associative container with unique binding from keys to a single value. */
public interface ObjectObjectMap<KType, VType> extends ObjectObjectAssociativeContainer<KType, VType> {
/**
* @return Returns the value associated with the given key or the default value
* for the value type, if the key is not associated with any value. For
* numeric value types, this default value is 0, for object types it is
* {@code null}.
*/
public VType get(KType key);
/**
* @return Returns the value associated with the given key or the provided
* default value if the key is not associated with any value.
*/
public VType getOrDefault(KType key, VType defaultValue);
/**
* Place a given key and value in the container.
*
* @return The value previously stored under the given key in the map is
* returned.
*/
public VType put(KType key, VType value);
/**
* If the specified key is not already associated with a value, associates it
* with the given value.
*
* @return {@code true} if {@code key} did not exist and {@code value} was
* placed in the map, {@code false} otherwise.
*/
public default boolean putIfAbsent(KType key, VType value) {
int keyIndex = indexOf(key);
if (indexExists(keyIndex)) {
return false;
} else {
indexInsert(keyIndex, key, value);
return true;
}
}
/**
* Puts all keys from another container to this map, replacing the values of
* existing keys, if such keys are present.
*
* @return Returns the number of keys added to the map as a result of this call
* (not previously present in the map). Values of existing keys are
* overwritten.
*/
public int putAll(ObjectObjectAssociativeContainer<? extends KType, ? extends VType> container);
/**
* Puts all keys from an iterable cursor to this map, replacing the values of
* existing keys, if such keys are present.
*
* @return Returns the number of keys added to the map as a result of this call
* (not previously present in the map). Values of existing keys are
* overwritten.
*/
public int putAll(Iterable<? extends ObjectObjectCursor<? extends KType, ? extends VType>> iterable);
/**
* Remove all values at the given key. The default value for the key type is
* returned if the value does not exist in the map.
*/
public VType remove(KType key);
/**
* Compares the specified object with this set for equality. Returns
* {@code true} if and only if the specified object is also a
* {@link ObjectObjectMap} and both objects contains exactly the same key-value
* pairs.
*/
public boolean equals(Object obj);
/**
* @return A hash code of elements stored in the map. The hash code is defined
* as a sum of hash codes of keys and values stored within the set).
* Because sum is commutative, this ensures that different order of
* elements in a set does not affect the hash code.
*/
public int hashCode();
/**
* Returns a logical "index" of a given key that can be used to speed up
* follow-up value setters or getters in certain scenarios (conditional logic).
*
* <p>
* The semantics of "indexes" are not strictly defined. Indexes may (and
* typically won't be) contiguous.
*
* <p>
* The index is valid only between map modifications (it will not be affected by
* read-only operations like iteration or value retrievals).
*
* @see #indexExists
* @see #indexGet
* @see #indexInsert
* @see #indexReplace
* @param key The key to locate in the map.
* @return A non-negative value of the logical "index" of the key in the map or
* a negative value if the key did not exist.
*/
public int indexOf(KType key);
/**
* @see #indexOf
* @param index The index of a given key, as returned from {@link #indexOf}.
* @return Returns <code>true</code> if the index corresponds to an existing key
* or false otherwise. This is equivalent to checking whether the index
* is a positive value (existing keys) or a negative value (non-existing
* keys).
*/
public boolean indexExists(int index);
/**
* Returns the value associated with an existing key.
*
* @see #indexOf
* @param index The index of an existing key.
* @return Returns the value currently associated with the key.
* @throws AssertionError If assertions are enabled and the index does not
* correspond to an existing key.
*/
public VType indexGet(int index);
/**
* Replaces the value associated with an existing key and returns any previous
* value stored for that key.
*
* @see #indexOf
* @param index The index of an existing key.
* @return Returns the previous value associated with the key.
* @throws AssertionError If assertions are enabled and the index does not
* correspond to an existing key.
*/
public VType indexReplace(int index, VType newValue);
/**
* Inserts a key-value pair for a key that is not present in the map. This
* method may help in avoiding double recalculation of the key's hash.
*
* @see #indexOf
* @param index The index of a previously non-existing key, as returned from
* {@link #indexOf}.
* @throws AssertionError If assertions are enabled and the index corresponds to
* an existing key.
*/
public void indexInsert(int index, KType key, VType value);
/**
* Removes a key-value pair at an index previously acquired from
* {@link #indexOf}.
*
* @see #indexOf
* @param index The index of the key to remove, as returned from
* {@link #indexOf}.
* @return Returns the previous value associated with the key.
* @throws AssertionError If assertions are enabled and the index does not
* correspond to an existing key.
*/
public VType indexRemove(int index);
/**
* Clear all keys and values in the container.
*
* @see #release()
*/
public void clear();
/**
* Removes all elements from the collection and additionally releases any
* internal buffers. Typically, if the object is to be reused, a simple
* {@link #clear()} should be a better alternative since it'll avoid
* reallocation.
*
* @see #clear()
*/
public void release();
/**
* Visually depict the distribution of keys.
*
* @param characters The number of characters to "squeeze" the entire buffer
* into.
* @return Returns a sequence of characters where '.' depicts an empty fragment
* of the internal buffer and 'X' depicts full or nearly full capacity
* within the buffer's range and anything between 1 and 9 is between.
*/
public String visualizeKeyDistribution(int characters);
}
@@ -0,0 +1,17 @@
/*
* HPPC
*
* Copyright (C) 2010-2024 Carrot Search s.c. and contributors
* All rights reserved.
*
* Refer to the full license file "LICENSE.txt":
* https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt
*/
package net.lax1dude.eaglercraft.backend.server.api.collect;
/**
* A predicate that applies to <code>Object</code>, <code>Object</code> pairs.
*/
public interface ObjectObjectPredicate<KType, VType> {
public boolean apply(KType key, VType value);
}
@@ -0,0 +1,17 @@
/*
* HPPC
*
* Copyright (C) 2010-2024 Carrot Search s.c. and contributors
* All rights reserved.
*
* Refer to the full license file "LICENSE.txt":
* https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt
*/
package net.lax1dude.eaglercraft.backend.server.api.collect;
/**
* A procedure that applies to <code>Object</code>, <code>Object</code> pairs.
*/
public interface ObjectObjectProcedure<KType, VType> {
public void apply(KType key, VType value);
}
@@ -0,0 +1,15 @@
/*
* HPPC
*
* Copyright (C) 2010-2024 Carrot Search s.c. and contributors
* All rights reserved.
*
* Refer to the full license file "LICENSE.txt":
* https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt
*/
package net.lax1dude.eaglercraft.backend.server.api.collect;
/** A predicate that applies to <code>Object</code> objects. */
public interface ObjectPredicate<KType> {
public boolean apply(KType value);
}
@@ -0,0 +1,15 @@
/*
* HPPC
*
* Copyright (C) 2010-2024 Carrot Search s.c. and contributors
* All rights reserved.
*
* Refer to the full license file "LICENSE.txt":
* https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt
*/
package net.lax1dude.eaglercraft.backend.server.api.collect;
/** A procedure that applies to <code>Object</code> objects. */
public interface ObjectProcedure<KType> {
public void apply(KType value);
}
@@ -0,0 +1,43 @@
/*
* HPPC
*
* Copyright (C) 2010-2024 Carrot Search s.c. and contributors
* All rights reserved.
*
* Refer to the full license file "LICENSE.txt":
* https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt
*/
package net.lax1dude.eaglercraft.backend.server.api.collect;
/** A set of <code>Object</code>s. */
public interface ObjectSet<KType> extends ObjectCollection<KType> {
/**
* Adds <code>k</code> to the set.
*
* @return Returns <code>true</code> if this element was not part of the set
* before. Returns <code>false</code> if an equal element is already
* part of the set, <b>does not replace the existing element</b> with
* the argument.
*/
public boolean add(KType k);
/**
* Visually depict the distribution of keys.
*
* @param characters The number of characters to "squeeze" the entire buffer
* into.
* @return Returns a sequence of characters where '.' depicts an empty fragment
* of the internal buffer and 'X' depicts full or nearly full capacity
* within the buffer's range and anything between 1 and 9 is between.
*/
public String visualizeKeyDistribution(int characters);
/**
* Adds all elements from the given {@link ObjectContainer} to this set.
*
* @return Returns the number of elements actually added as a result of this
* call (not previously present in the set).
* @since 0.9.1
*/
public int addAll(ObjectContainer<? extends KType> container);
}
@@ -0,0 +1,24 @@
/*
* HPPC
*
* Copyright (C) 2010-2024 Carrot Search s.c. and contributors
* All rights reserved.
*
* Refer to the full license file "LICENSE.txt":
* https://github.com/carrotsearch/hppc/blob/master/LICENSE.txt
*/
package net.lax1dude.eaglercraft.backend.server.api.collect;
/**
* Anything that can preallocate buffers given prior knowledge of the number of
* stored elements.
*/
public interface Preallocable {
/**
* Ensure this container can hold at least the given number of elements without
* resizing its buffers.
*
* @param expectedElements The total number of elements, inclusive.
*/
public void ensureCapacity(int expectedElements);
}
@@ -0,0 +1,28 @@
/*
* Copyright (c) 2025 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
package net.lax1dude.eaglercraft.backend.server.api.event;
import javax.annotation.Nonnull;
import net.lax1dude.eaglercraft.backend.server.api.IEaglerPendingConnection;
public interface IBaseHandshakeEvent<PlayerObject> extends IBaseServerEvent<PlayerObject> {
@Nonnull
IEaglerPendingConnection getPendingConnection();
}
@@ -0,0 +1,28 @@
/*
* Copyright (c) 2025 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
package net.lax1dude.eaglercraft.backend.server.api.event;
import javax.annotation.Nonnull;
import net.lax1dude.eaglercraft.backend.server.api.IEaglerLoginConnection;
public interface IBaseLoginEvent<PlayerObject> extends IBaseServerEvent<PlayerObject> {
@Nonnull
IEaglerLoginConnection getLoginConnection();
}
@@ -0,0 +1,28 @@
/*
* Copyright (c) 2025 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
package net.lax1dude.eaglercraft.backend.server.api.event;
import javax.annotation.Nonnull;
import net.lax1dude.eaglercraft.backend.server.api.IEaglerPlayer;
public interface IBasePlayerEvent<PlayerObject> extends IBaseServerEvent<PlayerObject> {
@Nonnull
IEaglerPlayer<PlayerObject> getPlayer();
}
@@ -0,0 +1,28 @@
/*
* Copyright (c) 2025 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
package net.lax1dude.eaglercraft.backend.server.api.event;
import javax.annotation.Nonnull;
import net.lax1dude.eaglercraft.backend.server.api.IEaglerXServerAPI;
public interface IBaseServerEvent<PlayerObject> {
@Nonnull
IEaglerXServerAPI<PlayerObject> getServerAPI();
}
@@ -0,0 +1,25 @@
/*
* Copyright (c) 2025 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
package net.lax1dude.eaglercraft.backend.server.api.event;
public interface ICancellableEvent {
boolean isCancelled();
void setCancelled(boolean cancelled);
}
@@ -0,0 +1,112 @@
/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* javax.annotation.Nonnull
* javax.annotation.Nullable
*/
package net.lax1dude.eaglercraft.backend.server.api.event;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.lax1dude.eaglercraft.backend.server.api.event.IBaseHandshakeEvent;
public interface IEaglercraftAuthCheckRequiredEvent<PlayerObject, ComponentObject>
extends IBaseHandshakeEvent<PlayerObject> {
public boolean isClientSolicitingPassword();
@Nonnull
public byte[] getAuthUsername();
public boolean isNicknameSelectionEnabled();
public void setNicknameSelectionEnabled(boolean var1);
@Nullable
public byte[] getSaltingData();
public void setSaltingData(@Nullable byte[] var1);
@Nullable
default public EnumAuthType getUseAuthType() {
return EnumAuthType.getById(this.getUseAuthTypeRaw());
}
default public void setUseAuthType(@Nullable EnumAuthType authType) {
this.setUseAuthTypeRaw(authType != null ? authType.id : (byte)0);
}
public byte getUseAuthTypeRaw();
public void setUseAuthTypeRaw(byte var1);
@Nullable
public EnumAuthResponse getAuthRequired();
public void setAuthRequired(@Nullable EnumAuthResponse var1);
@Nonnull
public String getAuthMessage();
public void setAuthMessage(@Nonnull String var1);
public boolean getEnableCookieAuth();
public void setEnableCookieAuth(boolean var1);
@Nullable
public ComponentObject getKickMessage();
public void setKickMessage(@Nullable ComponentObject var1);
public void setKickMessage(@Nullable String var1);
default public void kickUser(@Nullable ComponentObject kickMessage) {
this.setKickMessage(kickMessage);
this.setAuthRequired(EnumAuthResponse.DENY);
}
default public void kickUser(@Nullable String kickMessage) {
this.setKickMessage(kickMessage);
this.setAuthRequired(EnumAuthResponse.DENY);
}
public static enum EnumAuthType {
PLAINTEXT((byte)-1),
EAGLER_SHA256((byte)1),
AUTHME_SHA256((byte)2);
private byte id;
private EnumAuthType(byte id) {
this.id = id;
}
public byte getId() {
return this.id;
}
public static EnumAuthType getById(byte id) {
switch (id) {
case -1: {
return PLAINTEXT;
}
case 1: {
return EAGLER_SHA256;
}
case 2: {
return AUTHME_SHA256;
}
}
return null;
}
}
public static enum EnumAuthResponse {
SKIP,
REQUIRE,
DENY;
}
}
@@ -0,0 +1,121 @@
/*
* Copyright (c) 2025 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
package net.lax1dude.eaglercraft.backend.server.api.event;
import java.nio.charset.StandardCharsets;
import java.util.UUID;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.lax1dude.eaglercraft.backend.server.api.EnumPlatformType;
import net.lax1dude.eaglercraft.backend.server.api.UnsupportedOn;
public interface IEaglercraftAuthCookieEvent<PlayerObject, ComponentObject> extends IBaseLoginEvent<PlayerObject> {
public static enum EnumAuthResponse {
ALLOW, DENY, REQUIRE_AUTH
}
@Nonnull
byte[] getAuthUsername();
boolean isNicknameSelectionEnabled();
boolean getCookiesEnabled();
@Nullable
byte[] getCookieData();
@Nullable
default String getCookieDataString() {
byte[] ret = getCookieData();
return ret != null ? new String(ret, StandardCharsets.UTF_8) : null;
}
@Nonnull
String getRequestedNickname();
@Nonnull
String getProfileUsername();
void setProfileUsername(@Nonnull String username);
@Nonnull
UUID getProfileUUID();
@UnsupportedOn({ EnumPlatformType.BUKKIT })
void setProfileUUID(@Nonnull UUID uuid);
byte getAuthTypeRaw();
@Nullable
default IEaglercraftAuthCheckRequiredEvent.EnumAuthType getAuthType() {
return IEaglercraftAuthCheckRequiredEvent.EnumAuthType.getById(getAuthTypeRaw());
}
@Nullable
String getAuthMessage();
@Nonnull
String getAuthRequestedServer();
void setAuthRequestedServer(@Nonnull String server);
@Nullable
EnumAuthResponse getAuthResponse();
void setAuthResponse(@Nullable EnumAuthResponse response);
@Nullable
ComponentObject getKickMessage();
void setKickMessage(@Nullable ComponentObject kickMessage);
void setKickMessage(@Nullable String kickMessage);
default void setLoginAllowed() {
setAuthResponse(EnumAuthResponse.ALLOW);
}
default void setLoginPasswordRequired() {
setAuthResponse(EnumAuthResponse.REQUIRE_AUTH);
}
default void setLoginDenied(@Nullable ComponentObject kickMessage) {
setKickMessage(kickMessage);
setAuthResponse(EnumAuthResponse.DENY);
}
default void setLoginDenied(@Nullable String kickMessage) {
setKickMessage(kickMessage);
setAuthResponse(EnumAuthResponse.DENY);
}
void applyTexturesProperty(@Nullable String value, @Nullable String signature);
@Nullable
String getAppliedTexturesPropertyValue();
@Nullable
String getAppliedTexturesPropertySignature();
void setOverrideEaglerToVanillaSkins(boolean flag);
boolean isOverrideEaglerToVanillaSkins();
}
@@ -0,0 +1,123 @@
/*
* Copyright (c) 2025 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
package net.lax1dude.eaglercraft.backend.server.api.event;
import java.nio.charset.StandardCharsets;
import java.util.UUID;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.lax1dude.eaglercraft.backend.server.api.EnumPlatformType;
import net.lax1dude.eaglercraft.backend.server.api.UnsupportedOn;
public interface IEaglercraftAuthPasswordEvent<PlayerObject, ComponentObject> extends IBaseLoginEvent<PlayerObject> {
public static enum EnumAuthResponse {
ALLOW, DENY
}
@Nonnull
byte[] getAuthUsername();
boolean isNicknameSelectionEnabled();
@Nullable
byte[] getAuthSaltingData();
boolean getCookiesEnabled();
@Nullable
byte[] getCookieData();
@Nullable
default String getCookieDataString() {
byte[] ret = getCookieData();
return ret != null ? new String(ret, StandardCharsets.UTF_8) : null;
}
@Nonnull
byte[] getAuthPasswordDataResponse();
@Nonnull
String getRequestedNickname();
@Nonnull
String getProfileUsername();
void setProfileUsername(@Nonnull String username);
@Nonnull
UUID getProfileUUID();
@UnsupportedOn({ EnumPlatformType.BUKKIT })
void setProfileUUID(@Nonnull UUID uuid);
byte getAuthTypeRaw();
@Nullable
default IEaglercraftAuthCheckRequiredEvent.EnumAuthType getAuthType() {
return IEaglercraftAuthCheckRequiredEvent.EnumAuthType.getById(getAuthTypeRaw());
}
@Nullable
String getAuthMessage();
@Nonnull
String getAuthRequestedServer();
void setAuthRequestedServer(@Nonnull String server);
@Nullable
EnumAuthResponse getAuthResponse();
void setAuthResponse(@Nullable EnumAuthResponse response);
@Nullable
ComponentObject getKickMessage();
void setKickMessage(@Nullable ComponentObject kickMessage);
void setKickMessage(@Nullable String kickMessage);
default void setLoginAllowed() {
setAuthResponse(EnumAuthResponse.ALLOW);
}
default void setLoginDenied(@Nullable ComponentObject kickMessage) {
setKickMessage(kickMessage);
setAuthResponse(EnumAuthResponse.DENY);
}
default void setLoginDenied(@Nullable String kickMessage) {
setKickMessage(kickMessage);
setAuthResponse(EnumAuthResponse.DENY);
}
void applyTexturesProperty(@Nullable String value, @Nullable String signature);
@Nullable
String getAppliedTexturesPropertyValue();
@Nullable
String getAppliedTexturesPropertySignature();
void setOverrideEaglerToVanillaSkins(boolean flag);
boolean isOverrideEaglerToVanillaSkins();
}
@@ -0,0 +1,41 @@
/*
* Copyright (c) 2025 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
package net.lax1dude.eaglercraft.backend.server.api.event;
import javax.annotation.Nullable;
public interface IEaglercraftClientBrandEvent<PlayerObject, ComponentObject>
extends IBaseHandshakeEvent<PlayerObject>, ICancellableEvent {
@Nullable
ComponentObject getMessage();
void setMessage(@Nullable String message);
void setMessage(@Nullable ComponentObject message);
default void setKickMessage(@Nullable String message) {
setCancelled(true);
setMessage(message);
}
default void setKickMessage(@Nullable ComponentObject message) {
setCancelled(true);
setMessage(message);
}
}
@@ -0,0 +1,21 @@
/*
* Copyright (c) 2025 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
package net.lax1dude.eaglercraft.backend.server.api.event;
public interface IEaglercraftDestroyPlayerEvent<PlayerObject> extends IBasePlayerEvent<PlayerObject> {
}
@@ -0,0 +1,28 @@
/*
* Copyright (c) 2025 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
package net.lax1dude.eaglercraft.backend.server.api.event;
import java.util.Map;
import javax.annotation.Nonnull;
public interface IEaglercraftInitializePlayerEvent<PlayerObject> extends IBasePlayerEvent<PlayerObject> {
@Nonnull
Map<String, byte[]> getExtraProfileData();
}
@@ -0,0 +1,84 @@
/*
* Copyright (c) 2025 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
package net.lax1dude.eaglercraft.backend.server.api.event;
import java.util.UUID;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.lax1dude.eaglercraft.backend.server.api.EnumPlatformType;
import net.lax1dude.eaglercraft.backend.server.api.UnsupportedOn;
public interface IEaglercraftLoginEvent<PlayerObject, ComponentObject>
extends IBaseLoginEvent<PlayerObject>, ICancellableEvent {
@Nullable
ComponentObject getMessage();
void setMessage(@Nullable ComponentObject kickMessage);
void setMessage(@Nullable String kickMessage);
boolean isLoginStateRedirectSupported();
@Nullable
String getRedirectAddress();
void setRedirectAddress(@Nullable String addr);
@Nonnull
String getProfileUsername();
void setProfileUsername(@Nonnull String username);
@Nonnull
UUID getProfileUUID();
@UnsupportedOn({ EnumPlatformType.BUKKIT })
void setProfileUUID(@Nonnull UUID uuid);
@Nonnull
String getRequestedServer();
void setRequestedServer(@Nonnull String server);
default void setKickMessage(@Nullable ComponentObject kickMessage) {
setCancelled(true);
setMessage(kickMessage);
setRedirectAddress(null);
}
default void setKickMessage(@Nullable String kickMessage) {
setCancelled(true);
setMessage(kickMessage);
setRedirectAddress(null);
}
default void setKickRedirect(@Nonnull String addr) {
if (!isLoginStateRedirectSupported()) {
throw new UnsupportedOperationException("Login state redirect is not supported by this client");
}
if (addr == null) {
throw new NullPointerException("addr");
}
setCancelled(true);
setMessage((ComponentObject) null);
setRedirectAddress(addr);
}
}
@@ -0,0 +1,28 @@
/*
* Copyright (c) 2025 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
package net.lax1dude.eaglercraft.backend.server.api.event;
import javax.annotation.Nonnull;
import net.lax1dude.eaglercraft.backend.server.api.query.IMOTDConnection;
public interface IEaglercraftMOTDEvent<PlayerObject> extends IBaseServerEvent<PlayerObject> {
@Nonnull
IMOTDConnection getMOTDConnection();
}
@@ -0,0 +1,53 @@
/*
* Copyright (c) 2025 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
package net.lax1dude.eaglercraft.backend.server.api.event;
import javax.annotation.Nonnull;
import net.lax1dude.eaglercraft.backend.server.api.skins.EnumSkinModel;
import net.lax1dude.eaglercraft.backend.server.api.skins.IEaglerPlayerCape;
import net.lax1dude.eaglercraft.backend.server.api.skins.IEaglerPlayerSkin;
public interface IEaglercraftRegisterSkinEvent<PlayerObject> extends IBaseLoginEvent<PlayerObject> {
@Nonnull
IEaglerPlayerSkin getEaglerSkin();
@Nonnull
IEaglerPlayerCape getEaglerCape();
void forceFromVanillaTexturesProperty(@Nonnull String value);
void forceFromVanillaLoginProfile();
void forceSkinFromURL(@Nonnull String url, @Nonnull EnumSkinModel model);
void forceSkinFromVanillaTexturesProperty(@Nonnull String value);
void forceSkinFromVanillaLoginProfile();
void forceCapeFromURL(@Nonnull String url);
void forceCapeFromVanillaTexturesProperty(@Nonnull String value);
void forceCapeFromVanillaLoginProfile();
void forceSkinEagler(@Nonnull IEaglerPlayerSkin skin);
void forceCapeEagler(@Nonnull IEaglerPlayerCape cape);
}
@@ -0,0 +1,60 @@
/*
* Copyright (c) 2025 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
package net.lax1dude.eaglercraft.backend.server.api.event;
import java.nio.charset.StandardCharsets;
import javax.annotation.Nonnull;
import net.lax1dude.eaglercraft.backend.server.api.query.IQueryConnection;
public interface IEaglercraftRevokeSessionQueryEvent<PlayerObject> extends IBaseServerEvent<PlayerObject> {
public static enum EnumSessionRevokeStatus {
SUCCESS("ok", -1), FAILED_NOT_SUPPORTED("error", 1), FAILED_NOT_ALLOWED("error", 2),
FAILED_NOT_FOUND("error", 3), FAILED_SERVER_ERROR("error", 4);
public final String status;
public final int code;
private EnumSessionRevokeStatus(String status, int code) {
this.status = status;
this.code = code;
}
}
@Nonnull
IQueryConnection getSocket();
@Nonnull
byte[] getCookieData();
@Nonnull
default String getCookieDataString() {
return new String(getCookieData(), StandardCharsets.UTF_8);
}
@Nonnull
EnumSessionRevokeStatus getResultStatus();
void setResultStatus(@Nonnull EnumSessionRevokeStatus revokeStatus);
boolean getShouldDeleteCookie();
void setShouldDeleteCookie(boolean flag);
}
@@ -0,0 +1,43 @@
/*
* Copyright (c) 2025 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
package net.lax1dude.eaglercraft.backend.server.api.event;
import javax.annotation.Nonnull;
import net.lax1dude.eaglercraft.backend.server.api.voice.EnumVoiceState;
import net.lax1dude.eaglercraft.backend.server.api.voice.IVoiceManager;
import net.lax1dude.eaglercraft.backend.server.api.voice.IVoiceService;
public interface IEaglercraftVoiceChangeEvent<PlayerObject> extends IBasePlayerEvent<PlayerObject> {
@Nonnull
default IVoiceManager<PlayerObject> getVoiceManager() {
return getPlayer().getVoiceManager();
}
@Nonnull
default IVoiceService<PlayerObject> getVoiceService() {
return getServerAPI().getVoiceService();
}
@Nonnull
EnumVoiceState getVoiceStateOld();
@Nonnull
EnumVoiceState getVoiceStateNew();
}
@@ -0,0 +1,49 @@
/*
* Copyright (c) 2025 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
package net.lax1dude.eaglercraft.backend.server.api.event;
import java.util.List;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import io.netty.handler.codec.http.FullHttpRequest;
import net.lax1dude.eaglercraft.backend.server.api.IEaglerConnection;
public interface IEaglercraftWebSocketOpenEvent<PlayerObject>
extends IBaseServerEvent<PlayerObject>, ICancellableEvent {
@Nonnull
IEaglerConnection getConnection();
@Nullable
String getRawHeader(@Nonnull String name);
@Nonnull
List<String> getRawHeaders(@Nonnull String name);
@Nonnull
NettyUnsafe netty();
public interface NettyUnsafe {
@Nonnull
FullHttpRequest getHttpRequest();
}
}
@@ -0,0 +1,46 @@
/*
* Copyright (c) 2025 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
package net.lax1dude.eaglercraft.backend.server.api.event;
import javax.annotation.Nonnull;
import net.lax1dude.eaglercraft.backend.server.api.webview.IWebViewManager;
import net.lax1dude.eaglercraft.backend.server.api.webview.IWebViewService;
public interface IEaglercraftWebViewChannelEvent<PlayerObject> extends IBasePlayerEvent<PlayerObject> {
public static enum EnumEventType {
CHANNEL_OPEN, CHANNEL_CLOSE;
}
@Nonnull
default IWebViewManager<PlayerObject> getWebViewManager() {
return getPlayer().getWebViewManager();
}
@Nonnull
default IWebViewService<PlayerObject> getWebViewService() {
return getServerAPI().getWebViewService();
}
@Nonnull
EnumEventType getType();
@Nonnull
String getChannel();
}
@@ -0,0 +1,52 @@
/*
* Copyright (c) 2025 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
package net.lax1dude.eaglercraft.backend.server.api.event;
import javax.annotation.Nonnull;
import net.lax1dude.eaglercraft.backend.server.api.webview.IWebViewManager;
import net.lax1dude.eaglercraft.backend.server.api.webview.IWebViewService;
public interface IEaglercraftWebViewMessageEvent<PlayerObject> extends IBasePlayerEvent<PlayerObject> {
public static enum EnumMessageType {
STRING, BINARY;
}
@Nonnull
default IWebViewManager<PlayerObject> getWebViewManager() {
return getPlayer().getWebViewManager();
}
@Nonnull
default IWebViewService<PlayerObject> getWebViewService() {
return getServerAPI().getWebViewService();
}
@Nonnull
String getChannel();
@Nonnull
EnumMessageType getType();
@Nonnull
String getAsString();
@Nonnull
byte[] getAsBinary();
}
@@ -0,0 +1,69 @@
/*
* Copyright (c) 2025 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
package net.lax1dude.eaglercraft.backend.server.api.internal.factory;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Set;
import javax.annotation.Nonnull;
import net.lax1dude.eaglercraft.backend.server.api.IEaglerXServerAPI;
import net.lax1dude.eaglercraft.backend.server.api.attribute.IAttributeManager;
public abstract class EaglerXServerAPIFactory {
@Nonnull
public static final Factory INSTANCE;
static {
// Dependency injection? Never heard of it
try {
Class<?> clz = Class.forName("net.lax1dude.eaglercraft.backend.server.base.APIFactoryImpl");
Method meth = clz.getDeclaredMethod("createFactory");
meth.setAccessible(true);
INSTANCE = (Factory) meth.invoke(null);
} catch (ClassNotFoundException | NoSuchMethodException | SecurityException | IllegalAccessException
| IllegalArgumentException | InvocationTargetException e) {
throw new UnsupportedOperationException("Could not access the EaglerXServerAPI factory!", e);
}
}
protected EaglerXServerAPIFactory() {
}
public static abstract class Factory implements IEaglerAPIFactory {
@Nonnull
@Override
public abstract Set<Class<?>> getPlayerTypes();
@Nonnull
@Override
public abstract IAttributeManager getGlobalAttributeManager();
@Nonnull
@Override
public abstract <T> IEaglerXServerAPI<T> getAPI(@Nonnull Class<T> playerClass);
@Nonnull
@Override
public abstract IEaglerXServerAPI<?> getDefaultAPI();
}
}
@@ -0,0 +1,40 @@
/*
* Copyright (c) 2025 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
package net.lax1dude.eaglercraft.backend.server.api.internal.factory;
import java.util.Set;
import javax.annotation.Nonnull;
import net.lax1dude.eaglercraft.backend.server.api.IEaglerXServerAPI;
import net.lax1dude.eaglercraft.backend.server.api.attribute.IAttributeManager;
public interface IEaglerAPIFactory {
@Nonnull
Set<Class<?>> getPlayerTypes();
@Nonnull
IAttributeManager getGlobalAttributeManager();
@Nonnull
<T> IEaglerXServerAPI<T> getAPI(@Nonnull Class<T> playerClass);
@Nonnull
IEaglerXServerAPI<?> getDefaultAPI();
}

Some files were not shown because too many files have changed in this diff Show More