mirror of
https://github.com/GeyserMC/Floodgate.git
synced 2026-01-04 15:31:48 +00:00
Include module name in package, worked on moving to Avaje Inject
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,45 +23,47 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate;
|
||||
package org.geysermc.floodgate.core;
|
||||
|
||||
import static org.geysermc.floodgate.core.util.Utils.makeModule;
|
||||
|
||||
import io.avaje.inject.BeanScope;
|
||||
import io.avaje.inject.BeanScopeBuilder;
|
||||
import java.util.UUID;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import org.geysermc.floodgate.api.FloodgateApi;
|
||||
import org.geysermc.floodgate.api.InstanceHolder;
|
||||
import org.geysermc.floodgate.api.ProxyModule;
|
||||
import org.geysermc.floodgate.api.ServerModule;
|
||||
import org.geysermc.floodgate.api.event.FloodgateEventBus;
|
||||
import org.geysermc.floodgate.api.handshake.HandshakeHandlers;
|
||||
import org.geysermc.floodgate.api.inject.PlatformInjector;
|
||||
import org.geysermc.floodgate.api.link.PlayerLink;
|
||||
import org.geysermc.floodgate.api.logger.FloodgateLogger;
|
||||
import org.geysermc.floodgate.api.packet.PacketHandlers;
|
||||
import org.geysermc.floodgate.config.FloodgateConfig;
|
||||
import org.geysermc.floodgate.event.EventBus;
|
||||
import org.geysermc.floodgate.event.lifecycle.PostEnableEvent;
|
||||
import org.geysermc.floodgate.event.lifecycle.ShutdownEvent;
|
||||
import org.geysermc.floodgate.core.event.EventBus;
|
||||
import org.geysermc.floodgate.core.event.lifecycle.PostEnableEvent;
|
||||
import org.geysermc.floodgate.core.event.lifecycle.ShutdownEvent;
|
||||
|
||||
@Getter(AccessLevel.PROTECTED)
|
||||
public abstract class FloodgatePlatform {
|
||||
private static final UUID KEY = UUID.randomUUID();
|
||||
|
||||
private static final String PROXY_MODULE = "org.geysermc.floodgate.core.api.ProxyModule";
|
||||
private static final String SERVER_MODULE = "org.geysermc.floodgate.core.api.ServerModule";
|
||||
|
||||
private BeanScope scope;
|
||||
private FloodgateConfig config;
|
||||
private PlatformInjector injector;
|
||||
|
||||
|
||||
protected void onBuildBeanScope(BeanScopeBuilder builder) {
|
||||
}
|
||||
|
||||
public void load() {
|
||||
long startTime = System.currentTimeMillis();
|
||||
|
||||
scope = BeanScope.builder()
|
||||
.bean("isProxy", boolean.class, isProxy())
|
||||
.modules(new FloodgateModule())
|
||||
.modules(isProxy() ? new ProxyModule() : new ServerModule())
|
||||
.build();
|
||||
var scopeBuilder = BeanScope.builder()
|
||||
.bean("isProxy", boolean.class, isProxy())
|
||||
.modules(new CoreModule())
|
||||
// temporary fix for https://github.com/avaje/avaje-inject/issues/295
|
||||
.modules(makeModule(isProxy() ? PROXY_MODULE : SERVER_MODULE));
|
||||
onBuildBeanScope(scopeBuilder);
|
||||
scope = scopeBuilder.build();
|
||||
|
||||
config = scope.get(FloodgateConfig.class);
|
||||
injector = scope.get(PlatformInjector.class);
|
||||
|
||||
InstanceHolder.set(
|
||||
@@ -109,5 +111,5 @@ public abstract class FloodgatePlatform {
|
||||
scope.close();
|
||||
}
|
||||
|
||||
abstract boolean isProxy();
|
||||
abstract protected boolean isProxy();
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,13 +23,13 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.addon;
|
||||
package org.geysermc.floodgate.core.addon;
|
||||
|
||||
import io.netty.channel.Channel;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.inject.Singleton;
|
||||
import org.geysermc.floodgate.api.inject.InjectorAddon;
|
||||
import org.geysermc.floodgate.inject.CommonPlatformInjector;
|
||||
import org.geysermc.floodgate.core.inject.CommonPlatformInjector;
|
||||
|
||||
@Singleton
|
||||
public final class AddonManagerAddon implements InjectorAddon {
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,20 +23,20 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.addon;
|
||||
package org.geysermc.floodgate.core.addon;
|
||||
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.channel.ChannelPipeline;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.inject.Named;
|
||||
import jakarta.inject.Singleton;
|
||||
import org.geysermc.floodgate.addon.debug.ChannelInDebugHandler;
|
||||
import org.geysermc.floodgate.addon.debug.ChannelOutDebugHandler;
|
||||
import org.geysermc.floodgate.addon.debug.StateChangeDetector;
|
||||
import org.geysermc.floodgate.api.inject.InjectorAddon;
|
||||
import org.geysermc.floodgate.api.logger.FloodgateLogger;
|
||||
import org.geysermc.floodgate.config.FloodgateConfig;
|
||||
import org.geysermc.floodgate.util.Utils;
|
||||
import org.geysermc.floodgate.core.addon.debug.ChannelInDebugHandler;
|
||||
import org.geysermc.floodgate.core.addon.debug.ChannelOutDebugHandler;
|
||||
import org.geysermc.floodgate.core.addon.debug.StateChangeDetector;
|
||||
import org.geysermc.floodgate.core.config.FloodgateConfig;
|
||||
import org.geysermc.floodgate.core.util.Utils;
|
||||
|
||||
@Singleton
|
||||
public final class DebugAddon implements InjectorAddon {
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,18 +23,18 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.addon;
|
||||
package org.geysermc.floodgate.core.addon;
|
||||
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.channel.ChannelPipeline;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.inject.Named;
|
||||
import jakarta.inject.Singleton;
|
||||
import org.geysermc.floodgate.addon.packethandler.ChannelInPacketHandler;
|
||||
import org.geysermc.floodgate.addon.packethandler.ChannelOutPacketHandler;
|
||||
import org.geysermc.floodgate.api.inject.InjectorAddon;
|
||||
import org.geysermc.floodgate.packet.PacketHandlersImpl;
|
||||
import org.geysermc.floodgate.util.Utils;
|
||||
import org.geysermc.floodgate.core.addon.packethandler.ChannelInPacketHandler;
|
||||
import org.geysermc.floodgate.core.addon.packethandler.ChannelOutPacketHandler;
|
||||
import org.geysermc.floodgate.core.packet.PacketHandlersImpl;
|
||||
import org.geysermc.floodgate.core.util.Utils;
|
||||
|
||||
@Singleton
|
||||
public class PacketHandlerAddon implements InjectorAddon {
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,7 +23,7 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.addon.data;
|
||||
package org.geysermc.floodgate.core.addon.data;
|
||||
|
||||
import com.google.common.collect.Queues;
|
||||
import io.netty.channel.Channel;
|
||||
@@ -34,12 +34,12 @@ import java.net.InetSocketAddress;
|
||||
import java.util.Queue;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.geysermc.floodgate.api.handshake.HandshakeData;
|
||||
import org.geysermc.floodgate.config.FloodgateConfig;
|
||||
import org.geysermc.floodgate.core.config.FloodgateConfig;
|
||||
import org.geysermc.floodgate.core.player.FloodgateHandshakeHandler;
|
||||
import org.geysermc.floodgate.core.player.FloodgateHandshakeHandler.HandshakeResult;
|
||||
import org.geysermc.floodgate.core.player.HostnameSeparationResult;
|
||||
import org.geysermc.floodgate.core.util.Constants;
|
||||
import org.geysermc.floodgate.crypto.FloodgateCipher;
|
||||
import org.geysermc.floodgate.player.FloodgateHandshakeHandler;
|
||||
import org.geysermc.floodgate.player.FloodgateHandshakeHandler.HandshakeResult;
|
||||
import org.geysermc.floodgate.player.HostnameSeparationResult;
|
||||
import org.geysermc.floodgate.util.Constants;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
public abstract class CommonDataHandler extends ChannelInboundHandlerAdapter {
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,17 +23,17 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.addon.data;
|
||||
package org.geysermc.floodgate.core.addon.data;
|
||||
|
||||
import io.netty.channel.Channel;
|
||||
import java.util.UUID;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.geysermc.floodgate.api.handshake.HandshakeData;
|
||||
import org.geysermc.floodgate.config.FloodgateConfig;
|
||||
import org.geysermc.floodgate.core.config.FloodgateConfig;
|
||||
import org.geysermc.floodgate.core.util.Utils;
|
||||
import org.geysermc.floodgate.util.BedrockData;
|
||||
import org.geysermc.floodgate.util.LinkedPlayer;
|
||||
import org.geysermc.floodgate.util.Utils;
|
||||
|
||||
@Getter
|
||||
public class HandshakeDataImpl implements HandshakeData {
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,7 +23,7 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.addon.data;
|
||||
package org.geysermc.floodgate.core.addon.data;
|
||||
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,7 +23,7 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.addon.data;
|
||||
package org.geysermc.floodgate.core.addon.data;
|
||||
|
||||
import com.google.common.collect.Queues;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,7 +23,7 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.addon.debug;
|
||||
package org.geysermc.floodgate.core.addon.debug;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.ByteBufUtil;
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,7 +23,7 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.addon.debug;
|
||||
package org.geysermc.floodgate.core.addon.debug;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.ByteBufUtil;
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,7 +23,7 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.addon.debug;
|
||||
package org.geysermc.floodgate.core.addon.debug;
|
||||
|
||||
public enum State {
|
||||
HANDSHAKE, STATUS, LOGIN, PLAY;
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,7 +23,7 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.addon.debug;
|
||||
package org.geysermc.floodgate.core.addon.debug;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.Channel;
|
||||
@@ -31,8 +31,8 @@ import io.netty.channel.ChannelHandler;
|
||||
import io.netty.channel.ChannelPipeline;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import org.geysermc.floodgate.api.logger.FloodgateLogger;
|
||||
import org.geysermc.floodgate.util.Constants;
|
||||
import org.geysermc.floodgate.util.Utils;
|
||||
import org.geysermc.floodgate.core.util.Constants;
|
||||
import org.geysermc.floodgate.core.util.Utils;
|
||||
|
||||
public class StateChangeDetector {
|
||||
private static volatile int pluginMessageToClientId = -1;
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,12 +23,12 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.addon.packethandler;
|
||||
package org.geysermc.floodgate.core.addon.packethandler;
|
||||
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.channel.SimpleChannelInboundHandler;
|
||||
import org.geysermc.floodgate.api.util.TriFunction;
|
||||
import org.geysermc.floodgate.packet.PacketHandlersImpl;
|
||||
import org.geysermc.floodgate.core.packet.PacketHandlersImpl;
|
||||
|
||||
public class ChannelInPacketHandler extends SimpleChannelInboundHandler<Object> {
|
||||
private final PacketHandlersImpl packetHandlers;
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,13 +23,13 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.addon.packethandler;
|
||||
package org.geysermc.floodgate.core.addon.packethandler;
|
||||
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.handler.codec.MessageToMessageEncoder;
|
||||
import java.util.List;
|
||||
import org.geysermc.floodgate.api.util.TriFunction;
|
||||
import org.geysermc.floodgate.packet.PacketHandlersImpl;
|
||||
import org.geysermc.floodgate.core.packet.PacketHandlersImpl;
|
||||
|
||||
public class ChannelOutPacketHandler extends MessageToMessageEncoder<Object> {
|
||||
private final PacketHandlersImpl packetHandlers;
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,12 +23,12 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.api;
|
||||
package org.geysermc.floodgate.core.api;
|
||||
|
||||
import jakarta.inject.Inject;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import org.geysermc.floodgate.core.scope.ProxyScope;
|
||||
import org.geysermc.floodgate.crypto.FloodgateCipher;
|
||||
import org.geysermc.floodgate.scope.ProxyScope;
|
||||
import org.geysermc.floodgate.util.BedrockData;
|
||||
|
||||
@ProxyScope
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,7 +23,7 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.api;
|
||||
package org.geysermc.floodgate.core.api;
|
||||
|
||||
import com.google.common.cache.Cache;
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
@@ -39,17 +39,18 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import org.geysermc.cumulus.form.Form;
|
||||
import org.geysermc.cumulus.form.util.FormBuilder;
|
||||
import org.geysermc.floodgate.api.FloodgateApi;
|
||||
import org.geysermc.floodgate.api.logger.FloodgateLogger;
|
||||
import org.geysermc.floodgate.api.player.FloodgatePlayer;
|
||||
import org.geysermc.floodgate.api.unsafe.Unsafe;
|
||||
import org.geysermc.floodgate.config.FloodgateConfig;
|
||||
import org.geysermc.floodgate.pluginmessage.PluginMessageManager;
|
||||
import org.geysermc.floodgate.pluginmessage.channel.FormChannel;
|
||||
import org.geysermc.floodgate.pluginmessage.channel.TransferChannel;
|
||||
import org.geysermc.floodgate.scope.ServerScope;
|
||||
import org.geysermc.floodgate.util.Constants;
|
||||
import org.geysermc.floodgate.util.HttpClient;
|
||||
import org.geysermc.floodgate.util.Utils;
|
||||
import org.geysermc.floodgate.core.config.FloodgateConfig;
|
||||
import org.geysermc.floodgate.core.pluginmessage.PluginMessageManager;
|
||||
import org.geysermc.floodgate.core.pluginmessage.channel.FormChannel;
|
||||
import org.geysermc.floodgate.core.pluginmessage.channel.TransferChannel;
|
||||
import org.geysermc.floodgate.core.scope.ServerScope;
|
||||
import org.geysermc.floodgate.core.util.Constants;
|
||||
import org.geysermc.floodgate.core.util.HttpClient;
|
||||
import org.geysermc.floodgate.core.util.Utils;
|
||||
|
||||
@ServerScope
|
||||
public class SimpleFloodgateApi implements FloodgateApi {
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,12 +23,12 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.api;
|
||||
package org.geysermc.floodgate.core.api;
|
||||
|
||||
import java.util.UUID;
|
||||
import org.geysermc.floodgate.api.unsafe.Unsafe;
|
||||
import org.geysermc.floodgate.pluginmessage.PluginMessageManager;
|
||||
import org.geysermc.floodgate.pluginmessage.channel.PacketChannel;
|
||||
import org.geysermc.floodgate.core.pluginmessage.PluginMessageManager;
|
||||
import org.geysermc.floodgate.core.pluginmessage.channel.PacketChannel;
|
||||
|
||||
public final class UnsafeFloodgateApi implements Unsafe {
|
||||
private final PacketChannel packetChannel;
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,10 +23,10 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.command;
|
||||
package org.geysermc.floodgate.core.command;
|
||||
|
||||
import lombok.Getter;
|
||||
import org.geysermc.floodgate.platform.command.TranslatableMessage;
|
||||
import org.geysermc.floodgate.core.platform.command.TranslatableMessage;
|
||||
|
||||
/**
|
||||
* Messages (or part of messages) that are used in two or more commands and thus are 'commonly
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,9 +23,7 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.command;
|
||||
|
||||
import static org.geysermc.floodgate.command.CommonCommandMessage.CHECK_CONSOLE;
|
||||
package org.geysermc.floodgate.core.command;
|
||||
|
||||
import cloud.commandframework.ArgumentDescription;
|
||||
import cloud.commandframework.Command;
|
||||
@@ -40,16 +38,16 @@ import org.geysermc.floodgate.api.FloodgateApi;
|
||||
import org.geysermc.floodgate.api.link.LinkRequestResult;
|
||||
import org.geysermc.floodgate.api.link.PlayerLink;
|
||||
import org.geysermc.floodgate.api.logger.FloodgateLogger;
|
||||
import org.geysermc.floodgate.command.util.Permission;
|
||||
import org.geysermc.floodgate.config.FloodgateConfig;
|
||||
import org.geysermc.floodgate.link.GlobalPlayerLinking;
|
||||
import org.geysermc.floodgate.platform.command.FloodgateCommand;
|
||||
import org.geysermc.floodgate.platform.command.TranslatableMessage;
|
||||
import org.geysermc.floodgate.player.UserAudience;
|
||||
import org.geysermc.floodgate.player.UserAudience.PlayerAudience;
|
||||
import org.geysermc.floodgate.player.audience.ProfileAudience;
|
||||
import org.geysermc.floodgate.player.audience.ProfileAudienceArgument;
|
||||
import org.geysermc.floodgate.util.Constants;
|
||||
import org.geysermc.floodgate.core.command.util.Permission;
|
||||
import org.geysermc.floodgate.core.config.FloodgateConfig;
|
||||
import org.geysermc.floodgate.core.link.GlobalPlayerLinking;
|
||||
import org.geysermc.floodgate.core.platform.command.FloodgateCommand;
|
||||
import org.geysermc.floodgate.core.platform.command.TranslatableMessage;
|
||||
import org.geysermc.floodgate.core.player.UserAudience;
|
||||
import org.geysermc.floodgate.core.player.UserAudience.PlayerAudience;
|
||||
import org.geysermc.floodgate.core.player.audience.ProfileAudience;
|
||||
import org.geysermc.floodgate.core.player.audience.ProfileAudienceArgument;
|
||||
import org.geysermc.floodgate.core.util.Constants;
|
||||
|
||||
@Singleton
|
||||
@Secondary
|
||||
@@ -174,7 +172,7 @@ public final class LinkAccountCommand implements FloodgateCommand {
|
||||
BEDROCK_USAGE("floodgate.command.link_account.bedrock_usage"),
|
||||
LINK_REQUEST_EXPIRED("floodgate.command.link_account.link_request_expired"),
|
||||
LINK_REQUEST_COMPLETED("floodgate.command.link_account.link_request_completed"),
|
||||
LINK_REQUEST_ERROR("floodgate.command.link_request.error " + CHECK_CONSOLE),
|
||||
LINK_REQUEST_ERROR("floodgate.command.link_request.error " + CommonCommandMessage.CHECK_CONSOLE),
|
||||
INVALID_CODE("floodgate.command.link_account.invalid_code"),
|
||||
NO_LINK_REQUESTED("floodgate.command.link_account.no_link_requested");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,17 +23,17 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.command;
|
||||
package org.geysermc.floodgate.core.command;
|
||||
|
||||
import cloud.commandframework.Command;
|
||||
import cloud.commandframework.CommandManager;
|
||||
import cloud.commandframework.context.CommandContext;
|
||||
import jakarta.inject.Singleton;
|
||||
import org.geysermc.floodgate.api.FloodgateApi;
|
||||
import org.geysermc.floodgate.config.FloodgateConfig;
|
||||
import org.geysermc.floodgate.platform.command.FloodgateCommand;
|
||||
import org.geysermc.floodgate.player.UserAudience;
|
||||
import org.geysermc.floodgate.util.Constants;
|
||||
import org.geysermc.floodgate.core.config.FloodgateConfig;
|
||||
import org.geysermc.floodgate.core.platform.command.FloodgateCommand;
|
||||
import org.geysermc.floodgate.core.player.UserAudience;
|
||||
import org.geysermc.floodgate.core.util.Constants;
|
||||
|
||||
@Singleton
|
||||
public class TestCommand implements FloodgateCommand {
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,9 +23,7 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.command;
|
||||
|
||||
import static org.geysermc.floodgate.command.CommonCommandMessage.CHECK_CONSOLE;
|
||||
package org.geysermc.floodgate.core.command;
|
||||
|
||||
import cloud.commandframework.ArgumentDescription;
|
||||
import cloud.commandframework.Command;
|
||||
@@ -36,14 +34,14 @@ import jakarta.inject.Singleton;
|
||||
import lombok.Getter;
|
||||
import org.geysermc.floodgate.api.FloodgateApi;
|
||||
import org.geysermc.floodgate.api.link.PlayerLink;
|
||||
import org.geysermc.floodgate.command.util.Permission;
|
||||
import org.geysermc.floodgate.config.FloodgateConfig;
|
||||
import org.geysermc.floodgate.link.GlobalPlayerLinking;
|
||||
import org.geysermc.floodgate.platform.command.FloodgateCommand;
|
||||
import org.geysermc.floodgate.platform.command.TranslatableMessage;
|
||||
import org.geysermc.floodgate.player.UserAudience;
|
||||
import org.geysermc.floodgate.player.UserAudience.PlayerAudience;
|
||||
import org.geysermc.floodgate.util.Constants;
|
||||
import org.geysermc.floodgate.core.command.util.Permission;
|
||||
import org.geysermc.floodgate.core.config.FloodgateConfig;
|
||||
import org.geysermc.floodgate.core.link.GlobalPlayerLinking;
|
||||
import org.geysermc.floodgate.core.platform.command.FloodgateCommand;
|
||||
import org.geysermc.floodgate.core.platform.command.TranslatableMessage;
|
||||
import org.geysermc.floodgate.core.player.UserAudience;
|
||||
import org.geysermc.floodgate.core.player.UserAudience.PlayerAudience;
|
||||
import org.geysermc.floodgate.core.util.Constants;
|
||||
|
||||
@Singleton
|
||||
public final class UnlinkAccountCommand implements FloodgateCommand {
|
||||
@@ -117,7 +115,7 @@ public final class UnlinkAccountCommand implements FloodgateCommand {
|
||||
public enum Message implements TranslatableMessage {
|
||||
NOT_LINKED("floodgate.command.unlink_account.not_linked"),
|
||||
UNLINK_SUCCESS("floodgate.command.unlink_account.unlink_success"),
|
||||
UNLINK_ERROR("floodgate.command.unlink_account.error " + CHECK_CONSOLE);
|
||||
UNLINK_ERROR("floodgate.command.unlink_account.error " + CommonCommandMessage.CHECK_CONSOLE);
|
||||
|
||||
private final String rawMessage;
|
||||
private final String[] translateParts;
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,9 +23,7 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.command;
|
||||
|
||||
import static org.geysermc.floodgate.command.CommonCommandMessage.CHECK_CONSOLE;
|
||||
package org.geysermc.floodgate.core.command;
|
||||
|
||||
import cloud.commandframework.ArgumentDescription;
|
||||
import cloud.commandframework.Command;
|
||||
@@ -39,18 +37,18 @@ import java.util.UUID;
|
||||
import lombok.Getter;
|
||||
import org.geysermc.floodgate.api.FloodgateApi;
|
||||
import org.geysermc.floodgate.api.logger.FloodgateLogger;
|
||||
import org.geysermc.floodgate.command.util.Permission;
|
||||
import org.geysermc.floodgate.config.FloodgateConfig;
|
||||
import org.geysermc.floodgate.config.ProxyFloodgateConfig;
|
||||
import org.geysermc.floodgate.platform.command.CommandUtil;
|
||||
import org.geysermc.floodgate.platform.command.FloodgateCommand;
|
||||
import org.geysermc.floodgate.platform.command.TranslatableMessage;
|
||||
import org.geysermc.floodgate.platform.util.PlayerType;
|
||||
import org.geysermc.floodgate.player.UserAudience;
|
||||
import org.geysermc.floodgate.player.audience.ProfileAudience;
|
||||
import org.geysermc.floodgate.player.audience.ProfileAudienceArgument;
|
||||
import org.geysermc.floodgate.util.Constants;
|
||||
import org.geysermc.floodgate.util.HttpClient;
|
||||
import org.geysermc.floodgate.core.command.util.Permission;
|
||||
import org.geysermc.floodgate.core.config.FloodgateConfig;
|
||||
import org.geysermc.floodgate.core.config.ProxyFloodgateConfig;
|
||||
import org.geysermc.floodgate.core.platform.command.CommandUtil;
|
||||
import org.geysermc.floodgate.core.platform.command.FloodgateCommand;
|
||||
import org.geysermc.floodgate.core.platform.command.TranslatableMessage;
|
||||
import org.geysermc.floodgate.core.platform.util.PlayerType;
|
||||
import org.geysermc.floodgate.core.player.UserAudience;
|
||||
import org.geysermc.floodgate.core.player.audience.ProfileAudience;
|
||||
import org.geysermc.floodgate.core.player.audience.ProfileAudienceArgument;
|
||||
import org.geysermc.floodgate.core.util.Constants;
|
||||
import org.geysermc.floodgate.core.util.HttpClient;
|
||||
|
||||
@Singleton
|
||||
public class WhitelistCommand implements FloodgateCommand {
|
||||
@@ -197,13 +195,13 @@ public class WhitelistCommand implements FloodgateCommand {
|
||||
@Getter
|
||||
public enum Message implements TranslatableMessage {
|
||||
INVALID_USERNAME("floodgate.command.fwhitelist.invalid_username"),
|
||||
API_UNAVAILABLE("floodgate.command.fwhitelist.api_unavailable " + CHECK_CONSOLE),
|
||||
API_UNAVAILABLE("floodgate.command.fwhitelist.api_unavailable " + CommonCommandMessage.CHECK_CONSOLE),
|
||||
USER_NOT_FOUND("floodgate.command.fwhitelist.user_not_found"),
|
||||
PLAYER_ADDED("floodgate.command.fwhitelist.player_added"),
|
||||
PLAYER_REMOVED("floodgate.command.fwhitelist.player_removed"),
|
||||
PLAYER_ALREADY_WHITELISTED("floodgate.command.fwhitelist.player_already_whitelisted"),
|
||||
PLAYER_NOT_WHITELISTED("floodgate.command.fwhitelist.player_not_whitelisted"),
|
||||
UNEXPECTED_ERROR("floodgate.command.fwhitelist.unexpected_error " + CHECK_CONSOLE);
|
||||
UNEXPECTED_ERROR("floodgate.command.fwhitelist.unexpected_error " + CommonCommandMessage.CHECK_CONSOLE);
|
||||
|
||||
private final String rawMessage;
|
||||
private final String[] translateParts;
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,9 +23,9 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.command.main;
|
||||
package org.geysermc.floodgate.core.command.main;
|
||||
|
||||
import static org.geysermc.floodgate.util.Constants.COLOR_CHAR;
|
||||
import static org.geysermc.floodgate.core.util.Constants.COLOR_CHAR;
|
||||
|
||||
import cloud.commandframework.context.CommandContext;
|
||||
import com.google.gson.JsonElement;
|
||||
@@ -34,13 +34,13 @@ import jakarta.inject.Inject;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.function.BooleanSupplier;
|
||||
import org.geysermc.floodgate.command.util.Permission;
|
||||
import org.geysermc.floodgate.platform.command.FloodgateSubCommand;
|
||||
import org.geysermc.floodgate.player.UserAudience;
|
||||
import org.geysermc.floodgate.util.Constants;
|
||||
import org.geysermc.floodgate.util.HttpClient;
|
||||
import org.geysermc.floodgate.util.HttpClient.HttpResponse;
|
||||
import org.geysermc.floodgate.util.Utils;
|
||||
import org.geysermc.floodgate.core.command.util.Permission;
|
||||
import org.geysermc.floodgate.core.platform.command.FloodgateSubCommand;
|
||||
import org.geysermc.floodgate.core.player.UserAudience;
|
||||
import org.geysermc.floodgate.core.util.Constants;
|
||||
import org.geysermc.floodgate.core.util.HttpClient;
|
||||
import org.geysermc.floodgate.core.util.HttpClient.HttpResponse;
|
||||
import org.geysermc.floodgate.core.util.Utils;
|
||||
|
||||
final class FirewallCheckSubcommand extends FloodgateSubCommand {
|
||||
@Inject
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,9 +23,9 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.command.main;
|
||||
package org.geysermc.floodgate.core.command.main;
|
||||
|
||||
import static org.geysermc.floodgate.util.Constants.COLOR_CHAR;
|
||||
import static org.geysermc.floodgate.core.util.Constants.COLOR_CHAR;
|
||||
|
||||
import cloud.commandframework.ArgumentDescription;
|
||||
import cloud.commandframework.Command;
|
||||
@@ -34,11 +34,11 @@ import cloud.commandframework.CommandManager;
|
||||
import cloud.commandframework.context.CommandContext;
|
||||
import jakarta.inject.Singleton;
|
||||
import java.util.Locale;
|
||||
import org.geysermc.floodgate.command.util.Permission;
|
||||
import org.geysermc.floodgate.platform.command.FloodgateCommand;
|
||||
import org.geysermc.floodgate.platform.command.FloodgateSubCommand;
|
||||
import org.geysermc.floodgate.platform.command.SubCommands;
|
||||
import org.geysermc.floodgate.player.UserAudience;
|
||||
import org.geysermc.floodgate.core.command.util.Permission;
|
||||
import org.geysermc.floodgate.core.platform.command.FloodgateCommand;
|
||||
import org.geysermc.floodgate.core.platform.command.FloodgateSubCommand;
|
||||
import org.geysermc.floodgate.core.platform.command.SubCommands;
|
||||
import org.geysermc.floodgate.core.player.UserAudience;
|
||||
|
||||
@Singleton
|
||||
public final class MainCommand extends SubCommands implements FloodgateCommand {
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,20 +23,20 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.command.main;
|
||||
package org.geysermc.floodgate.core.command.main;
|
||||
|
||||
import static org.geysermc.floodgate.util.Constants.COLOR_CHAR;
|
||||
import static org.geysermc.floodgate.core.util.Constants.COLOR_CHAR;
|
||||
|
||||
import cloud.commandframework.context.CommandContext;
|
||||
import com.google.gson.JsonElement;
|
||||
import jakarta.inject.Inject;
|
||||
import org.geysermc.floodgate.api.logger.FloodgateLogger;
|
||||
import org.geysermc.floodgate.command.WhitelistCommand.Message;
|
||||
import org.geysermc.floodgate.command.util.Permission;
|
||||
import org.geysermc.floodgate.platform.command.FloodgateSubCommand;
|
||||
import org.geysermc.floodgate.player.UserAudience;
|
||||
import org.geysermc.floodgate.util.Constants;
|
||||
import org.geysermc.floodgate.util.HttpClient;
|
||||
import org.geysermc.floodgate.core.command.WhitelistCommand.Message;
|
||||
import org.geysermc.floodgate.core.command.util.Permission;
|
||||
import org.geysermc.floodgate.core.platform.command.FloodgateSubCommand;
|
||||
import org.geysermc.floodgate.core.player.UserAudience;
|
||||
import org.geysermc.floodgate.core.util.Constants;
|
||||
import org.geysermc.floodgate.core.util.HttpClient;
|
||||
|
||||
public class VersionSubcommand extends FloodgateSubCommand {
|
||||
@Inject HttpClient httpClient;
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,20 +23,17 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.command.util;
|
||||
|
||||
import static org.geysermc.floodgate.command.util.PermissionDefault.OP;
|
||||
import static org.geysermc.floodgate.command.util.PermissionDefault.TRUE;
|
||||
package org.geysermc.floodgate.core.command.util;
|
||||
|
||||
public enum Permission {
|
||||
COMMAND_MAIN("floodgate.command.floodgate", TRUE),
|
||||
COMMAND_MAIN_FIREWALL(COMMAND_MAIN, "firewall", OP),
|
||||
COMMAND_MAIN_VERSION(COMMAND_MAIN, "version", OP),
|
||||
COMMAND_LINK("floodgate.command.linkaccount", TRUE),
|
||||
COMMAND_UNLINK("floodgate.command.unlinkaccount", TRUE),
|
||||
COMMAND_WHITELIST("floodgate.command.fwhitelist", OP),
|
||||
COMMAND_MAIN("floodgate.command.floodgate", PermissionDefault.TRUE),
|
||||
COMMAND_MAIN_FIREWALL(COMMAND_MAIN, "firewall", PermissionDefault.OP),
|
||||
COMMAND_MAIN_VERSION(COMMAND_MAIN, "version", PermissionDefault.OP),
|
||||
COMMAND_LINK("floodgate.command.linkaccount", PermissionDefault.TRUE),
|
||||
COMMAND_UNLINK("floodgate.command.unlinkaccount", PermissionDefault.TRUE),
|
||||
COMMAND_WHITELIST("floodgate.command.fwhitelist", PermissionDefault.OP),
|
||||
|
||||
NEWS_RECEIVE("floodgate.news.receive", OP);
|
||||
NEWS_RECEIVE("floodgate.news.receive", PermissionDefault.OP);
|
||||
|
||||
private final String permission;
|
||||
private final PermissionDefault defaultValue;
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,7 +23,7 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.command.util;
|
||||
package org.geysermc.floodgate.core.command.util;
|
||||
|
||||
public enum PermissionDefault {
|
||||
TRUE, FALSE, OP, NOT_OP
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,32 +23,58 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.config;
|
||||
package org.geysermc.floodgate.core.config;
|
||||
|
||||
import io.avaje.inject.Bean;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.inject.Named;
|
||||
import jakarta.inject.Singleton;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.security.Key;
|
||||
import java.util.UUID;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.geysermc.configutils.ConfigUtilities;
|
||||
import org.geysermc.configutils.file.codec.PathFileCodec;
|
||||
import org.geysermc.configutils.file.template.ResourceTemplateReader;
|
||||
import org.geysermc.configutils.updater.change.Changes;
|
||||
import org.geysermc.floodgate.core.scope.ProxyScope;
|
||||
import org.geysermc.floodgate.core.scope.ServerScope;
|
||||
import org.geysermc.floodgate.crypto.FloodgateCipher;
|
||||
import org.geysermc.floodgate.crypto.KeyProducer;
|
||||
|
||||
@Singleton
|
||||
@Getter
|
||||
@RequiredArgsConstructor
|
||||
public final class ConfigLoader {
|
||||
private final Path dataDirectory;
|
||||
private final Class<? extends FloodgateConfig> configClass;
|
||||
|
||||
private final KeyProducer keyProducer;
|
||||
private final FloodgateCipher cipher;
|
||||
|
||||
@Inject
|
||||
ConfigLoader(
|
||||
@Named("dataDirectory") Path dataDirectory,
|
||||
KeyProducer keyProducer,
|
||||
FloodgateCipher cipher
|
||||
) {
|
||||
this.dataDirectory = dataDirectory;
|
||||
this.keyProducer = keyProducer;
|
||||
this.cipher = cipher;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ServerScope
|
||||
FloodgateConfig config() {
|
||||
return load(FloodgateConfig.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ProxyScope
|
||||
ProxyFloodgateConfig proxyConfig() {
|
||||
return load(ProxyFloodgateConfig.class);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T extends FloodgateConfig> T load() {
|
||||
private <T extends FloodgateConfig> T load(Class<? extends FloodgateConfig> configClass) {
|
||||
String templateFile = "config.yml";
|
||||
if (ProxyFloodgateConfig.class.isAssignableFrom(configClass)) {
|
||||
templateFile = "proxy-" + templateFile;
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,9 +23,8 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.config;
|
||||
package org.geysermc.floodgate.core.config;
|
||||
|
||||
import jakarta.inject.Singleton;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
@@ -39,7 +38,6 @@ import org.geysermc.configutils.loader.callback.GenericPostInitializeCallback;
|
||||
* addition to the global configuration like {@link ProxyFloodgateConfig} for the proxies.
|
||||
*/
|
||||
@Getter
|
||||
@Singleton
|
||||
public class FloodgateConfig implements GenericPostInitializeCallback<ConfigLoader> {
|
||||
private String keyFileName;
|
||||
private String usernamePrefix = "";
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,7 +23,7 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.config;
|
||||
package org.geysermc.floodgate.core.config;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,7 +23,7 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.database.config;
|
||||
package org.geysermc.floodgate.core.database.config;
|
||||
|
||||
/**
|
||||
* Base class for every database related configuration.
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,7 +23,7 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.database.config;
|
||||
package org.geysermc.floodgate.core.database.config;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import jakarta.inject.Inject;
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,12 +23,15 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.event;
|
||||
package org.geysermc.floodgate.core.event;
|
||||
|
||||
import io.avaje.inject.BeanScope;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.inject.Singleton;
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.Consumer;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.geysermc.event.Listener;
|
||||
import org.geysermc.event.PostOrder;
|
||||
import org.geysermc.event.bus.impl.EventBusImpl;
|
||||
import org.geysermc.event.subscribe.Subscribe;
|
||||
@@ -40,6 +43,15 @@ import org.geysermc.floodgate.api.event.FloodgateSubscriber;
|
||||
@SuppressWarnings("unchecked")
|
||||
public final class EventBus extends EventBusImpl<Object, FloodgateSubscriber<?>>
|
||||
implements FloodgateEventBus {
|
||||
@Inject
|
||||
public void registerListeners(BeanScope scope) {
|
||||
// https://github.com/avaje/avaje-inject/issues/289
|
||||
for (Object listener : scope.listByAnnotation(Listener.class)) {
|
||||
register(listener);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected <H, T, B extends Subscriber<T>> B makeSubscription(
|
||||
@NonNull Class<T> eventClass,
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,7 +23,7 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.event;
|
||||
package org.geysermc.floodgate.core.event;
|
||||
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.Consumer;
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,7 +23,7 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.event.lifecycle;
|
||||
package org.geysermc.floodgate.core.event.lifecycle;
|
||||
|
||||
public class PostEnableEvent {
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,7 +23,7 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.event.lifecycle;
|
||||
package org.geysermc.floodgate.core.event.lifecycle;
|
||||
|
||||
public class ShutdownEvent {
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,7 +23,7 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.event.skin;
|
||||
package org.geysermc.floodgate.core.event.skin;
|
||||
|
||||
import java.util.Objects;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,7 +23,7 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.inject;
|
||||
package org.geysermc.floodgate.core.inject;
|
||||
|
||||
import io.netty.channel.Channel;
|
||||
import jakarta.inject.Inject;
|
||||
@@ -42,7 +42,7 @@ public abstract class CommonPlatformInjector implements PlatformInjector {
|
||||
private final Map<Class<?>, InjectorAddon> addons = new HashMap<>();
|
||||
|
||||
@Inject
|
||||
void registerAddons(Set<InjectorAddon> addons) {
|
||||
public void registerAddons(Set<InjectorAddon> addons) {
|
||||
addons.forEach(this::addAddon);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,7 +23,7 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.link;
|
||||
package org.geysermc.floodgate.core.link;
|
||||
|
||||
import io.avaje.inject.BeanScope;
|
||||
import jakarta.inject.Inject;
|
||||
@@ -39,10 +39,10 @@ import org.geysermc.floodgate.api.FloodgateApi;
|
||||
import org.geysermc.floodgate.api.link.LinkRequest;
|
||||
import org.geysermc.floodgate.api.link.PlayerLink;
|
||||
import org.geysermc.floodgate.api.logger.FloodgateLogger;
|
||||
import org.geysermc.floodgate.config.FloodgateConfig;
|
||||
import org.geysermc.floodgate.database.config.DatabaseConfig;
|
||||
import org.geysermc.floodgate.database.config.DatabaseConfigLoader;
|
||||
import org.geysermc.floodgate.event.lifecycle.ShutdownEvent;
|
||||
import org.geysermc.floodgate.core.config.FloodgateConfig;
|
||||
import org.geysermc.floodgate.core.database.config.DatabaseConfig;
|
||||
import org.geysermc.floodgate.core.database.config.DatabaseConfigLoader;
|
||||
import org.geysermc.floodgate.core.event.lifecycle.ShutdownEvent;
|
||||
|
||||
@Listener
|
||||
public abstract class CommonPlayerLink implements PlayerLink {
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,7 +23,7 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.link;
|
||||
package org.geysermc.floodgate.core.link;
|
||||
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
@@ -31,8 +31,8 @@ import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.geysermc.floodgate.api.FloodgateApi;
|
||||
import org.geysermc.floodgate.api.link.LinkRequestResult;
|
||||
import org.geysermc.floodgate.api.link.PlayerLink;
|
||||
import org.geysermc.floodgate.core.util.Utils;
|
||||
import org.geysermc.floodgate.util.LinkedPlayer;
|
||||
import org.geysermc.floodgate.util.Utils;
|
||||
|
||||
/**
|
||||
* Simple class used when PlayerLinking is disabled. This class has been made because Floodgate
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,9 +23,9 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.link;
|
||||
package org.geysermc.floodgate.core.link;
|
||||
|
||||
import static org.geysermc.floodgate.util.Constants.GET_BEDROCK_LINK;
|
||||
import static org.geysermc.floodgate.core.util.Constants.GET_BEDROCK_LINK;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
@@ -36,10 +36,10 @@ import lombok.Getter;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.geysermc.floodgate.api.link.LinkRequestResult;
|
||||
import org.geysermc.floodgate.api.link.PlayerLink;
|
||||
import org.geysermc.floodgate.util.HttpClient;
|
||||
import org.geysermc.floodgate.util.HttpClient.DefaultHttpResponse;
|
||||
import org.geysermc.floodgate.core.util.HttpClient;
|
||||
import org.geysermc.floodgate.core.util.HttpClient.DefaultHttpResponse;
|
||||
import org.geysermc.floodgate.core.util.Utils;
|
||||
import org.geysermc.floodgate.util.LinkedPlayer;
|
||||
import org.geysermc.floodgate.util.Utils;
|
||||
|
||||
@Getter
|
||||
public class GlobalPlayerLinking extends CommonPlayerLink {
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,7 +23,7 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.link;
|
||||
package org.geysermc.floodgate.core.link;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.UUID;
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,13 +23,15 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.link;
|
||||
package org.geysermc.floodgate.core.link;
|
||||
|
||||
import static java.util.Objects.requireNonNull;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonObject;
|
||||
import io.avaje.inject.Bean;
|
||||
import io.avaje.inject.BeanScope;
|
||||
import io.avaje.inject.Factory;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.inject.Named;
|
||||
import jakarta.inject.Singleton;
|
||||
@@ -43,35 +45,38 @@ import java.nio.file.Path;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.geysermc.event.Listener;
|
||||
import org.geysermc.event.subscribe.Subscribe;
|
||||
import org.geysermc.floodgate.api.link.PlayerLink;
|
||||
import org.geysermc.floodgate.api.logger.FloodgateLogger;
|
||||
import org.geysermc.floodgate.config.FloodgateConfig;
|
||||
import org.geysermc.floodgate.config.FloodgateConfig.PlayerLinkConfig;
|
||||
import org.geysermc.floodgate.event.lifecycle.ShutdownEvent;
|
||||
import org.geysermc.floodgate.util.Constants;
|
||||
import org.geysermc.floodgate.util.Utils;
|
||||
import org.geysermc.floodgate.core.config.FloodgateConfig;
|
||||
import org.geysermc.floodgate.core.config.FloodgateConfig.PlayerLinkConfig;
|
||||
import org.geysermc.floodgate.core.event.lifecycle.ShutdownEvent;
|
||||
import org.geysermc.floodgate.core.util.Constants;
|
||||
import org.geysermc.floodgate.core.util.Utils;
|
||||
|
||||
@Listener
|
||||
@Singleton
|
||||
@Factory
|
||||
@SuppressWarnings("unchecked")
|
||||
public final class PlayerLinkHolder {
|
||||
@Inject BeanScope currentScope;
|
||||
@Inject FloodgateConfig config;
|
||||
@Inject FloodgateLogger logger;
|
||||
|
||||
@Inject
|
||||
@Named("dataDirectory")
|
||||
Path dataDirectory;
|
||||
private final BeanScope currentScope;
|
||||
|
||||
private URLClassLoader classLoader;
|
||||
private BeanScope childScope;
|
||||
private PlayerLink instance;
|
||||
|
||||
@NonNull
|
||||
public PlayerLink load() {
|
||||
@Inject
|
||||
PlayerLinkHolder(BeanScope scope) {
|
||||
this.currentScope = scope;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@Singleton
|
||||
PlayerLink load(
|
||||
FloodgateConfig config,
|
||||
FloodgateLogger logger,
|
||||
@Named("dataDirectory") Path dataDirectory
|
||||
) {
|
||||
if (instance != null) {
|
||||
return instance;
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,9 +23,9 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.logger;
|
||||
package org.geysermc.floodgate.core.logger;
|
||||
|
||||
import static org.geysermc.floodgate.util.MessageFormatter.format;
|
||||
import static org.geysermc.floodgate.core.util.MessageFormatter.format;
|
||||
|
||||
import io.avaje.inject.Secondary;
|
||||
import jakarta.inject.Inject;
|
||||
@@ -34,8 +34,8 @@ import jakarta.inject.Singleton;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import org.geysermc.floodgate.api.logger.FloodgateLogger;
|
||||
import org.geysermc.floodgate.config.FloodgateConfig;
|
||||
import org.geysermc.floodgate.util.LanguageManager;
|
||||
import org.geysermc.floodgate.core.config.FloodgateConfig;
|
||||
import org.geysermc.floodgate.core.util.LanguageManager;
|
||||
|
||||
@Secondary
|
||||
@Singleton
|
||||
@@ -0,0 +1,111 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @author GeyserMC
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.core.module;
|
||||
|
||||
import io.avaje.inject.Bean;
|
||||
import io.avaje.inject.Factory;
|
||||
import io.netty.util.AttributeKey;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.inject.Named;
|
||||
import jakarta.inject.Singleton;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.SynchronousQueue;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import org.geysermc.event.Listener;
|
||||
import org.geysermc.floodgate.api.player.FloodgatePlayer;
|
||||
import org.geysermc.floodgate.core.event.EventBus;
|
||||
import org.geysermc.floodgate.core.event.lifecycle.ShutdownEvent;
|
||||
import org.geysermc.floodgate.core.util.Constants;
|
||||
import org.geysermc.floodgate.crypto.AesCipher;
|
||||
import org.geysermc.floodgate.crypto.AesKeyProducer;
|
||||
import org.geysermc.floodgate.crypto.Base64Topping;
|
||||
import org.geysermc.floodgate.crypto.FloodgateCipher;
|
||||
import org.geysermc.floodgate.crypto.KeyProducer;
|
||||
|
||||
@Factory
|
||||
@Listener
|
||||
public class CommonModule {
|
||||
@Bean
|
||||
@Singleton
|
||||
@Named("commonPool")
|
||||
public ExecutorService commonPool() {
|
||||
return new ThreadPoolExecutor(0, 20, 60L, TimeUnit.SECONDS, new SynchronousQueue<>());
|
||||
}
|
||||
|
||||
@Inject
|
||||
public void registerShutdown(
|
||||
EventBus eventBus,
|
||||
@Named("commonPool") ExecutorService commonPool,
|
||||
@Named("commonScheduledPool") ScheduledExecutorService commonScheduledPool
|
||||
) {
|
||||
eventBus.subscribe(ShutdownEvent.class, ignored -> {
|
||||
commonPool.shutdown();
|
||||
commonScheduledPool.shutdown();
|
||||
});
|
||||
}
|
||||
|
||||
@Bean
|
||||
@Singleton
|
||||
public KeyProducer keyProducer() {
|
||||
return new AesKeyProducer();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@Singleton
|
||||
public FloodgateCipher cipher() {
|
||||
return new AesCipher(new Base64Topping());
|
||||
}
|
||||
|
||||
@Bean
|
||||
@Singleton
|
||||
@Named("gitBranch")
|
||||
public String gitBranch() {
|
||||
return Constants.GIT_BRANCH;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@Singleton
|
||||
@Named("buildNumber")
|
||||
public Integer buildNumber() {
|
||||
return Constants.BUILD_NUMBER;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@Singleton
|
||||
@Named("kickMessageAttribute")
|
||||
public AttributeKey<String> kickMessageAttribute() {
|
||||
return AttributeKey.valueOf("floodgate-kick-message");
|
||||
}
|
||||
|
||||
@Bean
|
||||
@Singleton
|
||||
@Named("playerAttribute")
|
||||
public AttributeKey<FloodgatePlayer> playerAttribute() {
|
||||
return AttributeKey.valueOf("floodgate-player");
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,7 +23,7 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.news;
|
||||
package org.geysermc.floodgate.core.news;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
@@ -39,14 +39,16 @@ import java.util.Map;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import org.geysermc.floodgate.api.logger.FloodgateLogger;
|
||||
import org.geysermc.floodgate.command.util.Permission;
|
||||
import org.geysermc.floodgate.core.command.util.Permission;
|
||||
import org.geysermc.floodgate.core.platform.command.CommandUtil;
|
||||
import org.geysermc.floodgate.core.util.Constants;
|
||||
import org.geysermc.floodgate.core.util.HttpClient;
|
||||
import org.geysermc.floodgate.core.util.HttpClient.HttpResponse;
|
||||
import org.geysermc.floodgate.news.NewsItem;
|
||||
import org.geysermc.floodgate.news.NewsItemAction;
|
||||
import org.geysermc.floodgate.news.data.AnnouncementData;
|
||||
import org.geysermc.floodgate.news.data.BuildSpecificData;
|
||||
import org.geysermc.floodgate.news.data.CheckAfterData;
|
||||
import org.geysermc.floodgate.platform.command.CommandUtil;
|
||||
import org.geysermc.floodgate.util.Constants;
|
||||
import org.geysermc.floodgate.util.HttpClient;
|
||||
import org.geysermc.floodgate.util.HttpClient.HttpResponse;
|
||||
|
||||
@Singleton
|
||||
public class NewsChecker {
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,20 +23,21 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.module;
|
||||
@InjectModule(requires = {
|
||||
PlatformUtils.class,
|
||||
String.class,
|
||||
// provided by either the Server- or ProxyModule
|
||||
FloodgateApi.class,
|
||||
FloodgateConfig.class,
|
||||
Path.class
|
||||
}, provides = {
|
||||
LanguageManager.class,
|
||||
})
|
||||
package org.geysermc.floodgate.core;
|
||||
|
||||
import com.google.inject.AbstractModule;
|
||||
import com.google.inject.Module;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
public final class PostEnableModules extends AbstractModule {
|
||||
private final Module[] postInitializeModules;
|
||||
|
||||
@Override
|
||||
protected void configure() {
|
||||
for (Module module : postInitializeModules) {
|
||||
install(module);
|
||||
}
|
||||
}
|
||||
}
|
||||
import io.avaje.inject.InjectModule;
|
||||
import java.nio.file.Path;
|
||||
import org.geysermc.floodgate.api.FloodgateApi;
|
||||
import org.geysermc.floodgate.core.config.FloodgateConfig;
|
||||
import org.geysermc.floodgate.core.platform.util.PlatformUtils;
|
||||
import org.geysermc.floodgate.core.util.LanguageManager;
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,7 +23,7 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.packet;
|
||||
package org.geysermc.floodgate.core.packet;
|
||||
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import jakarta.inject.Singleton;
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,10 +23,10 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.platform.command;
|
||||
package org.geysermc.floodgate.core.platform.command;
|
||||
|
||||
import static org.geysermc.floodgate.platform.util.PlayerType.ALL_PLAYERS;
|
||||
import static org.geysermc.floodgate.platform.util.PlayerType.ONLY_BEDROCK;
|
||||
import static org.geysermc.floodgate.core.platform.util.PlayerType.ALL_PLAYERS;
|
||||
import static org.geysermc.floodgate.core.platform.util.PlayerType.ONLY_BEDROCK;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@@ -38,11 +38,11 @@ import lombok.RequiredArgsConstructor;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.geysermc.floodgate.api.FloodgateApi;
|
||||
import org.geysermc.floodgate.platform.util.PlayerType;
|
||||
import org.geysermc.floodgate.player.UserAudience;
|
||||
import org.geysermc.floodgate.player.audience.ProfileAudience;
|
||||
import org.geysermc.floodgate.util.LanguageManager;
|
||||
import org.geysermc.floodgate.util.Utils;
|
||||
import org.geysermc.floodgate.core.platform.util.PlayerType;
|
||||
import org.geysermc.floodgate.core.player.UserAudience;
|
||||
import org.geysermc.floodgate.core.player.audience.ProfileAudience;
|
||||
import org.geysermc.floodgate.core.util.LanguageManager;
|
||||
import org.geysermc.floodgate.core.util.Utils;
|
||||
|
||||
/**
|
||||
* An interface used across all Floodgate platforms to simple stuff in commands like kicking players
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,13 +23,13 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.platform.command;
|
||||
package org.geysermc.floodgate.core.platform.command;
|
||||
|
||||
import cloud.commandframework.Command;
|
||||
import cloud.commandframework.CommandManager;
|
||||
import cloud.commandframework.context.CommandContext;
|
||||
import org.geysermc.floodgate.config.FloodgateConfig;
|
||||
import org.geysermc.floodgate.player.UserAudience;
|
||||
import org.geysermc.floodgate.core.config.FloodgateConfig;
|
||||
import org.geysermc.floodgate.core.player.UserAudience;
|
||||
|
||||
/** The base class for every Floodgate command. */
|
||||
public interface FloodgateCommand {
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,11 +23,11 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.platform.command;
|
||||
package org.geysermc.floodgate.core.platform.command;
|
||||
|
||||
import cloud.commandframework.context.CommandContext;
|
||||
import org.geysermc.floodgate.command.util.Permission;
|
||||
import org.geysermc.floodgate.player.UserAudience;
|
||||
import org.geysermc.floodgate.core.command.util.Permission;
|
||||
import org.geysermc.floodgate.core.player.UserAudience;
|
||||
|
||||
public abstract class FloodgateSubCommand {
|
||||
public abstract Class<?> parent();
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,7 +23,7 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.platform.command;
|
||||
package org.geysermc.floodgate.core.platform.command;
|
||||
|
||||
import jakarta.inject.Inject;
|
||||
import java.util.Set;
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,9 +23,9 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.platform.command;
|
||||
package org.geysermc.floodgate.core.platform.command;
|
||||
|
||||
import org.geysermc.floodgate.util.LanguageManager;
|
||||
import org.geysermc.floodgate.core.util.LanguageManager;
|
||||
|
||||
/**
|
||||
* TranslatableMessage is the interface for a message that can be translated. Messages are generally
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,7 +23,7 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.platform.listener;
|
||||
package org.geysermc.floodgate.core.platform.listener;
|
||||
|
||||
/**
|
||||
* This class is responsible for registering listeners to the listener manager of the platform that
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,7 +23,7 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.platform.pluginmessage;
|
||||
package org.geysermc.floodgate.core.platform.pluginmessage;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,7 +23,7 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.platform.util;
|
||||
package org.geysermc.floodgate.core.platform.util;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,7 +23,7 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.platform.util;
|
||||
package org.geysermc.floodgate.core.platform.util;
|
||||
|
||||
public enum PlayerType {
|
||||
ALL_PLAYERS,
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,13 +23,13 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.player;
|
||||
package org.geysermc.floodgate.core.player;
|
||||
|
||||
import cloud.commandframework.execution.preprocessor.CommandPreprocessingContext;
|
||||
import cloud.commandframework.execution.preprocessor.CommandPreprocessor;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.geysermc.floodgate.platform.command.CommandUtil;
|
||||
import org.geysermc.floodgate.core.platform.command.CommandUtil;
|
||||
|
||||
/**
|
||||
* Command preprocessor which decorated incoming {@link cloud.commandframework.context.CommandContext}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,10 +23,10 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.player;
|
||||
package org.geysermc.floodgate.core.player;
|
||||
|
||||
import static org.geysermc.floodgate.player.FloodgateHandshakeHandler.ResultType.INVALID_DATA_LENGTH;
|
||||
import static org.geysermc.floodgate.player.FloodgateHandshakeHandler.ResultType.NOT_FLOODGATE_DATA;
|
||||
import static org.geysermc.floodgate.core.player.FloodgateHandshakeHandler.ResultType.INVALID_DATA_LENGTH;
|
||||
import static org.geysermc.floodgate.core.player.FloodgateHandshakeHandler.ResultType.NOT_FLOODGATE_DATA;
|
||||
import static org.geysermc.floodgate.util.BedrockData.EXPECTED_LENGTH;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
@@ -34,6 +34,8 @@ import io.netty.channel.Channel;
|
||||
import io.netty.util.AttributeKey;
|
||||
import it.unimi.dsi.fastutil.Pair;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectObjectImmutablePair;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.inject.Named;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.CompletionException;
|
||||
@@ -41,52 +43,34 @@ import lombok.AccessLevel;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NonNull;
|
||||
import org.geysermc.floodgate.addon.data.HandshakeDataImpl;
|
||||
import org.geysermc.floodgate.addon.data.HandshakeHandlersImpl;
|
||||
import org.geysermc.floodgate.api.SimpleFloodgateApi;
|
||||
import org.geysermc.floodgate.api.handshake.HandshakeData;
|
||||
import org.geysermc.floodgate.api.logger.FloodgateLogger;
|
||||
import org.geysermc.floodgate.api.player.FloodgatePlayer;
|
||||
import org.geysermc.floodgate.api.player.PropertyKey;
|
||||
import org.geysermc.floodgate.config.FloodgateConfig;
|
||||
import org.geysermc.floodgate.core.addon.data.HandshakeDataImpl;
|
||||
import org.geysermc.floodgate.core.addon.data.HandshakeHandlersImpl;
|
||||
import org.geysermc.floodgate.core.api.SimpleFloodgateApi;
|
||||
import org.geysermc.floodgate.core.config.FloodgateConfig;
|
||||
import org.geysermc.floodgate.core.skin.SkinUploadManager;
|
||||
import org.geysermc.floodgate.core.util.Constants;
|
||||
import org.geysermc.floodgate.core.util.LanguageManager;
|
||||
import org.geysermc.floodgate.core.util.Utils;
|
||||
import org.geysermc.floodgate.crypto.FloodgateCipher;
|
||||
import org.geysermc.floodgate.skin.SkinUploadManager;
|
||||
import org.geysermc.floodgate.util.BedrockData;
|
||||
import org.geysermc.floodgate.util.Constants;
|
||||
import org.geysermc.floodgate.util.InvalidFormatException;
|
||||
import org.geysermc.floodgate.util.LanguageManager;
|
||||
import org.geysermc.floodgate.util.LinkedPlayer;
|
||||
import org.geysermc.floodgate.util.Utils;
|
||||
|
||||
public final class FloodgateHandshakeHandler {
|
||||
private final HandshakeHandlersImpl handshakeHandlers;
|
||||
private final SimpleFloodgateApi api;
|
||||
private final FloodgateCipher cipher;
|
||||
private final FloodgateConfig config;
|
||||
private final SkinUploadManager skinUploadManager;
|
||||
private final AttributeKey<FloodgatePlayer> playerAttribute;
|
||||
private final FloodgateLogger logger;
|
||||
private final LanguageManager languageManager;
|
||||
|
||||
public FloodgateHandshakeHandler(
|
||||
HandshakeHandlersImpl handshakeHandlers,
|
||||
SimpleFloodgateApi api,
|
||||
FloodgateCipher cipher,
|
||||
FloodgateConfig config,
|
||||
SkinUploadManager skinUploadManager,
|
||||
AttributeKey<FloodgatePlayer> playerAttribute,
|
||||
FloodgateLogger logger,
|
||||
LanguageManager languageManager) {
|
||||
|
||||
this.handshakeHandlers = handshakeHandlers;
|
||||
this.api = api;
|
||||
this.cipher = cipher;
|
||||
this.config = config;
|
||||
this.skinUploadManager = skinUploadManager;
|
||||
this.playerAttribute = playerAttribute;
|
||||
this.logger = logger;
|
||||
this.languageManager = languageManager;
|
||||
}
|
||||
@Inject HandshakeHandlersImpl handshakeHandlers;
|
||||
@Inject SimpleFloodgateApi api;
|
||||
@Inject FloodgateCipher cipher;
|
||||
@Inject FloodgateConfig config;
|
||||
@Inject SkinUploadManager skinUploadManager;
|
||||
@Inject
|
||||
@Named("playerAttribute")
|
||||
AttributeKey<FloodgatePlayer> playerAttribute;
|
||||
@Inject FloodgateLogger logger;
|
||||
@Inject LanguageManager languageManager;
|
||||
|
||||
/**
|
||||
* Separates the Floodgate data from the hostname
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,7 +23,7 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.player;
|
||||
package org.geysermc.floodgate.core.player;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -32,17 +32,17 @@ import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.geysermc.floodgate.api.FloodgateApi;
|
||||
import org.geysermc.floodgate.api.ProxyFloodgateApi;
|
||||
import org.geysermc.floodgate.api.handshake.HandshakeData;
|
||||
import org.geysermc.floodgate.api.player.FloodgatePlayer;
|
||||
import org.geysermc.floodgate.api.player.PropertyKey;
|
||||
import org.geysermc.floodgate.api.player.PropertyKey.Result;
|
||||
import org.geysermc.floodgate.core.api.ProxyFloodgateApi;
|
||||
import org.geysermc.floodgate.core.util.Utils;
|
||||
import org.geysermc.floodgate.util.BedrockData;
|
||||
import org.geysermc.floodgate.util.DeviceOs;
|
||||
import org.geysermc.floodgate.util.InputMode;
|
||||
import org.geysermc.floodgate.util.LinkedPlayer;
|
||||
import org.geysermc.floodgate.util.UiProfile;
|
||||
import org.geysermc.floodgate.util.Utils;
|
||||
|
||||
@Getter
|
||||
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,7 +23,7 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.player;
|
||||
package org.geysermc.floodgate.core.player;
|
||||
|
||||
public class HostnameSeparationResult {
|
||||
private final String floodgateData;
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,15 +23,15 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.player;
|
||||
package org.geysermc.floodgate.core.player;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
import lombok.Getter;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.geysermc.floodgate.platform.command.CommandUtil;
|
||||
import org.geysermc.floodgate.platform.command.TranslatableMessage;
|
||||
import org.geysermc.floodgate.core.platform.command.CommandUtil;
|
||||
import org.geysermc.floodgate.core.platform.command.TranslatableMessage;
|
||||
|
||||
@Getter @Accessors(fluent = true)
|
||||
public class UserAudience {
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,7 +23,7 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.player.audience;
|
||||
package org.geysermc.floodgate.core.player.audience;
|
||||
|
||||
import java.util.UUID;
|
||||
import lombok.Getter;
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,7 +23,7 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.player.audience;
|
||||
package org.geysermc.floodgate.core.player.audience;
|
||||
|
||||
import cloud.commandframework.arguments.CommandArgument;
|
||||
import cloud.commandframework.arguments.parser.ArgumentParseResult;
|
||||
@@ -36,9 +36,9 @@ import java.util.Queue;
|
||||
import java.util.UUID;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.geysermc.floodgate.platform.command.CommandUtil;
|
||||
import org.geysermc.floodgate.platform.util.PlayerType;
|
||||
import org.geysermc.floodgate.player.UserAudience;
|
||||
import org.geysermc.floodgate.core.platform.command.CommandUtil;
|
||||
import org.geysermc.floodgate.core.platform.util.PlayerType;
|
||||
import org.geysermc.floodgate.core.player.UserAudience;
|
||||
|
||||
public class ProfileAudienceArgument extends CommandArgument<UserAudience, ProfileAudience> {
|
||||
private ProfileAudienceArgument(@NonNull String name, ProfileAudienceParser parser) {
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,7 +23,7 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.pluginmessage;
|
||||
package org.geysermc.floodgate.core.pluginmessage;
|
||||
|
||||
import java.util.UUID;
|
||||
import lombok.AccessLevel;
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,13 +23,15 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.pluginmessage;
|
||||
package org.geysermc.floodgate.core.pluginmessage;
|
||||
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.inject.Singleton;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@Singleton
|
||||
public class PluginMessageManager {
|
||||
private final Map<Class<? extends PluginMessageChannel>, PluginMessageChannel> classInstanceMap = new HashMap<>();
|
||||
private final Map<String, PluginMessageChannel> identifierInstanceMap = new HashMap<>();
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,7 +23,7 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.pluginmessage;
|
||||
package org.geysermc.floodgate.core.pluginmessage;
|
||||
|
||||
public interface PluginMessageRegistration {
|
||||
void register(PluginMessageChannel channel);
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,7 +23,7 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.pluginmessage.channel;
|
||||
package org.geysermc.floodgate.core.pluginmessage.channel;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
import it.unimi.dsi.fastutil.shorts.Short2ObjectMap;
|
||||
@@ -35,9 +35,9 @@ import org.geysermc.cumulus.form.Form;
|
||||
import org.geysermc.cumulus.form.impl.FormDefinition;
|
||||
import org.geysermc.cumulus.form.impl.FormDefinitions;
|
||||
import org.geysermc.floodgate.api.logger.FloodgateLogger;
|
||||
import org.geysermc.floodgate.config.FloodgateConfig;
|
||||
import org.geysermc.floodgate.platform.pluginmessage.PluginMessageUtils;
|
||||
import org.geysermc.floodgate.pluginmessage.PluginMessageChannel;
|
||||
import org.geysermc.floodgate.core.config.FloodgateConfig;
|
||||
import org.geysermc.floodgate.core.platform.pluginmessage.PluginMessageUtils;
|
||||
import org.geysermc.floodgate.core.pluginmessage.PluginMessageChannel;
|
||||
|
||||
public class FormChannel implements PluginMessageChannel {
|
||||
private final FormDefinitions formDefinitions = FormDefinitions.instance();
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,13 +23,13 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.pluginmessage.channel;
|
||||
package org.geysermc.floodgate.core.pluginmessage.channel;
|
||||
|
||||
import jakarta.inject.Inject;
|
||||
import java.util.UUID;
|
||||
import org.geysermc.floodgate.api.UnsafeFloodgateApi;
|
||||
import org.geysermc.floodgate.platform.pluginmessage.PluginMessageUtils;
|
||||
import org.geysermc.floodgate.pluginmessage.PluginMessageChannel;
|
||||
import org.geysermc.floodgate.core.api.UnsafeFloodgateApi;
|
||||
import org.geysermc.floodgate.core.platform.pluginmessage.PluginMessageUtils;
|
||||
import org.geysermc.floodgate.core.pluginmessage.PluginMessageChannel;
|
||||
|
||||
public final class PacketChannel implements PluginMessageChannel {
|
||||
@Inject PluginMessageUtils pluginMessageUtils;
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,7 +23,7 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.pluginmessage.channel;
|
||||
package org.geysermc.floodgate.core.pluginmessage.channel;
|
||||
|
||||
import jakarta.inject.Inject;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
@@ -31,11 +31,11 @@ import java.util.UUID;
|
||||
import org.geysermc.floodgate.api.FloodgateApi;
|
||||
import org.geysermc.floodgate.api.player.FloodgatePlayer;
|
||||
import org.geysermc.floodgate.api.player.PropertyKey;
|
||||
import org.geysermc.floodgate.config.FloodgateConfig;
|
||||
import org.geysermc.floodgate.config.ProxyFloodgateConfig;
|
||||
import org.geysermc.floodgate.pluginmessage.PluginMessageChannel;
|
||||
import org.geysermc.floodgate.skin.SkinApplier;
|
||||
import org.geysermc.floodgate.skin.SkinDataImpl;
|
||||
import org.geysermc.floodgate.core.config.FloodgateConfig;
|
||||
import org.geysermc.floodgate.core.config.ProxyFloodgateConfig;
|
||||
import org.geysermc.floodgate.core.pluginmessage.PluginMessageChannel;
|
||||
import org.geysermc.floodgate.core.skin.SkinApplier;
|
||||
import org.geysermc.floodgate.core.skin.SkinDataImpl;
|
||||
|
||||
public class SkinChannel implements PluginMessageChannel {
|
||||
@Inject FloodgateApi api;
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,13 +23,13 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.pluginmessage.channel;
|
||||
package org.geysermc.floodgate.core.pluginmessage.channel;
|
||||
|
||||
import jakarta.inject.Inject;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.UUID;
|
||||
import org.geysermc.floodgate.platform.pluginmessage.PluginMessageUtils;
|
||||
import org.geysermc.floodgate.pluginmessage.PluginMessageChannel;
|
||||
import org.geysermc.floodgate.core.platform.pluginmessage.PluginMessageUtils;
|
||||
import org.geysermc.floodgate.core.pluginmessage.PluginMessageChannel;
|
||||
|
||||
public class TransferChannel implements PluginMessageChannel {
|
||||
@Inject PluginMessageUtils pluginMessageUtils;
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,15 +23,15 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.register;
|
||||
package org.geysermc.floodgate.core.register;
|
||||
|
||||
import cloud.commandframework.CommandManager;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.inject.Singleton;
|
||||
import java.util.Set;
|
||||
import org.geysermc.floodgate.config.FloodgateConfig;
|
||||
import org.geysermc.floodgate.platform.command.FloodgateCommand;
|
||||
import org.geysermc.floodgate.player.UserAudience;
|
||||
import org.geysermc.floodgate.core.config.FloodgateConfig;
|
||||
import org.geysermc.floodgate.core.platform.command.FloodgateCommand;
|
||||
import org.geysermc.floodgate.core.player.UserAudience;
|
||||
|
||||
/**
|
||||
* This class is responsible for registering commands to the command register of the platform that
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,7 +23,7 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.register;
|
||||
package org.geysermc.floodgate.core.register;
|
||||
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.inject.Qualifier;
|
||||
@@ -32,7 +32,7 @@ import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
import org.geysermc.floodgate.platform.listener.ListenerRegistration;
|
||||
import org.geysermc.floodgate.core.platform.listener.ListenerRegistration;
|
||||
|
||||
@Singleton
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
@@ -23,7 +23,7 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.scope;
|
||||
package org.geysermc.floodgate.core.scope;
|
||||
|
||||
import jakarta.inject.Scope;
|
||||
import java.lang.annotation.Retention;
|
||||
@@ -23,13 +23,16 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.scope;
|
||||
package org.geysermc.floodgate.core.scope;
|
||||
|
||||
import io.avaje.inject.InjectModule;
|
||||
import jakarta.inject.Scope;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import org.geysermc.floodgate.core.config.FloodgateConfig;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Scope
|
||||
@InjectModule(provides = FloodgateConfig.class)
|
||||
public @interface ServerScope {
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,7 +23,7 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.skin;
|
||||
package org.geysermc.floodgate.core.skin;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.geysermc.floodgate.api.event.skin.SkinApplyEvent.SkinData;
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,7 +23,7 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.skin;
|
||||
package org.geysermc.floodgate.core.skin;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import java.util.Objects;
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,7 +23,7 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.skin;
|
||||
package org.geysermc.floodgate.core.skin;
|
||||
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMaps;
|
||||
@@ -34,7 +34,7 @@ import org.geysermc.event.Listener;
|
||||
import org.geysermc.event.subscribe.Subscribe;
|
||||
import org.geysermc.floodgate.api.FloodgateApi;
|
||||
import org.geysermc.floodgate.api.logger.FloodgateLogger;
|
||||
import org.geysermc.floodgate.event.lifecycle.ShutdownEvent;
|
||||
import org.geysermc.floodgate.core.event.lifecycle.ShutdownEvent;
|
||||
|
||||
@Listener
|
||||
@Singleton
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,9 +23,9 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.skin;
|
||||
package org.geysermc.floodgate.core.skin;
|
||||
|
||||
import static org.geysermc.floodgate.util.Constants.WEBSOCKET_URL;
|
||||
import static org.geysermc.floodgate.core.util.Constants.WEBSOCKET_URL;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonObject;
|
||||
@@ -39,7 +39,7 @@ import org.geysermc.floodgate.api.event.skin.SkinApplyEvent.SkinData;
|
||||
import org.geysermc.floodgate.api.logger.FloodgateLogger;
|
||||
import org.geysermc.floodgate.api.player.FloodgatePlayer;
|
||||
import org.geysermc.floodgate.api.player.PropertyKey;
|
||||
import org.geysermc.floodgate.util.Utils;
|
||||
import org.geysermc.floodgate.core.util.Utils;
|
||||
import org.geysermc.floodgate.util.WebsocketEventType;
|
||||
import org.java_websocket.client.WebSocketClient;
|
||||
import org.java_websocket.handshake.ServerHandshake;
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,7 +23,7 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.util;
|
||||
package org.geysermc.floodgate.core.util;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,7 +23,7 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.util;
|
||||
package org.geysermc.floodgate.core.util;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonObject;
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,7 +23,7 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.util;
|
||||
package org.geysermc.floodgate.core.util;
|
||||
|
||||
import com.google.common.base.Joiner;
|
||||
import jakarta.inject.Inject;
|
||||
@@ -36,7 +36,7 @@ import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import lombok.Getter;
|
||||
import org.geysermc.floodgate.api.logger.FloodgateLogger;
|
||||
import org.geysermc.floodgate.config.FloodgateConfig;
|
||||
import org.geysermc.floodgate.core.config.FloodgateConfig;
|
||||
|
||||
/**
|
||||
* Manages translations for strings in Floodgate
|
||||
@@ -72,7 +72,7 @@ public final class LanguageManager {
|
||||
* Tries to load the log's locale file once a string has been requested
|
||||
*/
|
||||
@Inject
|
||||
private void init() {
|
||||
public void init() {
|
||||
if (!loadLocale("en_US")) {// Fallback
|
||||
logger.error("Failed to load the fallback language. This will likely cause errors!");
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,7 +23,7 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.util;
|
||||
package org.geysermc.floodgate.core.util;
|
||||
|
||||
public final class MessageFormatter {
|
||||
private static final String DELIM_STR = "{}";
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,7 +23,7 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.util;
|
||||
package org.geysermc.floodgate.core.util;
|
||||
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.inject.Named;
|
||||
@@ -41,9 +41,9 @@ import org.bstats.charts.SingleLineChart;
|
||||
import org.bstats.json.JsonObjectBuilder;
|
||||
import org.geysermc.floodgate.api.FloodgateApi;
|
||||
import org.geysermc.floodgate.api.logger.FloodgateLogger;
|
||||
import org.geysermc.floodgate.config.FloodgateConfig;
|
||||
import org.geysermc.floodgate.config.FloodgateConfig.MetricsConfig;
|
||||
import org.geysermc.floodgate.platform.util.PlatformUtils;
|
||||
import org.geysermc.floodgate.core.config.FloodgateConfig;
|
||||
import org.geysermc.floodgate.core.config.FloodgateConfig.MetricsConfig;
|
||||
import org.geysermc.floodgate.core.platform.util.PlatformUtils;
|
||||
|
||||
@Singleton
|
||||
public final class Metrics {
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,11 +23,12 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.util;
|
||||
package org.geysermc.floodgate.core.util;
|
||||
|
||||
import io.avaje.inject.PostConstruct;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.inject.Named;
|
||||
import jakarta.inject.Singleton;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
@@ -35,11 +36,11 @@ import java.util.concurrent.TimeUnit;
|
||||
import org.geysermc.event.Listener;
|
||||
import org.geysermc.event.subscribe.Subscribe;
|
||||
import org.geysermc.floodgate.api.logger.FloodgateLogger;
|
||||
import org.geysermc.floodgate.config.FloodgateConfig;
|
||||
import org.geysermc.floodgate.event.lifecycle.PostEnableEvent;
|
||||
import org.geysermc.floodgate.core.config.FloodgateConfig;
|
||||
import org.geysermc.floodgate.core.event.lifecycle.PostEnableEvent;
|
||||
|
||||
@AutoBind
|
||||
@Listener
|
||||
@Singleton
|
||||
public final class PostEnableMessages {
|
||||
private final List<String> messages = new ArrayList<>();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,7 +23,7 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.util;
|
||||
package org.geysermc.floodgate.core.util;
|
||||
|
||||
import java.lang.reflect.AccessibleObject;
|
||||
import java.lang.reflect.Constructor;
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
* Copyright (c) 2019-2023 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,8 +23,9 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.util;
|
||||
package org.geysermc.floodgate.core.util;
|
||||
|
||||
import io.avaje.inject.spi.Module;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.ChannelHandler;
|
||||
import io.netty.channel.ChannelPipeline;
|
||||
@@ -175,4 +176,12 @@ public class Utils {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static Module makeModule(String moduleClassName) {
|
||||
try {
|
||||
return (Module) Class.forName(moduleClassName).getDeclaredConstructor().newInstance();
|
||||
} catch (Throwable throwable) {
|
||||
throw new RuntimeException(throwable);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @author GeyserMC
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.event.util;
|
||||
|
||||
import com.google.inject.TypeLiteral;
|
||||
import com.google.inject.matcher.AbstractMatcher;
|
||||
import org.geysermc.event.Listener;
|
||||
|
||||
public class ListenerAnnotationMatcher extends AbstractMatcher<TypeLiteral<?>> {
|
||||
@Override
|
||||
public boolean matches(TypeLiteral<?> typeLiteral) {
|
||||
Class<?> rawType = typeLiteral.getRawType();
|
||||
return rawType.isAnnotationPresent(Listener.class);
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @author GeyserMC
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.module;
|
||||
|
||||
import com.google.inject.AbstractModule;
|
||||
import org.geysermc.floodgate.util.AutoBind;
|
||||
import org.geysermc.floodgate.util.Utils;
|
||||
|
||||
public class AutoBindModule extends AbstractModule {
|
||||
@Override
|
||||
protected void configure() {
|
||||
for (Class<?> clazz : Utils.getGeneratedClassesForAnnotation(AutoBind.class)) {
|
||||
bind(clazz).asEagerSingleton();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,188 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @author GeyserMC
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.module;
|
||||
|
||||
import com.google.inject.AbstractModule;
|
||||
import com.google.inject.Provides;
|
||||
import com.google.inject.TypeLiteral;
|
||||
import com.google.inject.name.Names;
|
||||
import com.google.inject.spi.InjectionListener;
|
||||
import com.google.inject.spi.TypeEncounter;
|
||||
import com.google.inject.spi.TypeListener;
|
||||
import io.netty.util.AttributeKey;
|
||||
import jakarta.inject.Named;
|
||||
import jakarta.inject.Singleton;
|
||||
import java.nio.file.Path;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.geysermc.event.PostOrder;
|
||||
import org.geysermc.floodgate.addon.data.HandshakeHandlersImpl;
|
||||
import org.geysermc.floodgate.api.SimpleFloodgateApi;
|
||||
import org.geysermc.floodgate.api.link.PlayerLink;
|
||||
import org.geysermc.floodgate.api.logger.FloodgateLogger;
|
||||
import org.geysermc.floodgate.api.player.FloodgatePlayer;
|
||||
import org.geysermc.floodgate.config.ConfigLoader;
|
||||
import org.geysermc.floodgate.config.FloodgateConfig;
|
||||
import org.geysermc.floodgate.crypto.AesCipher;
|
||||
import org.geysermc.floodgate.crypto.AesKeyProducer;
|
||||
import org.geysermc.floodgate.crypto.Base64Topping;
|
||||
import org.geysermc.floodgate.crypto.FloodgateCipher;
|
||||
import org.geysermc.floodgate.crypto.KeyProducer;
|
||||
import org.geysermc.floodgate.event.EventBus;
|
||||
import org.geysermc.floodgate.event.lifecycle.ShutdownEvent;
|
||||
import org.geysermc.floodgate.event.util.ListenerAnnotationMatcher;
|
||||
import org.geysermc.floodgate.link.PlayerLinkHolder;
|
||||
import org.geysermc.floodgate.player.FloodgateHandshakeHandler;
|
||||
import org.geysermc.floodgate.pluginmessage.PluginMessageManager;
|
||||
import org.geysermc.floodgate.skin.SkinUploadManager;
|
||||
import org.geysermc.floodgate.util.Constants;
|
||||
import org.geysermc.floodgate.util.LanguageManager;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
public class CommonModule extends AbstractModule {
|
||||
private final EventBus eventBus = new EventBus();
|
||||
private final Path dataDirectory;
|
||||
|
||||
@Override
|
||||
protected void configure() {
|
||||
// register every class that has the Listener annotation
|
||||
bindListener(new ListenerAnnotationMatcher(), new TypeListener() {
|
||||
@Override
|
||||
public <I> void hear(TypeLiteral<I> type, TypeEncounter<I> encounter) {
|
||||
encounter.register((InjectionListener<I>) eventBus::register);
|
||||
}
|
||||
});
|
||||
|
||||
ExecutorService commonPool = Executors.newCachedThreadPool();
|
||||
ScheduledExecutorService commonScheduledPool = Executors.newSingleThreadScheduledExecutor();
|
||||
|
||||
eventBus.subscribe(ShutdownEvent.class, ignored -> {
|
||||
commonPool.shutdown();
|
||||
commonScheduledPool.shutdown();
|
||||
}, PostOrder.LAST);
|
||||
|
||||
bind(ExecutorService.class)
|
||||
.annotatedWith(Names.named("commonPool"))
|
||||
.toInstance(commonPool);
|
||||
bind(ScheduledExecutorService.class)
|
||||
.annotatedWith(Names.named("commonScheduledPool"))
|
||||
.toInstance(commonScheduledPool);
|
||||
|
||||
install(new AutoBindModule());
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
public FloodgateConfig floodgateConfig(ConfigLoader configLoader) {
|
||||
return configLoader.load();
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
public PlayerLink playerLink(PlayerLinkHolder linkLoader) {
|
||||
return linkLoader.load();
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
public KeyProducer keyProducer() {
|
||||
return new AesKeyProducer();
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
public FloodgateCipher cipher() {
|
||||
return new AesCipher(new Base64Topping());
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
@Named("dataDirectory")
|
||||
public Path dataDirectory() {
|
||||
return dataDirectory;
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
public ConfigLoader configLoader(
|
||||
@Named("configClass") Class<? extends FloodgateConfig> configClass,
|
||||
KeyProducer producer,
|
||||
FloodgateCipher cipher) {
|
||||
return new ConfigLoader(dataDirectory, configClass, producer, cipher);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
public FloodgateHandshakeHandler handshakeHandler(
|
||||
HandshakeHandlersImpl handshakeHandlers,
|
||||
SimpleFloodgateApi api,
|
||||
FloodgateCipher cipher,
|
||||
FloodgateConfig config,
|
||||
SkinUploadManager skinUploadManager,
|
||||
@Named("playerAttribute") AttributeKey<FloodgatePlayer> playerAttribute,
|
||||
FloodgateLogger logger,
|
||||
LanguageManager languageManager) {
|
||||
|
||||
return new FloodgateHandshakeHandler(handshakeHandlers, api, cipher, config,
|
||||
skinUploadManager, playerAttribute, logger, languageManager);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
public PluginMessageManager pluginMessageManager() {
|
||||
return new PluginMessageManager();
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
@Named("gitBranch")
|
||||
public String gitBranch() {
|
||||
return Constants.GIT_BRANCH;
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
@Named("buildNumber")
|
||||
public int buildNumber() {
|
||||
return Constants.BUILD_NUMBER;
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
@Named("kickMessageAttribute")
|
||||
public AttributeKey<String> kickMessageAttribute() {
|
||||
return AttributeKey.valueOf("floodgate-kick-message");
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
@Named("playerAttribute")
|
||||
public AttributeKey<FloodgatePlayer> playerAttribute() {
|
||||
return AttributeKey.valueOf("floodgate-player");
|
||||
}
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @author GeyserMC
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.module;
|
||||
|
||||
import com.google.inject.AbstractModule;
|
||||
import com.google.inject.Provides;
|
||||
import jakarta.inject.Singleton;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.geysermc.floodgate.config.FloodgateConfig;
|
||||
import org.geysermc.floodgate.config.ProxyFloodgateConfig;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
public final class ConfigLoadedModule extends AbstractModule {
|
||||
private final FloodgateConfig config;
|
||||
|
||||
@Override
|
||||
protected void configure() {
|
||||
if (config instanceof ProxyFloodgateConfig) {
|
||||
bind(ProxyFloodgateConfig.class).toInstance((ProxyFloodgateConfig) config);
|
||||
}
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
public FloodgateConfig floodgateConfig() {
|
||||
return config;
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,7 @@
|
||||
* @link https://github.com/GeyserMC/Floodgate
|
||||
*/
|
||||
|
||||
package org.geysermc.floodgate.util;
|
||||
package org.geysermc.floodgate.core.util;
|
||||
|
||||
public final class Constants {
|
||||
public static final String VERSION = "@floodgateVersion@";
|
||||
Reference in New Issue
Block a user