From 56455e6ca99d355c1d60b3dec7e39ae739b4a5b3 Mon Sep 17 00:00:00 2001 From: mohammed jasem alaajel Date: Mon, 26 Jul 2021 21:35:18 +0400 Subject: [PATCH] fix patches --- .../0001-preparing-for-first-patch.patch | 2487 +++-------------- ...d-commits-from-forked-repo-Fastlogin.patch | 28 +- 2 files changed, 436 insertions(+), 2079 deletions(-) diff --git a/FastLogin-Patches/0001-preparing-for-first-patch.patch b/FastLogin-Patches/0001-preparing-for-first-patch.patch index 3dc87b2..0e4a03a 100644 --- a/FastLogin-Patches/0001-preparing-for-first-patch.patch +++ b/FastLogin-Patches/0001-preparing-for-first-patch.patch @@ -1,64 +1,107 @@ -From d545aec339fe904999ead07c9222f0310f4c5812 Mon Sep 17 00:00:00 2001 +From 24f4a5c65808664fb3d33898f3f1c73dc538a357 Mon Sep 17 00:00:00 2001 From: mohammed jasem alaajel <34905970+ham1255@users.noreply.github.com> Date: Wed, 16 Jun 2021 20:58:08 +0400 Subject: [PATCH] preparing for first patch -diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md +diff --git a/.github/ISSUE_TEMPLATE/bug_report.yaml b/.github/ISSUE_TEMPLATE/bug_report.yaml deleted file mode 100644 -index 4b7b130..0000000 ---- a/.github/ISSUE_TEMPLATE/bug_report.md +index 102930b..0000000 +--- a/.github/ISSUE_TEMPLATE/bug_report.yaml +++ /dev/null -@@ -1,41 +0,0 @@ ----- --name: Bug report --about: Something isn't working --title: '' --labels: 'bug' --assignees: '' +@@ -1,67 +0,0 @@ +-name: 🐞 Bug Report +-description: Something isn't working, broken, not expected behavior +-labels: [bug] +-body: +- - type: markdown +- attributes: +- value: | +- This ticket is about bugs, so broken, not expected behavior. Feedback about this form is appreciated. +- - type: textarea +- attributes: +- label: What happened? +- description: What behavior is observed? +- validations: +- required: true +- - type: textarea +- attributes: +- label: What did you expect? +- description: What behavior is expected? +- - type: textarea +- attributes: +- label: Steps to reproduce +- description: The actions that cause the issues. Please explain it in detail. +- - type: input +- attributes: +- label: Plugin list +- description: This can be found by running `/pl` +- placeholder: AuthMe, ProtocolLib, ... +- - type: input +- attributes: +- label: Configuration file +- description: | +- Link to the contents of your config.yml file. +- You can use [GitHub](https://gist.github.com/), [Hastebin](https://hastebin.com) or similar for that. +- placeholder: https://gist.github.com/games647/88c4439e1cd7810f21318b1b24a04ee0 +- - type: textarea +- attributes: +- label: Server log +- description: The error, stacktrace or link the complete log. You can use the links above for long versions. +- render: shell +- placeholder: https://hastebin.com/ / https://gist.github.com/ +- - type: input +- attributes: +- label: Plugin version +- description: Plugin version or build number. This can be found by running `/version plugin-name` +- placeholder: v3.1-SNAPSHOT-570b321 +- validations: +- required: true +- - type: dropdown +- attributes: +- label: Platform +- description: +- options: +- - Spigot +- - BungeeCord +- validations: +- required: true +- - type: checkboxes +- attributes: +- label: Relevance +- description: +- options: +- - label: I tried the latest build +- required: true +- - label: | +- I checked for existing tickets - +- If there are, please vote them with a thumps reaction and not create new ones +- required: true +diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml +deleted file mode 100644 +index 9287ef8..0000000 +--- a/.github/ISSUE_TEMPLATE/config.yml ++++ /dev/null +@@ -1,11 +0,0 @@ +-# General configuration for issue templates - ----- +-# Allow issues without a template +-#blank_issues_enabled: false - --[//]: # (Lines in this format are considered as comments and will not be displayed.) --[//]: # (Before reporting make sure you're running the **latest build** of the plugin and checked for existing issues!) +-# Extra section on creating issues to redirect to another site +-contact_links: +- - name: 📌 Questions +- url: https://github.com/games647/FastLogin/discussions +- about: You want to ask something - --### What behaviour is observed: --[//]: # (What happened?) -- --### What behaviour is expected: --[//]: # (What did you expect?) -- --### Steps/models to reproduce: --[//]: # (The actions that cause the issue. Please explain it in detail) -- --### Screenshots (if applicable) --[//]: # (You can drop the files here directly) -- --### Plugin list: --[//]: # (This can be found by running `/pl`) -- --### Environment description --[//]: # (Server software with exact version number, Minecraft version, SQLite/MySQL/MariaDB, ...) -- --### Plugin version or build number (don't write latest): --[//]: # (This can be found by running `/version plugin-name`.) -- --### Server Log: --[//]: # (No images please - only the textual representation) --[Hastebin](https://hastebin.com/) / [Gist](https://gist.github.com/) link of the error, stacktrace or the complete log (if any) -- --### Configuration: --[//]: # (No images please - only the textual representation) --[//]: # (remember to delete any sensitive data) --[Hastebin](https://hastebin.com/) / [Gist](https://gist.github.com/) link of your config.yml file diff --git a/.github/ISSUE_TEMPLATE/enhancement_request.md b/.github/ISSUE_TEMPLATE/enhancement_request.md deleted file mode 100644 -index 6814d40..0000000 +index ba426d6..0000000 --- a/.github/ISSUE_TEMPLATE/enhancement_request.md +++ /dev/null -@@ -1,22 +0,0 @@ +@@ -1,25 +0,0 @@ ---- --name: Enhancement request +-name: 💡 Enhancement request -about: New feature or change request -title: '' -labels: 'enhancement' @@ -67,6 +110,9 @@ index 6814d40..0000000 ---- - -[//]: # (Lines in this format are considered as comments and will not be displayed.) +-[//]: # (Before reporting make sure you're running the **latest build** of the plugin and checked for existing issues!) +- +-[//]: # (This ticket is about suggestions for a feature or particular enhancement) - -### Is your feature request related to a problem? Please describe. -[//]: # (A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]) @@ -79,22 +125,6 @@ index 6814d40..0000000 - -### Additional context -[//]: # (Add any other context or screenshots about the feature request here.) -diff --git a/.github/ISSUE_TEMPLATE/question.md b/.github/ISSUE_TEMPLATE/question.md -deleted file mode 100644 -index a008222..0000000 ---- a/.github/ISSUE_TEMPLATE/question.md -+++ /dev/null -@@ -1,10 +0,0 @@ ----- --name: Question --about: You want to ask something --title: '' --labels: 'question' --assignees: '' -- ----- -- -- diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index acb6458..0000000 @@ -150,23 +180,91 @@ index 134f2c6..0000000 - -### Related issue -[//]: # (Reference it using '#NUMBER'. Ex: Fixes/Related #...) +diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml +deleted file mode 100644 +index 63a7765..0000000 +--- a/.github/workflows/codeql-analysis.yml ++++ /dev/null +@@ -1,58 +0,0 @@ +-# GitHub automatic code security scanning using CodeQL +- +-# Human readable name in the actions tab +-name: "CodeQL" +- +-on: +- # Scan only for push on the primary branch for now +- push: +- branches: [ main ] +- pull_request: +- branches: [ main ] +- +-jobs: +- # job i +- analyze: +- +- # Display name +- name: Analyze +- +- # Environment +- runs-on: ubuntu-latest +- +- permissions: +- actions: read +- contents: read +- security-events: write +- +- strategy: +- fail-fast: false +- matrix: +- # Languages to scan +- language: [ 'java' ] +- +- steps: +- - name: Checkout repository +- uses: actions/checkout@v2 +- +- # Initializes the CodeQL tools for scanning. +- - name: Initialize CodeQL +- uses: github/codeql-action/init@v1 +- with: +- languages: ${{ matrix.language }} +- +- # Cache build process too like in the maven config +- - uses: actions/cache@v2.1.4 +- with: +- path: ~/.m2/repository +- key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} +- restore-keys: | +- ${{ runner.os }}-maven- +- +- # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). +- # If this step fails, then you should remove it and run the build manually (see below) +- - name: Autobuild +- uses: github/codeql-action/autobuild@v1 +- +- - name: Perform CodeQL Analysis +- uses: github/codeql-action/analyze@v1 diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml deleted file mode 100644 -index 4c8cfb3..0000000 +index 7ae5ed1..0000000 --- a/.github/workflows/maven.yml +++ /dev/null -@@ -1,50 +0,0 @@ +@@ -1,54 +0,0 @@ -# Automatically build, run unit and integration tests to detect errors early (CI provided by GitHub) -# including making pull requests review easier - -# Human readable name in the actions tab -name: Java CI - --# Build on every push and pull request regardless of the branch +-# Build on every pull request regardless of the branch -# Wiki: https://help.github.com/en/actions/reference/events-that-trigger-workflows -on: -- - push -- - pull_request +- push: +- branches: +- - main +- pull_request: +- branches: +- - main - -jobs: - # job id @@ -177,35 +275,91 @@ index 4c8cfb3..0000000 - - # Run steps - steps: -- # Pull changes -- - uses: actions/checkout@v2.3.4 +- # Pull changes +- - uses: actions/checkout@v2.3.4 - -- # Cache artifacts - however this has the downside that we don't get notified of -- # artifact resolution failures like invalid repository -- # Nevertheless the repositories should be more stable and it makes no sense to pull -- # a same version every time -- # A dry run would make more sense -- - uses: actions/cache@v2.1.4 -- with: -- path: ~/.m2/repository -- key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} -- restore-keys: | -- ${{ runner.os }}-maven- +- # Cache artifacts - however this has the downside that we don't get notified of +- # artifact resolution failures like invalid repository +- # Nevertheless the repositories should be more stable and it makes no sense to pull +- # a same version every time +- # A dry run would make more sense +- - uses: actions/cache@v2.1.4 +- with: +- path: ~/.m2/repository +- key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} +- restore-keys: | +- ${{ runner.os }}-maven- - -- # Setup Java -- - name: Set up JDK -- uses: actions/setup-java@v2.1.0 -- with: -- distribution: 'adopt' -- # Use Java 11, because it's minimum required version -- java-version: 11 +- # Setup Java +- - name: Set up JDK +- uses: actions/setup-java@v2.1.0 +- with: +- distribution: 'adopt' +- # Use Java 11, because it's minimum required version +- java-version: 11 - -- # Build and test (included in package) -- - name: Build with Maven and test -- # Run non-interactive, package (with compile+test), -- # ignore snapshot updates, because they are likely to have breaking changes, enforce checksums to validate -- # possible errors in dependencies -- run: mvn test --batch-mode --no-snapshot-updates --strict-checksums --file pom.xml +- # Build and test (included in package) +- - name: Build with Maven and test +- # Run non-interactive, package (with compile+test), +- # ignore snapshot updates, because they are likely to have breaking changes, enforce checksums to validate +- # possible errors in dependencies +- run: mvn test --batch-mode --no-snapshot-updates --strict-checksums --file pom.xml +diff --git a/.gitignore b/.gitignore +deleted file mode 100644 +index 2936551..0000000 +--- a/.gitignore ++++ /dev/null +@@ -1,49 +0,0 @@ +-# Eclipse +-.classpath +-.project +-.settings/ +- +-# NetBeans +-nbproject/ +-nb-configuration.xml +- +-# IntelliJ +-*.iml +-*.ipr +-*.iws +-.idea/ +- +-# VSCode +-.vscode/ +- +-# Maven +-target/ +-pom.xml.versionsBackup +- +-# Gradle +-.gradle +- +-# Ignore Gradle GUI config +-gradle-app.setting +- +-# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) +-!gradle-wrapper.jar +- +-# various other potential build files +-build/ +-bin/ +-dist/ +-manifest.mf +-*.log +- +-# Vim +-.*.sw[a-p] +- +-# virtual machine crash logs, see https://www.java.com/en/download/help/error_hotspot.xml +-hs_err_pid* +- +-# Mac filesystem dust +-.DS_Store +- +-# Factorypath from Visual Studio Code +-.factorypath +\ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index d1ac62c..0000000 @@ -500,137 +654,6 @@ index 87bd21d..0000000 -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - -diff --git a/README.md b/README.md -deleted file mode 100644 -index 683822d..0000000 ---- a/README.md -+++ /dev/null -@@ -1,125 +0,0 @@ --# FastLogin -- --Checks if a Minecraft player has a paid account (premium). If so, they can skip offline authentication (auth plugins). --So they don't need to enter passwords. This is also called auto login (auto-login). -- --## Features -- --* Detect paid accounts from others --* Automatically login paid accounts (premium) --* Support various of auth plugins --* Cauldron support --* Forge/Sponge message support --* Premium UUID support --* Forward skins --* Detect user name changed and will update the existing database record --* BungeeCord support --* Auto register new premium players --* Plugin: ProtocolSupport is supported and can be used as an alternative to ProtocolLib --* No client modifications needed --* Good performance by using async operations --* Locale messages --* Support for Bedrock players proxied through FloodGate -- --## Issues -- --Please use issues for bug reports, suggestions, questions and more. Please check for existing issues. Existing issues --can be voted up by adding up vote to the original post. Closing issues means that they are marked as resolved. Comments --are still allowed and it could be re-opened. -- --## Development builds -- --Development builds of this project can be acquired at the provided CI (continuous integration) server. It contains the --latest changes from the Source-Code in preparation for the following release. This means they could contain new --features, bug fixes and other changes since the last release. -- --They **could** contain new bugs and are likely to be less stable than released versions. -- --Specific builds can be grabbed by clicking on the build number on the left side or by clicking on status to retrieve the --latest build. --https://ci.codemc.org/job/Games647/job/FastLogin/changes -- --*** -- --## Commands -- -- /premium [player] Label the invoker or the argument as paid account -- /cracked [player] Label the invoker or the argument as cracked account -- --## Permissions -- -- fastlogin.bukkit.command.premium -- fastlogin.bukkit.command.cracked -- fastlogin.command.premium.other -- fastlogin.command.cracked.other -- --## Placeholder -- --This plugin supports `PlaceholderAPI` on `Spigot`. It exports the following variable --`%fastlogin_status%`. In BungeeCord environments, the status of a player will be delivered with a delay after the player --already successful joined the server. This takes about a couple of milliseconds. In this case the value --will be `Unknown`. -- --Possible values: `Premium`, `Cracked`, `Unknown` -- --## Requirements -- --* Plugin: -- * [ProtocolLib](https://www.spigotmc.org/resources/protocollib.1997/) or -- * [ProtocolSupport](https://www.spigotmc.org/resources/protocolsupport.7201/) --* [Spigot](https://www.spigotmc.org) 1.8.8+ --* Java 8+ --* Run Spigot (or a fork e.g. Paper) and/or BungeeCord (or a fork e.g. Waterfall) in offline mode --* An auth plugin. -- --### Supported auth plugins -- --#### Spigot/Paper -- --* [AdvancedLogin (Paid)](https://www.spigotmc.org/resources/advancedlogin.10510/) --* [AuthMe (5.X)](https://dev.bukkit.org/bukkit-plugins/authme-reloaded/) --* [CrazyLogin](https://dev.bukkit.org/bukkit-plugins/crazylogin/) --* [LoginSecurity](https://dev.bukkit.org/bukkit-plugins/loginsecurity/) --* [LogIt](https://github.com/games647/LogIt) --* [SodionAuth (2.0+)](https://github.com/Mohist-Community/SodionAuth) --* [UltraAuth](https://dev.bukkit.org/bukkit-plugins/ultraauth-aa/) --* [UserLogin](https://www.spigotmc.org/resources/userlogin.80669/) --* [xAuth](https://dev.bukkit.org/bukkit-plugins/xauth/) -- --#### BungeeCord/Waterfall -- --* [BungeeAuth](https://www.spigotmc.org/resources/bungeeauth.493/) --* [BungeeAuthenticator](https://www.spigotmc.org/resources/bungeecordauthenticator.87669/) --* [SodionAuth (2.0+)](https://github.com/Mohist-Community/SodionAuth) -- --## Network requests -- --This plugin performs network requests to: -- --* https://api.mojang.com - retrieving uuid data to decide if we should activate premium login --* https://sessionserver.mojang.com - verify if the player is the owner of that account -- --*** -- --## How to install -- --### Spigot/Paper -- --1. Download and install ProtocolLib/ProtocolSupport --2. Download and install FastLogin (or FastLoginBukkit for newer versions) --3. Set your server in offline mode by setting the value onlinemode in your server.properties to false -- --### BungeeCord/Waterfall -- --1. Activate BungeeCord in the Spigot configuration --2. Restart your server --3. Now there is `allowed-proxies.txt` file in the FastLogin folder --Put your stats id from the BungeeCord config into this file --4. Activate ipForward in your BungeeCord config --5. Download and Install FastLogin (or FastLoginBungee in newer versions) on BungeeCord AND Spigot --(on the servers where your login plugin is or where player should be able to execute the commands of FastLogin) --6. Check your database settings in the config of FastLogin on BungeeCord --7. Set proxy and Spigot in offline mode by setting the value onlinemode in your config.yml to false --8. You should *always* firewall your Spigot server that it's only accessible through BungeeCord -- * https://www.spigotmc.org/wiki/bungeecord-installation/#post-installation -- * BungeeCord doesn't support SQLite per default, so you should change the configuration to MySQL or MariaDB diff --git a/bukkit/lib/CrazyCore v10.7.7.jar b/bukkit/lib/CrazyCore v10.7.7.jar deleted file mode 100644 index 3330015c0d48e977597903b8bad06f285967bb81..0000000000000000000000000000000000000000 @@ -13903,312 +13926,6 @@ zw-7*h5vs9xHglmHio9$av_}U4nwMZT6l2E@x{1gu8$rvx5uj@oRueH7f1?|TJbSE$ zFb~MuxgM*LSQbbkn+ckCMjqBeHFL!-tY%`Fg+?|L)G$JBZh{8H5Fq&&vY9xC#{#@r S*+7~Ufp7`1IVpc0!~+01BosCP -diff --git a/bukkit/pom.xml b/bukkit/pom.xml -deleted file mode 100644 -index 81a0351..0000000 ---- a/bukkit/pom.xml -+++ /dev/null -@@ -1,300 +0,0 @@ -- -- -- 4.0.0 -- -- -- com.github.games647 -- fastlogin -- 1.11-SNAPSHOT -- ../pom.xml -- -- -- -- fastlogin.bukkit -- jar -- -- FastLoginBukkit -- -- -- -- -- org.apache.maven.plugins -- maven-shade-plugin -- 3.2.4 -- -- false -- false -- -- -- com.zaxxer.hikari -- fastlogin.hikari -- -- -- org.slf4j -- fastlogin.slf4j -- -- -- net.md_5.bungee.config -- fastlogin.config -- -- -- com.google.gson -- fastlogin.gson -- -- -- io.papermc.lib -- fastlogin.paperlib -- -- -- -- -- -- package -- -- shade -- -- -- -- -- -- -- -- -- -- -- papermc -- https://papermc.io/repo/repository/maven-public/ -- -- -- -- -- dmulloy2-repo -- https://repo.dmulloy2.net/nexus/repository/public/ -- -- false -- -- -- -- -- -- codemc-releases -- https://repo.codemc.io/repository/maven-public/ -- -- -- -- -- jitpack.io -- https://jitpack.io -- -- false -- -- -- -- -- -- placeholderapi -- https://repo.extendedclip.com/content/repositories/placeholderapi -- -- false -- -- -- -- -- -- nukkitx-snapshot -- https://repo.nukkitx.com/maven-snapshots/ -- -- -- -- -- -- -- com.github.games647 -- fastlogin.core -- ${project.version} -- -- -- -- -- com.destroystokyo.paper -- paper-api -- 1.15.2-R0.1-SNAPSHOT -- provided -- -- -- -- -- io.papermc -- paperlib -- 1.0.6 -- compile -- -- -- -- -- com.comphenix.protocol -- ProtocolLib -- 4.6.0 -- provided -- -- -- -- -- com.github.ProtocolSupport -- ProtocolSupport -- -- 3a80c661fe -- provided -- -- -- -- -- me.clip -- placeholderapi -- 2.10.8 -- provided -- true -- -- -- * -- * -- -- -- -- -- -- -- org.geysermc.floodgate -- api -- 2.0-SNAPSHOT -- provided -- -- -- -- -- fr.xephi -- authme -- 5.4.0 -- provided -- true -- -- -- * -- * -- -- -- -- -- -- com.lenis0012.bukkit -- loginsecurity -- 3.0.2 -- provided -- true -- -- -- * -- * -- -- -- -- -- -- com.github.games647 -- LogIt -- 9e3581db27 -- provided -- true -- -- -- * -- * -- -- -- -- -- -- de.luricos.bukkit -- xAuth -- 2.6 -- provided -- true -- -- -- -- * -- * -- -- -- -- -- -- -- de.st_ddt.crazy -- CrazyCore -- 10.7.7 -- true -- system -- ${project.basedir}/lib/CrazyCore v10.7.7.jar -- -- -- -- de.st_ddt.crazy -- CrazyLogin -- 7.23 -- true -- system -- ${project.basedir}/lib/CrazyLogin v7.23.2.jar -- -- -- -- ultraauth -- ultraauth -- 2.0.2 -- true -- system -- ${project.basedir}/lib/UltraAuth v2.1.2.jar -- -- -- -- com.github.Mohist-Community.SodionAuth -- SodionAuth-Bukkit -- 2bdfdc854b -- -- -- com.github.Mohist-Community.SodionAuth -- SodionAuth-Libs -- -- -- true -- provided -- -- -- diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/BukkitLoginSession.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/BukkitLoginSession.java deleted file mode 100644 index 6800824..0000000 @@ -14585,318 +14302,6 @@ index 46321d3..0000000 - firedJoinEvents.remove(player.getUniqueId()); - } -} -diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/FastLoginBukkit.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/FastLoginBukkit.java -deleted file mode 100644 -index 74d4220..0000000 ---- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/FastLoginBukkit.java -+++ /dev/null -@@ -1,306 +0,0 @@ --/* -- * SPDX-License-Identifier: MIT -- * -- * The MIT License (MIT) -- * -- * Copyright (c) 2015-2021 -- * -- * 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. -- */ --package com.github.games647.fastlogin.bukkit; -- --import com.github.games647.fastlogin.bukkit.command.CrackedCommand; --import com.github.games647.fastlogin.bukkit.command.PremiumCommand; --import com.github.games647.fastlogin.bukkit.listener.ConnectionListener; --import com.github.games647.fastlogin.bukkit.listener.PaperPreLoginListener; --import com.github.games647.fastlogin.bukkit.listener.protocollib.ProtocolLibListener; --import com.github.games647.fastlogin.bukkit.listener.protocollib.SkinApplyListener; --import com.github.games647.fastlogin.bukkit.listener.protocolsupport.ProtocolSupportListener; --import com.github.games647.fastlogin.bukkit.task.DelayedAuthHook; --import com.github.games647.fastlogin.core.CommonUtil; --import com.github.games647.fastlogin.core.PremiumStatus; --import com.github.games647.fastlogin.core.shared.FastLoginCore; --import com.github.games647.fastlogin.core.shared.PlatformPlugin; -- --import io.papermc.lib.PaperLib; -- --import java.net.InetSocketAddress; --import java.nio.file.Path; --import java.util.Map; --import java.util.UUID; --import java.util.concurrent.ConcurrentHashMap; --import java.util.concurrent.ConcurrentMap; -- --import org.bukkit.Bukkit; --import org.bukkit.command.CommandSender; --import org.bukkit.entity.Player; --import org.bukkit.plugin.PluginManager; --import org.bukkit.plugin.java.JavaPlugin; --import org.slf4j.Logger; -- --/** -- * This plugin checks if a player has a paid account and if so tries to skip offline mode authentication. -- */ --public class FastLoginBukkit extends JavaPlugin implements PlatformPlugin { -- -- //1 minutes should be enough as a timeout for bad internet connection (Server, Client and Mojang) -- private final ConcurrentMap loginSession = CommonUtil.buildCache(1, -1); -- private final Map premiumPlayers = new ConcurrentHashMap<>(); -- private final Logger logger; -- -- private boolean serverStarted; -- private BungeeManager bungeeManager; -- private final BukkitScheduler scheduler; -- private FastLoginCore core; -- -- private PremiumPlaceholder premiumPlaceholder; -- -- public FastLoginBukkit() { -- this.logger = CommonUtil.createLoggerFromJDK(getLogger()); -- this.scheduler = new BukkitScheduler(this, logger, getThreadFactory()); -- } -- -- @Override -- public void onEnable() { -- core = new FastLoginCore<>(this); -- core.load(); -- -- if (getServer().getOnlineMode()) { -- //we need to require offline to prevent a loginSession request for a offline player -- logger.error("Server has to be in offline mode"); -- setEnabled(false); -- return; -- } -- -- // Check Floodgate config values -- if (!isValidFloodgateConfigString("autoLoginFloodgate") -- || !isValidFloodgateConfigString("allowFloodgateNameConflict")) { -- setEnabled(false); -- return; -- } -- -- bungeeManager = new BungeeManager(this); -- bungeeManager.initialize(); -- -- PluginManager pluginManager = getServer().getPluginManager(); -- if (bungeeManager.isEnabled()) { -- markInitialized(); -- } else { -- if (!core.setupDatabase()) { -- setEnabled(false); -- return; -- } -- -- if (pluginManager.isPluginEnabled("ProtocolSupport")) { -- pluginManager.registerEvents(new ProtocolSupportListener(this, core.getRateLimiter()), this); -- } else if (pluginManager.isPluginEnabled("ProtocolLib")) { -- ProtocolLibListener.register(this, core.getRateLimiter()); -- -- //if server is using paper - we need to set the skin at pre login anyway, so no need for this listener -- if (!PaperLib.isPaper() && getConfig().getBoolean("forwardSkin")) { -- pluginManager.registerEvents(new SkinApplyListener(this), this); -- } -- } else { -- logger.warn("Either ProtocolLib or ProtocolSupport have to be installed if you don't use BungeeCord"); -- } -- } -- -- //delay dependency setup because we load the plugin very early where plugins are initialized yet -- getServer().getScheduler().runTaskLater(this, new DelayedAuthHook(this), 5L); -- -- pluginManager.registerEvents(new ConnectionListener(this), this); -- -- //if server is using paper - we need to add one more listener to correct the usercache usage -- if (PaperLib.isPaper()) { -- pluginManager.registerEvents(new PaperPreLoginListener(this), this); -- } -- -- //register commands using a unique name -- getCommand("premium").setExecutor(new PremiumCommand(this)); -- getCommand("cracked").setExecutor(new CrackedCommand(this)); -- -- if (pluginManager.isPluginEnabled("PlaceholderAPI")) { -- premiumPlaceholder = new PremiumPlaceholder(this); -- premiumPlaceholder.register(); -- } -- -- dependencyWarnings(); -- } -- -- @Override -- public void onDisable() { -- loginSession.clear(); -- premiumPlayers.clear(); -- -- if (core != null) { -- core.close(); -- } -- -- bungeeManager.cleanup(); -- if (premiumPlaceholder != null && getServer().getPluginManager().isPluginEnabled("PlaceholderAPI")) { -- try { -- premiumPlaceholder.unregister(); -- } catch (Exception | NoSuchMethodError exception) { -- logger.error("Failed to unregister placeholder", exception); -- } -- } -- } -- -- public FastLoginCore getCore() { -- return core; -- } -- -- /** -- * Gets a thread-safe map about players which are connecting to the server are being checked to be premium (paid -- * account) -- * -- * @return a thread-safe loginSession map -- */ -- public ConcurrentMap getLoginSessions() { -- return loginSession; -- } -- -- public BukkitLoginSession getSession(InetSocketAddress addr) { -- String id = getSessionId(addr); -- return loginSession.get(id); -- } -- -- public String getSessionId(InetSocketAddress addr) { -- return addr.getAddress().getHostAddress() + ':' + addr.getPort(); -- } -- -- public void putSession(InetSocketAddress addr, BukkitLoginSession session) { -- String id = getSessionId(addr); -- loginSession.put(id, session); -- } -- -- public void removeSession(InetSocketAddress addr) { -- String id = getSessionId(addr); -- loginSession.remove(id); -- } -- -- public Map getPremiumPlayers() { -- return premiumPlayers; -- } -- -- /** -- * Fetches the premium status of an online player. -- * -- * @param onlinePlayer -- * @return the online status or unknown if an error happened, the player isn't online or BungeeCord doesn't send -- * us the status message yet (This means you cannot check the login status on the PlayerJoinEvent). -- */ -- public PremiumStatus getStatus(UUID onlinePlayer) { -- return premiumPlayers.getOrDefault(onlinePlayer, PremiumStatus.UNKNOWN); -- } -- -- /** -- * Wait before the server is fully started. This is workaround, because connections right on startup are not -- * injected by ProtocolLib -- * -- * @return true if ProtocolLib can now intercept packets -- */ -- public boolean isServerFullyStarted() { -- return serverStarted; -- } -- -- public void markInitialized() { -- this.serverStarted = true; -- } -- -- public BungeeManager getBungeeManager() { -- return bungeeManager; -- } -- -- @Override -- public Path getPluginFolder() { -- return getDataFolder().toPath(); -- } -- -- @Override -- public Logger getLog() { -- return logger; -- } -- -- @Override -- public BukkitScheduler getScheduler() { -- return scheduler; -- } -- -- @Override -- public void sendMessage(CommandSender receiver, String message) { -- receiver.sendMessage(message); -- } -- -- /** -- * Checks if a config entry (related to Floodgate) is valid.
-- * Writes to Log if the value is invalid. -- *

-- * This should be used for: -- *

    -- *
  • allowFloodgateNameConflict -- *
  • autoLoginFloodgate -- *
  • autoRegisterFloodgate -- *
-- *

-- * -- * @param key the key of the entry in config.yml -- * @return true if the entry's value is "true", "false", or "linked" -- */ -- private boolean isValidFloodgateConfigString(String key) { -- String value = core.getConfig().get(key).toString().toLowerCase(); -- if (!value.equals("true") && !value.equals("linked") && !value.equals("false") && !value.equals("no-conflict")) { -- logger.error("Invalid value detected for {} in FastLogin/config.yml.", key); -- return false; -- } -- return true; -- } -- -- /** -- * Checks if a plugin is installed on the server -- * @param name the name of the plugin -- * @return true if the plugin is installed -- */ -- public boolean isPluginInstalled(String name) { -- //the plugin may be enabled after FastLogin, so isPluginEnabled() -- //won't work here -- return Bukkit.getServer().getPluginManager().getPlugin(name) != null; -- } -- -- /** -- * Send warning messages to log if incompatible plugins are used -- */ -- private void dependencyWarnings() { -- if (isPluginInstalled("floodgate-bukkit")) { -- logger.warn("We have detected that you are runnging Floodgate 1.0 which is not supported by the Bukkit " -- + "version of FastLogin."); -- logger.warn("If you would like to use FastLogin with Floodgate, you can download developement builds of " -- + "Floodgate 2.0 from https://ci.opencollab.dev/job/GeyserMC/job/Floodgate/job/dev%252F2.0/"); -- logger.warn("Don't forget to update Geyser to a supported version as well from " -- + "https://ci.opencollab.dev/job/GeyserMC/job/Geyser/job/floodgate-2.0/"); -- } else if (isPluginInstalled("floodgate") && isPluginInstalled("ProtocolLib")) { -- logger.warn("We have detected that you are runnging FastLogin alongside Floodgate and ProtocolLib."); -- logger.warn("Currently there is an issue with FastLogin that prevents Floodgate name prefixes from showing up " -- + "when it is together used with ProtocolLib."); -- logger.warn("If you would like to use Floodgate name prefixes, you can replace ProtocolLib with ProtocolSupport " -- + "which does not have this issue."); -- logger.warn("For more information visit https://github.com/games647/FastLogin/issues/493"); -- } -- } --} diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/PremiumPlaceholder.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/PremiumPlaceholder.java deleted file mode 100644 index f05b609..0000000 @@ -16450,200 +15855,6 @@ index 0a4fcef..0000000 - } - } -} -diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/ConnectionListener.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/ConnectionListener.java -deleted file mode 100644 -index fc2acad..0000000 ---- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/ConnectionListener.java -+++ /dev/null -@@ -1,116 +0,0 @@ --/* -- * SPDX-License-Identifier: MIT -- * -- * The MIT License (MIT) -- * -- * Copyright (c) 2015-2021 -- * -- * 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. -- */ --package com.github.games647.fastlogin.bukkit.listener; -- --import com.github.games647.fastlogin.bukkit.BukkitLoginSession; --import com.github.games647.fastlogin.bukkit.FastLoginBukkit; --import com.github.games647.fastlogin.bukkit.task.FloodgateAuthTask; --import com.github.games647.fastlogin.bukkit.task.ForceLoginTask; -- --import org.bukkit.Bukkit; --import org.bukkit.entity.Player; --import org.bukkit.event.EventHandler; --import org.bukkit.event.EventPriority; --import org.bukkit.event.Listener; --import org.bukkit.event.player.PlayerJoinEvent; --import org.bukkit.event.player.PlayerLoginEvent; --import org.bukkit.event.player.PlayerLoginEvent.Result; --import org.geysermc.floodgate.api.FloodgateApi; --import org.geysermc.floodgate.api.player.FloodgatePlayer; --import org.bukkit.event.player.PlayerQuitEvent; -- --/** -- * This listener tells authentication plugins if the player has a premium account and we checked it successfully. So the -- * plugin can skip authentication. -- */ --public class ConnectionListener implements Listener { -- -- private static final long DELAY_LOGIN = 20L / 2; -- -- private final FastLoginBukkit plugin; -- -- public ConnectionListener(FastLoginBukkit plugin) { -- this.plugin = plugin; -- } -- -- @EventHandler(priority = EventPriority.LOWEST) -- public void onPlayerLogin(PlayerLoginEvent loginEvent) { -- removeBlockedStatus(loginEvent.getPlayer()); -- if (loginEvent.getResult() == Result.ALLOWED && !plugin.isServerFullyStarted()) { -- loginEvent.disallow(Result.KICK_OTHER, plugin.getCore().getMessage("not-started")); -- } -- } -- -- @EventHandler(ignoreCancelled = true) -- public void onPlayerJoin(PlayerJoinEvent joinEvent) { -- Player player = joinEvent.getPlayer(); -- -- Bukkit.getScheduler().runTaskLater(plugin, () -> { -- // session exists so the player is ready for force login -- // cases: Paper (firing BungeeCord message before PlayerJoinEvent) or not running BungeeCord and already -- // having the login session from the login process -- BukkitLoginSession session = plugin.getSession(player.getAddress()); -- -- boolean isFloodgateLogin = false; -- if (Bukkit.getServer().getPluginManager().isPluginEnabled("floodgate")) { -- FloodgatePlayer floodgatePlayer = FloodgateApi.getInstance().getPlayer(player.getUniqueId()); -- if (floodgatePlayer != null) { -- isFloodgateLogin = true; -- Runnable floodgateAuthTask = new FloodgateAuthTask(plugin, player, floodgatePlayer); -- Bukkit.getScheduler().runTaskAsynchronously(plugin, floodgateAuthTask); -- } -- } -- -- if (!isFloodgateLogin) { -- if (session == null) { -- String sessionId = plugin.getSessionId(player.getAddress()); -- plugin.getLog().info("No on-going login session for player: {} with ID {}", player, sessionId); -- } else { -- Runnable forceLoginTask = new ForceLoginTask(plugin.getCore(), player, session); -- Bukkit.getScheduler().runTaskAsynchronously(plugin, forceLoginTask); -- } -- } -- -- plugin.getBungeeManager().markJoinEventFired(player); -- // delay the login process to let auth plugins initialize the player -- // Magic number however as there is no direct event from those plugins -- }, DELAY_LOGIN); -- } -- -- @EventHandler -- public void onPlayerQuit(PlayerQuitEvent quitEvent) { -- Player player = quitEvent.getPlayer(); -- -- removeBlockedStatus(player); -- plugin.getCore().getPendingConfirms().remove(player.getUniqueId()); -- plugin.getPremiumPlayers().remove(player.getUniqueId()); -- plugin.getBungeeManager().cleanup(player); -- } -- -- private void removeBlockedStatus(Player player) { -- player.removeMetadata(plugin.getName(), plugin); -- } --} -diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/PaperPreLoginListener.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/PaperPreLoginListener.java -deleted file mode 100644 -index 396cb2c..0000000 ---- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/PaperPreLoginListener.java -+++ /dev/null -@@ -1,66 +0,0 @@ --/* -- * SPDX-License-Identifier: MIT -- * -- * The MIT License (MIT) -- * -- * Copyright (c) 2015-2021 -- * -- * 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. -- */ --package com.github.games647.fastlogin.bukkit.listener; -- --import com.destroystokyo.paper.profile.ProfileProperty; --import com.github.games647.craftapi.model.skin.Textures; --import com.github.games647.fastlogin.bukkit.BukkitLoginSession; --import com.github.games647.fastlogin.bukkit.FastLoginBukkit; --import org.bukkit.event.EventHandler; --import org.bukkit.event.EventPriority; --import org.bukkit.event.Listener; --import org.bukkit.event.player.AsyncPlayerPreLoginEvent; --import org.bukkit.event.player.AsyncPlayerPreLoginEvent.Result; -- --public class PaperPreLoginListener implements Listener { -- -- private final FastLoginBukkit plugin; -- -- public PaperPreLoginListener(final FastLoginBukkit plugin) { -- this.plugin = plugin; -- } -- -- @EventHandler(priority = EventPriority.HIGHEST) -- //if paper is used - player skin must be set at pre login, otherwise usercache is used -- //using usercache makes premium name change basically impossible -- public void onAsyncPlayerPreLogin(AsyncPlayerPreLoginEvent event) { -- if (event.getLoginResult() != Result.ALLOWED) { -- return; -- } -- -- // event gives us only IP, not the port, so we need to loop through all the sessions -- for (BukkitLoginSession session : plugin.getLoginSessions().values()) { -- if (!event.getName().equals(session.getUsername())) { -- continue; -- } -- -- session.getSkin().ifPresent(skin -> event.getPlayerProfile().setProperty(new ProfileProperty(Textures.KEY, -- skin.getValue(), skin.getSignature()))); -- break; -- } -- } -- --} diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/EncryptionUtil.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/EncryptionUtil.java deleted file mode 100644 index 652882b..0000000 @@ -16806,390 +16017,6 @@ index 652882b..0000000 - return digest.digest(); - } -} -diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/NameCheckTask.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/NameCheckTask.java -deleted file mode 100644 -index 3aa8e76..0000000 ---- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/NameCheckTask.java -+++ /dev/null -@@ -1,114 +0,0 @@ --/* -- * SPDX-License-Identifier: MIT -- * -- * The MIT License (MIT) -- * -- * Copyright (c) 2015-2021 -- * -- * 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. -- */ --package com.github.games647.fastlogin.bukkit.listener.protocollib; -- --import com.comphenix.protocol.ProtocolLibrary; --import com.comphenix.protocol.events.PacketEvent; --import com.github.games647.fastlogin.bukkit.BukkitLoginSession; --import com.github.games647.fastlogin.bukkit.FastLoginBukkit; --import com.github.games647.fastlogin.bukkit.event.BukkitFastLoginPreLoginEvent; --import com.github.games647.fastlogin.core.StoredProfile; --import com.github.games647.fastlogin.core.shared.JoinManagement; --import com.github.games647.fastlogin.core.shared.event.FastLoginPreLoginEvent; -- --import java.security.PublicKey; --import java.util.Random; -- --import org.bukkit.command.CommandSender; --import org.bukkit.entity.Player; -- --public class NameCheckTask extends JoinManagement -- implements Runnable { -- -- private final FastLoginBukkit plugin; -- private final PacketEvent packetEvent; -- private final PublicKey publicKey; -- -- private final Random random; -- -- private final Player player; -- private final String username; -- -- -- public NameCheckTask(FastLoginBukkit plugin, PacketEvent packetEvent, Random random, -- Player player, String username, PublicKey publicKey) { -- super(plugin.getCore(), plugin.getCore().getAuthPluginHook()); -- -- this.plugin = plugin; -- this.packetEvent = packetEvent; -- this.publicKey = publicKey; -- this.random = random; -- this.player = player; -- this.username = username; -- } -- -- @Override -- public void run() { -- try { -- super.onLogin(username, new ProtocolLibLoginSource(packetEvent, player, random, publicKey)); -- } finally { -- ProtocolLibrary.getProtocolManager().getAsynchronousManager().signalPacketTransmission(packetEvent); -- } -- } -- -- @Override -- public FastLoginPreLoginEvent callFastLoginPreLoginEvent(String username, ProtocolLibLoginSource source, StoredProfile profile) { -- BukkitFastLoginPreLoginEvent event = new BukkitFastLoginPreLoginEvent(username, source, profile); -- plugin.getServer().getPluginManager().callEvent(event); -- return event; -- } -- -- //Minecraft server implementation -- //https://github.com/bergerkiller/CraftSource/blob/master/net.minecraft.server/LoginListener.java#L161 -- @Override -- public void requestPremiumLogin(ProtocolLibLoginSource source, StoredProfile profile -- , String username, boolean registered) { -- try { -- source.setOnlineMode(); -- } catch (Exception ex) { -- plugin.getLog().error("Cannot send encryption packet. Falling back to cracked login for: {}", profile, ex); -- return; -- } -- -- String ip = player.getAddress().getAddress().getHostAddress(); -- core.getPendingLogin().put(ip + username, new Object()); -- -- byte[] verify = source.getVerifyToken(); -- -- BukkitLoginSession playerSession = new BukkitLoginSession(username, verify, registered, profile); -- plugin.putSession(player.getAddress(), playerSession); -- //cancel only if the player has a paid account otherwise login as normal offline player -- synchronized (packetEvent.getAsyncMarker().getProcessingLock()) { -- packetEvent.setCancelled(true); -- } -- } -- -- @Override -- public void startCrackedSession(ProtocolLibLoginSource source, StoredProfile profile, String username) { -- BukkitLoginSession loginSession = new BukkitLoginSession(username, profile); -- plugin.putSession(player.getAddress(), loginSession); -- } --} -diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/ProtocolLibListener.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/ProtocolLibListener.java -deleted file mode 100644 -index 23b3b89..0000000 ---- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/ProtocolLibListener.java -+++ /dev/null -@@ -1,119 +0,0 @@ --/* -- * SPDX-License-Identifier: MIT -- * -- * The MIT License (MIT) -- * -- * Copyright (c) 2015-2021 -- * -- * 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. -- */ --package com.github.games647.fastlogin.bukkit.listener.protocollib; -- --import com.comphenix.protocol.PacketType; --import com.comphenix.protocol.ProtocolLibrary; --import com.comphenix.protocol.events.PacketAdapter; --import com.comphenix.protocol.events.PacketContainer; --import com.comphenix.protocol.events.PacketEvent; --import com.github.games647.fastlogin.bukkit.FastLoginBukkit; --import com.github.games647.fastlogin.core.RateLimiter; -- --import java.security.KeyPair; --import java.security.SecureRandom; -- --import org.bukkit.entity.Player; -- --import static com.comphenix.protocol.PacketType.Login.Client.ENCRYPTION_BEGIN; --import static com.comphenix.protocol.PacketType.Login.Client.START; -- --public class ProtocolLibListener extends PacketAdapter { -- -- private final FastLoginBukkit plugin; -- -- //just create a new once on plugin enable. This used for verify token generation -- private final SecureRandom random = new SecureRandom(); -- private final KeyPair keyPair = EncryptionUtil.generateKeyPair(); -- private final RateLimiter rateLimiter; -- -- public ProtocolLibListener(FastLoginBukkit plugin, RateLimiter rateLimiter) { -- //run async in order to not block the server, because we are making api calls to Mojang -- super(params() -- .plugin(plugin) -- .types(START, ENCRYPTION_BEGIN) -- .optionAsync()); -- -- this.plugin = plugin; -- this.rateLimiter = rateLimiter; -- } -- -- public static void register(FastLoginBukkit plugin, RateLimiter rateLimiter) { -- //they will be created with a static builder, because otherwise it will throw a NoClassDefFoundError -- ProtocolLibrary.getProtocolManager() -- .getAsynchronousManager() -- .registerAsyncHandler(new ProtocolLibListener(plugin, rateLimiter)) -- .start(); -- } -- -- @Override -- public void onPacketReceiving(PacketEvent packetEvent) { -- if (packetEvent.isCancelled() -- || plugin.getCore().getAuthPluginHook()== null -- || !plugin.isServerFullyStarted()) { -- return; -- } -- -- Player sender = packetEvent.getPlayer(); -- PacketType packetType = packetEvent.getPacketType(); -- if (packetType == START) { -- if (!rateLimiter.tryAcquire()) { -- plugin.getLog().warn("Join limit hit - Ignoring player {}", sender); -- return; -- } -- -- onLogin(packetEvent, sender); -- } else { -- onEncryptionBegin(packetEvent, sender); -- } -- } -- -- private void onEncryptionBegin(PacketEvent packetEvent, Player sender) { -- byte[] sharedSecret = packetEvent.getPacket().getByteArrays().read(0); -- -- packetEvent.getAsyncMarker().incrementProcessingDelay(); -- Runnable verifyTask = new VerifyResponseTask(plugin, packetEvent, sender, sharedSecret, keyPair); -- plugin.getScheduler().runAsync(verifyTask); -- } -- -- private void onLogin(PacketEvent packetEvent, Player player) { -- //this includes ip:port. Should be unique for an incoming login request with a timeout of 2 minutes -- String sessionKey = player.getAddress().toString(); -- -- //remove old data every time on a new login in order to keep the session only for one person -- plugin.removeSession(player.getAddress()); -- -- //player.getName() won't work at this state -- PacketContainer packet = packetEvent.getPacket(); -- -- String username = packet.getGameProfiles().read(0).getName(); -- plugin.getLog().trace("GameProfile {} with {} connecting", sessionKey, username); -- -- packetEvent.getAsyncMarker().incrementProcessingDelay(); -- Runnable nameCheckTask = new NameCheckTask(plugin, packetEvent, random, player, username, keyPair.getPublic()); -- plugin.getScheduler().runAsync(nameCheckTask); -- } --} -diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/ProtocolLibLoginSource.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/ProtocolLibLoginSource.java -deleted file mode 100644 -index 4e9691f..0000000 ---- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/ProtocolLibLoginSource.java -+++ /dev/null -@@ -1,133 +0,0 @@ --/* -- * SPDX-License-Identifier: MIT -- * -- * The MIT License (MIT) -- * -- * Copyright (c) 2015-2021 -- * -- * 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. -- */ --package com.github.games647.fastlogin.bukkit.listener.protocollib; -- --import com.comphenix.protocol.ProtocolLibrary; --import com.comphenix.protocol.ProtocolManager; --import com.comphenix.protocol.events.PacketContainer; --import com.comphenix.protocol.events.PacketEvent; --import com.comphenix.protocol.reflect.StructureModifier; --import com.comphenix.protocol.wrappers.WrappedChatComponent; --import com.github.games647.fastlogin.core.shared.LoginSource; -- --import java.lang.reflect.InvocationTargetException; --import java.net.InetSocketAddress; --import java.security.PublicKey; --import java.util.Arrays; --import java.util.Random; -- --import org.bukkit.entity.Player; -- --import static com.comphenix.protocol.PacketType.Login.Server.DISCONNECT; --import static com.comphenix.protocol.PacketType.Login.Server.ENCRYPTION_BEGIN; -- --class ProtocolLibLoginSource implements LoginSource { -- -- private final PacketEvent packetEvent; -- private final Player player; -- -- private final Random random; -- private final PublicKey publicKey; -- -- private final String serverId = ""; -- private byte[] verifyToken; -- -- public ProtocolLibLoginSource(PacketEvent packetEvent, Player player, Random random, PublicKey publicKey) { -- this.packetEvent = packetEvent; -- this.player = player; -- this.random = random; -- this.publicKey = publicKey; -- } -- -- @Override -- public void setOnlineMode() throws Exception { -- verifyToken = EncryptionUtil.generateVerifyToken(random); -- -- /* -- * Packet Information: https://wiki.vg/Protocol#Encryption_Request -- * -- * ServerID="" (String) key=public server key verifyToken=random 4 byte array -- */ -- PacketContainer newPacket = new PacketContainer(ENCRYPTION_BEGIN); -- -- newPacket.getStrings().write(0, serverId); -- StructureModifier keyModifier = newPacket.getSpecificModifier(PublicKey.class); -- int verifyField = 0; -- if (keyModifier.getFields().isEmpty()) { -- // Since 1.16.4 this is now a byte field -- newPacket.getByteArrays().write(0, publicKey.getEncoded()); -- verifyField++; -- } else { -- keyModifier.write(0, publicKey); -- } -- -- newPacket.getByteArrays().write(verifyField, verifyToken); -- -- //serverId is a empty string -- ProtocolLibrary.getProtocolManager().sendServerPacket(player, newPacket); -- } -- -- @Override -- public void kick(String message) throws InvocationTargetException { -- ProtocolManager protocolManager = ProtocolLibrary.getProtocolManager(); -- -- PacketContainer kickPacket = new PacketContainer(DISCONNECT); -- kickPacket.getChatComponents().write(0, WrappedChatComponent.fromText(message)); -- -- try { -- //send kick packet at login state -- //the normal event.getPlayer.kickPlayer(String) method does only work at play state -- protocolManager.sendServerPacket(player, kickPacket); -- } finally { -- //tell the server that we want to close the connection -- player.kickPlayer("Disconnect"); -- } -- } -- -- @Override -- public InetSocketAddress getAddress() { -- return packetEvent.getPlayer().getAddress(); -- } -- -- public String getServerId() { -- return serverId; -- } -- -- public byte[] getVerifyToken() { -- return verifyToken.clone(); -- } -- -- @Override -- public String toString() { -- return this.getClass().getSimpleName() + '{' + -- "packetEvent=" + packetEvent + -- ", player=" + player + -- ", random=" + random + -- ", serverId='" + serverId + '\'' + -- ", verifyToken=" + Arrays.toString(verifyToken) + -- '}'; -- } --} diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/SkinApplyListener.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/SkinApplyListener.java deleted file mode 100644 index 042950b..0000000 @@ -17288,515 +16115,6 @@ index 042950b..0000000 - } - } -} -diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/VerifyResponseTask.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/VerifyResponseTask.java -deleted file mode 100644 -index 10239f0..0000000 ---- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/VerifyResponseTask.java -+++ /dev/null -@@ -1,295 +0,0 @@ --/* -- * SPDX-License-Identifier: MIT -- * -- * The MIT License (MIT) -- * -- * Copyright (c) 2015-2021 -- * -- * 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. -- */ --package com.github.games647.fastlogin.bukkit.listener.protocollib; -- --import com.comphenix.protocol.ProtocolLibrary; --import com.comphenix.protocol.events.PacketContainer; --import com.comphenix.protocol.events.PacketEvent; --import com.comphenix.protocol.injector.server.TemporaryPlayerFactory; --import com.comphenix.protocol.reflect.FieldUtils; --import com.comphenix.protocol.reflect.FuzzyReflection; --import com.comphenix.protocol.utility.MinecraftReflection; --import com.comphenix.protocol.wrappers.WrappedChatComponent; --import com.comphenix.protocol.wrappers.WrappedGameProfile; --import com.github.games647.craftapi.model.auth.Verification; --import com.github.games647.craftapi.model.skin.SkinProperty; --import com.github.games647.craftapi.resolver.MojangResolver; --import com.github.games647.fastlogin.bukkit.BukkitLoginSession; --import com.github.games647.fastlogin.bukkit.FastLoginBukkit; -- --import java.io.IOException; --import java.lang.reflect.InvocationTargetException; --import java.lang.reflect.Method; --import java.net.InetAddress; --import java.net.InetSocketAddress; --import java.security.GeneralSecurityException; --import java.security.Key; --import java.security.KeyPair; --import java.security.PrivateKey; --import java.util.Arrays; --import java.util.Optional; --import java.util.UUID; -- --import javax.crypto.Cipher; --import javax.crypto.SecretKey; -- --import org.bukkit.entity.Player; -- --import static com.comphenix.protocol.PacketType.Login.Client.START; --import static com.comphenix.protocol.PacketType.Login.Server.DISCONNECT; -- --public class VerifyResponseTask implements Runnable { -- -- private static final String ENCRYPTION_CLASS_NAME = "MinecraftEncryption"; -- private static final Class ENCRYPTION_CLASS; -- -- static { -- ENCRYPTION_CLASS = MinecraftReflection.getMinecraftClass("util." + ENCRYPTION_CLASS_NAME, ENCRYPTION_CLASS_NAME); -- } -- -- private final FastLoginBukkit plugin; -- private final PacketEvent packetEvent; -- private final KeyPair serverKey; -- -- private final Player player; -- -- private final byte[] sharedSecret; -- -- private static Method encryptMethod; -- private static Method cipherMethod; -- -- public VerifyResponseTask(FastLoginBukkit plugin, PacketEvent packetEvent, Player player, -- byte[] sharedSecret, KeyPair keyPair) { -- this.plugin = plugin; -- this.packetEvent = packetEvent; -- this.player = player; -- this.sharedSecret = Arrays.copyOf(sharedSecret, sharedSecret.length); -- this.serverKey = keyPair; -- } -- -- @Override -- public void run() { -- try { -- BukkitLoginSession session = plugin.getSession(player.getAddress()); -- if (session == null) { -- disconnect("invalid-request", true -- , "GameProfile {0} tried to send encryption response at invalid state", player.getAddress()); -- } else { -- verifyResponse(session); -- } -- } finally { -- //this is a fake packet; it shouldn't be send to the server -- synchronized (packetEvent.getAsyncMarker().getProcessingLock()) { -- packetEvent.setCancelled(true); -- } -- -- ProtocolLibrary.getProtocolManager().getAsynchronousManager().signalPacketTransmission(packetEvent); -- } -- } -- -- private void verifyResponse(BukkitLoginSession session) { -- PrivateKey privateKey = serverKey.getPrivate(); -- -- SecretKey loginKey; -- try { -- loginKey = EncryptionUtil.decryptSharedKey(privateKey, sharedSecret); -- } catch (GeneralSecurityException securityEx) { -- disconnect("error-kick", false, "Cannot decrypt received contents", securityEx); -- return; -- } -- -- try { -- if (!checkVerifyToken(session) || !enableEncryption(loginKey)) { -- return; -- } -- } catch (Exception ex) { -- disconnect("error-kick", false, "Cannot decrypt received contents", ex); -- return; -- } -- -- String serverId = EncryptionUtil.getServerIdHashString("", loginKey, serverKey.getPublic()); -- -- String requestedUsername = session.getRequestUsername(); -- InetSocketAddress socketAddress = player.getAddress(); -- try { -- MojangResolver resolver = plugin.getCore().getResolver(); -- InetAddress address = socketAddress.getAddress(); -- Optional response = resolver.hasJoined(requestedUsername, serverId, address); -- if (response.isPresent()) { -- Verification verification = response.get(); -- plugin.getLog().info("Profile {} has a verified premium account: {}", requestedUsername, verification); -- String realUsername = verification.getName(); -- if (realUsername == null) { -- disconnect("invalid-session", true, "Username field null for {}", requestedUsername); -- return; -- } -- -- SkinProperty[] properties = verification.getProperties(); -- if (properties.length > 0) { -- session.setSkinProperty(properties[0]); -- } -- -- session.setVerifiedUsername(realUsername); -- session.setUuid(verification.getId()); -- session.setVerified(true); -- -- setPremiumUUID(session.getUuid()); -- receiveFakeStartPacket(realUsername); -- } else { -- //user tried to fake a authentication -- disconnect("invalid-session", true -- , "GameProfile {0} ({1}) tried to log in with an invalid session ServerId: {2}" -- , session.getRequestUsername(), socketAddress, serverId); -- } -- } catch (IOException ioEx) { -- disconnect("error-kick", false, "Failed to connect to session server", ioEx); -- } -- } -- -- private void setPremiumUUID(UUID premiumUUID) { -- if (plugin.getConfig().getBoolean("premiumUuid") && premiumUUID != null) { -- try { -- Object networkManager = getNetworkManager(); -- //https://github.com/bergerkiller/CraftSource/blob/master/net.minecraft.server/NetworkManager.java#L69 -- FieldUtils.writeField(networkManager, "spoofedUUID", premiumUUID, true); -- } catch (Exception exc) { -- plugin.getLog().error("Error setting premium uuid of {}", player, exc); -- } -- } -- } -- -- private boolean checkVerifyToken(BukkitLoginSession session) throws GeneralSecurityException { -- byte[] requestVerify = session.getVerifyToken(); -- //encrypted verify token -- byte[] responseVerify = packetEvent.getPacket().getByteArrays().read(1); -- -- //https://github.com/bergerkiller/CraftSource/blob/master/net.minecraft.server/LoginListener.java#L182 -- if (!Arrays.equals(requestVerify, EncryptionUtil.decrypt(serverKey.getPrivate(), responseVerify))) { -- //check if the verify token are equal to the server sent one -- disconnect("invalid-verify-token", true -- , "GameProfile {0} ({1}) tried to login with an invalid verify token. Server: {2} Client: {3}" -- , session.getRequestUsername(), packetEvent.getPlayer().getAddress(), requestVerify, responseVerify); -- return false; -- } -- -- return true; -- } -- -- //try to get the networkManager from ProtocolLib -- private Object getNetworkManager() throws IllegalAccessException, ClassNotFoundException { -- Object injectorContainer = TemporaryPlayerFactory.getInjectorFromPlayer(player); -- -- //ChannelInjector -- Class injectorClass = Class.forName("com.comphenix.protocol.injector.netty.Injector"); -- Object rawInjector = FuzzyReflection.getFieldValue(injectorContainer, injectorClass, true); -- return FieldUtils.readField(rawInjector, "networkManager", true); -- } -- -- private boolean enableEncryption(SecretKey loginKey) throws IllegalArgumentException { -- // Initialize method reflections -- if (encryptMethod == null) { -- Class networkManagerClass = MinecraftReflection.getNetworkManagerClass(); -- -- try { -- // Try to get the old (pre MC 1.16.4) encryption method -- encryptMethod = FuzzyReflection.fromClass(networkManagerClass) -- .getMethodByParameters("a", SecretKey.class); -- } catch (IllegalArgumentException exception) { -- // Get the new encryption method -- encryptMethod = FuzzyReflection.fromClass(networkManagerClass) -- .getMethodByParameters("a", Cipher.class, Cipher.class); -- -- // Get the needed Cipher helper method (used to generate ciphers from login key) -- cipherMethod = FuzzyReflection.fromClass(ENCRYPTION_CLASS) -- .getMethodByParameters("a", int.class, Key.class); -- } -- } -- -- try { -- Object networkManager = this.getNetworkManager(); -- -- // If cipherMethod is null - use old encryption (pre MC 1.16.4), otherwise use the new cipher one -- if (cipherMethod == null) { -- // Encrypt/decrypt packet flow, this behaviour is expected by the client -- encryptMethod.invoke(networkManager, loginKey); -- } else { -- // Create ciphers from login key -- Object decryptionCipher = cipherMethod.invoke(null, Cipher.DECRYPT_MODE, loginKey); -- Object encryptionCipher = cipherMethod.invoke(null, Cipher.ENCRYPT_MODE, loginKey); -- -- // Encrypt/decrypt packet flow, this behaviour is expected by the client -- encryptMethod.invoke(networkManager, decryptionCipher, encryptionCipher); -- } -- } catch (Exception ex) { -- disconnect("error-kick", false, "Couldn't enable encryption", ex); -- return false; -- } -- -- return true; -- } -- -- private void disconnect(String reasonKey, boolean debug, String logMessage, Object... arguments) { -- if (debug) { -- plugin.getLog().debug(logMessage, arguments); -- } else { -- plugin.getLog().error(logMessage, arguments); -- } -- -- kickPlayer(plugin.getCore().getMessage(reasonKey)); -- } -- -- private void kickPlayer(String reason) { -- PacketContainer kickPacket = new PacketContainer(DISCONNECT); -- kickPacket.getChatComponents().write(0, WrappedChatComponent.fromText(reason)); -- try { -- //send kick packet at login state -- //the normal event.getPlayer.kickPlayer(String) method does only work at play state -- ProtocolLibrary.getProtocolManager().sendServerPacket(player, kickPacket); -- //tell the server that we want to close the connection -- player.kickPlayer("Disconnect"); -- } catch (InvocationTargetException ex) { -- plugin.getLog().error("Error sending kick packet for: {}", player, ex); -- } -- } -- -- //fake a new login packet in order to let the server handle all the other stuff -- private void receiveFakeStartPacket(String username) { -- //see StartPacketListener for packet information -- PacketContainer startPacket = new PacketContainer(START); -- -- //uuid is ignored by the packet definition -- WrappedGameProfile fakeProfile = new WrappedGameProfile(UUID.randomUUID(), username); -- startPacket.getGameProfiles().write(0, fakeProfile); -- try { -- //we don't want to handle our own packets so ignore filters -- ProtocolLibrary.getProtocolManager().recieveClientPacket(player, startPacket, false); -- } catch (InvocationTargetException | IllegalAccessException ex) { -- plugin.getLog().warn("Failed to fake a new start packet for: {}", username, ex); -- //cancel the event in order to prevent the server receiving an invalid packet -- kickPlayer(plugin.getCore().getMessage("error-kick")); -- } -- } --} -diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocolsupport/ProtocolLoginSource.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocolsupport/ProtocolLoginSource.java -deleted file mode 100644 -index 6c05caf..0000000 ---- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocolsupport/ProtocolLoginSource.java -+++ /dev/null -@@ -1,67 +0,0 @@ --/* -- * SPDX-License-Identifier: MIT -- * -- * The MIT License (MIT) -- * -- * Copyright (c) 2015-2021 -- * -- * 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. -- */ --package com.github.games647.fastlogin.bukkit.listener.protocolsupport; -- --import com.github.games647.fastlogin.core.shared.LoginSource; -- --import java.net.InetSocketAddress; -- --import protocolsupport.api.events.PlayerLoginStartEvent; -- --public class ProtocolLoginSource implements LoginSource { -- -- private final PlayerLoginStartEvent loginStartEvent; -- -- public ProtocolLoginSource(PlayerLoginStartEvent loginStartEvent) { -- this.loginStartEvent = loginStartEvent; -- } -- -- @Override -- public void setOnlineMode() { -- loginStartEvent.setOnlineMode(true); -- } -- -- @Override -- public void kick(String message) { -- loginStartEvent.denyLogin(message); -- } -- -- @Override -- public InetSocketAddress getAddress() { -- return loginStartEvent.getAddress(); -- } -- -- public PlayerLoginStartEvent getLoginStartEvent() { -- return loginStartEvent; -- } -- -- @Override -- public String toString() { -- return this.getClass().getSimpleName() + '{' + -- "loginStartEvent=" + loginStartEvent + -- '}'; -- } --} -diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocolsupport/ProtocolSupportListener.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocolsupport/ProtocolSupportListener.java -deleted file mode 100644 -index f200ea8..0000000 ---- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocolsupport/ProtocolSupportListener.java -+++ /dev/null -@@ -1,129 +0,0 @@ --/* -- * SPDX-License-Identifier: MIT -- * -- * The MIT License (MIT) -- * -- * Copyright (c) 2015-2021 -- * -- * 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. -- */ --package com.github.games647.fastlogin.bukkit.listener.protocolsupport; -- --import com.github.games647.craftapi.UUIDAdapter; --import com.github.games647.fastlogin.bukkit.BukkitLoginSession; --import com.github.games647.fastlogin.bukkit.FastLoginBukkit; --import com.github.games647.fastlogin.bukkit.event.BukkitFastLoginPreLoginEvent; --import com.github.games647.fastlogin.core.RateLimiter; --import com.github.games647.fastlogin.core.StoredProfile; --import com.github.games647.fastlogin.core.shared.JoinManagement; --import com.github.games647.fastlogin.core.shared.event.FastLoginPreLoginEvent; -- --import java.net.InetSocketAddress; --import java.util.Optional; -- --import org.bukkit.command.CommandSender; --import org.bukkit.entity.Player; --import org.bukkit.event.EventHandler; --import org.bukkit.event.Listener; -- --import protocolsupport.api.events.ConnectionCloseEvent; --import protocolsupport.api.events.PlayerLoginStartEvent; --import protocolsupport.api.events.PlayerProfileCompleteEvent; -- --public class ProtocolSupportListener extends JoinManagement -- implements Listener { -- -- private final FastLoginBukkit plugin; -- private final RateLimiter rateLimiter; -- -- public ProtocolSupportListener(FastLoginBukkit plugin, RateLimiter rateLimiter) { -- super(plugin.getCore(), plugin.getCore().getAuthPluginHook()); -- -- this.plugin = plugin; -- this.rateLimiter = rateLimiter; -- } -- -- @EventHandler -- public void onLoginStart(PlayerLoginStartEvent loginStartEvent) { -- if (loginStartEvent.isLoginDenied() || plugin.getCore().getAuthPluginHook() == null) { -- return; -- } -- -- if (!rateLimiter.tryAcquire()) { -- plugin.getLog().warn("Join limit hit - Ignoring player {}", loginStartEvent.getConnection()); -- return; -- } -- -- String username = loginStartEvent.getConnection().getProfile().getName(); -- InetSocketAddress address = loginStartEvent.getAddress(); -- -- //remove old data every time on a new login in order to keep the session only for one person -- plugin.removeSession(address); -- -- ProtocolLoginSource source = new ProtocolLoginSource(loginStartEvent); -- super.onLogin(username, source); -- } -- -- @EventHandler -- public void onConnectionClosed(ConnectionCloseEvent closeEvent) { -- InetSocketAddress address = closeEvent.getConnection().getAddress(); -- plugin.removeSession(address); -- } -- -- @EventHandler -- public void onPropertiesResolve(PlayerProfileCompleteEvent profileCompleteEvent) { -- InetSocketAddress address = profileCompleteEvent.getAddress(); -- BukkitLoginSession session = plugin.getSession(address); -- -- if (session != null && profileCompleteEvent.getConnection().getProfile().isOnlineMode()) { -- session.setVerified(true); -- -- if (!plugin.getConfig().getBoolean("premiumUuid")) { -- String username = Optional.ofNullable(profileCompleteEvent.getForcedName()) -- .orElse(profileCompleteEvent.getConnection().getProfile().getName()); -- profileCompleteEvent.setForcedUUID(UUIDAdapter.generateOfflineId(username)); -- } -- } -- } -- -- @Override -- public FastLoginPreLoginEvent callFastLoginPreLoginEvent(String username, ProtocolLoginSource source, StoredProfile profile) { -- BukkitFastLoginPreLoginEvent event = new BukkitFastLoginPreLoginEvent(username, source, profile); -- plugin.getServer().getPluginManager().callEvent(event); -- return event; -- } -- -- @Override -- public void requestPremiumLogin(ProtocolLoginSource source, StoredProfile profile, String username -- , boolean registered) { -- source.setOnlineMode(); -- -- String ip = source.getAddress().getAddress().getHostAddress(); -- plugin.getCore().getPendingLogin().put(ip + username, new Object()); -- -- BukkitLoginSession playerSession = new BukkitLoginSession(username, registered, profile); -- plugin.putSession(source.getAddress(), playerSession); -- } -- -- @Override -- public void startCrackedSession(ProtocolLoginSource source, StoredProfile profile, String username) { -- BukkitLoginSession loginSession = new BukkitLoginSession(username, profile); -- plugin.putSession(source.getAddress(), loginSession); -- } --} diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/task/DelayedAuthHook.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/task/DelayedAuthHook.java deleted file mode 100644 index c5dcc9c..0000000 @@ -17929,139 +16247,6 @@ index c5dcc9c..0000000 - } - } -} -diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/task/FloodgateAuthTask.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/task/FloodgateAuthTask.java -deleted file mode 100644 -index 2900256..0000000 ---- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/task/FloodgateAuthTask.java -+++ /dev/null -@@ -1,127 +0,0 @@ --/* -- * SPDX-License-Identifier: MIT -- * -- * The MIT License (MIT) -- * -- * Copyright (c) 2015-2021 -- * -- * 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. -- */ --package com.github.games647.fastlogin.bukkit.task; -- --import java.io.IOException; --import java.util.Optional; -- --import org.bukkit.Bukkit; --import org.bukkit.entity.Player; --import org.geysermc.floodgate.api.player.FloodgatePlayer; -- --import com.github.games647.craftapi.model.Profile; --import com.github.games647.craftapi.resolver.RateLimitException; --import com.github.games647.fastlogin.bukkit.BukkitLoginSession; --import com.github.games647.fastlogin.bukkit.FastLoginBukkit; --import com.github.games647.fastlogin.core.StoredProfile; --import com.github.games647.fastlogin.core.hooks.AuthPlugin; -- --public class FloodgateAuthTask implements Runnable { -- -- private final FastLoginBukkit plugin; -- private final Player player; -- private final FloodgatePlayer floodgatePlayer; -- -- public FloodgateAuthTask(FastLoginBukkit plugin, Player player, FloodgatePlayer floodgatePlayer) { -- this.plugin = plugin; -- this.player = player; -- this.floodgatePlayer = floodgatePlayer; -- } -- -- @Override -- public void run() { -- plugin.getLog().info( -- "Player {} is connecting through Geyser Floodgate.", -- player.getName()); -- -- // check if the Bedrock player is linked to a Java account -- boolean isLinked = floodgatePlayer.getLinkedPlayer() != null; -- AuthPlugin authPlugin = plugin.getCore().getAuthPluginHook(); -- -- String autoLoginFloodgate = plugin.getCore().getConfig().get("autoLoginFloodgate").toString().toLowerCase(); -- String autoRegisterFloodgate = plugin.getCore().getConfig().get("autoRegisterFloodgate").toString().toLowerCase(); -- String allowNameConflict = plugin.getCore().getConfig().get("allowFloodgateNameConflict").toString().toLowerCase(); -- -- boolean isRegistered; -- try { -- isRegistered = authPlugin.isRegistered(player.getName()); -- } catch (Exception e) { -- plugin.getLog().error( -- "An error has occured while checking if player {} is registered", -- player.getName()); -- return; -- } -- -- //decide if checks should be made for conflicting Java player names -- if (!isLinked //linked players have the same name as their Java profile -- // if allowNameConflict is 'false' or 'linked' and the player had a conflicting -- // name, than they would have been kicked in FloodgateHook#checkNameConflict -- && allowNameConflict.equals("true") && -- ( -- autoLoginFloodgate.equals("no-conflict") -- || !isRegistered && autoRegisterFloodgate.equals("no-conflict")) -- ) { -- // check for conflicting Premium Java name -- Optional premiumUUID = Optional.empty(); -- try { -- premiumUUID = plugin.getCore().getResolver().findProfile(player.getName()); -- } catch (IOException | RateLimitException e) { -- plugin.getLog().error( -- "Could not check wether Floodgate Player {}'s name conflits a premium Java player's name.", -- player.getName()); -- return; -- } -- -- //stop execution if player's name is conflicting -- if (premiumUUID.isPresent()) { -- return; -- } -- } -- -- if (!isRegistered && autoRegisterFloodgate.equals("false")) { -- plugin.getLog().info( -- "Auto registration is disabled for Floodgate players in config.yml"); -- return; -- } -- -- // logging in from bedrock for a second time threw an error with UUID -- StoredProfile profile = plugin.getCore().getStorage().loadProfile(player.getName()); -- if (profile == null) { -- profile = new StoredProfile(player.getUniqueId(), player.getName(), true, player.getAddress().toString()); -- } -- -- BukkitLoginSession session = new BukkitLoginSession(player.getName(), isRegistered, profile); -- -- // enable auto login based on the value of 'autoLoginFloodgate' in config.yml -- session.setVerified(autoLoginFloodgate.equals("true") -- || (autoLoginFloodgate.equals("linked") && isLinked)); -- -- // run login task -- Runnable forceLoginTask = new ForceLoginTask(plugin.getCore(), player, session); -- Bukkit.getScheduler().runTaskAsynchronously(plugin, forceLoginTask); -- } -- --} diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/task/ForceLoginTask.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/task/ForceLoginTask.java deleted file mode 100644 index 9a88b7e..0000000 @@ -18318,8 +16503,121 @@ index 681b31a..0000000 - // } - // } -} +diff --git a/bungee/Limelogin.bungee.iml b/bungee/Limelogin.bungee.iml +new file mode 100644 +index 0000000..09874bc +--- /dev/null ++++ b/bungee/Limelogin.bungee.iml +@@ -0,0 +1,106 @@ ++ ++ ++ ++ ++ ++ ++ BUNGEECORD ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ +\ No newline at end of file diff --git a/bungee/pom.xml b/bungee/pom.xml -index 6012212..2e6f977 100644 +index 2724922..7cbdc04 100644 --- a/bungee/pom.xml +++ b/bungee/pom.xml @@ -30,18 +30,18 @@ @@ -18355,8 +16653,46 @@ index 6012212..2e6f977 100644 ${project.version} +diff --git a/core/limelogin.core.iml b/core/limelogin.core.iml +new file mode 100644 +index 0000000..218e53c +--- /dev/null ++++ b/core/limelogin.core.iml +@@ -0,0 +1,31 @@ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ +\ No newline at end of file diff --git a/core/pom.xml b/core/pom.xml -index 9a52278..ccdc63a 100644 +index 24e4937..17535a4 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -30,16 +30,16 @@ @@ -18381,6 +16717,27 @@ index 9a52278..ccdc63a 100644 +diff --git a/limelogin-parent.iml b/limelogin-parent.iml +new file mode 100644 +index 0000000..d838761 +--- /dev/null ++++ b/limelogin-parent.iml +@@ -0,0 +1,14 @@ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ +\ No newline at end of file diff --git a/pom.xml b/pom.xml index 6031c25..b65c5a4 100644 --- a/pom.xml @@ -18455,5 +16812,5 @@ index 6031c25..b65c5a4 100644 com.mycila license-maven-plugin -- -2.32.0.windows.1 +2.25.1 diff --git a/FastLogin-Patches/0002-Added-old-commits-from-forked-repo-Fastlogin.patch b/FastLogin-Patches/0002-Added-old-commits-from-forked-repo-Fastlogin.patch index dfed89f..158e96f 100644 --- a/FastLogin-Patches/0002-Added-old-commits-from-forked-repo-Fastlogin.patch +++ b/FastLogin-Patches/0002-Added-old-commits-from-forked-repo-Fastlogin.patch @@ -1,4 +1,4 @@ -From 979a51e843ef6c205ad839317f99ac6a7ea76062 Mon Sep 17 00:00:00 2001 +From 914ab071cda9943fb43d8544cd75d971f2e699cb Mon Sep 17 00:00:00 2001 From: mohammed jasem alaajel <34905970+ham1255@users.noreply.github.com> Date: Mon, 14 Jun 2021 22:27:22 +0400 Subject: [PATCH] Added old commits from forked repo Fastlogin @@ -6,10 +6,10 @@ Subject: [PATCH] Added old commits from forked repo Fastlogin commits: \nAuto-add - character for offline mode users\nFix empty database getting users marked as cracked falsely\nDon't save offline mode user to database\nalways use false to fix an error\nsome debug stuff...\nadd GovindasPreSecondAttemptEvent\nshade sqlite so we can stop using mariadb for fastlogin diff --git a/bungee/pom.xml b/bungee/pom.xml -index 2e6f977..9f9c28a 100644 +index 7cbdc04..eafeda5 100644 --- a/bungee/pom.xml +++ b/bungee/pom.xml -@@ -170,5 +170,11 @@ +@@ -176,5 +176,11 @@ true provided @@ -22,10 +22,10 @@ index 2e6f977..9f9c28a 100644 diff --git a/bungee/src/main/java/com/github/games647/fastlogin/bungee/listener/ConnectListener.java b/bungee/src/main/java/com/github/games647/fastlogin/bungee/listener/ConnectListener.java -index 8a81b14..db8f269 100644 +index 8777a60..fef86f5 100644 --- a/bungee/src/main/java/com/github/games647/fastlogin/bungee/listener/ConnectListener.java +++ b/bungee/src/main/java/com/github/games647/fastlogin/bungee/listener/ConnectListener.java -@@ -42,6 +42,7 @@ import java.lang.invoke.MethodHandle; +@@ -40,6 +40,7 @@ import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodHandles.Lookup; import java.lang.reflect.Field; @@ -33,7 +33,7 @@ index 8a81b14..db8f269 100644 import java.util.UUID; import net.md_5.bungee.api.connection.PendingConnection; -@@ -167,6 +168,52 @@ public class ConnectListener implements Listener { +@@ -157,6 +158,52 @@ public class ConnectListener implements Listener { } } } @@ -105,7 +105,7 @@ index c52f41a..1d1c8d9 100644 softDepends: # BungeeCord auth plugins diff --git a/core/pom.xml b/core/pom.xml -index ccdc63a..3491ef0 100644 +index 17535a4..46fc0a9 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -81,7 +81,7 @@ @@ -132,7 +132,7 @@ index ccdc63a..3491ef0 100644 org.geysermc.floodgate diff --git a/core/src/main/java/com/github/games647/fastlogin/core/AuthStorage.java b/core/src/main/java/com/github/games647/fastlogin/core/AuthStorage.java -index 94500cb..b304559 100644 +index 94500cb..316445c 100644 --- a/core/src/main/java/com/github/games647/fastlogin/core/AuthStorage.java +++ b/core/src/main/java/com/github/games647/fastlogin/core/AuthStorage.java @@ -142,9 +142,8 @@ public class AuthStorage { @@ -175,7 +175,7 @@ index 94500cb..b304559 100644 saveStmt.setString(1, uuid); diff --git a/core/src/main/java/com/github/games647/fastlogin/core/shared/ForceLoginManagement.java b/core/src/main/java/com/github/games647/fastlogin/core/shared/ForceLoginManagement.java -index 7efb157..b417e64 100644 +index 7efb157..feac10d 100644 --- a/core/src/main/java/com/github/games647/fastlogin/core/shared/ForceLoginManagement.java +++ b/core/src/main/java/com/github/games647/fastlogin/core/shared/ForceLoginManagement.java @@ -92,7 +92,13 @@ public abstract class ForceLoginManagement