├── bungee
├── src
│ └── main
│ │ ├── java
│ │ └── com
│ │ │ └── minekube
│ │ │ └── connect
│ │ │ ├── util
│ │ │ ├── BungeeUserAudience.java
│ │ │ └── BungeePlatformUtils.java
│ │ │ ├── listener
│ │ │ └── BungeeListenerRegistration.java
│ │ │ ├── module
│ │ │ └── BungeeListenerModule.java
│ │ │ ├── BungeePlugin.java
│ │ │ └── inject
│ │ │ └── bungee
│ │ │ └── ConnectIoHandlerWrapper.java
│ │ └── resources
│ │ └── plugin.yml
└── build.gradle.kts
├── .vscode
└── settings.json
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradle.properties
├── .idea
├── codeStyles
│ └── codeStyleConfig.xml
└── copyright
│ ├── profiles_settings.xml
│ └── GeyserMC.xml
├── core
├── src
│ └── main
│ │ ├── proto
│ │ ├── README.md
│ │ └── com
│ │ │ └── minekube
│ │ │ └── connect
│ │ │ └── v1alpha1
│ │ │ └── tunnel_service.proto
│ │ ├── resources
│ │ ├── languages
│ │ │ └── texts
│ │ │ │ └── en_US.properties
│ │ ├── proxy-config.yml
│ │ └── config.yml
│ │ └── java
│ │ └── com
│ │ └── minekube
│ │ └── connect
│ │ ├── platform
│ │ ├── util
│ │ │ └── PlatformUtils.java
│ │ ├── listener
│ │ │ └── ListenerRegistration.java
│ │ └── command
│ │ │ ├── TranslatableMessage.java
│ │ │ └── ConnectCommand.java
│ │ ├── command
│ │ ├── util
│ │ │ ├── PermissionDefault.java
│ │ │ └── Permission.java
│ │ ├── CommonCommandMessage.java
│ │ └── TestCommand.java
│ │ ├── skin
│ │ ├── SkinApplier.java
│ │ └── SkinData.java
│ │ ├── config
│ │ ├── ProxyConnectConfig.java
│ │ ├── ConfigHolder.java
│ │ └── ConnectConfig.java
│ │ ├── api
│ │ └── ProxyConnectApi.java
│ │ ├── watch
│ │ ├── Watcher.java
│ │ └── SessionProposal.java
│ │ ├── addon
│ │ ├── debug
│ │ │ ├── State.java
│ │ │ ├── ChannelInDebugHandler.java
│ │ │ └── ChannelOutDebugHandler.java
│ │ ├── AddonManagerAddon.java
│ │ ├── packethandler
│ │ │ ├── ChannelInPacketHandler.java
│ │ │ └── ChannelOutPacketHandler.java
│ │ ├── data
│ │ │ └── CommonDataHandler.java
│ │ ├── PacketHandlerAddon.java
│ │ └── DebugAddon.java
│ │ ├── util
│ │ ├── backoff
│ │ │ ├── NanoClock.java
│ │ │ └── BackOff.java
│ │ ├── InjectorHolder.java
│ │ └── Constants.java
│ │ ├── module
│ │ ├── WatcherModule.java
│ │ ├── PostInitializeModule.java
│ │ ├── ConfigLoadedModule.java
│ │ ├── ServerCommonModule.java
│ │ ├── CommandModule.java
│ │ └── ProxyCommonModule.java
│ │ ├── network
│ │ └── netty
│ │ │ ├── DefaultChannelPipelinePublic.java
│ │ │ ├── LocalChannelWithSessionContext.java
│ │ │ ├── LocalServerChannelWrapper.java
│ │ │ ├── LocalChannelWrapper.java
│ │ │ └── TunnelHandler.java
│ │ ├── player
│ │ ├── audience
│ │ │ └── ProfileAudience.java
│ │ ├── ConnectPlayerImpl.java
│ │ └── ConnectCommandPreprocessor.java
│ │ ├── register
│ │ ├── AddonRegister.java
│ │ ├── ListenerRegister.java
│ │ └── CommandRegister.java
│ │ ├── tunnel
│ │ └── TunnelConn.java
│ │ └── logger
│ │ └── JavaUtilConnectLogger.java
└── build.gradle.kts
├── spigot
├── src
│ └── main
│ │ ├── resources
│ │ └── plugin.yml
│ │ └── java
│ │ └── com
│ │ └── minekube
│ │ └── connect
│ │ ├── util
│ │ ├── SpigotPlatformUtils.java
│ │ ├── ProxyUtils.java
│ │ └── SpigotVersionSpecificMethods.java
│ │ ├── listener
│ │ ├── SpigotListenerRegistration.java
│ │ ├── PaperProfileListener.java
│ │ └── SpigotListener.java
│ │ ├── module
│ │ ├── PaperListenerModule.java
│ │ ├── SpigotListenerModule.java
│ │ └── SpigotAddonModule.java
│ │ ├── SpigotPlatform.java
│ │ └── addon
│ │ └── data
│ │ └── SpigotDataAddon.java
└── build.gradle.kts
├── velocity
├── src
│ └── main
│ │ ├── resources
│ │ └── velocity-plugin.json
│ │ └── java
│ │ └── com
│ │ └── minekube
│ │ └── connect
│ │ ├── util
│ │ ├── VelocityPlatformUtils.java
│ │ └── VelocitySkinApplier.java
│ │ ├── listener
│ │ └── VelocityListenerRegistration.java
│ │ ├── module
│ │ └── VelocityListenerModule.java
│ │ ├── inject
│ │ └── velocity
│ │ │ └── ConnectWatchedSingleThreadIoEventLoop.java
│ │ ├── VelocityPlugin.java
│ │ └── logger
│ │ └── Slf4JConnectLogger.java
└── build.gradle.kts
├── api
├── build.gradle.kts
└── src
│ └── main
│ └── java
│ └── com
│ └── minekube
│ └── connect
│ └── api
│ ├── player
│ ├── Auth.java
│ ├── GameProfile.java
│ └── ConnectPlayer.java
│ ├── packet
│ ├── PacketHandler.java
│ └── PacketHandlers.java
│ ├── InstanceHolder.java
│ ├── ConnectApi.java
│ ├── inject
│ ├── InjectorAddon.java
│ └── PlatformInjector.java
│ └── util
│ └── TriFunction.java
├── LICENSE
├── .github
└── workflows
│ ├── pullrequest.yml
│ └── release.yml
├── ruleset.xml
├── settings.gradle.kts
└── gradlew.bat
/bungee/src/main/java/com/minekube/connect/util/BungeeUserAudience.java:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "java.compile.nullAnalysis.mode": "automatic"
3 | }
4 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/minekube/connect-java/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.configureondemand=true
2 | org.gradle.caching=true
3 | org.gradle.parallel=true
4 | version=2.2.3-SNAPSHOT
--------------------------------------------------------------------------------
/bungee/src/main/resources/plugin.yml:
--------------------------------------------------------------------------------
1 | name: ${name}
2 | description: ${description}
3 | version: ${version}
4 | author: ${author}
5 | main: com.minekube.connect.BungeePlugin
--------------------------------------------------------------------------------
/.idea/codeStyles/codeStyleConfig.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/core/src/main/proto/README.md:
--------------------------------------------------------------------------------
1 | ProtoBuf definitions are taken from Connect main
2 | repo https://github.com/minekube/connect/tree/main/api. We keep them in sync manually until we have
3 | a more clean way, though changes in our proto are rare.
--------------------------------------------------------------------------------
/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 |
--------------------------------------------------------------------------------
/spigot/src/main/resources/plugin.yml:
--------------------------------------------------------------------------------
1 | name: ${name}
2 | description: ${description}
3 | version: ${version}
4 | author: ${author}
5 | website: ${url}
6 | main: com.minekube.connect.SpigotPlugin
7 | api-version: 1.13
8 | folia-supported: false # TODO support folia
9 | softdepend: [ProtocolSupport]
--------------------------------------------------------------------------------
/velocity/src/main/resources/velocity-plugin.json:
--------------------------------------------------------------------------------
1 | {
2 | "id": "${id}",
3 | "name": "${name}",
4 | "version": "${version}",
5 | "description": "${description}",
6 | "url": "${url}",
7 | "authors": [
8 | "${author}"
9 | ],
10 | "main": "com.minekube.connect.VelocityPlugin"
11 | }
--------------------------------------------------------------------------------
/core/src/main/resources/languages/texts/en_US.properties:
--------------------------------------------------------------------------------
1 | connect.core.finish=Took {0}ms to boot Connect
2 |
3 | connect.ingame.disconnect_name=Connect tunneled player {0} disconnected
4 | connect.ingame.login_name=Connect tunneled player logged in as {0} (UUID: {1})
5 |
6 | connect.watch.started=Started watching for new player sessions
--------------------------------------------------------------------------------
/api/build.gradle.kts:
--------------------------------------------------------------------------------
1 | import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
2 |
3 | dependencies {
4 | api("com.google.code.gson", "gson", Versions.gsonVersion)
5 |
6 | compileOnly("io.netty", "netty-transport", Versions.nettyVersion)
7 | }
8 |
9 | tasks {
10 | named("jar") {
11 | archiveClassifier.set("")
12 | }
13 | named("shadowJar") {
14 | archiveClassifier.set("shaded")
15 | }
16 | }
--------------------------------------------------------------------------------
/bungee/build.gradle.kts:
--------------------------------------------------------------------------------
1 | var bungeeVersion = "1.21-R0.1-SNAPSHOT"
2 | var gsonVersion = "2.8.0"
3 | var guavaVersion = "21.0"
4 |
5 | dependencies {
6 | api(projects.core)
7 | implementation("cloud.commandframework", "cloud-bungee", Versions.cloudVersion)
8 | }
9 |
10 | relocate("com.google.inject")
11 | relocate("com.google.protobuf")
12 | relocate("net.kyori")
13 | relocate("cloud.commandframework")
14 | // used in cloud
15 | relocate("io.leangen.geantyref")
16 | // since 1.20
17 | relocate("org.yaml")
18 |
19 | // these dependencies are already present on the platform
20 | provided("net.md-5", "bungeecord-proxy", bungeeVersion)
21 | provided("com.google.code.gson", "gson", gsonVersion)
22 | provided("com.google.guava", "guava", guavaVersion)
23 |
--------------------------------------------------------------------------------
/core/src/main/proto/com/minekube/connect/v1alpha1/tunnel_service.proto:
--------------------------------------------------------------------------------
1 | syntax = "proto3";
2 |
3 | package minekube.connect.v1alpha1;
4 |
5 | service TunnelService {
6 | // Tunnel the connection of a session.
7 | rpc Tunnel(stream TunnelRequest) returns (stream TunnelResponse);
8 | }
9 |
10 | message TunnelRequest {
11 | // This is a raw client bound chunk of data.
12 | //
13 | // The data is just a chunk of the stream and it should
14 | // never be assumed it contains a complete single packet.
15 | bytes data = 1;
16 | }
17 |
18 | message TunnelResponse {
19 | // This is a raw server bound chunk of data.
20 | //
21 | // The data is just a chunk of the stream and it should
22 | // never be assumed it contains a complete single packet.
23 | bytes data = 1;
24 | }
25 |
--------------------------------------------------------------------------------
/spigot/src/main/java/com/minekube/connect/util/SpigotPlatformUtils.java:
--------------------------------------------------------------------------------
1 | package com.minekube.connect.util;
2 |
3 | import com.minekube.connect.platform.util.PlatformUtils;
4 | import org.bukkit.Bukkit;
5 |
6 | public class SpigotPlatformUtils extends PlatformUtils {
7 | @Override
8 | public AuthType authType() {
9 | if (Bukkit.getOnlineMode()) {
10 | return AuthType.ONLINE;
11 | }
12 | return ProxyUtils.isProxyData() ? AuthType.PROXIED : AuthType.OFFLINE;
13 | }
14 |
15 | @Override
16 | public String minecraftVersion() {
17 | return Bukkit.getServer().getVersion().split("\\(MC: ")[1].split("\\)")[0];
18 | }
19 |
20 | @Override
21 | public String serverImplementationName() {
22 | return Bukkit.getServer().getName();
23 | }
24 |
25 | @Override
26 | public int getPlayerCount() {
27 | return Bukkit.getServer().getOnlinePlayers().size();
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/velocity/src/main/java/com/minekube/connect/util/VelocityPlatformUtils.java:
--------------------------------------------------------------------------------
1 | package com.minekube.connect.util;
2 |
3 | import com.google.inject.Inject;
4 | import com.minekube.connect.platform.util.PlatformUtils;
5 | import com.velocitypowered.api.network.ProtocolVersion;
6 | import com.velocitypowered.api.proxy.ProxyServer;
7 |
8 | public final class VelocityPlatformUtils extends PlatformUtils {
9 | @Inject
10 | private ProxyServer server;
11 |
12 | @Override
13 | public AuthType authType() {
14 | return server.getConfiguration().isOnlineMode() ? AuthType.ONLINE : AuthType.OFFLINE;
15 | }
16 |
17 | @Override
18 | public String minecraftVersion() {
19 | return ProtocolVersion.MAXIMUM_VERSION.getMostRecentSupportedVersion();
20 | }
21 |
22 | @Override
23 | public String serverImplementationName() {
24 | return server.getVersion().getName();
25 | }
26 |
27 | @Override
28 | public int getPlayerCount() {
29 | return server.getPlayerCount();
30 | }
31 | }
--------------------------------------------------------------------------------
/velocity/build.gradle.kts:
--------------------------------------------------------------------------------
1 | var velocityVersion = "3.2.0-SNAPSHOT"
2 | var log4jVersion = "2.11.2"
3 | var gsonVersion = "2.8.8"
4 | var guavaVersion = "25.1-jre"
5 |
6 | java {
7 | // For Velocity API
8 | sourceCompatibility = JavaVersion.VERSION_11
9 | targetCompatibility = JavaVersion.VERSION_11
10 | }
11 |
12 | dependencies {
13 | api(projects.core)
14 | implementation("cloud.commandframework", "cloud-velocity", Versions.cloudVersion)
15 | }
16 |
17 | relocate("cloud.commandframework")
18 | // used in cloud
19 | relocate("io.leangen.geantyref")
20 |
21 |
22 | // these dependencies are already present on the platform
23 | provided("com.google.code.gson", "gson", gsonVersion)
24 | provided("com.google.guava", "guava", guavaVersion)
25 | provided("com.google.inject", "guice", Versions.guiceVersion)
26 | provided("org.yaml", "snakeyaml", Versions.snakeyamlVersion) // included in Configurate
27 | provided("com.velocitypowered", "velocity-api", velocityVersion)
28 | provided("org.apache.logging.log4j", "log4j-core", log4jVersion)
29 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021-2022 Minekube
4 | Copyright (c) 2019-2022 GeyserMC
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in all
14 | copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | SOFTWARE.
23 |
--------------------------------------------------------------------------------
/core/src/main/java/com/minekube/connect/platform/util/PlatformUtils.java:
--------------------------------------------------------------------------------
1 | package com.minekube.connect.platform.util;
2 |
3 | import lombok.RequiredArgsConstructor;
4 |
5 | @RequiredArgsConstructor
6 | public abstract class PlatformUtils {
7 | /**
8 | * Returns the authentication type used on the platform
9 | *
10 | * @return the authentication type
11 | */
12 | public abstract AuthType authType();
13 |
14 | /**
15 | * Returns the Minecraft version the server is based on (or the most recent supported version
16 | * for proxy platforms)
17 | *
18 | * @return the Minecraft version
19 | */
20 | public abstract String minecraftVersion();
21 |
22 |
23 | /**
24 | * Returns the platform name
25 | *
26 | * @return the platform name
27 | */
28 | public abstract String serverImplementationName();
29 |
30 | /**
31 | * Returns the amount of players currently online,
32 | * including Connect players.
33 | *
34 | * @return the amount of players online
35 | */
36 | public abstract int getPlayerCount();
37 |
38 | public enum AuthType {
39 | ONLINE,
40 | PROXIED,
41 | OFFLINE
42 | }
43 | }
--------------------------------------------------------------------------------
/.github/workflows/pullrequest.yml:
--------------------------------------------------------------------------------
1 | name: Build Pull Request
2 |
3 | on: [ pull_request ]
4 |
5 | jobs:
6 | build:
7 |
8 | runs-on: ubuntu-latest
9 |
10 | steps:
11 | - name: Checkout repository and submodules
12 | uses: actions/checkout@v4
13 | with:
14 | submodules: recursive
15 |
16 | - name: Set up JDK 17
17 | uses: actions/setup-java@v2
18 | with:
19 | distribution: 'temurin'
20 | java-version: '17'
21 | cache: 'gradle'
22 |
23 | - name: Build with Maven
24 | run: ./gradlew build
25 |
26 | - name: Archive artifacts (Floodgate Bungee)
27 | uses: actions/upload-artifact@v4
28 | if: success()
29 | with:
30 | name: Floodgate Bungee
31 | path: bungee/build/libs/connect-bungee.jar
32 |
33 | - name: Archive artifacts (Floodgate Spigot)
34 | uses: actions/upload-artifact@v4
35 | if: success()
36 | with:
37 | name: Floodgate Spigot
38 | path: spigot/build/libs/connect-spigot.jar
39 |
40 | - name: Archive artifacts (Floodgate Velocity)
41 | uses: actions/upload-artifact@v4
42 | if: success()
43 | with:
44 | name: Floodgate Velocity
45 | path: velocity/build/libs/connect-velocity.jar
46 |
--------------------------------------------------------------------------------
/core/src/main/resources/proxy-config.yml:
--------------------------------------------------------------------------------
1 | # The endpoint name of this server/proxy instance registered on startup with the Connect network.
2 | # Default is a random string. You can change it to a custom endpoint name.
3 | endpoint: ${endpoint}
4 |
5 | # This setting is only relevant if you want to allow cracked players to join.
6 | # If left blank, the correct mode will be securely detected automatically.
7 | allow-offline-mode-players: false
8 |
9 | # The default locale for Connect. By default, Connect uses the system locale
10 | #default-locale: en_US
11 |
12 | # Super endpoints are authorized to control this endpoint via Connect API.
13 | # e.g. disconnect players from this endpoint, send messages to players, etc.
14 | #
15 | # You can add as many super endpoint names as you want.
16 | #super-endpoints:
17 | # - pvp-endpoint
18 | # - someones-hub
19 |
20 | # bStats is a stat tracker that is entirely anonymous and tracks only basic information
21 | # about Connect, such as how many people are online, how many servers are using Connect,
22 | # what OS is being used, etc. You can learn more about bStats here: https://bstats.org/.
23 | metrics:
24 | # If metrics should be disabled.
25 | disabled: false
26 | # The unique id that should be consistent for a server/proxy.
27 | uuid: ${metrics.uuid}
28 |
29 | # Do not change this
30 | config-version: 1
31 |
--------------------------------------------------------------------------------
/.idea/copyright/GeyserMC.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/core/src/main/resources/config.yml:
--------------------------------------------------------------------------------
1 | # The endpoint name of this server/proxy instance registered on startup with the Connect network.
2 | # Default is a random string. You can change it to a custom endpoint name.
3 | endpoint: ${endpoint}
4 |
5 | # This setting is only relevant if you want to allow cracked players to join.
6 | # This should not be irritated by offline-mode servers behind an online-mode proxy, keep this setting disabled.
7 | # If left blank, the correct mode will be securely detected automatically.
8 | allow-offline-mode-players: false
9 |
10 | # Super endpoints are authorized to control this endpoint via Connect API.
11 | # e.g. disconnect players from this endpoint, send messages to players, etc.
12 | #
13 | # You can add as many super endpoint names as you want.
14 | #super-endpoints:
15 | # - pvp-endpoint
16 | # - someones-hub
17 |
18 | # The default locale for Connect. By default, Connect uses the system locale
19 | #default-locale: en_US
20 |
21 | # bStats is a stat tracker that is entirely anonymous and tracks only basic information
22 | # about Connect, such as how many people are online, how many servers are using Connect,
23 | # what OS is being used, etc. You can learn more about bStats here: https://bstats.org/.
24 | metrics:
25 | # If metrics should be disabled.
26 | disabled: false
27 | # The unique id that should be consistent for a server/proxy.
28 | uuid: ${metrics.uuid}
29 |
30 | # Do not change this
31 | config-version: 1
32 |
--------------------------------------------------------------------------------
/core/src/main/java/com/minekube/connect/command/util/PermissionDefault.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | * THE SOFTWARE.
21 | *
22 | * @author GeyserMC
23 | * @link https://github.com/GeyserMC/Floodgate
24 | */
25 |
26 | package com.minekube.connect.command.util;
27 |
28 | public enum PermissionDefault {
29 | TRUE, FALSE, OP, NOT_OP
30 | }
31 |
--------------------------------------------------------------------------------
/core/src/main/java/com/minekube/connect/skin/SkinApplier.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | * THE SOFTWARE.
21 | *
22 | * @author GeyserMC
23 | * @link https://github.com/GeyserMC/Floodgate
24 | */
25 |
26 | package com.minekube.connect.skin;
27 |
28 | import com.minekube.connect.api.player.ConnectPlayer;
29 |
30 | public interface SkinApplier {
31 | void applySkin(ConnectPlayer connectPlayer, SkinData skinData);
32 | }
33 |
--------------------------------------------------------------------------------
/spigot/build.gradle.kts:
--------------------------------------------------------------------------------
1 | var authlibVersion = "1.5.21"
2 | var guavaVersion = "31.1-jre"
3 | var gsonVersion = "2.8.5"
4 |
5 | //java {
6 | // For Folia
7 | // targetCompatibility = JavaVersion.VERSION_1_8
8 | // toolchain {
9 | // languageVersion.set(JavaLanguageVersion.of(17))
10 | // }
11 | //}
12 |
13 | dependencies {
14 | api(projects.core)
15 |
16 | implementation("cloud.commandframework", "cloud-bukkit", Versions.cloudVersion)
17 | // hack to make pre 1.12 work
18 | implementation("com.google.guava", "guava", guavaVersion)
19 |
20 | compileOnlyApi("dev.folia", "folia-api", Versions.spigotVersion) {
21 | attributes {
22 | attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, 17)
23 | }
24 | }
25 | }
26 |
27 | relocate("com.google.inject")
28 | relocate("com.google.protobuf")
29 | relocate("net.kyori")
30 | relocate("cloud.commandframework")
31 | relocate("io.leangen.geantyref") // used in cloud
32 | // hack to make pre 1.12 work
33 | relocate("com.google.common")
34 | relocate("com.google.guava")
35 | // hack to make (old versions? of) Paper work
36 | relocate("it.unimi")
37 | // since 1.20
38 | relocate("org.yaml")
39 |
40 | // these dependencies are already present on the platform
41 | provided("com.mojang", "authlib", authlibVersion)
42 | provided("io.netty", "netty-transport", Versions.nettyVersion)
43 | provided("io.netty", "netty-codec", Versions.nettyVersion)
44 | provided("com.google.code.gson", "gson", gsonVersion)
45 | provided("com.viaversion", "viaversion-bukkit", Versions.viaVersionVersion)
46 |
--------------------------------------------------------------------------------
/core/src/main/java/com/minekube/connect/config/ProxyConnectConfig.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | * THE SOFTWARE.
21 | *
22 | * @author GeyserMC
23 | * @link https://github.com/GeyserMC/Floodgate
24 | */
25 |
26 | package com.minekube.connect.config;
27 |
28 | import lombok.Getter;
29 |
30 | /**
31 | * The configuration used by proxy platforms, currently Velocity and BungeeCord.
32 | */
33 | @Getter
34 | public final class ProxyConnectConfig extends ConnectConfig {
35 | }
36 |
--------------------------------------------------------------------------------
/core/src/main/java/com/minekube/connect/api/ProxyConnectApi.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | * THE SOFTWARE.
21 | *
22 | * @author GeyserMC
23 | * @link https://github.com/GeyserMC/Floodgate
24 | */
25 |
26 | package com.minekube.connect.api;
27 |
28 | import com.minekube.connect.api.logger.ConnectLogger;
29 |
30 |
31 | public final class ProxyConnectApi extends SimpleConnectApi {
32 |
33 | public ProxyConnectApi(ConnectLogger logger) {
34 | super(logger);
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/core/src/main/java/com/minekube/connect/watch/Watcher.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021-2022 Minekube. https://minekube.com
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | * THE SOFTWARE.
21 | *
22 | * @author Minekube
23 | * @link https://github.com/minekube/connect-java
24 | */
25 |
26 | package com.minekube.connect.watch;
27 |
28 | public interface Watcher {
29 |
30 | void onProposal(SessionProposal proposal);
31 |
32 | void onError(final Throwable t);
33 |
34 | default void onCompleted() {
35 | }
36 |
37 | default void onOpen() {
38 | }
39 | }
40 |
41 |
--------------------------------------------------------------------------------
/core/src/main/java/com/minekube/connect/addon/debug/State.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | * THE SOFTWARE.
21 | *
22 | * @author GeyserMC
23 | * @link https://github.com/GeyserMC/Floodgate
24 | */
25 |
26 | package com.minekube.connect.addon.debug;
27 |
28 | public enum State {
29 | HANDSHAKE, STATUS, LOGIN, PLAY;
30 |
31 | private static final State[] VALUES = values();
32 |
33 | public static State getById(int id) {
34 | return id < VALUES.length ? VALUES[id] : null;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/core/src/main/java/com/minekube/connect/util/backoff/NanoClock.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2013 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5 | * in compliance with the License. You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License
10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11 | * or implied. See the License for the specific language governing permissions and limitations under
12 | * the License.
13 | */
14 |
15 | package com.minekube.connect.util.backoff;
16 |
17 | /**
18 | * Nano clock which can be used to measure elapsed time in nanoseconds.
19 | *
20 | *
The default system implementation can be accessed at {@link #SYSTEM}. Alternative
21 | * implementations may be used for testing.
22 | *
23 | * @author Yaniv Inbar
24 | * @since 1.14
25 | */
26 | public interface NanoClock {
27 |
28 | /**
29 | * Returns the current value of the most precise available system timer, in nanoseconds for use
30 | * to measure elapsed time, to match the behavior of {@link System#nanoTime()}.
31 | */
32 | long nanoTime();
33 |
34 | /**
35 | * Provides the default System implementation of a nano clock by using {@link
36 | * System#nanoTime()}.
37 | */
38 | NanoClock SYSTEM =
39 | new NanoClock() {
40 | public long nanoTime() {
41 | return System.nanoTime();
42 | }
43 | };
44 | }
--------------------------------------------------------------------------------
/core/src/main/java/com/minekube/connect/util/InjectorHolder.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | * THE SOFTWARE.
21 | *
22 | * @author GeyserMC
23 | * @link https://github.com/GeyserMC/Floodgate
24 | */
25 |
26 | package com.minekube.connect.util;
27 |
28 | import com.google.inject.Injector;
29 |
30 | public class InjectorHolder {
31 | private Injector injector;
32 |
33 | public Injector get() {
34 | return injector;
35 | }
36 |
37 | public void set(Injector injector) {
38 | this.injector = injector;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/api/src/main/java/com/minekube/connect/api/player/Auth.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021-2022 Minekube. https://minekube.com
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | * THE SOFTWARE.
21 | *
22 | * @author Minekube
23 | * @link https://github.com/minekube/connect-java
24 | */
25 |
26 | package com.minekube.connect.api.player;
27 |
28 |
29 | import lombok.Data;
30 |
31 | /**
32 | * @see Proto
33 | */
34 | @Data
35 | public class Auth {
36 | private final boolean passthrough;
37 | }
38 |
--------------------------------------------------------------------------------
/core/src/main/java/com/minekube/connect/module/WatcherModule.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | * THE SOFTWARE.
21 | *
22 | * @author GeyserMC
23 | * @link https://github.com/GeyserMC/Floodgate
24 | */
25 |
26 | package com.minekube.connect.module;
27 |
28 | import com.google.inject.AbstractModule;
29 | import com.minekube.connect.register.WatcherRegister;
30 |
31 | public class WatcherModule extends AbstractModule {
32 |
33 | @Override
34 | protected void configure() {
35 | bind(WatcherRegister.class).asEagerSingleton();
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/core/src/main/java/com/minekube/connect/network/netty/DefaultChannelPipelinePublic.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | * THE SOFTWARE.
21 | *
22 | * @author GeyserMC
23 | * @link https://github.com/GeyserMC/Floodgate
24 | */
25 |
26 | package com.minekube.connect.network.netty;
27 |
28 | import io.netty.channel.Channel;
29 | import io.netty.channel.DefaultChannelPipeline;
30 |
31 | /**
32 | * Exists solely to make DefaultChannelPipeline's protected constructor public
33 | */
34 | public class DefaultChannelPipelinePublic extends DefaultChannelPipeline {
35 | public DefaultChannelPipelinePublic(Channel channel) {
36 | super(channel);
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/api/src/main/java/com/minekube/connect/api/player/GameProfile.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021-2022 Minekube. https://minekube.com
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | * THE SOFTWARE.
21 | *
22 | * @author Minekube
23 | * @link https://github.com/minekube/connect-java
24 | */
25 |
26 | package com.minekube.connect.api.player;
27 |
28 | import java.util.List;
29 | import java.util.UUID;
30 | import lombok.Data;
31 |
32 | @Data
33 | public class GameProfile {
34 | private final String username;
35 | private final UUID uniqueId;
36 | private final List properties;
37 |
38 | @Data
39 | public static class Property {
40 | private final String name;
41 | private final String value;
42 | private final String signature;
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/core/src/main/java/com/minekube/connect/module/PostInitializeModule.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | * THE SOFTWARE.
21 | *
22 | * @author GeyserMC
23 | * @link https://github.com/GeyserMC/Floodgate
24 | */
25 |
26 | package com.minekube.connect.module;
27 |
28 | import com.google.inject.AbstractModule;
29 | import com.google.inject.Module;
30 | import lombok.RequiredArgsConstructor;
31 |
32 | @RequiredArgsConstructor
33 | public final class PostInitializeModule extends AbstractModule {
34 | private final Module[] postInitializeModules;
35 |
36 | @Override
37 | protected void configure() {
38 | for (Module module : postInitializeModules) {
39 | install(module);
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/core/src/main/java/com/minekube/connect/network/netty/LocalChannelWithSessionContext.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | * THE SOFTWARE.
21 | *
22 | * @author GeyserMC
23 | * @link https://github.com/GeyserMC/Floodgate
24 | */
25 |
26 | package com.minekube.connect.network.netty;
27 |
28 | import com.minekube.connect.network.netty.LocalSession.Context;
29 | import io.netty.channel.local.LocalChannel;
30 | import lombok.AccessLevel;
31 | import lombok.Getter;
32 | import lombok.Setter;
33 |
34 | /**
35 | * Client -> server storing session context on a channel.
36 | */
37 | public class LocalChannelWithSessionContext extends LocalChannel {
38 | @Getter
39 | @Setter(AccessLevel.PACKAGE)
40 | private Context context;
41 | }
42 |
--------------------------------------------------------------------------------
/core/src/main/java/com/minekube/connect/player/audience/ProfileAudience.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | * THE SOFTWARE.
21 | *
22 | * @author GeyserMC
23 | * @link https://github.com/GeyserMC/Floodgate
24 | */
25 |
26 | package com.minekube.connect.player.audience;
27 |
28 | import java.util.UUID;
29 | import lombok.Getter;
30 | import lombok.experimental.Accessors;
31 | import org.checkerframework.checker.nullness.qual.Nullable;
32 |
33 | @Getter
34 | @Accessors(fluent = true)
35 | public final class ProfileAudience {
36 | private final @Nullable UUID uuid;
37 | private final @Nullable String username;
38 |
39 | public ProfileAudience(@Nullable UUID uuid, @Nullable String username) {
40 | this.uuid = uuid;
41 | this.username = username;
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/spigot/src/main/java/com/minekube/connect/util/ProxyUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | * THE SOFTWARE.
21 | *
22 | * @author GeyserMC
23 | * @link https://github.com/GeyserMC/Floodgate
24 | */
25 |
26 | package com.minekube.connect.util;
27 |
28 | public final class ProxyUtils {
29 |
30 | public static boolean isProxyData() {
31 | return isBungeeData() || isVelocitySupport();
32 | }
33 |
34 | public static boolean isBungeeData() {
35 | return ReflectionUtils.castedStaticBooleanValue(ClassNames.BUNGEE);
36 | }
37 |
38 | public static boolean isVelocitySupport() {
39 | if (ClassNames.PAPER_VELOCITY_SUPPORT == null) {
40 | return false;
41 | }
42 |
43 | return ClassNames.PAPER_VELOCITY_SUPPORT.getAsBoolean();
44 | }
45 | }
--------------------------------------------------------------------------------
/bungee/src/main/java/com/minekube/connect/util/BungeePlatformUtils.java:
--------------------------------------------------------------------------------
1 | package com.minekube.connect.util;
2 |
3 | import com.minekube.connect.platform.util.PlatformUtils;
4 | import java.lang.reflect.Field;
5 | import java.util.List;
6 | import net.md_5.bungee.api.ProxyServer;
7 | import net.md_5.bungee.protocol.ProtocolConstants;
8 |
9 | @SuppressWarnings("ConstantConditions")
10 | public final class BungeePlatformUtils extends PlatformUtils {
11 | private static final String LATEST_SUPPORTED_VERSION;
12 | private final ProxyServer proxyServer = ProxyServer.getInstance();
13 |
14 | static {
15 | int protocolNumber = -1;
16 | String versionName = "";
17 |
18 | for (Field field : ProtocolConstants.class.getFields()) {
19 | if (!field.getName().startsWith("MINECRAFT_")) {
20 | continue;
21 | }
22 |
23 | int fieldValue = ReflectionUtils.castedStaticValue(field);
24 | if (fieldValue > protocolNumber) {
25 | protocolNumber = fieldValue;
26 | versionName = field.getName().substring(10).replace('_', '.');
27 | }
28 | }
29 |
30 | if (protocolNumber == -1) {
31 | List versions = ProtocolConstants.SUPPORTED_VERSIONS;
32 | versionName = versions.get(versions.size() - 1);
33 | }
34 | LATEST_SUPPORTED_VERSION = versionName;
35 | }
36 |
37 | @Override
38 | public AuthType authType() {
39 | return proxyServer.getConfig().isOnlineMode() ? AuthType.ONLINE : AuthType.OFFLINE;
40 | }
41 |
42 | @Override
43 | public String minecraftVersion() {
44 | return LATEST_SUPPORTED_VERSION;
45 | }
46 |
47 | @Override
48 | public String serverImplementationName() {
49 | return proxyServer.getName();
50 | }
51 |
52 | @Override
53 | public int getPlayerCount() {
54 | return proxyServer.getOnlineCount();
55 | }
56 | }
--------------------------------------------------------------------------------
/ruleset.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 | Connect Code ruleset
9 |
10 |
11 |
12 | .*/ConnectConfig.*
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/velocity/src/main/java/com/minekube/connect/listener/VelocityListenerRegistration.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2022 GeyserMC. http://geysermc.org
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 | * THE SOFTWARE.
21 | *
22 | * @author GeyserMC
23 | * @link https://github.com/GeyserMC/Floodgate
24 | */
25 |
26 | package com.minekube.connect.listener;
27 |
28 | import com.minekube.connect.VelocityPlugin;
29 | import com.minekube.connect.platform.listener.ListenerRegistration;
30 | import com.velocitypowered.api.event.EventManager;
31 | import lombok.RequiredArgsConstructor;
32 |
33 | @RequiredArgsConstructor
34 | public final class VelocityListenerRegistration implements ListenerRegistration