From 74bd0e98b17620ae52a8757a85b5c9630a8b2a5d Mon Sep 17 00:00:00 2001 From: Mohammed Alteneiji Date: Sun, 22 Dec 2024 22:55:58 +0400 Subject: [PATCH] rewrite init --- .github/workflows/gradle.yml | 27 +- LICENSE | 404 +++++++------- README.md | 19 +- api/build.gradle.kts | 85 --- .../redisbungee/AbstractRedisBungeeAPI.java | 497 ------------------ .../minecraft/redisbungee/Constants.java | 23 - .../redisbungee/api/PlayerDataManager.java | 284 ---------- .../redisbungee/api/ProxyDataManager.java | 409 -------------- .../redisbungee/api/RedisBungeeMode.java | 15 - .../redisbungee/api/RedisBungeePlugin.java | 96 ---- .../api/config/HandleMotdOrder.java | 17 - .../api/config/LangConfiguration.java | 155 ------ .../api/config/RedisBungeeConfiguration.java | 94 ---- .../api/config/loaders/ConfigLoader.java | 206 -------- .../config/loaders/GenericConfigLoader.java | 58 -- .../api/config/loaders/LangConfigLoader.java | 55 -- .../api/events/EventsPlatform.java | 33 -- .../IPlayerChangedServerNetworkEvent.java | 23 - .../api/events/IPlayerJoinedNetworkEvent.java | 19 - .../api/events/IPlayerLeftNetworkEvent.java | 19 - .../api/events/IPubSubMessageEvent.java | 20 - .../api/events/RedisBungeeEvent.java | 14 - .../api/payloads/AbstractPayload.java | 24 - .../gson/AbstractPayloadSerializer.java | 34 -- .../api/payloads/proxy/DeathPayload.java | 19 - .../api/payloads/proxy/HeartbeatPayload.java | 31 -- .../api/payloads/proxy/PubSubPayload.java | 34 -- .../api/payloads/proxy/RunCommandPayload.java | 36 -- .../proxy/gson/DeathPayloadSerializer.java | 36 -- .../gson/HeartbeatPayloadSerializer.java | 38 -- .../proxy/gson/PubSubPayloadSerializer.java | 40 -- .../gson/RunCommandPayloadSerializer.java | 38 -- .../api/summoners/JedisClusterSummoner.java | 42 -- .../api/summoners/JedisPooledSummoner.java | 60 --- .../summoners/NotClosableJedisCluster.java | 29 - .../api/summoners/NotClosableJedisPooled.java | 26 - .../redisbungee/api/summoners/Summoner.java | 28 - .../api/tasks/RedisPipelineTask.java | 49 -- .../redisbungee/api/tasks/RedisTask.java | 67 --- .../api/tasks/UUIDCleanupTask.java | 56 -- .../redisbungee/api/util/InitialUtils.java | 48 -- .../redisbungee/api/util/RedisUtil.java | 31 -- .../util/serialize/MultiMapSerialization.java | 40 -- .../api/util/uuid/CachedUUIDEntry.java | 42 -- .../api/util/uuid/NameFetcher.java | 59 --- .../api/util/uuid/UUIDFetcher.java | 77 --- .../api/util/uuid/UUIDTranslator.java | 208 -------- api/src/main/resources/REDISBUNGEE_LICENSE | 203 ------- api/src/main/resources/config.yml | 149 ------ api/src/main/resources/lang.yml | 55 -- build.gradle.kts | 0 commands/build.gradle.kts | 24 - .../redisbungee/commands/CommandLoader.java | 31 -- .../commands/CommandRedisBungee.java | 189 ------- .../commands/legacy/CommandFind.java | 34 -- .../commands/legacy/CommandGList.java | 34 -- .../commands/legacy/CommandIp.java | 34 -- .../commands/legacy/CommandLastSeen.java | 34 -- .../commands/legacy/CommandPProxy.java | 33 -- .../commands/legacy/CommandPlist.java | 35 -- .../commands/legacy/CommandSendToAll.java | 33 -- .../commands/legacy/CommandServerId.java | 33 -- .../commands/legacy/CommandServerIds.java | 36 -- .../legacy/LegacyRedisBungeeCommands.java | 260 --------- .../commands/utils/AdventureBaseCommand.java | 26 - .../commands/utils/CommandPlatformHelper.java | 36 -- .../utils/StopperUUIDCleanupTask.java | 25 - copyright_print.txt | 6 +- gradle.properties | 4 +- gradle/wrapper/gradle-wrapper.jar | Bin 43583 -> 0 bytes proxies/bungeecord/build.gradle.kts | 67 --- .../bungeecord-api/build.gradle.kts | 50 -- .../minecraft/redisbungee/RedisBungeeAPI.java | 63 --- .../PlayerChangedServerNetworkEvent.java | 52 -- .../events/PlayerJoinedNetworkEvent.java | 38 -- .../events/PlayerLeftNetworkEvent.java | 38 -- .../events/PubSubMessageEvent.java | 42 -- .../BungeeCommandPlatformHelper.java | 17 - .../redisbungee/BungeePlayerDataManager.java | 97 ---- .../minecraft/redisbungee/RedisBungee.java | 373 ------------- .../redisbungee/RedisBungeeCommandSender.java | 84 --- .../redisbungee/RedisBungeeListener.java | 192 ------- .../bungeecord/src/main/resources/plugin.yml | 6 - proxies/velocity/build.gradle.kts | 47 -- .../redisbungee/RedisBungeeCommandSource.java | 45 -- .../redisbungee/RedisBungeeListener.java | 199 ------- .../RedisBungeeVelocityPlugin.java | 387 -------------- .../VelocityCommandPlatformHelper.java | 26 - .../VelocityPlayerDataManager.java | 98 ---- .../velocity/velocity-api/build.gradle.kts | 62 --- .../minecraft/redisbungee/RedisBungeeAPI.java | 64 --- .../redisbungee/ServerObjectFetcher.java | 10 - .../PlayerChangedServerNetworkEvent.java | 52 -- .../events/PlayerJoinedNetworkEvent.java | 38 -- .../events/PlayerLeftNetworkEvent.java | 38 -- .../events/PubSubMessageEvent.java | 42 -- settings.gradle.kts | 95 ---- 97 files changed, 214 insertions(+), 7186 deletions(-) delete mode 100644 api/build.gradle.kts delete mode 100644 api/src/main/java/com/imaginarycode/minecraft/redisbungee/AbstractRedisBungeeAPI.java delete mode 100644 api/src/main/java/com/imaginarycode/minecraft/redisbungee/Constants.java delete mode 100644 api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/PlayerDataManager.java delete mode 100644 api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/ProxyDataManager.java delete mode 100644 api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/RedisBungeeMode.java delete mode 100644 api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/RedisBungeePlugin.java delete mode 100644 api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/config/HandleMotdOrder.java delete mode 100644 api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/config/LangConfiguration.java delete mode 100644 api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/config/RedisBungeeConfiguration.java delete mode 100644 api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/config/loaders/ConfigLoader.java delete mode 100644 api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/config/loaders/GenericConfigLoader.java delete mode 100644 api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/config/loaders/LangConfigLoader.java delete mode 100644 api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/events/EventsPlatform.java delete mode 100644 api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/events/IPlayerChangedServerNetworkEvent.java delete mode 100644 api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/events/IPlayerJoinedNetworkEvent.java delete mode 100644 api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/events/IPlayerLeftNetworkEvent.java delete mode 100644 api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/events/IPubSubMessageEvent.java delete mode 100644 api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/events/RedisBungeeEvent.java delete mode 100644 api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/payloads/AbstractPayload.java delete mode 100644 api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/payloads/gson/AbstractPayloadSerializer.java delete mode 100644 api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/payloads/proxy/DeathPayload.java delete mode 100644 api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/payloads/proxy/HeartbeatPayload.java delete mode 100644 api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/payloads/proxy/PubSubPayload.java delete mode 100644 api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/payloads/proxy/RunCommandPayload.java delete mode 100644 api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/payloads/proxy/gson/DeathPayloadSerializer.java delete mode 100644 api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/payloads/proxy/gson/HeartbeatPayloadSerializer.java delete mode 100644 api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/payloads/proxy/gson/PubSubPayloadSerializer.java delete mode 100644 api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/payloads/proxy/gson/RunCommandPayloadSerializer.java delete mode 100644 api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/summoners/JedisClusterSummoner.java delete mode 100644 api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/summoners/JedisPooledSummoner.java delete mode 100644 api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/summoners/NotClosableJedisCluster.java delete mode 100644 api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/summoners/NotClosableJedisPooled.java delete mode 100644 api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/summoners/Summoner.java delete mode 100644 api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/tasks/RedisPipelineTask.java delete mode 100644 api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/tasks/RedisTask.java delete mode 100644 api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/tasks/UUIDCleanupTask.java delete mode 100644 api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/util/InitialUtils.java delete mode 100644 api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/util/RedisUtil.java delete mode 100644 api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/util/serialize/MultiMapSerialization.java delete mode 100644 api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/util/uuid/CachedUUIDEntry.java delete mode 100644 api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/util/uuid/NameFetcher.java delete mode 100644 api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/util/uuid/UUIDFetcher.java delete mode 100644 api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/util/uuid/UUIDTranslator.java delete mode 100644 api/src/main/resources/REDISBUNGEE_LICENSE delete mode 100644 api/src/main/resources/config.yml delete mode 100644 api/src/main/resources/lang.yml delete mode 100644 build.gradle.kts delete mode 100644 commands/build.gradle.kts delete mode 100644 commands/src/main/java/com/imaginarycode/minecraft/redisbungee/commands/CommandLoader.java delete mode 100644 commands/src/main/java/com/imaginarycode/minecraft/redisbungee/commands/CommandRedisBungee.java delete mode 100644 commands/src/main/java/com/imaginarycode/minecraft/redisbungee/commands/legacy/CommandFind.java delete mode 100644 commands/src/main/java/com/imaginarycode/minecraft/redisbungee/commands/legacy/CommandGList.java delete mode 100644 commands/src/main/java/com/imaginarycode/minecraft/redisbungee/commands/legacy/CommandIp.java delete mode 100644 commands/src/main/java/com/imaginarycode/minecraft/redisbungee/commands/legacy/CommandLastSeen.java delete mode 100644 commands/src/main/java/com/imaginarycode/minecraft/redisbungee/commands/legacy/CommandPProxy.java delete mode 100644 commands/src/main/java/com/imaginarycode/minecraft/redisbungee/commands/legacy/CommandPlist.java delete mode 100644 commands/src/main/java/com/imaginarycode/minecraft/redisbungee/commands/legacy/CommandSendToAll.java delete mode 100644 commands/src/main/java/com/imaginarycode/minecraft/redisbungee/commands/legacy/CommandServerId.java delete mode 100644 commands/src/main/java/com/imaginarycode/minecraft/redisbungee/commands/legacy/CommandServerIds.java delete mode 100644 commands/src/main/java/com/imaginarycode/minecraft/redisbungee/commands/legacy/LegacyRedisBungeeCommands.java delete mode 100644 commands/src/main/java/com/imaginarycode/minecraft/redisbungee/commands/utils/AdventureBaseCommand.java delete mode 100644 commands/src/main/java/com/imaginarycode/minecraft/redisbungee/commands/utils/CommandPlatformHelper.java delete mode 100644 commands/src/main/java/com/imaginarycode/minecraft/redisbungee/commands/utils/StopperUUIDCleanupTask.java delete mode 100644 proxies/bungeecord/build.gradle.kts delete mode 100644 proxies/bungeecord/bungeecord-api/build.gradle.kts delete mode 100644 proxies/bungeecord/bungeecord-api/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungeeAPI.java delete mode 100644 proxies/bungeecord/bungeecord-api/src/main/java/com/imaginarycode/minecraft/redisbungee/events/PlayerChangedServerNetworkEvent.java delete mode 100644 proxies/bungeecord/bungeecord-api/src/main/java/com/imaginarycode/minecraft/redisbungee/events/PlayerJoinedNetworkEvent.java delete mode 100644 proxies/bungeecord/bungeecord-api/src/main/java/com/imaginarycode/minecraft/redisbungee/events/PlayerLeftNetworkEvent.java delete mode 100644 proxies/bungeecord/bungeecord-api/src/main/java/com/imaginarycode/minecraft/redisbungee/events/PubSubMessageEvent.java delete mode 100644 proxies/bungeecord/src/main/java/com/imaginarycode/minecraft/redisbungee/BungeeCommandPlatformHelper.java delete mode 100644 proxies/bungeecord/src/main/java/com/imaginarycode/minecraft/redisbungee/BungeePlayerDataManager.java delete mode 100644 proxies/bungeecord/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungee.java delete mode 100644 proxies/bungeecord/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungeeCommandSender.java delete mode 100644 proxies/bungeecord/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungeeListener.java delete mode 100644 proxies/bungeecord/src/main/resources/plugin.yml delete mode 100644 proxies/velocity/build.gradle.kts delete mode 100644 proxies/velocity/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungeeCommandSource.java delete mode 100644 proxies/velocity/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungeeListener.java delete mode 100644 proxies/velocity/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungeeVelocityPlugin.java delete mode 100644 proxies/velocity/src/main/java/com/imaginarycode/minecraft/redisbungee/VelocityCommandPlatformHelper.java delete mode 100644 proxies/velocity/src/main/java/com/imaginarycode/minecraft/redisbungee/VelocityPlayerDataManager.java delete mode 100644 proxies/velocity/velocity-api/build.gradle.kts delete mode 100644 proxies/velocity/velocity-api/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungeeAPI.java delete mode 100644 proxies/velocity/velocity-api/src/main/java/com/imaginarycode/minecraft/redisbungee/ServerObjectFetcher.java delete mode 100644 proxies/velocity/velocity-api/src/main/java/com/imaginarycode/minecraft/redisbungee/events/PlayerChangedServerNetworkEvent.java delete mode 100644 proxies/velocity/velocity-api/src/main/java/com/imaginarycode/minecraft/redisbungee/events/PlayerJoinedNetworkEvent.java delete mode 100644 proxies/velocity/velocity-api/src/main/java/com/imaginarycode/minecraft/redisbungee/events/PlayerLeftNetworkEvent.java delete mode 100644 proxies/velocity/velocity-api/src/main/java/com/imaginarycode/minecraft/redisbungee/events/PubSubMessageEvent.java delete mode 100644 settings.gradle.kts diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index f413a033..ea6da297 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -1,19 +1,17 @@ # This workflow will build a Java project with Maven # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven -name: RedisBungee Build +name: ValioBungee Build on: push: - branches: [ stable, develop ] + branches: [ "dev/rewrite" ] pull_request: - branches: [ stable, develop ] + branches: [ "dev/rewrite" ] jobs: build: - runs-on: ubuntu-latest - steps: - uses: actions/checkout@v2 - name: Set up JDK 17 @@ -22,21 +20,4 @@ jobs: java-version: '17' distribution: 'adopt' - name: Build with gradle - run: ./gradlew shadowJar - - name: Upload Bungee - uses: actions/upload-artifact@v4.4.0 - with: - # Artifact name - name: RedisBungee-Bungee - # Destination path - path: proxies/bungeecord/build/libs/* - - name: Upload Velocity - uses: actions/upload-artifact@v4.4.0 - with: - name: RedisBungee-Velocity - path: proxies/velocity/build/libs/* - - name: Upload API - uses: actions/upload-artifact@v4.4.0 - with: - name: RedisBungee-API - path: api/build/libs/* + run: ./gradlew build \ No newline at end of file diff --git a/LICENSE b/LICENSE index 50328437..f49a4e16 100644 --- a/LICENSE +++ b/LICENSE @@ -1,203 +1,201 @@ -Eclipse Public License - v 1.0 - -THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC -LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM -CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. - -1. DEFINITIONS - -"Contribution" means: - -a) in the case of the initial Contributor, the initial code and documentation - distributed under this Agreement, and -b) in the case of each subsequent Contributor: - i) changes to the Program, and - ii) additions to the Program; - - where such changes and/or additions to the Program originate from and are - distributed by that particular Contributor. A Contribution 'originates' - from a Contributor if it was added to the Program by such Contributor - itself or anyone acting on such Contributor's behalf. Contributions do not - include additions to the Program which: (i) are separate modules of - software distributed in conjunction with the Program under their own - license agreement, and (ii) are not derivative works of the Program. - -"Contributor" means any person or entity that distributes the Program. - -"Licensed Patents" mean patent claims licensable by a Contributor which are -necessarily infringed by the use or sale of its Contribution alone or when -combined with the Program. - -"Program" means the Contributions distributed in accordance with this -Agreement. - -"Recipient" means anyone who receives the Program under this Agreement, -including all Contributors. - -2. GRANT OF RIGHTS - a) Subject to the terms of this Agreement, each Contributor hereby grants - Recipient a non-exclusive, worldwide, royalty-free copyright license to - reproduce, prepare derivative works of, publicly display, publicly - perform, distribute and sublicense the Contribution of such Contributor, - if any, and such derivative works, in source code and object code form. - b) Subject to the terms of this Agreement, each Contributor hereby grants - Recipient a non-exclusive, worldwide, royalty-free patent license under - Licensed Patents to make, use, sell, offer to sell, import and otherwise - transfer the Contribution of such Contributor, if any, in source code and - object code form. This patent license shall apply to the combination of - the Contribution and the Program if, at the time the Contribution is - added by the Contributor, such addition of the Contribution causes such - combination to be covered by the Licensed Patents. The patent license - shall not apply to any other combinations which include the Contribution. - No hardware per se is licensed hereunder. - c) Recipient understands that although each Contributor grants the licenses - to its Contributions set forth herein, no assurances are provided by any - Contributor that the Program does not infringe the patent or other - intellectual property rights of any other entity. Each Contributor - disclaims any liability to Recipient for claims brought by any other - entity based on infringement of intellectual property rights or - otherwise. As a condition to exercising the rights and licenses granted - hereunder, each Recipient hereby assumes sole responsibility to secure - any other intellectual property rights needed, if any. For example, if a - third party patent license is required to allow Recipient to distribute - the Program, it is Recipient's responsibility to acquire that license - before distributing the Program. - d) Each Contributor represents that to its knowledge it has sufficient - copyright rights in its Contribution, if any, to grant the copyright - license set forth in this Agreement. - -3. REQUIREMENTS - -A Contributor may choose to distribute the Program in object code form under -its own license agreement, provided that: - - a) it complies with the terms and conditions of this Agreement; and - b) its license agreement: - i) effectively disclaims on behalf of all Contributors all warranties - and conditions, express and implied, including warranties or - conditions of title and non-infringement, and implied warranties or - conditions of merchantability and fitness for a particular purpose; - ii) effectively excludes on behalf of all Contributors all liability for - damages, including direct, indirect, special, incidental and - consequential damages, such as lost profits; - iii) states that any provisions which differ from this Agreement are - offered by that Contributor alone and not by any other party; and - iv) states that source code for the Program is available from such - Contributor, and informs licensees how to obtain it in a reasonable - manner on or through a medium customarily used for software exchange. - -When the Program is made available in source code form: - - a) it must be made available under this Agreement; and - b) a copy of this Agreement must be included with each copy of the Program. - Contributors may not remove or alter any copyright notices contained - within the Program. - -Each Contributor must identify itself as the originator of its Contribution, -if -any, in a manner that reasonably allows subsequent Recipients to identify the -originator of the Contribution. - -4. COMMERCIAL DISTRIBUTION - -Commercial distributors of software may accept certain responsibilities with -respect to end users, business partners and the like. While this license is -intended to facilitate the commercial use of the Program, the Contributor who -includes the Program in a commercial product offering should do so in a manner -which does not create potential liability for other Contributors. Therefore, -if a Contributor includes the Program in a commercial product offering, such -Contributor ("Commercial Contributor") hereby agrees to defend and indemnify -every other Contributor ("Indemnified Contributor") against any losses, -damages and costs (collectively "Losses") arising from claims, lawsuits and -other legal actions brought by a third party against the Indemnified -Contributor to the extent caused by the acts or omissions of such Commercial -Contributor in connection with its distribution of the Program in a commercial -product offering. The obligations in this section do not apply to any claims -or Losses relating to any actual or alleged intellectual property -infringement. In order to qualify, an Indemnified Contributor must: -a) promptly notify the Commercial Contributor in writing of such claim, and -b) allow the Commercial Contributor to control, and cooperate with the -Commercial Contributor in, the defense and any related settlement -negotiations. The Indemnified Contributor may participate in any such claim at -its own expense. - -For example, a Contributor might include the Program in a commercial product -offering, Product X. That Contributor is then a Commercial Contributor. If -that Commercial Contributor then makes performance claims, or offers -warranties related to Product X, those performance claims and warranties are -such Commercial Contributor's responsibility alone. Under this section, the -Commercial Contributor would have to defend claims against the other -Contributors related to those performance claims and warranties, and if a -court requires any other Contributor to pay any damages as a result, the -Commercial Contributor must pay those damages. - -5. NO WARRANTY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN -"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR -IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, -NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each -Recipient is solely responsible for determining the appropriateness of using -and distributing the Program and assumes all risks associated with its -exercise of rights under this Agreement , including but not limited to the -risks and costs of program errors, compliance with applicable laws, damage to -or loss of data, programs or equipment, and unavailability or interruption of -operations. - -6. DISCLAIMER OF LIABILITY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY -CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION -LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE -EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY -OF SUCH DAMAGES. - -7. GENERAL - -If any provision of this Agreement is invalid or unenforceable under -applicable law, it shall not affect the validity or enforceability of the -remainder of the terms of this Agreement, and without further action by the -parties hereto, such provision shall be reformed to the minimum extent -necessary to make such provision valid and enforceable. - -If Recipient institutes patent litigation against any entity (including a -cross-claim or counterclaim in a lawsuit) alleging that the Program itself -(excluding combinations of the Program with other software or hardware) -infringes such Recipient's patent(s), then such Recipient's rights granted -under Section 2(b) shall terminate as of the date such litigation is filed. - -All Recipient's rights under this Agreement shall terminate if it fails to -comply with any of the material terms or conditions of this Agreement and does -not cure such failure in a reasonable period of time after becoming aware of -such noncompliance. If all Recipient's rights under this Agreement terminate, -Recipient agrees to cease use and distribution of the Program as soon as -reasonably practicable. However, Recipient's obligations under this Agreement -and any licenses granted by Recipient relating to the Program shall continue -and survive. - -Everyone is permitted to copy and distribute copies of this Agreement, but in -order to avoid inconsistency the Agreement is copyrighted and may only be -modified in the following manner. The Agreement Steward reserves the right to -publish new versions (including revisions) of this Agreement from time to -time. No one other than the Agreement Steward has the right to modify this -Agreement. The Eclipse Foundation is the initial Agreement Steward. The -Eclipse Foundation may assign the responsibility to serve as the Agreement -Steward to a suitable separate entity. Each new version of the Agreement will -be given a distinguishing version number. The Program (including -Contributions) may always be distributed subject to the version of the -Agreement under which it was received. In addition, after a new version of the -Agreement is published, Contributor may elect to distribute the Program -(including its Contributions) under the new version. Except as expressly -stated in Sections 2(a) and 2(b) above, Recipient receives no rights or -licenses to the intellectual property of any Contributor under this Agreement, -whether expressly, by implication, estoppel or otherwise. All rights in the -Program not expressly granted under this Agreement are reserved. - -This Agreement is governed by the laws of the State of New York and the -intellectual property laws of the United States of America. No party to this -Agreement will bring a legal action under this Agreement more than one year -after the cause of action arose. Each party waives its rights to a jury trial in -any resulting litigation. \ No newline at end of file + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. \ No newline at end of file diff --git a/README.md b/README.md index f50a7c13..d9ea2a08 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,8 @@ -# RedisBungee Limework's Fork +# ValioBungee: RedisBungee Limework's Fork The original project of RedisBungee is no longer maintained, so we have forked the plugin. -RedisBungee uses [Redis](https://redis.io) with Java client [Jedis](https://github.com/redis/jedis/) -to Synchronize players data between [BungeeCord](https://github.com/SpigotMC/BungeeCord) -or [Velocity*](https://github.com/PaperMC/Velocity) proxies - -## Downloads - -[![](https://raw.githubusercontent.com/Prospector/badges/master/modrinth-badge-72h-padded.png)](https://modrinth.com/plugin/redisbungee) +this is complete rewrite of the plugin. And does not use any code from pre-rewrite. +which allow us to re-license the project to Apache license v2 ## Wiki @@ -19,11 +14,5 @@ open an issue with question button ## License -This project is distributed under Eclipse Public License 1.0 - -You can find it [here](https://github.com/proxiodev/RedisBungee/blob/master/LICENSE) - -You can find the original RedisBungee is by [astei](https://github.com/astei) and project can be -found [here](https://github.com/minecrafter/RedisBungee) or spigot -page [here, but its no longer available](https://www.spigotmc.org/resources/redisbungee.13494/) +This project is licensed under Apache License 2.0 diff --git a/api/build.gradle.kts b/api/build.gradle.kts deleted file mode 100644 index 282cdfd5..00000000 --- a/api/build.gradle.kts +++ /dev/null @@ -1,85 +0,0 @@ -import java.time.Instant -import java.io.ByteArrayOutputStream - -plugins { - `java-library` - `maven-publish` - id("net.kyori.blossom") version "1.2.0" - -} - -dependencies { - api(libs.guava) - api(libs.jedis) - api(libs.okhttp) - api(libs.configurate) - api(libs.caffeine) - api(libs.adventure.api) - api(libs.adventure.gson) - api(libs.adventure.legacy) - api(libs.adventure.plain) - api(libs.adventure.miniMessage) -} - -description = "RedisBungee interfaces" - -blossom { - replaceToken("@version@", "$version") - // GIT - val commit: String; - val commitStdout = ByteArrayOutputStream() - rootProject.exec { - standardOutput = commitStdout - commandLine("git", "rev-parse", "HEAD") - } - commit = "$commitStdout".replace("\n", "") // for some reason it adds new line so remove it. - commitStdout.close() - replaceToken("@git_commit@", commit) -} - - -java { - withJavadocJar() - withSourcesJar() -} - -tasks { - // thanks again for paper too - withType { - val options = options as StandardJavadocDocletOptions - options.use() - options.isDocFilesSubDirs = true - val jedisVersion = libs.jedis.get().version - val configurateVersion = libs.configurate.get().version - val guavaVersion = libs.guava.get().version - val adventureVersion = libs.adventure.plain.get().version - options.links( - "https://configurate.aoeu.xyz/$configurateVersion/apidocs/", // configurate - "https://javadoc.io/doc/redis.clients/jedis/$jedisVersion/", // jedis - "https://guava.dev/releases/$guavaVersion/api/docs/", // guava - "https://javadoc.io/doc/com.github.ben-manes.caffeine/caffeine", - "https://jd.advntr.dev/api/$adventureVersion" - - ) - - } - - compileJava { - options.encoding = Charsets.UTF_8.name() - options.release.set(17) - } - javadoc { - options.encoding = Charsets.UTF_8.name() - } - processResources { - filteringCharset = Charsets.UTF_8.name() - } -} - -publishing { - publications { - create("maven") { - from(components["java"]) - } - } -} diff --git a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/AbstractRedisBungeeAPI.java b/api/src/main/java/com/imaginarycode/minecraft/redisbungee/AbstractRedisBungeeAPI.java deleted file mode 100644 index 50f475eb..00000000 --- a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/AbstractRedisBungeeAPI.java +++ /dev/null @@ -1,497 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee; - -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Multimap; -import com.imaginarycode.minecraft.redisbungee.api.RedisBungeeMode; -import com.imaginarycode.minecraft.redisbungee.api.RedisBungeePlugin; -import com.imaginarycode.minecraft.redisbungee.api.summoners.JedisClusterSummoner; -import com.imaginarycode.minecraft.redisbungee.api.summoners.JedisPooledSummoner; -import com.imaginarycode.minecraft.redisbungee.api.summoners.Summoner; -import net.kyori.adventure.text.Component; -import org.checkerframework.checker.nullness.qual.NonNull; -import org.checkerframework.checker.nullness.qual.Nullable; -import redis.clients.jedis.Jedis; -import redis.clients.jedis.JedisCluster; -import redis.clients.jedis.JedisPool; -import redis.clients.jedis.JedisPooled; - -import java.net.InetAddress; -import java.util.*; - -/** - * This abstract class is extended by platform plugin to provide some platform specific methods. - * overall its general contains all methods needed by external usage. - * - * @author Ham1255 - * @since 0.8.0 - */ -@SuppressWarnings("unused") -public abstract class AbstractRedisBungeeAPI { - protected final RedisBungeePlugin plugin; - private static AbstractRedisBungeeAPI abstractRedisBungeeAPI; - - public AbstractRedisBungeeAPI(RedisBungeePlugin plugin) { - // this does make sure that no one can replace first initiated API class. - if (abstractRedisBungeeAPI == null) { - abstractRedisBungeeAPI = this; - } - this.plugin = plugin; - } - - /** - * Get a combined count of all players on this network. - * - * @return a count of all players found - */ - public final int getPlayerCount() { - return plugin.proxyDataManager().totalNetworkPlayers(); - } - - /** - * Get the last time a player was on. If the player is currently online, this will return 0. If the player has not been recorded, - * this will return -1. Otherwise it will return a value in milliseconds. - * - * @param player a player name - * @return the last time a player was on, if online returns a 0 - */ - public final long getLastOnline(@NonNull UUID player) { - return plugin.playerDataManager().getLastOnline(player); - } - - /** - * Get the server where the specified player is playing. This function also deals with the case of local players - * as well, and will return local information on them. - * - * @param player a player uuid - * @return a String name for the server the player is on. Can be Null if plugins is doing weird stuff to the proxy internals - */ - @Nullable - public final String getServerNameFor(@NonNull UUID player) { - return plugin.playerDataManager().getServerFor(player); - } - - /** - * Get a combined list of players on this network. - *

- * Note that this function returns an instance of {@link com.google.common.collect.ImmutableSet}. - * - * @return a Set with all players found - */ - public final Set getPlayersOnline() { - return plugin.proxyDataManager().networkPlayers(); - } - - /** - * Get a combined list of players on this network, as a collection of usernames. - * - * @return a Set with all players found - * @see #getNameFromUuid(java.util.UUID) - * @since 0.3 - */ - public final Collection getHumanPlayersOnline() { - Set names = new HashSet<>(); - for (UUID uuid : getPlayersOnline()) { - names.add(getNameFromUuid(uuid, false)); - } - return names; - } - - /** - * Get a full list of players on all servers. - * - * @return a immutable Multimap with all players found on this network - * @since 0.2.5 - */ - public final Multimap getServerToPlayers() { - return plugin.playerDataManager().serversToPlayers(); - } - - /** - * Get a list of players on the server with the given name. - * - * @param server a server name - * @return a Set with all players found on this server - */ - public final Set getPlayersOnServer(@NonNull String server) { - return ImmutableSet.copyOf(getServerToPlayers().get(server)); - } - - /** - * Get a list of players on the specified proxy. - * - * @param proxyID proxy id - * @return a Set with all UUIDs found on this proxy - */ - public final Set getPlayersOnProxy(@NonNull String proxyID) { - return plugin.proxyDataManager().getPlayersOn(proxyID); - } - - /** - * Convenience method: Checks if the specified player is online. - * - * @param player a player name - * @return if the player is online - */ - public final boolean isPlayerOnline(@NonNull UUID player) { - return getLastOnline(player) == 0; - } - - /** - * Get the {@link java.net.InetAddress} associated with this player. - * - * @param player the player to fetch the IP for - * @return an {@link java.net.InetAddress} if the player is online, null otherwise - * @since 0.2.4 - */ - public final InetAddress getPlayerIp(@NonNull UUID player) { - return plugin.playerDataManager().getIpFor(player); - } - - /** - * Get the RedisBungee proxy ID this player is connected to. - * - * @param player the player to fetch the IP for - * @return the proxy the player is connected to, or null if they are offline - * @since 0.3.3 - */ - public final String getProxy(@NonNull UUID player) { - return plugin.playerDataManager().getProxyFor(player); - } - - /** - * Sends a proxy command to all proxies. - * - * @param command the command to send and execute - * @see #sendProxyCommand(String, String) - * @since 0.2.5 - */ - public final void sendProxyCommand(@NonNull String command) { - sendProxyCommand("allservers", command); - } - - /** - * Sends a proxy command to the proxy with the given ID. "allservers" means all proxies. - * - * @param proxyId a proxy ID - * @param command the command to send and execute - * @see #getProxyId() - * @see #getAllProxies() - * @since 0.2.5 - */ - public final void sendProxyCommand(@NonNull String proxyId, @NonNull String command) { - plugin.proxyDataManager().sendCommandTo(proxyId, command); - } - - /** - * Sends a message to a PubSub channel which makes PubSubMessageEvent fire. - *

- * Note: Since 0.12.0 registering a channel api is no longer required - * - * @param channel The PubSub channel - * @param message the message body to send - * @since 0.3.3 - */ - public final void sendChannelMessage(@NonNull String channel, @NonNull String message) { - plugin.proxyDataManager().sendChannelMessage(channel, message); - } - - /** - * Get the current BungeeCord / Velocity proxy ID for this server. - * - * @return the current server ID - * @see #getAllProxies() - * @since 0.8.0 - */ - public final String getProxyId() { - return plugin.proxyDataManager().proxyId(); - } - - /** - * Get the current BungeeCord / Velocity proxy ID for this server. - * - * @return the current server ID - * @see #getAllServers() - * @since 0.2.5 - * @deprecated to avoid confusion between A server and A proxy see #getProxyId() - */ - @Deprecated(forRemoval = true) - public final String getServerId() { - return getProxyId(); - } - - /** - * Get all the linked proxies in this network. - * - * @return the list of all proxies - * @see #getProxyId() - * @since 0.8.0 - */ - public final List getAllProxies() { - return plugin.proxyDataManager().proxiesIds(); - } - - /** - * Get all the linked proxies in this network. - * - * @return the list of all proxies - * @see #getServerId() - * @since 0.2.5 - * @deprecated to avoid confusion between A server and A proxy see see {@link #getAllProxies()} - */ - @Deprecated(forRemoval = true) - public final List getAllServers() { - return getAllProxies(); - } - - /** - * Register (a) PubSub channel(s), so that you may handle PubSubMessageEvent for it. - * - * @param channels the channels to register - * @since 0.3 - * @deprecated No longer required - */ - @Deprecated(forRemoval = true) - public final void registerPubSubChannels(String... channels) { - } - - /** - * Unregister (a) PubSub channel(s). - * - * @param channels the channels to unregister - * @since 0.3 - * @deprecated No longer required - */ - @Deprecated(forRemoval = true) - public final void unregisterPubSubChannels(String... channels) { - } - - /** - * Fetch a name from the specified UUID. UUIDs are cached locally and in Redis. This function falls back to Mojang - * as a last resort, so calls may be blocking. - *

- * For the common use case of translating a list of UUIDs into names, use {@link #getHumanPlayersOnline()} instead. - *

- * If performance is a concern, use {@link #getNameFromUuid(java.util.UUID, boolean)} as this allows you to disable Mojang lookups. - * - * @param uuid the UUID to fetch the name for - * @return the name for the UUID - * @since 0.3 - */ - public final String getNameFromUuid(@NonNull UUID uuid) { - return getNameFromUuid(uuid, true); - } - - /** - * Fetch a name from the specified UUID. UUIDs are cached locally and in Redis. This function can fall back to Mojang - * as a last resort if {@code expensiveLookups} is true, so calls may be blocking. - *

- * For the common use case of translating the list of online players into names, use {@link #getHumanPlayersOnline()}. - *

- * If performance is a concern, set {@code expensiveLookups} to false as this will disable lookups via Mojang. - * - * @param uuid the UUID to fetch the name for - * @param expensiveLookups whether or not to perform potentially expensive lookups - * @return the name for the UUID - * @since 0.3.2 - */ - public final String getNameFromUuid(@NonNull UUID uuid, boolean expensiveLookups) { - return plugin.getUuidTranslator().getNameFromUuid(uuid, expensiveLookups); - } - - /** - * Fetch a UUID from the specified name. Names are cached locally and in Redis. This function falls back to Mojang - * as a last resort, so calls may be blocking. - *

- * If performance is a concern, see {@link #getUuidFromName(String, boolean)}, which disables the following functions: - *

    - *
  • Searching local entries case-insensitively
  • - *
  • Searching Mojang
  • - *
- * - * @param name the UUID to fetch the name for - * @return the UUID for the name - * @since 0.3 - */ - public final UUID getUuidFromName(@NonNull String name) { - return getUuidFromName(name, true); - } - - /** - * Fetch a UUID from the specified name. Names are cached locally and in Redis. This function falls back to Mojang - * as a last resort if {@code expensiveLookups} is true, so calls may be blocking. - *

- * If performance is a concern, set {@code expensiveLookups} to false to disable searching Mojang and searching for usernames - * case-insensitively. - * - * @param name the UUID to fetch the name for - * @param expensiveLookups whether or not to perform potentially expensive lookups - * @return the {@link UUID} for the name - * @since 0.3.2 - */ - public final UUID getUuidFromName(@NonNull String name, boolean expensiveLookups) { - return plugin.getUuidTranslator().getTranslatedUuid(name, expensiveLookups); - } - - - /** - * Kicks a player from the network - * calls {@link #getUuidFromName(String)} to get uuid - * - * @param playerName player name - * @param message kick message that player will see on kick - * @since 0.8.0 - * @deprecated - */ - @Deprecated(forRemoval = true) - public void kickPlayer(String playerName, String message) { - kickPlayer(getUuidFromName(playerName), message); - } - - /** - * Kicks a player from the network - * - * @param playerUUID player name - * @param message kick message that player will see on kick - * @since 0.8.0 - * @deprecated - */ - @Deprecated(forRemoval = true) - public void kickPlayer(UUID playerUUID, String message) { - kickPlayer(playerUUID, Component.text(message)); - } - - /** - * Kicks a player from the network - * calls {@link #getUuidFromName(String)} to get uuid - * - * @param playerName player name - * @param message kick message that player will see on kick - * @since 0.12.0 - */ - - public void kickPlayer(String playerName, Component message) { - kickPlayer(getUuidFromName(playerName), message); - } - - /** - * Kicks a player from the network - * - * @param playerUUID player name - * @param message kick message that player will see on kick - * @since 0.12.0 - */ - public void kickPlayer(UUID playerUUID, Component message) { - this.plugin.playerDataManager().kickPlayer(playerUUID, message); - } - - - /** - * This gives you instance of Jedis - * - * @return {@link Jedis} - * @throws IllegalStateException if the {@link #getMode()} is not equal to {@link RedisBungeeMode#SINGLE} - * @see #getJedisPool() - * @since 0.7.0 - * @deprecated use {@link #getSummoner() } - */ - @Deprecated(forRemoval = true) - public Jedis requestJedis() { - if (getMode() == RedisBungeeMode.SINGLE) { - return getJedisPool().getResource(); - } else { - throw new IllegalStateException("Mode is not " + RedisBungeeMode.SINGLE); - } - } - - /** - * This gets Redis Bungee {@link JedisPool} - * - * @return {@link JedisPool} - * @throws IllegalStateException if the {@link #getMode()} is not equal to {@link RedisBungeeMode#SINGLE} - * @throws IllegalStateException if JedisPool compatibility mode is disabled in the config - * @since 0.6.5 - */ - public JedisPool getJedisPool() { - if (getMode() == RedisBungeeMode.SINGLE) { - JedisPool jedisPool = ((JedisPooledSummoner) this.plugin.getSummoner()).getCompatibilityJedisPool(); - if (jedisPool == null) { - throw new IllegalStateException("JedisPool compatibility mode is disabled, Please enable it in the RedisBungee config.yml"); - } - return jedisPool; - } else { - throw new IllegalStateException("Mode is not " + RedisBungeeMode.SINGLE); - } - } - - /** - * This gives you an instance of JedisCluster that can't be closed - * see {@link com.imaginarycode.minecraft.redisbungee.api.summoners.NotClosableJedisCluster} - * - * @return {@link redis.clients.jedis.JedisCluster} - * @throws IllegalStateException if the {@link #getMode()} is not equal to {@link RedisBungeeMode#CLUSTER} - * @since 0.8.0 - * @deprecated use {@link #getSummoner()} - */ - @Deprecated(forRemoval = true) - public JedisCluster requestClusterJedis() { - if (getMode() == RedisBungeeMode.CLUSTER) { - return ((JedisClusterSummoner) this.plugin.getSummoner()).obtainResource(); - } else { - throw new IllegalStateException("Mode is not " + RedisBungeeMode.CLUSTER); - } - } - - /** - * This gives you an instance of JedisPooled that can't be closed - * see {@link com.imaginarycode.minecraft.redisbungee.api.summoners.NotClosableJedisPooled} - * - * @return {@link redis.clients.jedis.JedisPooled} - * @throws IllegalStateException if the {@link #getMode()} is not equal to {@link RedisBungeeMode#SINGLE} - * @since 0.8.0 - * @deprecated use {@link #getSummoner()} - */ - @Deprecated(forRemoval = true) - public JedisPooled requestJedisPooled() { - if (getMode() == RedisBungeeMode.SINGLE) { - return ((JedisPooledSummoner) this.plugin.getSummoner()).obtainResource(); - } else { - throw new IllegalStateException("Mode is not " + RedisBungeeMode.SINGLE); - } - } - - /** - * returns Summoner class responsible for Single Jedis {@link redis.clients.jedis.JedisPooled} with {@link JedisPool}, Cluster Jedis {@link redis.clients.jedis.JedisCluster} handling - * - * @return {@link Summoner} - * @since 0.8.0 - */ - public Summoner getSummoner() { - return this.plugin.getSummoner(); - } - - - /** - * shows what mode is RedisBungee is on - * Basically what every redis mode is used like cluster or single instance. - * - * @return {@link RedisBungeeMode} - * @since 0.8.0 - */ - public RedisBungeeMode getMode() { - return this.plugin.getRedisBungeeMode(); - } - - public static AbstractRedisBungeeAPI getAbstractRedisBungeeAPI() { - return abstractRedisBungeeAPI; - } -} diff --git a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/Constants.java b/api/src/main/java/com/imaginarycode/minecraft/redisbungee/Constants.java deleted file mode 100644 index 4471b0fc..00000000 --- a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/Constants.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - - -package com.imaginarycode.minecraft.redisbungee; - -public class Constants { - - public final static String VERSION = "@version@"; - public final static String GIT_COMMIT = "@git_commit@"; - - public static String getGithubCommitLink() { - return "https://github.com/ProxioDev/RedisBungee/commit/" + GIT_COMMIT; - } - -} diff --git a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/PlayerDataManager.java b/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/PlayerDataManager.java deleted file mode 100644 index 653ffcc2..00000000 --- a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/PlayerDataManager.java +++ /dev/null @@ -1,284 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee.api; - -import com.github.benmanes.caffeine.cache.Caffeine; -import com.github.benmanes.caffeine.cache.LoadingCache; -import com.google.common.collect.ImmutableMultimap; -import com.google.common.collect.Multimap; -import com.google.common.net.InetAddresses; -import com.imaginarycode.minecraft.redisbungee.api.events.IPlayerChangedServerNetworkEvent; -import com.imaginarycode.minecraft.redisbungee.api.events.IPlayerLeftNetworkEvent; -import com.imaginarycode.minecraft.redisbungee.api.events.IPubSubMessageEvent; -import com.imaginarycode.minecraft.redisbungee.api.tasks.RedisPipelineTask; -import net.kyori.adventure.text.Component; -import net.kyori.adventure.text.serializer.json.JSONComponentSerializer; -import org.json.JSONObject; -import redis.clients.jedis.ClusterPipeline; -import redis.clients.jedis.Pipeline; -import redis.clients.jedis.Response; -import redis.clients.jedis.UnifiedJedis; - -import java.net.InetAddress; -import java.util.*; -import java.util.concurrent.TimeUnit; - -public abstract class PlayerDataManager { - - protected final RedisBungeePlugin

plugin; - private final Object SERVERS_TO_PLAYERS_KEY = new Object(); - private final UnifiedJedis unifiedJedis; - private final String proxyId; - private final String networkId; - private final LoadingCache serverCache = Caffeine.newBuilder().expireAfterWrite(1, TimeUnit.HOURS).build(this::getServerFromRedis); - private final LoadingCache lastServerCache = Caffeine.newBuilder().expireAfterWrite(1, TimeUnit.HOURS).build(this::getLastServerFromRedis); - private final LoadingCache proxyCache = Caffeine.newBuilder().expireAfterWrite(1, TimeUnit.HOURS).build(this::getProxyFromRedis); - private final LoadingCache ipCache = Caffeine.newBuilder().expireAfterWrite(1, TimeUnit.HOURS).build(this::getIpAddressFromRedis); - private final LoadingCache> serverToPlayersCache = Caffeine.newBuilder().expireAfterWrite(10, TimeUnit.MINUTES).build(this::serversToPlayersBuilder); - private final JSONComponentSerializer COMPONENT_SERIALIZER = JSONComponentSerializer.json(); - - public PlayerDataManager(RedisBungeePlugin

plugin) { - this.plugin = plugin; - this.unifiedJedis = plugin.proxyDataManager().unifiedJedis(); - this.proxyId = plugin.proxyDataManager().proxyId(); - this.networkId = plugin.proxyDataManager().networkId(); - } - - // handle network wide - // server change - //l public abstract void onPlayerChangedServerNetworkEvent(SC event); - - // public abstract void onNetworkPlayerQuit(NJE event); - - // local events - //public abstract void onPubSubMessageEvent(PS event); - - //public abstract void onServerConnectedEvent(CE event); - - //public abstract void onLoginEvent(LE event); - - //public abstract void onDisconnectEvent(DE event); - - protected void handleNetworkPlayerServerChange(IPlayerChangedServerNetworkEvent event) { - this.serverCache.invalidate(event.getUuid()); - this.lastServerCache.invalidate(event.getUuid()); - - //TODO: We could also rely on redisbungee-serverchange pubsub messages to update the cache in-place without querying redis. That would be a lot more efficient. - this.serverToPlayersCache.invalidate(SERVERS_TO_PLAYERS_KEY); - } - - protected void handleNetworkPlayerQuit(IPlayerLeftNetworkEvent event) { - this.proxyCache.invalidate(event.getUuid()); - this.serverCache.invalidate(event.getUuid()); - this.ipCache.invalidate(event.getUuid()); - - //TODO: We could also rely on redisbungee-serverchange pubsub messages to update the cache in-place without querying redis. That would be a lot more efficient. - this.serverToPlayersCache.invalidate(SERVERS_TO_PLAYERS_KEY); - } - - protected void handlePubSubMessageEvent(IPubSubMessageEvent event) { - // kick api - if (event.getChannel().equals("redisbungee-kick")) { - JSONObject data = new JSONObject(event.getMessage()); - String proxy = data.getString("proxy"); - if (proxy.equals(this.proxyId)) { - return; - } - UUID uuid = UUID.fromString(data.getString("uuid")); - String message = data.getString("message"); - plugin.handlePlatformKick(uuid, COMPONENT_SERIALIZER.deserialize(message)); - return; - } - if (event.getChannel().equals("redisbungee-serverchange")) { - JSONObject data = new JSONObject(event.getMessage()); - String proxy = data.getString("proxy"); - if (proxy.equals(this.proxyId)) { - return; - } - UUID uuid = UUID.fromString(data.getString("uuid")); - String from = null; - if (data.has("from")) from = data.getString("from"); - String to = data.getString("to"); - plugin.fireEvent(plugin.createPlayerChangedServerNetworkEvent(uuid, from, to)); - return; - } - if (event.getChannel().equals("redisbungee-player-join")) { - JSONObject data = new JSONObject(event.getMessage()); - String proxy = data.getString("proxy"); - if (proxy.equals(this.proxyId)) { - return; - } - UUID uuid = UUID.fromString(data.getString("uuid")); - plugin.fireEvent(plugin.createPlayerJoinedNetworkEvent(uuid)); - return; - } - if (event.getChannel().equals("redisbungee-player-leave")) { - JSONObject data = new JSONObject(event.getMessage()); - String proxy = data.getString("proxy"); - if (proxy.equals(this.proxyId)) { - return; - } - UUID uuid = UUID.fromString(data.getString("uuid")); - plugin.fireEvent(plugin.createPlayerLeftNetworkEvent(uuid)); - } - - } - - protected void playerChangedServer(UUID uuid, String from, String to) { - JSONObject data = new JSONObject(); - data.put("proxy", this.proxyId); - data.put("uuid", uuid); - data.put("from", from); - data.put("to", to); - plugin.proxyDataManager().sendChannelMessage("redisbungee-serverchange", data.toString()); - plugin.fireEvent(plugin.createPlayerChangedServerNetworkEvent(uuid, from, to)); - handleServerChangeRedis(uuid, to); - } - - public void kickPlayer(UUID uuid, Component message) { - if (!plugin.handlePlatformKick(uuid, message)) { // handle locally before SENDING a message - JSONObject data = new JSONObject(); - data.put("proxy", this.proxyId); - data.put("uuid", uuid); - data.put("message", COMPONENT_SERIALIZER.serialize(message)); - plugin.proxyDataManager().sendChannelMessage("redisbungee-kick", data.toString()); - } - } - - private void handleServerChangeRedis(UUID uuid, String server) { - Map data = new HashMap<>(); - data.put("server", server); - data.put("last-server", server); - unifiedJedis.hset("redis-bungee::" + this.networkId + "::player::" + uuid + "::data", data); - } - - protected void addPlayer(final UUID uuid, final String name, final InetAddress inetAddress) { - Map redisData = new HashMap<>(); - redisData.put("last-online", String.valueOf(0)); - redisData.put("proxy", this.proxyId); - redisData.put("ip", inetAddress.getHostAddress()); - unifiedJedis.hset("redis-bungee::" + this.networkId + "::player::" + uuid + "::data", redisData); - plugin.getUuidTranslator().persistInfo(name, uuid, this.unifiedJedis); - JSONObject data = new JSONObject(); - data.put("proxy", this.proxyId); - data.put("uuid", uuid); - plugin.proxyDataManager().sendChannelMessage("redisbungee-player-join", data.toString()); - plugin.fireEvent(plugin.createPlayerJoinedNetworkEvent(uuid)); - this.plugin.proxyDataManager().addPlayer(uuid); - } - - protected void removePlayer(UUID uuid) { - unifiedJedis.hset("redis-bungee::" + this.networkId + "::player::" + uuid + "::data", "last-online", String.valueOf(System.currentTimeMillis())); - unifiedJedis.hdel("redis-bungee::" + this.networkId + "::player::" + uuid + "::data", "server", "proxy", "ip"); - JSONObject data = new JSONObject(); - data.put("proxy", this.proxyId); - data.put("uuid", uuid); - plugin.proxyDataManager().sendChannelMessage("redisbungee-player-leave", data.toString()); - plugin.fireEvent(plugin.createPlayerLeftNetworkEvent(uuid)); - this.plugin.proxyDataManager().removePlayer(uuid); - } - - - protected String getProxyFromRedis(UUID uuid) { - return unifiedJedis.hget("redis-bungee::" + this.networkId + "::player::" + uuid + "::data", "proxy"); - } - - protected String getServerFromRedis(UUID uuid) { - return unifiedJedis.hget("redis-bungee::" + this.networkId + "::player::" + uuid + "::data", "server"); - } - - protected String getLastServerFromRedis(UUID uuid) { - return unifiedJedis.hget("redis-bungee::" + this.networkId + "::player::" + uuid + "::data", "last-server"); - } - - protected InetAddress getIpAddressFromRedis(UUID uuid) { - String ip = unifiedJedis.hget("redis-bungee::" + this.networkId + "::player::" + uuid + "::data", "ip"); - if (ip == null) return null; - return InetAddresses.forString(ip); - } - - protected long getLastOnlineFromRedis(UUID uuid) { - String unixString = unifiedJedis.hget("redis-bungee::" + this.networkId + "::player::" + uuid + "::data", "last-online"); - if (unixString == null) return -1; - return Long.parseLong(unixString); - } - - public String getLastServerFor(UUID uuid) { - return this.lastServerCache.get(uuid); - } - - public String getServerFor(UUID uuid) { - return this.serverCache.get(uuid); - } - - public String getProxyFor(UUID uuid) { - return this.proxyCache.get(uuid); - } - - public InetAddress getIpFor(UUID uuid) { - return this.ipCache.get(uuid); - } - - public long getLastOnline(UUID uuid) { - return getLastOnlineFromRedis(uuid); - } - - public Multimap serversToPlayers() { - return this.serverToPlayersCache.get(SERVERS_TO_PLAYERS_KEY); - } - - protected Multimap serversToPlayersBuilder(Object o) { - try { - return new RedisPipelineTask>(plugin) { - private final Set uuids = plugin.proxyDataManager().networkPlayers(); - private final ImmutableMultimap.Builder builder = ImmutableMultimap.builder(); - - @Override - public Multimap doPooledPipeline(Pipeline pipeline) { - HashMap> responses = new HashMap<>(); - for (UUID uuid : uuids) { - Optional.ofNullable(pipeline.hget("redis-bungee::" + networkId + "::player::" + uuid + "::data", "server")).ifPresent(stringResponse -> { - responses.put(uuid, stringResponse); - }); - } - pipeline.sync(); - responses.forEach((uuid, response) -> { - String key = response.get(); - if (key == null) return; - - builder.put(key, uuid); - }); - return builder.build(); - } - - @Override - public Multimap clusterPipeline(ClusterPipeline pipeline) { - HashMap> responses = new HashMap<>(); - for (UUID uuid : uuids) { - Optional.ofNullable(pipeline.hget("redis-bungee::" + networkId + "::player::" + uuid + "::data", "server")).ifPresent(stringResponse -> { - responses.put(uuid, stringResponse); - }); - } - pipeline.sync(); - responses.forEach((uuid, response) -> { - String key = response.get(); - if (key == null) return; - builder.put(key, uuid); - }); - return builder.build(); - } - }.call(); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - -} diff --git a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/ProxyDataManager.java b/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/ProxyDataManager.java deleted file mode 100644 index 07a5df3a..00000000 --- a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/ProxyDataManager.java +++ /dev/null @@ -1,409 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee.api; - -import com.google.common.collect.ImmutableMap; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.imaginarycode.minecraft.redisbungee.api.payloads.AbstractPayload; -import com.imaginarycode.minecraft.redisbungee.api.payloads.gson.AbstractPayloadSerializer; -import com.imaginarycode.minecraft.redisbungee.api.payloads.proxy.DeathPayload; -import com.imaginarycode.minecraft.redisbungee.api.payloads.proxy.HeartbeatPayload; -import com.imaginarycode.minecraft.redisbungee.api.payloads.proxy.PubSubPayload; -import com.imaginarycode.minecraft.redisbungee.api.payloads.proxy.RunCommandPayload; -import com.imaginarycode.minecraft.redisbungee.api.payloads.proxy.gson.DeathPayloadSerializer; -import com.imaginarycode.minecraft.redisbungee.api.payloads.proxy.gson.HeartbeatPayloadSerializer; -import com.imaginarycode.minecraft.redisbungee.api.payloads.proxy.gson.PubSubPayloadSerializer; -import com.imaginarycode.minecraft.redisbungee.api.payloads.proxy.gson.RunCommandPayloadSerializer; -import com.imaginarycode.minecraft.redisbungee.api.tasks.RedisPipelineTask; -import com.imaginarycode.minecraft.redisbungee.api.util.RedisUtil; -import redis.clients.jedis.*; -import redis.clients.jedis.params.XAddParams; -import redis.clients.jedis.params.XReadParams; -import redis.clients.jedis.resps.StreamEntry; - -import java.time.Instant; -import java.util.*; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.atomic.AtomicBoolean; - -import static com.google.common.base.Preconditions.checkArgument; - -public abstract class ProxyDataManager implements Runnable { - - private static final int MAX_ENTRIES = 10000; - - private final AtomicBoolean closed = new AtomicBoolean(false); - - private final UnifiedJedis unifiedJedis; - - // data: - // Proxy id, heartbeat (unix epoch from instant), players as int - private final ConcurrentHashMap heartbeats = new ConcurrentHashMap<>(); - - private final String networkId; - - private final String proxyId; - - private final String STREAM_ID; - - // This different from proxy id, just to detect if there is duplicate proxy using same proxy id - private final UUID dataManagerUUID = UUID.randomUUID(); - - protected final RedisBungeePlugin plugin; - - private final Gson gson = new GsonBuilder().registerTypeAdapter(AbstractPayload.class, new AbstractPayloadSerializer()).registerTypeAdapter(HeartbeatPayload.class, new HeartbeatPayloadSerializer()).registerTypeAdapter(DeathPayload.class, new DeathPayloadSerializer()).registerTypeAdapter(PubSubPayload.class, new PubSubPayloadSerializer()).registerTypeAdapter(RunCommandPayload.class, new RunCommandPayloadSerializer()).create(); - - public ProxyDataManager(RedisBungeePlugin plugin) { - this.plugin = plugin; - this.proxyId = this.plugin.configuration().getProxyId(); - this.unifiedJedis = plugin.getSummoner().obtainResource(); - this.networkId = plugin.configuration().networkId(); - this.STREAM_ID = "network-" + this.networkId + "-redisbungee-stream"; - this.destroyProxyMembers(); - } - - public abstract Set getLocalOnlineUUIDs(); - - public Set getPlayersOn(String proxyId) { - checkArgument(proxiesIds().contains(proxyId), proxyId + " is not a valid proxy ID"); - if (proxyId.equals(this.proxyId)) return this.getLocalOnlineUUIDs(); - if (!this.heartbeats.containsKey(proxyId)) { - return new HashSet<>(); // return empty hashset or null? - } - return getProxyMembers(proxyId); - } - - // this skip checking if proxy is and its package private - // due proxy shutdown shenanigans - public boolean isPlayerTrulyOnProxy(String proxyId, UUID uuid) { - return unifiedJedis.sismember("redisbungee::" + this.networkId + "::proxies::" + proxyId + "::online-players", uuid.toString()); - } - - - public List proxiesIds() { - return Collections.list(this.heartbeats.keys()); - } - - public synchronized void sendCommandTo(String proxyToRun, String command) { - if (isClosed()) return; - if (proxyToRun.equals("allservers") || proxyToRun.equals(this.proxyId())) { - handlePlatformCommandExecution(command); - } - publishPayload(new RunCommandPayload(this.proxyId, proxyToRun, command)); - } - - public synchronized void sendChannelMessage(String channel, String message) { - if (isClosed()) return; - this.plugin.fireEvent(this.plugin.createPubSubEvent(channel, message)); - publishPayload(new PubSubPayload(this.proxyId, channel, message)); - } - - // call every 1 second - public synchronized void publishHeartbeat() { - if (isClosed()) return; - HeartbeatPayload.HeartbeatData heartbeatData = new HeartbeatPayload.HeartbeatData(Instant.now().getEpochSecond(), this.getLocalOnlineUUIDs().size()); - this.heartbeats.put(this.proxyId(), heartbeatData); - publishPayload(new HeartbeatPayload(this.proxyId, heartbeatData)); - } - - public Set networkPlayers() { - try { - return new RedisPipelineTask>(this.plugin) { - @Override - public Set doPooledPipeline(Pipeline pipeline) { - HashSet>> responses = new HashSet<>(); - for (String proxyId : proxiesIds()) { - responses.add(pipeline.smembers("redisbungee::" + networkId + "::proxies::" + proxyId + "::online-players")); - } - pipeline.sync(); - HashSet uuids = new HashSet<>(); - for (Response> response : responses) { - for (String stringUUID : response.get()) { - uuids.add(UUID.fromString(stringUUID)); - } - } - return uuids; - } - - @Override - public Set clusterPipeline(ClusterPipeline pipeline) { - HashSet>> responses = new HashSet<>(); - for (String proxyId : proxiesIds()) { - responses.add(pipeline.smembers("redisbungee::" + networkId + "::proxies::" + proxyId + "::online-players")); - } - pipeline.sync(); - HashSet uuids = new HashSet<>(); - for (Response> response : responses) { - for (String stringUUID : response.get()) { - uuids.add(UUID.fromString(stringUUID)); - } - } - return uuids; - } - }.call(); - } catch (Exception e) { - throw new RuntimeException("unable to get network players", e); - } - - } - - public int totalNetworkPlayers() { - int players = 0; - for (HeartbeatPayload.HeartbeatData value : this.heartbeats.values()) { - players += value.players(); - } - return players; - } - - public Map eachProxyCount() { - ImmutableMap.Builder builder = ImmutableMap.builder(); - heartbeats.forEach((proxy, data) -> builder.put(proxy, data.players())); - return builder.build(); - } - - // Call on close - private synchronized void publishDeath() { - publishPayload(new DeathPayload(this.proxyId)); - } - - private void publishPayload(AbstractPayload payload) { - Map data = new HashMap<>(); - data.put("payload", gson.toJson(payload)); - data.put("data-manager-uuid", this.dataManagerUUID.toString()); - data.put("class", payload.getClassName()); - this.unifiedJedis.xadd(STREAM_ID, XAddParams.xAddParams().maxLen(MAX_ENTRIES).id(StreamEntryID.NEW_ENTRY), data); - } - - - private void handleHeartBeat(HeartbeatPayload payload) { - String id = payload.senderProxy(); - if (!heartbeats.containsKey(id)) { - plugin.logInfo("Proxy {} has connected", id); - } - heartbeats.put(id, payload.data()); - } - - - // call every 1 minutes - public void correctionTask() { - // let's check this proxy players - Set localOnlineUUIDs = getLocalOnlineUUIDs(); - Set storedRedisUuids = getProxyMembers(this.proxyId); - - if (!localOnlineUUIDs.equals(storedRedisUuids)) { - plugin.logWarn("De-synced playerS set detected correcting...."); - Set add = new HashSet<>(localOnlineUUIDs); - Set remove = new HashSet<>(storedRedisUuids); - add.removeAll(storedRedisUuids); - remove.removeAll(localOnlineUUIDs); - for (UUID uuid : add) { - plugin.logWarn("found {} that isn't in the set, adding it to the Corrected set", uuid); - } - for (UUID uuid : remove) { - plugin.logWarn("found {} that does not belong to this proxy removing it from the corrected set", uuid); - } - try { - new RedisPipelineTask(plugin) { - @Override - public Void doPooledPipeline(Pipeline pipeline) { - Set removeString = new HashSet<>(); - for (UUID uuid : remove) { - removeString.add(uuid.toString()); - } - Set addString = new HashSet<>(); - for (UUID uuid : add) { - addString.add(uuid.toString()); - } - pipeline.srem("redisbungee::" + networkId + "::proxies::" + proxyId + "::online-players", removeString.toArray(new String[]{})); - pipeline.sadd("redisbungee::" + networkId + "::proxies::" + proxyId + "::online-players", addString.toArray(new String[]{})); - pipeline.sync(); - return null; - } - - @Override - public Void clusterPipeline(ClusterPipeline pipeline) { - Set removeString = new HashSet<>(); - for (UUID uuid : remove) { - removeString.add(uuid.toString()); - } - Set addString = new HashSet<>(); - for (UUID uuid : add) { - addString.add(uuid.toString()); - } - pipeline.srem("redisbungee::" + networkId + "::proxies::" + proxyId + "::online-players", removeString.toArray(new String[]{})); - pipeline.sadd("redisbungee::" + networkId + "::proxies::" + proxyId + "::online-players", addString.toArray(new String[]{})); - pipeline.sync(); - return null; - } - }.call(); - } catch (Exception e) { - throw new RuntimeException(e); - } - plugin.logInfo("Player set has been corrected!"); - } - - - // handle dead proxies "THAT" Didn't send death payload but considered dead due TIMEOUT ~30 seconds - final Set deadProxies = new HashSet<>(); - for (Map.Entry stringHeartbeatDataEntry : this.heartbeats.entrySet()) { - String id = stringHeartbeatDataEntry.getKey(); - long heartbeat = stringHeartbeatDataEntry.getValue().heartbeat(); - if (Instant.now().getEpochSecond() - heartbeat > RedisUtil.PROXY_TIMEOUT) { - deadProxies.add(id); - cleanProxy(id); - } - } - try { - new RedisPipelineTask(plugin) { - @Override - public Void doPooledPipeline(Pipeline pipeline) { - for (String deadProxy : deadProxies) { - pipeline.del("redisbungee::" + networkId + "::proxies::" + deadProxy + "::online-players"); - } - pipeline.sync(); - return null; - } - - @Override - public Void clusterPipeline(ClusterPipeline pipeline) { - for (String deadProxy : deadProxies) { - pipeline.del("redisbungee::" + networkId + "::proxies::" + deadProxy + "::online-players"); - } - pipeline.sync(); - return null; - } - }.call(); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - private void handleProxyDeath(DeathPayload payload) { - cleanProxy(payload.senderProxy()); - } - - private void cleanProxy(String id) { - if (id.equals(this.proxyId())) { - return; - } - for (UUID uuid : getProxyMembers(id)) plugin.fireEvent(plugin.createPlayerLeftNetworkEvent(uuid)); - this.heartbeats.remove(id); - plugin.logInfo("Proxy {} has disconnected", id); - } - - private void handleChannelMessage(PubSubPayload payload) { - String channel = payload.channel(); - String message = payload.message(); - this.plugin.fireEvent(this.plugin.createPubSubEvent(channel, message)); - } - - protected abstract void handlePlatformCommandExecution(String command); - - private void handleCommand(RunCommandPayload payload) { - String proxyToRun = payload.proxyToRun(); - String command = payload.command(); - if (proxyToRun.equals("allservers") || proxyToRun.equals(this.proxyId())) { - handlePlatformCommandExecution(command); - } - } - - - public void addPlayer(UUID uuid) { - this.unifiedJedis.sadd("redisbungee::" + this.networkId + "::proxies::" + this.proxyId + "::online-players", uuid.toString()); - } - - public void removePlayer(UUID uuid) { - this.unifiedJedis.srem("redisbungee::" + this.networkId + "::proxies::" + this.proxyId + "::online-players", uuid.toString()); - } - - private void destroyProxyMembers() { - unifiedJedis.del("redisbungee::" + this.networkId + "::proxies::" + this.proxyId + "::online-players"); - } - - private Set getProxyMembers(String proxyId) { - Set uuidsStrings = unifiedJedis.smembers("redisbungee::" + this.networkId + "::proxies::" + proxyId + "::online-players"); - HashSet uuids = new HashSet<>(); - for (String proxyMember : uuidsStrings) { - uuids.add(UUID.fromString(proxyMember)); - } - return uuids; - } - - private StreamEntryID lastStreamEntryID; - - // polling from stream - @Override - public void run() { - while (!isClosed()) { - try { - List>> data = unifiedJedis.xread(XReadParams.xReadParams().block(0), Collections.singletonMap(STREAM_ID, lastStreamEntryID != null ? lastStreamEntryID : StreamEntryID.LAST_ENTRY)); - for (Map.Entry> datum : data) { - for (StreamEntry streamEntry : datum.getValue()) { - this.lastStreamEntryID = streamEntry.getID(); - String payloadData = streamEntry.getFields().get("payload"); - String clazz = streamEntry.getFields().get("class"); - UUID payloadDataManagerUUID = UUID.fromString(streamEntry.getFields().get("data-manager-uuid")); - - AbstractPayload unknownPayload = (AbstractPayload) gson.fromJson(payloadData, Class.forName(clazz)); - - if (unknownPayload.senderProxy().equals(this.proxyId)) { - if (!payloadDataManagerUUID.equals(this.dataManagerUUID)) { - plugin.logWarn("detected other proxy is using same ID! {} this can cause issues, please shutdown this proxy and change the id!", this.proxyId); - } - continue; - } - if (unknownPayload instanceof HeartbeatPayload payload) { - handleHeartBeat(payload); - } else if (unknownPayload instanceof DeathPayload payload) { - handleProxyDeath(payload); - } else if (unknownPayload instanceof RunCommandPayload payload) { - handleCommand(payload); - } else if (unknownPayload instanceof PubSubPayload payload) { - handleChannelMessage(payload); - } else { - plugin.logWarn("got unknown data manager payload: {}", unknownPayload.getClassName()); - } - } - } - } catch (Exception e) { - this.plugin.logFatal("an error has occurred in the stream", e); - try { - Thread.sleep(5000); - } catch (InterruptedException ignored) { - } - } - } - } - - public void close() { - closed.set(true); - this.publishDeath(); - this.heartbeats.clear(); - this.destroyProxyMembers(); - } - - public boolean isClosed() { - return closed.get(); - } - - public String proxyId() { - return proxyId; - } - - public UnifiedJedis unifiedJedis() { - return unifiedJedis; - } - - public String networkId() { - return networkId; - } -} diff --git a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/RedisBungeeMode.java b/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/RedisBungeeMode.java deleted file mode 100644 index 33a5b478..00000000 --- a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/RedisBungeeMode.java +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee.api; - -public enum RedisBungeeMode { - SINGLE, CLUSTER -} diff --git a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/RedisBungeePlugin.java b/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/RedisBungeePlugin.java deleted file mode 100644 index 8dc6887a..00000000 --- a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/RedisBungeePlugin.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee.api; - -import com.imaginarycode.minecraft.redisbungee.AbstractRedisBungeeAPI; -import com.imaginarycode.minecraft.redisbungee.api.config.LangConfiguration; -import com.imaginarycode.minecraft.redisbungee.api.config.RedisBungeeConfiguration; -import com.imaginarycode.minecraft.redisbungee.api.events.EventsPlatform; -import com.imaginarycode.minecraft.redisbungee.api.summoners.Summoner; -import com.imaginarycode.minecraft.redisbungee.api.util.uuid.UUIDTranslator; -import net.kyori.adventure.text.Component; - -import java.net.InetAddress; -import java.util.UUID; -import java.util.concurrent.TimeUnit; - - -/** - * This Class has all internal methods needed by every redis bungee plugin, and it can be used to implement another platforms than bungeecord or another forks of RedisBungee - *

- * Reason this is interface because some proxies implementations require the user to extend class for plugins for example bungeecord. - * - * @author Ham1255 - * @since 0.7.0 - */ -public interface RedisBungeePlugin

extends EventsPlatform { - - default void initialize() { - - } - - default void stop() { - - } - - void logInfo(String msg); - - void logInfo(String format, Object... object); - - void logWarn(String msg); - - void logWarn(String format, Object... object); - - void logFatal(String msg); - - void logFatal(String format, Throwable throwable); - - RedisBungeeConfiguration configuration(); - - LangConfiguration langConfiguration(); - - Summoner getSummoner(); - - RedisBungeeMode getRedisBungeeMode(); - - AbstractRedisBungeeAPI getAbstractRedisBungeeApi(); - - ProxyDataManager proxyDataManager(); - - PlayerDataManager playerDataManager(); - - UUIDTranslator getUuidTranslator(); - - boolean isOnlineMode(); - - P getPlayer(UUID uuid); - - P getPlayer(String name); - - UUID getPlayerUUID(String player); - - - String getPlayerName(UUID player); - - boolean handlePlatformKick(UUID uuid, Component message); - - String getPlayerServerName(P player); - - boolean isPlayerOnAServer(P player); - - InetAddress getPlayerIp(P player); - - void executeAsync(Runnable runnable); - - void executeAsyncAfter(Runnable runnable, TimeUnit timeUnit, int time); - - -} diff --git a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/config/HandleMotdOrder.java b/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/config/HandleMotdOrder.java deleted file mode 100644 index 07b7f21c..00000000 --- a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/config/HandleMotdOrder.java +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee.api.config; - -public enum HandleMotdOrder { - FIRST, - NORMAL, - LAST -} diff --git a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/config/LangConfiguration.java b/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/config/LangConfiguration.java deleted file mode 100644 index 87aaa11c..00000000 --- a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/config/LangConfiguration.java +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee.api.config; - -import net.kyori.adventure.text.Component; -import net.kyori.adventure.text.minimessage.MiniMessage; -import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; - -import java.util.HashMap; -import java.util.Locale; -import java.util.Map; - -/** - * This language support implementation is temporarily - * until I come up with better system but for now we will use Maps instead :/ - * Todo: possible usage of adventure api - */ -public class LangConfiguration { - - private interface RegistrableMessages { - - void register(String id, Locale locale, String miniMessage); - - void test(Locale locale); - - default void throwError(Locale locale, String where) { - throw new IllegalStateException("Language system in `" + where + "` found missing entries for " + locale.toString()); - } - - } - - public static class Messages implements RegistrableMessages{ - - private final Map LOGGED_IN_FROM_OTHER_LOCATION; - private final Map ALREADY_LOGGED_IN; - private final Map SERVER_CONNECTING; - private final Map SERVER_NOT_FOUND; - - private final Locale defaultLocale; - - public Messages(Locale defaultLocale) { - LOGGED_IN_FROM_OTHER_LOCATION = new HashMap<>(); - ALREADY_LOGGED_IN = new HashMap<>(); - SERVER_CONNECTING = new HashMap<>(); - SERVER_NOT_FOUND = new HashMap<>(); - this.defaultLocale = defaultLocale; - } - - public void register(String id, Locale locale, String miniMessage) { - switch (id) { - case "server-not-found" -> SERVER_NOT_FOUND.put(locale, miniMessage); - case "server-connecting" -> SERVER_CONNECTING.put(locale, miniMessage); - case "logged-in-other-location" -> LOGGED_IN_FROM_OTHER_LOCATION.put(locale, MiniMessage.miniMessage().deserialize(miniMessage)); - case "already-logged-in" -> ALREADY_LOGGED_IN.put(locale, MiniMessage.miniMessage().deserialize(miniMessage)); - } - } - - public Component alreadyLoggedIn(Locale locale) { - if (ALREADY_LOGGED_IN.containsKey(locale)) return ALREADY_LOGGED_IN.get(locale); - return ALREADY_LOGGED_IN.get(defaultLocale); - } - - // there is no way to know whats client locale during login so just default to use default locale MESSAGES. - public Component alreadyLoggedIn() { - return this.alreadyLoggedIn(this.defaultLocale); - } - - public Component loggedInFromOtherLocation(Locale locale) { - if (LOGGED_IN_FROM_OTHER_LOCATION.containsKey(locale)) return LOGGED_IN_FROM_OTHER_LOCATION.get(locale); - return LOGGED_IN_FROM_OTHER_LOCATION.get(defaultLocale); - } - - // there is no way to know what's client locale during login so just default to use default locale MESSAGES. - public Component loggedInFromOtherLocation() { - return this.loggedInFromOtherLocation(this.defaultLocale); - } - - public Component serverConnecting(Locale locale, String server) { - String miniMessage; - if (SERVER_CONNECTING.containsKey(locale)) { - miniMessage = SERVER_CONNECTING.get(locale); - } else { - miniMessage = SERVER_CONNECTING.get(defaultLocale); - } - return MiniMessage.miniMessage().deserialize(miniMessage, Placeholder.parsed("server", server)); - } - - public Component serverConnecting(String server) { - return this.serverConnecting(this.defaultLocale, server); - } - - public Component serverNotFound(Locale locale, String server) { - String miniMessage; - if (SERVER_NOT_FOUND.containsKey(locale)) { - miniMessage = SERVER_NOT_FOUND.get(locale); - } else { - miniMessage = SERVER_NOT_FOUND.get(defaultLocale); - } - return MiniMessage.miniMessage().deserialize(miniMessage, Placeholder.parsed("server", server)); - } - - public Component serverNotFound(String server) { - return this.serverNotFound(this.defaultLocale, server); - } - - - // tests locale if set CORRECTLY or just throw if not - public void test(Locale locale) { - if (!(LOGGED_IN_FROM_OTHER_LOCATION.containsKey(locale) && ALREADY_LOGGED_IN.containsKey(locale) && SERVER_CONNECTING.containsKey(locale) && SERVER_NOT_FOUND.containsKey(locale))) { - throwError(locale, "messages"); - } - } - - } - - private final Component redisBungeePrefix; - - private final Locale defaultLanguage; - - private final boolean useClientLanguage; - - private final Messages messages; - - public LangConfiguration(Component redisBungeePrefix, Locale defaultLanguage, boolean useClientLanguage, Messages messages) { - this.redisBungeePrefix = redisBungeePrefix; - this.defaultLanguage = defaultLanguage; - this.useClientLanguage = useClientLanguage; - this.messages = messages; - } - - public Component redisBungeePrefix() { - return redisBungeePrefix; - } - - public Locale defaultLanguage() { - return defaultLanguage; - } - - public boolean useClientLanguage() { - return useClientLanguage; - } - - public Messages messages() { - return messages; - } - -} diff --git a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/config/RedisBungeeConfiguration.java b/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/config/RedisBungeeConfiguration.java deleted file mode 100644 index 4a27b403..00000000 --- a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/config/RedisBungeeConfiguration.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee.api.config; - -import com.google.common.collect.ImmutableList; -import com.google.common.net.InetAddresses; - -import javax.annotation.Nullable; -import java.net.InetAddress; -import java.util.List; - -public class RedisBungeeConfiguration { - - private final String proxyId; - private final List exemptAddresses; - private final boolean kickWhenOnline; - - private final boolean handleReconnectToLastServer; - private final boolean handleMotd; - private final HandleMotdOrder handleMotdOrder; - - private final CommandsConfiguration commandsConfiguration; - private final String networkId; - - - public RedisBungeeConfiguration(String networkId, String proxyId, List exemptAddresses, boolean kickWhenOnline, boolean handleReconnectToLastServer, boolean handleMotd, HandleMotdOrder handleMotdOrder, CommandsConfiguration commandsConfiguration) { - this.proxyId = proxyId; - ImmutableList.Builder addressBuilder = ImmutableList.builder(); - for (String s : exemptAddresses) { - addressBuilder.add(InetAddresses.forString(s)); - } - this.exemptAddresses = addressBuilder.build(); - this.kickWhenOnline = kickWhenOnline; - this.handleReconnectToLastServer = handleReconnectToLastServer; - this.handleMotd = handleMotd; - this.handleMotdOrder = handleMotdOrder; - this.commandsConfiguration = commandsConfiguration; - this.networkId = networkId; - } - - public String getProxyId() { - return proxyId; - } - - public List getExemptAddresses() { - return exemptAddresses; - } - - public boolean kickWhenOnline() { - return kickWhenOnline; - } - - public boolean handleMotd() { - return this.handleMotd; - } - - public HandleMotdOrder handleMotdOrder() { - return handleMotdOrder; - } - - public boolean handleReconnectToLastServer() { - return this.handleReconnectToLastServer; - } - - public record CommandsConfiguration(boolean redisbungeeEnabled, boolean redisbungeeLegacyEnabled, - @Nullable LegacySubCommandsConfiguration legacySubCommandsConfiguration) { - - } - - public record LegacySubCommandsConfiguration(boolean findEnabled, boolean glistEnabled, boolean ipEnabled, - boolean lastseenEnabled, boolean plistEnabled, boolean pproxyEnabled, - boolean sendtoallEnabled, boolean serveridEnabled, - boolean serveridsEnabled, boolean installFind, boolean installGlist, boolean installIp, - boolean installLastseen, boolean installPlist, boolean installPproxy, - boolean installSendtoall, boolean installServerid, - boolean installServerids) { - } - - public CommandsConfiguration commandsConfiguration() { - return commandsConfiguration; - } - - public String networkId() { - return networkId; - } -} diff --git a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/config/loaders/ConfigLoader.java b/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/config/loaders/ConfigLoader.java deleted file mode 100644 index 415b43ae..00000000 --- a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/config/loaders/ConfigLoader.java +++ /dev/null @@ -1,206 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee.api.config.loaders; - - -import com.google.common.reflect.TypeToken; -import com.imaginarycode.minecraft.redisbungee.api.RedisBungeeMode; -import com.imaginarycode.minecraft.redisbungee.api.RedisBungeePlugin; -import com.imaginarycode.minecraft.redisbungee.api.config.HandleMotdOrder; -import com.imaginarycode.minecraft.redisbungee.api.config.RedisBungeeConfiguration; -import com.imaginarycode.minecraft.redisbungee.api.summoners.JedisClusterSummoner; -import com.imaginarycode.minecraft.redisbungee.api.summoners.JedisPooledSummoner; -import com.imaginarycode.minecraft.redisbungee.api.summoners.Summoner; -import ninja.leaping.configurate.ConfigurationNode; -import ninja.leaping.configurate.objectmapping.ObjectMappingException; -import ninja.leaping.configurate.yaml.YAMLConfigurationLoader; -import org.apache.commons.pool2.impl.GenericObjectPoolConfig; -import redis.clients.jedis.*; -import redis.clients.jedis.providers.ClusterConnectionProvider; -import redis.clients.jedis.providers.PooledConnectionProvider; - -import java.io.IOException; -import java.nio.file.Path; -import java.util.*; - -public interface ConfigLoader extends GenericConfigLoader { - - int CONFIG_VERSION = 2; - - default void loadConfig(RedisBungeePlugin plugin, Path dataFolder) throws IOException { - Path configFile = createConfigFile(dataFolder, "config.yml", "config.yml"); - final YAMLConfigurationLoader yamlConfigurationFileLoader = YAMLConfigurationLoader.builder().setPath(configFile).build(); - ConfigurationNode node = yamlConfigurationFileLoader.load(); - if (node.getNode("config-version").getInt(0) != CONFIG_VERSION) { - handleOldConfig(dataFolder, "config.yml", "config.yml"); - node = yamlConfigurationFileLoader.load(); - } - final boolean useSSL = node.getNode("useSSL").getBoolean(false); - final boolean kickWhenOnline = node.getNode("kick-when-online").getBoolean(true); - String redisPassword = node.getNode("redis-password").getString(""); - String redisUsername = node.getNode("redis-username").getString(""); - String networkId = node.getNode("network-id").getString("main"); - String proxyId = node.getNode("proxy-id").getString("proxy-1"); - - final int maxConnections = node.getNode("max-redis-connections").getInt(10); - List exemptAddresses; - try { - exemptAddresses = node.getNode("exempt-ip-addresses").getList(TypeToken.of(String.class)); - } catch (ObjectMappingException e) { - exemptAddresses = Collections.emptyList(); - } - - // check redis password - if ((redisPassword.isEmpty() || redisPassword.equals("none"))) { - redisPassword = null; - plugin.logWarn("password is empty"); - } - if ((redisUsername.isEmpty() || redisUsername.equals("none"))) { - redisUsername = null; - } - // env var - String proxyIdFromEnv = System.getenv("REDISBUNGEE_PROXY_ID"); - if (proxyIdFromEnv != null) { - plugin.logInfo("Overriding current configured proxy id {} and been set to {} by Environment variable REDISBUNGEE_PROXY_ID", proxyId, proxyIdFromEnv); - proxyId = proxyIdFromEnv; - } - - String networkIdFromEnv = System.getenv("REDISBUNGEE_NETWORK_ID"); - if (networkIdFromEnv != null) { - plugin.logInfo("Overriding current configured network id {} and been set to {} by Environment variable REDISBUNGEE_NETWORK_ID", networkId, networkIdFromEnv); - networkId = networkIdFromEnv; - } - - // Configuration sanity checks. - if (proxyId == null || proxyId.isEmpty()) { - String genId = UUID.randomUUID().toString(); - plugin.logInfo("Generated proxy id " + genId + " and saving it to config."); - node.getNode("proxy-id").setValue(genId); - yamlConfigurationFileLoader.save(node); - proxyId = genId; - plugin.logInfo("proxy id was generated: " + proxyId); - } else { - plugin.logInfo("Loaded proxy id " + proxyId); - } - - if (networkId.isEmpty()) { - networkId = "main"; - plugin.logWarn("network id was empty and replaced with 'main'"); - } - - plugin.logInfo("Loaded network id " + networkId); - - - - boolean reconnectToLastServer = node.getNode("reconnect-to-last-server").getBoolean(); - boolean handleMotd = node.getNode("handle-motd").getBoolean(true); - plugin.logInfo("handle reconnect to last server: {}", reconnectToLastServer); - plugin.logInfo("handle motd: {}", handleMotd); - - HandleMotdOrder handleMotdOrder = HandleMotdOrder.NORMAL; - String handleMotdOrderName = node.getNode("handle-motd-priority").getString(); - if (handleMotdOrderName != null) { - try { - handleMotdOrder = HandleMotdOrder.valueOf(handleMotdOrderName.toUpperCase(Locale.ROOT)); - } catch (IllegalArgumentException e) { - plugin.logWarn("handle motd order value '{}' is unsupported (allowed: {})", handleMotdOrderName, HandleMotdOrder.values()); - } - } - plugin.logInfo("handle motd order: {}", handleMotdOrder); - - // commands - boolean redisBungeeEnabled = node.getNode("commands", "redisbungee", "enabled").getBoolean(true); - boolean redisBungeeLegacyEnabled =node.getNode("commands", "redisbungee-legacy", "enabled").getBoolean(false); - - boolean glistEnabled = node.getNode("commands", "redisbungee-legacy", "subcommands", "glist", "enabled").getBoolean(false); - boolean findEnabled = node.getNode("commands", "redisbungee-legacy", "subcommands", "find", "enabled").getBoolean(false); - boolean lastseenEnabled = node.getNode("commands", "redisbungee-legacy", "subcommands", "lastseen", "enabled").getBoolean(false); - boolean ipEnabled = node.getNode("commands", "redisbungee-legacy", "subcommands", "ip", "enabled").getBoolean(false); - boolean pproxyEnabled = node.getNode("commands", "redisbungee-legacy", "subcommands", "pproxy", "enabled").getBoolean(false); - boolean sendToAllEnabled = node.getNode("commands", "redisbungee-legacy", "subcommands", "sendtoall", "enabled").getBoolean(false); - boolean serverIdEnabled = node.getNode("commands", "redisbungee-legacy", "subcommands", "serverid", "enabled").getBoolean(false); - boolean serverIdsEnabled = node.getNode("commands", "redisbungee-legacy", "subcommands", "serverids", "enabled").getBoolean(false); - boolean pListEnabled = node.getNode("commands", "redisbungee-legacy", "subcommands", "plist", "enabled").getBoolean(false); - - boolean installGlist = node.getNode("commands", "redisbungee-legacy", "subcommands", "glist", "install").getBoolean(false); - boolean installFind = node.getNode("commands", "redisbungee-legacy", "subcommands", "find", "install").getBoolean(false); - boolean installLastseen = node.getNode("commands", "redisbungee-legacy", "subcommands", "lastseen", "install").getBoolean(false); - boolean installIp = node.getNode("commands", "redisbungee-legacy", "subcommands", "ip", "install").getBoolean(false); - boolean installPproxy = node.getNode("commands", "redisbungee-legacy", "subcommands", "pproxy", "install").getBoolean(false); - boolean installSendToAll = node.getNode("commands", "redisbungee-legacy", "subcommands", "sendtoall", "install").getBoolean(false); - boolean installServerid = node.getNode("commands", "redisbungee-legacy", "subcommands", "serverid", "install").getBoolean(false); - boolean installServerIds = node.getNode("commands", "redisbungee-legacy", "subcommands", "serverids", "install").getBoolean(false); - boolean installPlist = node.getNode("commands", "redisbungee-legacy", "subcommands", "plist", "install").getBoolean(false); - - - RedisBungeeConfiguration configuration = new RedisBungeeConfiguration(networkId, proxyId, exemptAddresses, kickWhenOnline, reconnectToLastServer, handleMotd, handleMotdOrder, - new RedisBungeeConfiguration.CommandsConfiguration( - redisBungeeEnabled, redisBungeeLegacyEnabled, - new RedisBungeeConfiguration.LegacySubCommandsConfiguration( - findEnabled, glistEnabled, ipEnabled, - lastseenEnabled, pListEnabled, pproxyEnabled, - sendToAllEnabled, serverIdEnabled, serverIdsEnabled, - installFind, installGlist, installIp, - installLastseen, installPlist, installPproxy, - installSendToAll, installServerid, installServerIds) - )); - Summoner summoner; - RedisBungeeMode redisBungeeMode; - if (useSSL) { - plugin.logInfo("Using ssl"); - } - if (node.getNode("cluster-mode-enabled").getBoolean(false)) { - plugin.logInfo("RedisBungee MODE: CLUSTER"); - Set hostAndPortSet = new HashSet<>(); - GenericObjectPoolConfig poolConfig = new GenericObjectPoolConfig<>(); - poolConfig.setMaxTotal(maxConnections); - poolConfig.setBlockWhenExhausted(true); - node.getNode("redis-cluster-servers").getChildrenList().forEach((childNode) -> { - Map hostAndPort = childNode.getChildrenMap(); - String host = hostAndPort.get("host").getString(); - int port = hostAndPort.get("port").getInt(); - hostAndPortSet.add(new HostAndPort(host, port)); - }); - plugin.logInfo(hostAndPortSet.size() + " cluster nodes were specified"); - if (hostAndPortSet.isEmpty()) { - throw new RuntimeException("No redis cluster servers specified"); - } - summoner = new JedisClusterSummoner(new ClusterConnectionProvider(hostAndPortSet, DefaultJedisClientConfig.builder().user(redisUsername).password(redisPassword).ssl(useSSL).socketTimeoutMillis(5000).timeoutMillis(10000).build(), poolConfig)); - redisBungeeMode = RedisBungeeMode.CLUSTER; - } else { - plugin.logInfo("RedisBungee MODE: SINGLE"); - final String redisServer = node.getNode("redis-server").getString("127.0.0.1"); - final int redisPort = node.getNode("redis-port").getInt(6379); - if (redisServer != null && redisServer.isEmpty()) { - throw new RuntimeException("No redis server specified"); - } - JedisPool jedisPool = null; - if (node.getNode("enable-jedis-pool-compatibility").getBoolean(false)) { - JedisPoolConfig config = new JedisPoolConfig(); - config.setMaxTotal(node.getNode("compatibility-max-connections").getInt(3)); - config.setBlockWhenExhausted(true); - jedisPool = new JedisPool(config, redisServer, redisPort, 5000, redisUsername, redisPassword, useSSL); - plugin.logInfo("Compatibility JedisPool was created"); - } - GenericObjectPoolConfig poolConfig = new GenericObjectPoolConfig<>(); - poolConfig.setMaxTotal(maxConnections); - poolConfig.setBlockWhenExhausted(true); - summoner = new JedisPooledSummoner(new PooledConnectionProvider(new ConnectionFactory(new HostAndPort(redisServer, redisPort), DefaultJedisClientConfig.builder().user(redisUsername).timeoutMillis(5000).ssl(useSSL).password(redisPassword).build()), poolConfig), jedisPool); - redisBungeeMode = RedisBungeeMode.SINGLE; - } - plugin.logInfo("Successfully connected to Redis."); - onConfigLoad(configuration, summoner, redisBungeeMode); - } - - void onConfigLoad(RedisBungeeConfiguration configuration, Summoner summoner, RedisBungeeMode mode); - - -} diff --git a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/config/loaders/GenericConfigLoader.java b/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/config/loaders/GenericConfigLoader.java deleted file mode 100644 index 78a5d29b..00000000 --- a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/config/loaders/GenericConfigLoader.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee.api.config.loaders; - -import org.jetbrains.annotations.Nullable; - -import java.io.IOException; -import java.io.InputStream; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.StandardCopyOption; -import java.time.Instant; - - -public interface GenericConfigLoader { - - // CHANGES on every reboot - String RANDOM_OLD = "backup-" + Instant.now().getEpochSecond(); - - default Path createConfigFile(Path dataFolder, String configFile, @Nullable String defaultResourceID) throws IOException { - if (Files.notExists(dataFolder)) { - Files.createDirectory(dataFolder); - } - Path file = dataFolder.resolve(configFile); - if (Files.notExists(file) && defaultResourceID != null) { - try (InputStream in = getClass().getClassLoader().getResourceAsStream(defaultResourceID)) { - Files.createFile(file); - assert in != null; - Files.copy(in, file, StandardCopyOption.REPLACE_EXISTING); - } - } - return file; - } - - default void handleOldConfig(Path dataFolder, String configFile, @Nullable String defaultResourceID) throws IOException { - Path oldConfigFolder = dataFolder.resolve("old_config"); - if (Files.notExists(oldConfigFolder)) { - Files.createDirectory(oldConfigFolder); - } - Path randomStoreConfigDirectory = oldConfigFolder.resolve(RANDOM_OLD); - if (Files.notExists(randomStoreConfigDirectory)) { - Files.createDirectory(randomStoreConfigDirectory); - } - Path oldConfigPath = dataFolder.resolve(configFile); - - Files.move(oldConfigPath, randomStoreConfigDirectory.resolve(configFile)); - createConfigFile(dataFolder, configFile, defaultResourceID); - } - -} diff --git a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/config/loaders/LangConfigLoader.java b/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/config/loaders/LangConfigLoader.java deleted file mode 100644 index ad30c429..00000000 --- a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/config/loaders/LangConfigLoader.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee.api.config.loaders; - -import com.imaginarycode.minecraft.redisbungee.api.RedisBungeePlugin; -import com.imaginarycode.minecraft.redisbungee.api.config.LangConfiguration; -import net.kyori.adventure.text.Component; -import net.kyori.adventure.text.minimessage.MiniMessage; -import ninja.leaping.configurate.ConfigurationNode; -import ninja.leaping.configurate.yaml.YAMLConfigurationLoader; - -import java.io.IOException; -import java.nio.file.Path; -import java.util.Locale; - -public interface LangConfigLoader extends GenericConfigLoader { - - int CONFIG_VERSION = 1; - - default void loadLangConfig(RedisBungeePlugin plugin, Path dataFolder) throws IOException { - Path configFile = createConfigFile(dataFolder, "lang.yml", "lang.yml"); - final YAMLConfigurationLoader yamlConfigurationFileLoader = YAMLConfigurationLoader.builder().setPath(configFile).build(); - ConfigurationNode node = yamlConfigurationFileLoader.load(); - if (node.getNode("config-version").getInt(0) != CONFIG_VERSION) { - handleOldConfig(dataFolder, "lang.yml", "lang.yml"); - node = yamlConfigurationFileLoader.load(); - } - // MINI message serializer - MiniMessage miniMessage = MiniMessage.miniMessage(); - - Component prefix = miniMessage.deserialize(node.getNode("prefix").getString("[RedisBungee]")); - Locale defaultLocale = Locale.forLanguageTag(node.getNode("default-locale").getString("en-us")); - boolean useClientLocale = node.getNode("use-client-locale").getBoolean(true); - LangConfiguration.Messages messages = new LangConfiguration.Messages(defaultLocale); - node.getNode("messages").getChildrenMap().forEach((key, childNode) -> childNode.getChildrenMap().forEach((childKey, childChildNode) -> { - messages.register(key.toString(), Locale.forLanguageTag(childKey.toString()), childChildNode.getString()); - })); - messages.test(defaultLocale); - - onLangConfigLoad(new LangConfiguration(prefix, defaultLocale, useClientLocale, messages)); - } - - - void onLangConfigLoad(LangConfiguration langConfiguration); - - -} diff --git a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/events/EventsPlatform.java b/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/events/EventsPlatform.java deleted file mode 100644 index 79dabfac..00000000 --- a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/events/EventsPlatform.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee.api.events; - -import java.util.UUID; - -/** - * Since each platform have their own events' implementation for example Bungeecord events extends Event while velocity don't - * - * @author Ham1255 - * @since 0.7.0 - */ -public interface EventsPlatform { - - IPlayerChangedServerNetworkEvent createPlayerChangedServerNetworkEvent(UUID uuid, String previousServer, String server); - - IPlayerJoinedNetworkEvent createPlayerJoinedNetworkEvent(UUID uuid); - - IPlayerLeftNetworkEvent createPlayerLeftNetworkEvent(UUID uuid); - - IPubSubMessageEvent createPubSubEvent(String channel, String message); - - void fireEvent(Object event); - -} diff --git a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/events/IPlayerChangedServerNetworkEvent.java b/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/events/IPlayerChangedServerNetworkEvent.java deleted file mode 100644 index 4b93759b..00000000 --- a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/events/IPlayerChangedServerNetworkEvent.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee.api.events; - -import java.util.UUID; - -public interface IPlayerChangedServerNetworkEvent extends RedisBungeeEvent { - - UUID getUuid(); - - String getServer(); - - String getPreviousServer(); - -} diff --git a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/events/IPlayerJoinedNetworkEvent.java b/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/events/IPlayerJoinedNetworkEvent.java deleted file mode 100644 index 14db7b70..00000000 --- a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/events/IPlayerJoinedNetworkEvent.java +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee.api.events; - -import java.util.UUID; - -public interface IPlayerJoinedNetworkEvent extends RedisBungeeEvent { - - UUID getUuid(); - -} diff --git a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/events/IPlayerLeftNetworkEvent.java b/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/events/IPlayerLeftNetworkEvent.java deleted file mode 100644 index a7b60924..00000000 --- a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/events/IPlayerLeftNetworkEvent.java +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee.api.events; - -import java.util.UUID; - -public interface IPlayerLeftNetworkEvent extends RedisBungeeEvent { - - UUID getUuid(); - -} diff --git a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/events/IPubSubMessageEvent.java b/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/events/IPubSubMessageEvent.java deleted file mode 100644 index a419e1c5..00000000 --- a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/events/IPubSubMessageEvent.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee.api.events; - -public interface IPubSubMessageEvent extends RedisBungeeEvent { - - String getChannel(); - - String getMessage(); - - -} diff --git a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/events/RedisBungeeEvent.java b/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/events/RedisBungeeEvent.java deleted file mode 100644 index 63d1ab6c..00000000 --- a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/events/RedisBungeeEvent.java +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee.api.events; - -interface RedisBungeeEvent { -} diff --git a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/payloads/AbstractPayload.java b/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/payloads/AbstractPayload.java deleted file mode 100644 index e41ee5f7..00000000 --- a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/payloads/AbstractPayload.java +++ /dev/null @@ -1,24 +0,0 @@ - -package com.imaginarycode.minecraft.redisbungee.api.payloads; - -public abstract class AbstractPayload { - - private final String senderProxy; - - public AbstractPayload(String proxyId) { - this.senderProxy = proxyId; - } - - public AbstractPayload(String senderProxy, String className) { - this.senderProxy = senderProxy; - } - - public String senderProxy() { - return senderProxy; - } - - public String getClassName() { - return getClass().getName(); - } - -} diff --git a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/payloads/gson/AbstractPayloadSerializer.java b/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/payloads/gson/AbstractPayloadSerializer.java deleted file mode 100644 index 6769ff29..00000000 --- a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/payloads/gson/AbstractPayloadSerializer.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee.api.payloads.gson; - -import com.google.gson.*; -import com.imaginarycode.minecraft.redisbungee.api.payloads.AbstractPayload; - -import java.lang.reflect.Type; - -public class AbstractPayloadSerializer implements JsonSerializer, JsonDeserializer { - - - @Override - public AbstractPayload deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { - JsonObject jsonObject = json.getAsJsonObject(); - return new AbstractPayload(jsonObject.get("proxy").getAsString(), jsonObject.get("class").getAsString()) { - }; - } - - @Override - public JsonElement serialize(AbstractPayload src, Type typeOfSrc, JsonSerializationContext context) { - JsonObject jsonObject = new JsonObject(); - jsonObject.add("proxy", new JsonPrimitive(src.senderProxy())); - return jsonObject; - } -} diff --git a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/payloads/proxy/DeathPayload.java b/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/payloads/proxy/DeathPayload.java deleted file mode 100644 index 399071ad..00000000 --- a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/payloads/proxy/DeathPayload.java +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee.api.payloads.proxy; - -import com.imaginarycode.minecraft.redisbungee.api.payloads.AbstractPayload; - -public class DeathPayload extends AbstractPayload { - public DeathPayload(String proxyId) { - super(proxyId); - } -} diff --git a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/payloads/proxy/HeartbeatPayload.java b/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/payloads/proxy/HeartbeatPayload.java deleted file mode 100644 index 02268fd8..00000000 --- a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/payloads/proxy/HeartbeatPayload.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee.api.payloads.proxy; - -import com.imaginarycode.minecraft.redisbungee.api.payloads.AbstractPayload; - -public class HeartbeatPayload extends AbstractPayload { - - public record HeartbeatData(long heartbeat, int players) { - - } - - private final HeartbeatData data; - - public HeartbeatPayload(String proxyId, HeartbeatData data) { - super(proxyId); - this.data = data; - } - - public HeartbeatData data() { - return data; - } -} diff --git a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/payloads/proxy/PubSubPayload.java b/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/payloads/proxy/PubSubPayload.java deleted file mode 100644 index eaa9092a..00000000 --- a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/payloads/proxy/PubSubPayload.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee.api.payloads.proxy; - -import com.imaginarycode.minecraft.redisbungee.api.payloads.AbstractPayload; - -public class PubSubPayload extends AbstractPayload { - - private final String channel; - private final String message; - - - public PubSubPayload(String proxyId, String channel, String message) { - super(proxyId); - this.channel = channel; - this.message = message; - } - - public String channel() { - return channel; - } - - public String message() { - return message; - } -} diff --git a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/payloads/proxy/RunCommandPayload.java b/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/payloads/proxy/RunCommandPayload.java deleted file mode 100644 index 6374e5c7..00000000 --- a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/payloads/proxy/RunCommandPayload.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee.api.payloads.proxy; - -import com.imaginarycode.minecraft.redisbungee.api.payloads.AbstractPayload; - -public class RunCommandPayload extends AbstractPayload { - - - private final String proxyToRun; - - private final String command; - - - public RunCommandPayload(String proxyId, String proxyToRun, String command) { - super(proxyId); - this.proxyToRun = proxyToRun; - this.command = command; - } - - public String proxyToRun() { - return proxyToRun; - } - - public String command() { - return command; - } -} diff --git a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/payloads/proxy/gson/DeathPayloadSerializer.java b/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/payloads/proxy/gson/DeathPayloadSerializer.java deleted file mode 100644 index d77dd512..00000000 --- a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/payloads/proxy/gson/DeathPayloadSerializer.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee.api.payloads.proxy.gson; - -import com.google.gson.*; -import com.imaginarycode.minecraft.redisbungee.api.payloads.proxy.DeathPayload; - -import java.lang.reflect.Type; - -public class DeathPayloadSerializer implements JsonSerializer, JsonDeserializer { - - private static final Gson gson = new Gson(); - - - @Override - public DeathPayload deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { - JsonObject jsonObject = json.getAsJsonObject(); - String senderProxy = jsonObject.get("proxy").getAsString(); - return new DeathPayload(senderProxy); - } - - @Override - public JsonElement serialize(DeathPayload src, Type typeOfSrc, JsonSerializationContext context) { - JsonObject jsonObject = new JsonObject(); - jsonObject.add("proxy", new JsonPrimitive(src.senderProxy())); - return jsonObject; - } -} diff --git a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/payloads/proxy/gson/HeartbeatPayloadSerializer.java b/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/payloads/proxy/gson/HeartbeatPayloadSerializer.java deleted file mode 100644 index 1f301f2c..00000000 --- a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/payloads/proxy/gson/HeartbeatPayloadSerializer.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee.api.payloads.proxy.gson; - -import com.google.gson.*; -import com.imaginarycode.minecraft.redisbungee.api.payloads.proxy.HeartbeatPayload; - -import java.lang.reflect.Type; - -public class HeartbeatPayloadSerializer implements JsonSerializer, JsonDeserializer { - - - @Override - public HeartbeatPayload deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { - JsonObject jsonObject = json.getAsJsonObject(); - String senderProxy = jsonObject.get("proxy").getAsString(); - long heartbeat = jsonObject.get("heartbeat").getAsLong(); - int players = jsonObject.get("players").getAsInt(); - return new HeartbeatPayload(senderProxy, new HeartbeatPayload.HeartbeatData(heartbeat, players)); - } - - @Override - public JsonElement serialize(HeartbeatPayload src, Type typeOfSrc, JsonSerializationContext context) { - JsonObject jsonObject = new JsonObject(); - jsonObject.add("proxy", new JsonPrimitive(src.senderProxy())); - jsonObject.add("heartbeat", new JsonPrimitive(src.data().heartbeat())); - jsonObject.add("players", new JsonPrimitive(src.data().players())); - return jsonObject; - } -} diff --git a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/payloads/proxy/gson/PubSubPayloadSerializer.java b/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/payloads/proxy/gson/PubSubPayloadSerializer.java deleted file mode 100644 index 01d66a5f..00000000 --- a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/payloads/proxy/gson/PubSubPayloadSerializer.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee.api.payloads.proxy.gson; - -import com.google.gson.*; -import com.imaginarycode.minecraft.redisbungee.api.payloads.proxy.PubSubPayload; - -import java.lang.reflect.Type; - -public class PubSubPayloadSerializer implements JsonSerializer, JsonDeserializer { - - private static final Gson gson = new Gson(); - - - @Override - public PubSubPayload deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { - JsonObject jsonObject = json.getAsJsonObject(); - String senderProxy = jsonObject.get("proxy").getAsString(); - String channel = jsonObject.get("channel").getAsString(); - String message = jsonObject.get("message").getAsString(); - return new PubSubPayload(senderProxy, channel, message); - } - - @Override - public JsonElement serialize(PubSubPayload src, Type typeOfSrc, JsonSerializationContext context) { - JsonObject jsonObject = new JsonObject(); - jsonObject.add("proxy", new JsonPrimitive(src.senderProxy())); - jsonObject.add("channel", new JsonPrimitive(src.channel())); - jsonObject.add("message", context.serialize(src.message())); - return jsonObject; - } -} diff --git a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/payloads/proxy/gson/RunCommandPayloadSerializer.java b/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/payloads/proxy/gson/RunCommandPayloadSerializer.java deleted file mode 100644 index 2a7de335..00000000 --- a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/payloads/proxy/gson/RunCommandPayloadSerializer.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee.api.payloads.proxy.gson; - -import com.google.gson.*; -import com.imaginarycode.minecraft.redisbungee.api.payloads.proxy.RunCommandPayload; - -import java.lang.reflect.Type; - -public class RunCommandPayloadSerializer implements JsonSerializer, JsonDeserializer { - - - @Override - public RunCommandPayload deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { - JsonObject jsonObject = json.getAsJsonObject(); - String senderProxy = jsonObject.get("proxy").getAsString(); - String proxyToRun = jsonObject.get("proxy-to-run").getAsString(); - String command = jsonObject.get("command").getAsString(); - return new RunCommandPayload(senderProxy, proxyToRun, command); - } - - @Override - public JsonElement serialize(RunCommandPayload src, Type typeOfSrc, JsonSerializationContext context) { - JsonObject jsonObject = new JsonObject(); - jsonObject.add("proxy", new JsonPrimitive(src.senderProxy())); - jsonObject.add("proxy-to-run", new JsonPrimitive(src.proxyToRun())); - jsonObject.add("command", context.serialize(src.command())); - return jsonObject; - } -} diff --git a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/summoners/JedisClusterSummoner.java b/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/summoners/JedisClusterSummoner.java deleted file mode 100644 index 14c25144..00000000 --- a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/summoners/JedisClusterSummoner.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee.api.summoners; - -import redis.clients.jedis.JedisCluster; -import redis.clients.jedis.providers.ClusterConnectionProvider; - -import java.io.IOException; -import java.time.Duration; - -public class JedisClusterSummoner implements Summoner { - private final ClusterConnectionProvider clusterConnectionProvider; - - public JedisClusterSummoner(ClusterConnectionProvider clusterConnectionProvider) { - this.clusterConnectionProvider = clusterConnectionProvider; - // test the connection - JedisCluster jedisCluster = obtainResource(); - jedisCluster.set("random_data", "0"); - jedisCluster.del("random_data"); - } - - - @Override - public void close() throws IOException { - this.clusterConnectionProvider.close(); - } - - @Override - public JedisCluster obtainResource() { - return new NotClosableJedisCluster(this.clusterConnectionProvider, 60, Duration.ofSeconds(10)); - } - - -} diff --git a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/summoners/JedisPooledSummoner.java b/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/summoners/JedisPooledSummoner.java deleted file mode 100644 index f0dd2b57..00000000 --- a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/summoners/JedisPooledSummoner.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee.api.summoners; - -import redis.clients.jedis.Jedis; -import redis.clients.jedis.JedisPool; -import redis.clients.jedis.JedisPooled; -import redis.clients.jedis.providers.PooledConnectionProvider; - -import java.io.IOException; - -public class JedisPooledSummoner implements Summoner { - - private final PooledConnectionProvider connectionProvider; - private final JedisPool jedisPool; - - public JedisPooledSummoner(PooledConnectionProvider connectionProvider, JedisPool jedisPool) { - this.connectionProvider = connectionProvider; - this.jedisPool = jedisPool; - // test connections - if (jedisPool != null) { - try (Jedis jedis = this.jedisPool.getResource()) { - // Test the connection to make sure configuration is right - jedis.ping(); - } - - } - final JedisPooled jedisPooled = this.obtainResource(); - jedisPooled.set("random_data", "0"); - jedisPooled.del("random_data"); - - } - - @Override - public JedisPooled obtainResource() { - // create UnClosable JedisPool *disposable* - return new NotClosableJedisPooled(this.connectionProvider); - } - - public JedisPool getCompatibilityJedisPool() { - return this.jedisPool; - } - - @Override - public void close() throws IOException { - if (this.jedisPool != null) { - this.jedisPool.close(); - } - this.connectionProvider.close(); - - } -} diff --git a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/summoners/NotClosableJedisCluster.java b/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/summoners/NotClosableJedisCluster.java deleted file mode 100644 index 5e098594..00000000 --- a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/summoners/NotClosableJedisCluster.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee.api.summoners; - -import redis.clients.jedis.JedisCluster; -import redis.clients.jedis.providers.ClusterConnectionProvider; - -import java.time.Duration; - - -public class NotClosableJedisCluster extends JedisCluster { - - NotClosableJedisCluster(ClusterConnectionProvider provider, int maxAttempts, Duration maxTotalRetriesDuration) { - super(provider, maxAttempts, maxTotalRetriesDuration); - } - - @Override - public void close() { - - } -} diff --git a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/summoners/NotClosableJedisPooled.java b/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/summoners/NotClosableJedisPooled.java deleted file mode 100644 index 61e7caf0..00000000 --- a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/summoners/NotClosableJedisPooled.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee.api.summoners; - -import redis.clients.jedis.JedisPooled; -import redis.clients.jedis.providers.PooledConnectionProvider; - - -public class NotClosableJedisPooled extends JedisPooled { - NotClosableJedisPooled(PooledConnectionProvider provider) { - super(provider); - } - - @Override - public void close() { - - } -} diff --git a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/summoners/Summoner.java b/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/summoners/Summoner.java deleted file mode 100644 index 36beac54..00000000 --- a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/summoners/Summoner.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee.api.summoners; - -import redis.clients.jedis.UnifiedJedis; - -import java.io.Closeable; - - -/** - * This class intended for future release to support redis sentinel or redis clusters - * - * @author Ham1255 - * @since 0.7.0 - */ -public interface Summoner

extends Closeable { - - P obtainResource(); - -} diff --git a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/tasks/RedisPipelineTask.java b/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/tasks/RedisPipelineTask.java deleted file mode 100644 index 21a5d291..00000000 --- a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/tasks/RedisPipelineTask.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee.api.tasks; - -import com.imaginarycode.minecraft.redisbungee.AbstractRedisBungeeAPI; -import com.imaginarycode.minecraft.redisbungee.api.RedisBungeePlugin; -import redis.clients.jedis.*; - -public abstract class RedisPipelineTask extends RedisTask { - - - public RedisPipelineTask(AbstractRedisBungeeAPI api) { - super(api); - } - - public RedisPipelineTask(RedisBungeePlugin plugin) { - super(plugin); - } - - - @Override - public T unifiedJedisTask(UnifiedJedis unifiedJedis) { - if (unifiedJedis instanceof JedisPooled pooled) { - try (Pipeline pipeline = pooled.pipelined()) { - return doPooledPipeline(pipeline); - } - } else if (unifiedJedis instanceof JedisCluster jedisCluster) { - try (ClusterPipeline pipeline = jedisCluster.pipelined()) { - return clusterPipeline(pipeline); - } - } - - return null; - } - - public abstract T doPooledPipeline(Pipeline pipeline); - - public abstract T clusterPipeline(ClusterPipeline pipeline); - - -} diff --git a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/tasks/RedisTask.java b/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/tasks/RedisTask.java deleted file mode 100644 index 9a6da179..00000000 --- a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/tasks/RedisTask.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee.api.tasks; - -import com.imaginarycode.minecraft.redisbungee.AbstractRedisBungeeAPI; -import com.imaginarycode.minecraft.redisbungee.api.RedisBungeeMode; -import com.imaginarycode.minecraft.redisbungee.api.RedisBungeePlugin; -import com.imaginarycode.minecraft.redisbungee.api.summoners.JedisClusterSummoner; -import com.imaginarycode.minecraft.redisbungee.api.summoners.JedisPooledSummoner; -import com.imaginarycode.minecraft.redisbungee.api.summoners.Summoner; -import redis.clients.jedis.UnifiedJedis; - -import java.util.concurrent.Callable; - -/** - * Since Jedis now have UnifiedJedis which basically extended by cluster / single connections classes - * can help us to have shared code. - */ -public abstract class RedisTask implements Runnable, Callable { - - protected final Summoner summoner; - - protected final RedisBungeeMode mode; - - @Override - public V call() throws Exception { - return this.execute(); - } - - public RedisTask(AbstractRedisBungeeAPI api) { - this.summoner = api.getSummoner(); - this.mode = api.getMode(); - } - - public RedisTask(RedisBungeePlugin plugin) { - this.summoner = plugin.getSummoner(); - this.mode = plugin.getRedisBungeeMode(); - } - - public abstract V unifiedJedisTask(UnifiedJedis unifiedJedis); - - @Override - public void run() { - this.execute(); - } - - public V execute() { - // JedisCluster, JedisPooled in fact is just UnifiedJedis does not need new instance since its single instance anyway. - if (mode == RedisBungeeMode.SINGLE) { - JedisPooledSummoner jedisSummoner = (JedisPooledSummoner) summoner; - return this.unifiedJedisTask(jedisSummoner.obtainResource()); - } else if (mode == RedisBungeeMode.CLUSTER) { - JedisClusterSummoner jedisClusterSummoner = (JedisClusterSummoner) summoner; - return this.unifiedJedisTask(jedisClusterSummoner.obtainResource()); - } - return null; - } - -} diff --git a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/tasks/UUIDCleanupTask.java b/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/tasks/UUIDCleanupTask.java deleted file mode 100644 index 6e080c41..00000000 --- a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/tasks/UUIDCleanupTask.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee.api.tasks; - -import com.google.gson.Gson; -import com.imaginarycode.minecraft.redisbungee.api.RedisBungeePlugin; -import com.imaginarycode.minecraft.redisbungee.api.util.uuid.CachedUUIDEntry; -import redis.clients.jedis.UnifiedJedis; -import redis.clients.jedis.exceptions.JedisException; - -import java.util.ArrayList; - - -public class UUIDCleanupTask extends RedisTask{ - - private final Gson gson = new Gson(); - private final RedisBungeePlugin plugin; - - public UUIDCleanupTask(RedisBungeePlugin plugin) { - super(plugin); - this.plugin = plugin; - } - - // this code is inspired from https://github.com/minecrafter/redisbungeeclean - @Override - public Void unifiedJedisTask(UnifiedJedis unifiedJedis) { - try { - final long number = unifiedJedis.hlen("uuid-cache"); - plugin.logInfo("Found {} entries", number); - ArrayList fieldsToRemove = new ArrayList<>(); - unifiedJedis.hgetAll("uuid-cache").forEach((field, data) -> { - CachedUUIDEntry cachedUUIDEntry = gson.fromJson(data, CachedUUIDEntry.class); - if (cachedUUIDEntry.expired()) { - fieldsToRemove.add(field); - } - }); - if (!fieldsToRemove.isEmpty()) { - unifiedJedis.hdel("uuid-cache", fieldsToRemove.toArray(new String[0])); - } - plugin.logInfo("deleted {} entries", fieldsToRemove.size()); - } catch (JedisException e) { - plugin.logFatal("There was an error fetching information", e); - } - return null; - } - - -} \ No newline at end of file diff --git a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/util/InitialUtils.java b/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/util/InitialUtils.java deleted file mode 100644 index db90cf39..00000000 --- a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/util/InitialUtils.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee.api.util; - -import com.imaginarycode.minecraft.redisbungee.api.RedisBungeePlugin; -import com.imaginarycode.minecraft.redisbungee.api.tasks.RedisTask; -import redis.clients.jedis.Protocol; -import redis.clients.jedis.UnifiedJedis; - - -public class InitialUtils { - - public static void checkRedisVersion(RedisBungeePlugin plugin) { - new RedisTask(plugin) { - @Override - public Void unifiedJedisTask(UnifiedJedis unifiedJedis) { - // This is more portable than INFO

- String info = new String((byte[]) unifiedJedis.sendCommand(Protocol.Command.INFO)); - for (String s : info.split("\r\n")) { - if (s.startsWith("redis_version:")) { - String version = s.split(":")[1]; - plugin.logInfo("Redis server version: " + version); - if (!RedisUtil.isRedisVersionRight(version)) { - plugin.logFatal("Your version of Redis (" + version + ") is not at least version " + RedisUtil.MAJOR_VERSION + "." + RedisUtil.MINOR_VERSION + " RedisBungee requires a newer version of Redis."); - throw new RuntimeException("Unsupported Redis version detected"); - } - long uuidCacheSize = unifiedJedis.hlen("uuid-cache"); - if (uuidCacheSize > 750000) { - plugin.logInfo("Looks like you have a really big UUID cache! Run '/rb clean' to remove expired cache entries"); - } - break; - } - } - return null; - } - }.execute(); - } - - -} diff --git a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/util/RedisUtil.java b/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/util/RedisUtil.java deleted file mode 100644 index 7e337db6..00000000 --- a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/util/RedisUtil.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.imaginarycode.minecraft.redisbungee.api.util; - -import com.google.common.annotations.VisibleForTesting; - -@VisibleForTesting -public class RedisUtil { - public final static int PROXY_TIMEOUT = 30; - - public static final int MAJOR_VERSION = 6; - public static final int MINOR_VERSION = 2; - - public static boolean isRedisVersionRight(String redisVersion) { - String[] args = redisVersion.split("\\."); - if (args.length < 2) { - return false; - } - int major = Integer.parseInt(args[0]); - int minor = Integer.parseInt(args[1]); - - if (major > MAJOR_VERSION) return true; - return major == MAJOR_VERSION && minor >= MINOR_VERSION; - - } - - // Ham1255: i am keeping this if some plugin uses this *IF* - @Deprecated - public static boolean canUseLua(String redisVersion) { - // Need to use >=3 to use Lua optimizations. - return isRedisVersionRight(redisVersion); - } -} diff --git a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/util/serialize/MultiMapSerialization.java b/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/util/serialize/MultiMapSerialization.java deleted file mode 100644 index 71df20b9..00000000 --- a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/util/serialize/MultiMapSerialization.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.imaginarycode.minecraft.redisbungee.api.util.serialize; - -import com.google.common.collect.Multimap; -import com.google.common.collect.Multiset; -import com.google.common.io.ByteArrayDataOutput; - -import java.util.Collection; -import java.util.Map; - -public class MultiMapSerialization { - - public static void serializeMultiset(Multiset collection, ByteArrayDataOutput output) { - output.writeInt(collection.elementSet().size()); - for (Multiset.Entry entry : collection.entrySet()) { - output.writeUTF(entry.getElement()); - output.writeInt(entry.getCount()); - } - } - - @SuppressWarnings("SameParameterValue") - public static void serializeMultimap(Multimap collection, boolean includeNames, ByteArrayDataOutput output) { - output.writeInt(collection.keySet().size()); - for (Map.Entry> entry : collection.asMap().entrySet()) { - output.writeUTF(entry.getKey()); - if (includeNames) { - serializeCollection(entry.getValue(), output); - } else { - output.writeInt(entry.getValue().size()); - } - } - } - - public static void serializeCollection(Collection collection, ByteArrayDataOutput output) { - output.writeInt(collection.size()); - for (Object o : collection) { - output.writeUTF(o.toString()); - } - } - -} diff --git a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/util/uuid/CachedUUIDEntry.java b/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/util/uuid/CachedUUIDEntry.java deleted file mode 100644 index 84f50596..00000000 --- a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/util/uuid/CachedUUIDEntry.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee.api.util.uuid; - -import java.util.Calendar; -import java.util.UUID; - -public class CachedUUIDEntry { - private final String name; - private final UUID uuid; - private final Calendar expiry; - - public CachedUUIDEntry(String name, UUID uuid, Calendar expiry) { - this.name = name; - this.uuid = uuid; - this.expiry = expiry; - } - - public String getName() { - return name; - } - - public UUID getUuid() { - return uuid; - } - - public Calendar getExpiry() { - return expiry; - } - - public boolean expired() { - return Calendar.getInstance().after(expiry); - } -} diff --git a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/util/uuid/NameFetcher.java b/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/util/uuid/NameFetcher.java deleted file mode 100644 index 3bcd38c6..00000000 --- a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/util/uuid/NameFetcher.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee.api.util.uuid; - -import com.google.gson.Gson; -import com.google.gson.JsonObject; -import com.squareup.okhttp.OkHttpClient; -import com.squareup.okhttp.Request; -import com.squareup.okhttp.ResponseBody; - -import java.io.IOException; -import java.util.Collections; -import java.util.List; -import java.util.UUID; - -public class NameFetcher { - private static OkHttpClient httpClient; - private static final Gson gson = new Gson(); - - public static void setHttpClient(OkHttpClient httpClient) { - NameFetcher.httpClient = httpClient; - } - - public static List nameHistoryFromUuid(UUID uuid) throws IOException { - String name = getName(uuid); - if (name == null) return Collections.emptyList(); - return Collections.singletonList(name); - } - - public static String getName(UUID uuid) throws IOException { - String url = "https://playerdb.co/api/player/minecraft/" + uuid.toString(); - Request request = new Request.Builder() - .addHeader("User-Agent", "RedisBungee-ProxioDev") - .url(url) - .get() - .build(); - ResponseBody body = httpClient.newCall(request).execute().body(); - String response = body.string(); - body.close(); - - JsonObject json = gson.fromJson(response, JsonObject.class); - if (!json.has("success") || !json.get("success").getAsBoolean()) return null; - if (!json.has("data")) return null; - JsonObject data = json.getAsJsonObject("data"); - if (!data.has("player")) return null; - JsonObject player = data.getAsJsonObject("player"); - if (!player.has("username")) return null; - - return player.get("username").getAsString(); - } -} \ No newline at end of file diff --git a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/util/uuid/UUIDFetcher.java b/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/util/uuid/UUIDFetcher.java deleted file mode 100644 index 06433e24..00000000 --- a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/util/uuid/UUIDFetcher.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee.api.util.uuid; - -import com.google.common.collect.ImmutableList; -import com.google.gson.Gson; -import com.squareup.okhttp.*; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import java.util.concurrent.Callable; - -/* Credits to evilmidget38 for this class. I modified it to use Gson. */ -public class UUIDFetcher implements Callable> { - private static final double PROFILES_PER_REQUEST = 100; - private static final String PROFILE_URL = "https://api.mojang.com/profiles/minecraft"; - private static final MediaType JSON = MediaType.parse("application/json"); - private final List names; - private final boolean rateLimiting; - private static final Gson gson = new Gson(); - - - public static void setHttpClient(OkHttpClient httpClient) { - UUIDFetcher.httpClient = httpClient; - } - - private static OkHttpClient httpClient; - - private UUIDFetcher(List names, boolean rateLimiting) { - this.names = ImmutableList.copyOf(names); - this.rateLimiting = rateLimiting; - } - - public UUIDFetcher(List names) { - this(names, true); - } - - public static UUID getUUID(String id) { - return UUID.fromString(id.substring(0, 8) + "-" + id.substring(8, 12) + "-" + id.substring(12, 16) + "-" + id.substring(16, 20) + "-" + id.substring(20, 32)); - } - - public Map call() throws Exception { - Map uuidMap = new HashMap<>(); - int requests = (int) Math.ceil(names.size() / PROFILES_PER_REQUEST); - for (int i = 0; i < requests; i++) { - String body = gson.toJson(names.subList(i * 100, Math.min((i + 1) * 100, names.size()))); - Request request = new Request.Builder().url(PROFILE_URL).post(RequestBody.create(JSON, body)).build(); - ResponseBody responseBody = httpClient.newCall(request).execute().body(); - String response = responseBody.string(); - responseBody.close(); - Profile[] array = gson.fromJson(response, Profile[].class); - for (Profile profile : array) { - UUID uuid = UUIDFetcher.getUUID(profile.id); - uuidMap.put(profile.name, uuid); - } - if (rateLimiting && i != requests - 1) { - Thread.sleep(100L); - } - } - return uuidMap; - } - - private static class Profile { - String id; - String name; - } -} \ No newline at end of file diff --git a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/util/uuid/UUIDTranslator.java b/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/util/uuid/UUIDTranslator.java deleted file mode 100644 index acccf407..00000000 --- a/api/src/main/java/com/imaginarycode/minecraft/redisbungee/api/util/uuid/UUIDTranslator.java +++ /dev/null @@ -1,208 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee.api.util.uuid; - -import com.google.common.base.Charsets; -import com.google.common.collect.ImmutableMap; -import com.google.gson.Gson; -import com.imaginarycode.minecraft.redisbungee.api.RedisBungeePlugin; -import com.imaginarycode.minecraft.redisbungee.api.tasks.RedisTask; -import org.checkerframework.checker.nullness.qual.NonNull; -import redis.clients.jedis.UnifiedJedis; -import redis.clients.jedis.exceptions.JedisException; - -import java.util.Calendar; -import java.util.Collections; -import java.util.Map; -import java.util.UUID; -import java.util.concurrent.ConcurrentHashMap; -import java.util.regex.Pattern; - -public final class UUIDTranslator { - private static final Pattern UUID_PATTERN = Pattern.compile("[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}"); - private static final Pattern MOJANGIAN_UUID_PATTERN = Pattern.compile("[a-fA-F0-9]{32}"); - private final RedisBungeePlugin plugin; - private final Map nameToUuidMap = new ConcurrentHashMap<>(128, 0.5f, 4); - private final Map uuidToNameMap = new ConcurrentHashMap<>(128, 0.5f, 4); - private static final Gson gson = new Gson(); - - public UUIDTranslator(RedisBungeePlugin plugin) { - this.plugin = plugin; - } - - private void addToMaps(String name, UUID uuid) { - // This is why I like LocalDate... - - // Cache the entry for three days. - Calendar calendar = Calendar.getInstance(); - calendar.add(Calendar.DAY_OF_MONTH, 3); - - // Create the entry and populate the local maps - CachedUUIDEntry entry = new CachedUUIDEntry(name, uuid, calendar); - nameToUuidMap.put(name.toLowerCase(), entry); - uuidToNameMap.put(uuid, entry); - } - - public UUID getTranslatedUuid(@NonNull String player, boolean expensiveLookups) { - // If the player is online, give them their UUID. - // Remember, local data > remote data. - if (plugin.getPlayer(player) != null) - return plugin.getPlayerUUID(player); - - // Check if it exists in the map - CachedUUIDEntry cachedUUIDEntry = nameToUuidMap.get(player.toLowerCase()); - if (cachedUUIDEntry != null) { - if (!cachedUUIDEntry.expired()) - return cachedUUIDEntry.getUuid(); - else - nameToUuidMap.remove(player); - } - - // Check if we can exit early - if (UUID_PATTERN.matcher(player).find()) { - return UUID.fromString(player); - } - - if (MOJANGIAN_UUID_PATTERN.matcher(player).find()) { - // Reconstruct the UUID - return UUIDFetcher.getUUID(player); - } - - // If we are in offline mode, UUID generation is simple. - // We don't even have to cache the UUID, since this is easy to recalculate. - if (!plugin.isOnlineMode()) { - return UUID.nameUUIDFromBytes(("OfflinePlayer:" + player).getBytes(Charsets.UTF_8)); - } - RedisTask redisTask = new RedisTask(plugin) { - @Override - public UUID unifiedJedisTask(UnifiedJedis unifiedJedis) { - String stored = unifiedJedis.hget("uuid-cache", player.toLowerCase()); - if (stored != null) { - // Found an entry value. Deserialize it. - CachedUUIDEntry entry = gson.fromJson(stored, CachedUUIDEntry.class); - - // Check for expiry: - if (entry.expired()) { - unifiedJedis.hdel("uuid-cache", player.toLowerCase()); - // Doesn't hurt to also remove the UUID entry as well. - unifiedJedis.hdel("uuid-cache", entry.getUuid().toString()); - } else { - nameToUuidMap.put(player.toLowerCase(), entry); - uuidToNameMap.put(entry.getUuid(), entry); - return entry.getUuid(); - } - } - - // That didn't work. Let's ask Mojang. - if (!expensiveLookups || !plugin.isOnlineMode()) - return null; - - Map uuidMap1; - try { - uuidMap1 = new UUIDFetcher(Collections.singletonList(player)).call(); - } catch (Exception e) { - plugin.logFatal("Unable to fetch UUID from Mojang for " + player); - return null; - } - for (Map.Entry entry : uuidMap1.entrySet()) { - if (entry.getKey().equalsIgnoreCase(player)) { - persistInfo(entry.getKey(), entry.getValue(), unifiedJedis); - return entry.getValue(); - } - } - return null; - } - }; - // Let's try Redis. - try { - return redisTask.execute(); - } catch (JedisException e) { - plugin.logFatal("Unable to fetch UUID for " + player); - } - - return null; // Nope, game over! - } - - public String getNameFromUuid(@NonNull UUID player, boolean expensiveLookups) { - // If the player is online, give them their UUID. - // Remember, local data > remote data. - if (plugin.getPlayer(player) != null) - return plugin.getPlayerName(player); - - // Check if it exists in the map - CachedUUIDEntry cachedUUIDEntry = uuidToNameMap.get(player); - if (cachedUUIDEntry != null) { - if (!cachedUUIDEntry.expired()) - return cachedUUIDEntry.getName(); - else - uuidToNameMap.remove(player); - } - - RedisTask redisTask = new RedisTask(plugin) { - @Override - public String unifiedJedisTask(UnifiedJedis unifiedJedis) { - String stored = unifiedJedis.hget("uuid-cache", player.toString()); - if (stored != null) { - // Found an entry value. Deserialize it. - CachedUUIDEntry entry = gson.fromJson(stored, CachedUUIDEntry.class); - - // Check for expiry: - if (entry.expired()) { - unifiedJedis.hdel("uuid-cache", player.toString()); - // Doesn't hurt to also remove the named entry as well. - // TODO: Since UUIDs are fixed, we could look up the name and see if the UUID matches. - unifiedJedis.hdel("uuid-cache", entry.getName()); - } else { - nameToUuidMap.put(entry.getName().toLowerCase(), entry); - uuidToNameMap.put(player, entry); - return entry.getName(); - } - } - - if (!expensiveLookups || !plugin.isOnlineMode()) - return null; - - // That didn't work. Let's ask PlayerDB. - String name; - try { - name = NameFetcher.getName(player); - } catch (Exception e) { - plugin.logFatal("Unable to fetch name from PlayerDB for " + player); - return null; - } - - if (name != null) { - persistInfo(name, player, unifiedJedis); - return name; - } - - return null; - } - }; - - - // Okay, it wasn't locally cached. Let's try Redis. - try { - return redisTask.execute(); - } catch (JedisException e) { - plugin.logFatal("Unable to fetch name for " + player); - return null; - } - } - - public void persistInfo(String name, UUID uuid, UnifiedJedis unifiedJedis) { - addToMaps(name, uuid); - String json = gson.toJson(uuidToNameMap.get(uuid)); - unifiedJedis.hset("uuid-cache", ImmutableMap.of(name.toLowerCase(), json, uuid.toString(), json)); - } - - -} diff --git a/api/src/main/resources/REDISBUNGEE_LICENSE b/api/src/main/resources/REDISBUNGEE_LICENSE deleted file mode 100644 index 50328437..00000000 --- a/api/src/main/resources/REDISBUNGEE_LICENSE +++ /dev/null @@ -1,203 +0,0 @@ -Eclipse Public License - v 1.0 - -THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC -LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM -CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. - -1. DEFINITIONS - -"Contribution" means: - -a) in the case of the initial Contributor, the initial code and documentation - distributed under this Agreement, and -b) in the case of each subsequent Contributor: - i) changes to the Program, and - ii) additions to the Program; - - where such changes and/or additions to the Program originate from and are - distributed by that particular Contributor. A Contribution 'originates' - from a Contributor if it was added to the Program by such Contributor - itself or anyone acting on such Contributor's behalf. Contributions do not - include additions to the Program which: (i) are separate modules of - software distributed in conjunction with the Program under their own - license agreement, and (ii) are not derivative works of the Program. - -"Contributor" means any person or entity that distributes the Program. - -"Licensed Patents" mean patent claims licensable by a Contributor which are -necessarily infringed by the use or sale of its Contribution alone or when -combined with the Program. - -"Program" means the Contributions distributed in accordance with this -Agreement. - -"Recipient" means anyone who receives the Program under this Agreement, -including all Contributors. - -2. GRANT OF RIGHTS - a) Subject to the terms of this Agreement, each Contributor hereby grants - Recipient a non-exclusive, worldwide, royalty-free copyright license to - reproduce, prepare derivative works of, publicly display, publicly - perform, distribute and sublicense the Contribution of such Contributor, - if any, and such derivative works, in source code and object code form. - b) Subject to the terms of this Agreement, each Contributor hereby grants - Recipient a non-exclusive, worldwide, royalty-free patent license under - Licensed Patents to make, use, sell, offer to sell, import and otherwise - transfer the Contribution of such Contributor, if any, in source code and - object code form. This patent license shall apply to the combination of - the Contribution and the Program if, at the time the Contribution is - added by the Contributor, such addition of the Contribution causes such - combination to be covered by the Licensed Patents. The patent license - shall not apply to any other combinations which include the Contribution. - No hardware per se is licensed hereunder. - c) Recipient understands that although each Contributor grants the licenses - to its Contributions set forth herein, no assurances are provided by any - Contributor that the Program does not infringe the patent or other - intellectual property rights of any other entity. Each Contributor - disclaims any liability to Recipient for claims brought by any other - entity based on infringement of intellectual property rights or - otherwise. As a condition to exercising the rights and licenses granted - hereunder, each Recipient hereby assumes sole responsibility to secure - any other intellectual property rights needed, if any. For example, if a - third party patent license is required to allow Recipient to distribute - the Program, it is Recipient's responsibility to acquire that license - before distributing the Program. - d) Each Contributor represents that to its knowledge it has sufficient - copyright rights in its Contribution, if any, to grant the copyright - license set forth in this Agreement. - -3. REQUIREMENTS - -A Contributor may choose to distribute the Program in object code form under -its own license agreement, provided that: - - a) it complies with the terms and conditions of this Agreement; and - b) its license agreement: - i) effectively disclaims on behalf of all Contributors all warranties - and conditions, express and implied, including warranties or - conditions of title and non-infringement, and implied warranties or - conditions of merchantability and fitness for a particular purpose; - ii) effectively excludes on behalf of all Contributors all liability for - damages, including direct, indirect, special, incidental and - consequential damages, such as lost profits; - iii) states that any provisions which differ from this Agreement are - offered by that Contributor alone and not by any other party; and - iv) states that source code for the Program is available from such - Contributor, and informs licensees how to obtain it in a reasonable - manner on or through a medium customarily used for software exchange. - -When the Program is made available in source code form: - - a) it must be made available under this Agreement; and - b) a copy of this Agreement must be included with each copy of the Program. - Contributors may not remove or alter any copyright notices contained - within the Program. - -Each Contributor must identify itself as the originator of its Contribution, -if -any, in a manner that reasonably allows subsequent Recipients to identify the -originator of the Contribution. - -4. COMMERCIAL DISTRIBUTION - -Commercial distributors of software may accept certain responsibilities with -respect to end users, business partners and the like. While this license is -intended to facilitate the commercial use of the Program, the Contributor who -includes the Program in a commercial product offering should do so in a manner -which does not create potential liability for other Contributors. Therefore, -if a Contributor includes the Program in a commercial product offering, such -Contributor ("Commercial Contributor") hereby agrees to defend and indemnify -every other Contributor ("Indemnified Contributor") against any losses, -damages and costs (collectively "Losses") arising from claims, lawsuits and -other legal actions brought by a third party against the Indemnified -Contributor to the extent caused by the acts or omissions of such Commercial -Contributor in connection with its distribution of the Program in a commercial -product offering. The obligations in this section do not apply to any claims -or Losses relating to any actual or alleged intellectual property -infringement. In order to qualify, an Indemnified Contributor must: -a) promptly notify the Commercial Contributor in writing of such claim, and -b) allow the Commercial Contributor to control, and cooperate with the -Commercial Contributor in, the defense and any related settlement -negotiations. The Indemnified Contributor may participate in any such claim at -its own expense. - -For example, a Contributor might include the Program in a commercial product -offering, Product X. That Contributor is then a Commercial Contributor. If -that Commercial Contributor then makes performance claims, or offers -warranties related to Product X, those performance claims and warranties are -such Commercial Contributor's responsibility alone. Under this section, the -Commercial Contributor would have to defend claims against the other -Contributors related to those performance claims and warranties, and if a -court requires any other Contributor to pay any damages as a result, the -Commercial Contributor must pay those damages. - -5. NO WARRANTY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN -"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR -IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, -NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each -Recipient is solely responsible for determining the appropriateness of using -and distributing the Program and assumes all risks associated with its -exercise of rights under this Agreement , including but not limited to the -risks and costs of program errors, compliance with applicable laws, damage to -or loss of data, programs or equipment, and unavailability or interruption of -operations. - -6. DISCLAIMER OF LIABILITY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY -CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION -LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE -EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY -OF SUCH DAMAGES. - -7. GENERAL - -If any provision of this Agreement is invalid or unenforceable under -applicable law, it shall not affect the validity or enforceability of the -remainder of the terms of this Agreement, and without further action by the -parties hereto, such provision shall be reformed to the minimum extent -necessary to make such provision valid and enforceable. - -If Recipient institutes patent litigation against any entity (including a -cross-claim or counterclaim in a lawsuit) alleging that the Program itself -(excluding combinations of the Program with other software or hardware) -infringes such Recipient's patent(s), then such Recipient's rights granted -under Section 2(b) shall terminate as of the date such litigation is filed. - -All Recipient's rights under this Agreement shall terminate if it fails to -comply with any of the material terms or conditions of this Agreement and does -not cure such failure in a reasonable period of time after becoming aware of -such noncompliance. If all Recipient's rights under this Agreement terminate, -Recipient agrees to cease use and distribution of the Program as soon as -reasonably practicable. However, Recipient's obligations under this Agreement -and any licenses granted by Recipient relating to the Program shall continue -and survive. - -Everyone is permitted to copy and distribute copies of this Agreement, but in -order to avoid inconsistency the Agreement is copyrighted and may only be -modified in the following manner. The Agreement Steward reserves the right to -publish new versions (including revisions) of this Agreement from time to -time. No one other than the Agreement Steward has the right to modify this -Agreement. The Eclipse Foundation is the initial Agreement Steward. The -Eclipse Foundation may assign the responsibility to serve as the Agreement -Steward to a suitable separate entity. Each new version of the Agreement will -be given a distinguishing version number. The Program (including -Contributions) may always be distributed subject to the version of the -Agreement under which it was received. In addition, after a new version of the -Agreement is published, Contributor may elect to distribute the Program -(including its Contributions) under the new version. Except as expressly -stated in Sections 2(a) and 2(b) above, Recipient receives no rights or -licenses to the intellectual property of any Contributor under this Agreement, -whether expressly, by implication, estoppel or otherwise. All rights in the -Program not expressly granted under this Agreement are reserved. - -This Agreement is governed by the laws of the State of New York and the -intellectual property laws of the United States of America. No party to this -Agreement will bring a legal action under this Agreement more than one year -after the cause of action arose. Each party waives its rights to a jury trial in -any resulting litigation. \ No newline at end of file diff --git a/api/src/main/resources/config.yml b/api/src/main/resources/config.yml deleted file mode 100644 index b69b5eee..00000000 --- a/api/src/main/resources/config.yml +++ /dev/null @@ -1,149 +0,0 @@ -# RedisBungee configuration file. -# Notice: -# Redis 7.2.4 is last free and open source Redis version after license change -# https://download.redis.io/releases/redis-7.2.4.tar.gz which you have to compile yourself, -# unless your package manager still provide it. -# Here is The alternatives -# - 'ValKey' By linux foundation https://valkey.io/download/ -# - 'KeyDB' by Snapchat inc https://docs.keydb.dev/docs/download/ - - -# The 'Redis', 'ValKey', 'KeyDB' server you will use. -# these settings are ignored when cluster mode is enabled. -redis-server: 127.0.0.1 -redis-port: 6379 - -# Cluster Mode -# enabling this option will enable cluster mode. -cluster-mode-enabled: false - -# FORMAT: -# redis-cluster-servers: -# - host: 127.0.0.1` -# port: 2020 -# - host: 127.0.0.1 -# port: 2021 -# - host: 127.0.0.1 -# port: 2021 - -# you can set single server and Jedis will automatically discover cluster nodes, -# but might fail if this single redis node is down when Proxy startup, its recommended put the all the nodes -redis-cluster-servers: - - host: 127.0.0.1 - port: 6379 - -# OPTIONAL: if your redis uses acl usernames set the username here. leave empty for no username. -redis-username: "" - -# OPTIONAL but recommended: If your Redis server uses AUTH, set the required password. -redis-password: "" - -# Maximum connections that will be maintained to the Redis server. -# The default is 10. This setting should be left as-is unless you have some wildly -# inefficient plugins or a lot of players. -max-redis-connections: 10 - -# since redis can support ssl by version 6 you can use SSL/TLS in redis bungee too! -# but there is more configuration needed to work see https://github.com/ProxioDev/RedisBungee/issues/18 -# Keep note that SSL/TLS connections will decrease redis performance so use it when needed. -useSSL: false - -# An identifier for this network, which helps to separate redisbungee instances on same redis instance. -# You can use environment variable 'REDISBUNGEE_NETWORK_ID' to override -network-id: "main" - -# An identifier for this BungeeCord / Velocity instance. Will randomly generate if leaving it blank. -# You can set Environment variable 'REDISBUNGEE_PROXY_ID' to override -proxy-id: "proxy-1" - -# since RedisBungee Internally now uses UnifiedJedis instead of Jedis, JedisPool. -# which will break compatibility with old plugins that uses RedisBungee JedisPool -# so to mitigate this issue, RedisBungee will create an JedisPool for compatibility reasons. -# disabled by default -# Automatically disabled when cluster mode is enabled -enable-jedis-pool-compatibility: false - -# max connections for the compatibility pool -compatibility-max-connections: 3 - -# restore old login behavior before 0.9.0 update -# enabled by default -# when true: when player login and there is old player with same uuid it will get disconnected as result and new player will log in -# when false: when a player login but login will fail because old player is still connected. -kick-when-online: true - -# enabled by default -# this option tells RedisBungee handle motd and set online count, when motd is requested -# you can disable this when you want to handle motd yourself, use RedisBungee api to get total players when needed :) -handle-motd: true - -# MOTD plugins compatibility setting -# Allowed values: FIRST, NORMAL, LAST -# This option enables RedisBungee to manage various interactions between other plugins and the online player count, -# which is dynamically updated to a global player count in ping responses if the handle-motd option is enabled. -# If you encounter issues with other plugins accessing or modifying the player count, try using a value of FIRST or LAST. -handle-motd-order: NORMAL - -# A list of IP addresses for which RedisBungee will not modify the response for, useful for automatic -# restart scripts. -# Automatically disabled if handle-motd is disabled. -exempt-ip-addresses: [] - -# disabled by default -# RedisBungee will attempt to connect player to last server that was stored. -reconnect-to-last-server: false - -# For redis bungee legacy commands -# either can be run using '/rbl glist' for example -# or if 'install' is set to true '/glist' can be used. -# 'install' also overrides the proxy installed commands -# -# In legacy commands each command got it own permissions since they had it own permission pre new command system, -# so it's also applied to subcommands in '/rbl'. -commands: - # Permission redisbungee.legacy.use - redisbungee-legacy: - enabled: false - subcommands: - # Permission redisbungee.command.glist - glist: - enabled: false - install: false - # Permission redisbungee.command.find - find: - enabled: false - install: false - # Permission redisbungee.command.lastseen - lastseen: - enabled: false - install: false - # Permission redisbungee.command.ip - ip: - enabled: false - install: false - # Permission redisbungee.command.pproxy - pproxy: - enabled: false - install: false - # Permission redisbungee.command.sendtoall - sendtoall: - enabled: false - install: false - # Permission redisbungee.command.serverid - serverid: - enabled: false - install: false - # Permission redisbungee.command.serverids - serverids: - enabled: false - install: false - # Permission redisbungee.command.plist - plist: - enabled: false - install: false - # Permission redisbungee.command.use - redisbungee: - enabled: true - -# Config version DO NOT CHANGE!!!! -config-version: 2 diff --git a/api/src/main/resources/lang.yml b/api/src/main/resources/lang.yml deleted file mode 100644 index 817a053b..00000000 --- a/api/src/main/resources/lang.yml +++ /dev/null @@ -1,55 +0,0 @@ -# this config file is for messages / Languages -# use MiniMessage format https://docs.advntr.dev/minimessage/format.html -# for colors etc... Legacy chat color is not supported. - -# Language codes used in minecraft from the minecraft wiki -# example: en-us for american english and ar-sa for arabic - -# all codes can be obtained from link below -# from the colum Locale Code -> In-game -# NOTE: minecraft wiki shows languages like this `en_us` in config it should be `en-us` -# https://minecraft.wiki/w/Language - -# example: -# lets assume we want to add arabic language. -# messages: -# logged-in-other-location: -# en-us: "You logged in from another location!" -# ar-sa: "لقد اتصلت من مكان اخر" - - -# RedisBungee Prefix if ever used. -prefix: "[RedisBungee]" - -# en-us is american English, Which is the default language used when a language for a message isn't defined. -# Warning: IF THE set default locale wasn't defined in the config for all messages, plugin will not load. -# set the Default locale -default-locale: en-us - -# send language based on client sent settings -# if you don't have languages configured For client Language -# it will default to language that has been set above -# NOTE: due minecraft protocol not sending player settings during login, -# some of the messages like logged-in-other-location will -# skip translation and use default locale that has been set in default-locale. -use-client-locale: true - -# messages that are used during login, and connecting to Last server -messages: - logged-in-other-location: - en-us: "You logged in from another location!" - pt-br: "Você está logado em outra localização!" - already-logged-in: - en-us: "You are already logged in!" - pt-br: "Você já está logado!" - server-not-found: - # placeholder displays server name in the message. - en-us: "unable to connect you to the last server, because server was not found." - pt-br: "falha ao conectar você ao último servidor, porque o servidor não foi encontrado." - server-connecting: - # placeholder displays server name in the message. - en-us: "Connecting you to ..." - pt-br: "Conectando você a ..." - -# DO NOT CHANGE!!!!! -config-version: 1 diff --git a/build.gradle.kts b/build.gradle.kts deleted file mode 100644 index e69de29b..00000000 diff --git a/commands/build.gradle.kts b/commands/build.gradle.kts deleted file mode 100644 index 0c5944ef..00000000 --- a/commands/build.gradle.kts +++ /dev/null @@ -1,24 +0,0 @@ -plugins { - `java-library` -} - -dependencies { - implementation(project(":RedisBungee-API")) - implementation(libs.acf.core) -} - -description = "RedisBungee common commands" - - -tasks { - compileJava { - options.encoding = Charsets.UTF_8.name() - options.release.set(17) - } - javadoc { - options.encoding = Charsets.UTF_8.name() - } - processResources { - filteringCharset = Charsets.UTF_8.name() - } -} diff --git a/commands/src/main/java/com/imaginarycode/minecraft/redisbungee/commands/CommandLoader.java b/commands/src/main/java/com/imaginarycode/minecraft/redisbungee/commands/CommandLoader.java deleted file mode 100644 index 5346be9f..00000000 --- a/commands/src/main/java/com/imaginarycode/minecraft/redisbungee/commands/CommandLoader.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee.commands; - -import co.aikar.commands.CommandManager; -import com.imaginarycode.minecraft.redisbungee.api.RedisBungeePlugin; - -import com.imaginarycode.minecraft.redisbungee.commands.legacy.LegacyRedisBungeeCommands; - -public class CommandLoader { - - public static void initCommands(CommandManager commandManager, RedisBungeePlugin plugin) { - var commandsConfiguration = plugin.configuration().commandsConfiguration(); - if (commandsConfiguration.redisbungeeEnabled()) { - commandManager.registerCommand(new CommandRedisBungee(plugin)); - } - if (commandsConfiguration.redisbungeeLegacyEnabled()) { - commandManager.registerCommand(new LegacyRedisBungeeCommands(commandManager,plugin)); - } - - } - -} diff --git a/commands/src/main/java/com/imaginarycode/minecraft/redisbungee/commands/CommandRedisBungee.java b/commands/src/main/java/com/imaginarycode/minecraft/redisbungee/commands/CommandRedisBungee.java deleted file mode 100644 index c67b7a03..00000000 --- a/commands/src/main/java/com/imaginarycode/minecraft/redisbungee/commands/CommandRedisBungee.java +++ /dev/null @@ -1,189 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee.commands; - -import co.aikar.commands.CommandIssuer; -import co.aikar.commands.RegisteredCommand; -import co.aikar.commands.annotation.*; -import com.google.common.primitives.Ints; -import com.imaginarycode.minecraft.redisbungee.Constants; -import com.imaginarycode.minecraft.redisbungee.api.RedisBungeePlugin; -import com.imaginarycode.minecraft.redisbungee.commands.utils.AdventureBaseCommand; -import com.imaginarycode.minecraft.redisbungee.commands.utils.StopperUUIDCleanupTask; -import net.kyori.adventure.text.Component; -import net.kyori.adventure.text.TextComponent; -import net.kyori.adventure.text.event.ClickEvent; -import net.kyori.adventure.text.event.HoverEvent; -import net.kyori.adventure.text.format.NamedTextColor; -import net.kyori.adventure.text.minimessage.MiniMessage; -import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -@CommandAlias("rb|redisbungee") -@CommandPermission("redisbungee.command.use") -@Description("Main command") -public class CommandRedisBungee extends AdventureBaseCommand { - - private final RedisBungeePlugin plugin; - - public CommandRedisBungee(RedisBungeePlugin plugin) { - this.plugin = plugin; - } - - @Default - @Subcommand("info|version|git") - @Description("information about current redisbungee build") - public void info(CommandIssuer issuer) { - final String message = """ - This proxy is running RedisBungee Limework's fork - ======================================== - RedisBungee version: - Commit: - ======================================== - run /rb help for more commands"""; - sendMessage( - issuer, - MiniMessage.miniMessage() - .deserialize( - message, - Placeholder.component("version", Component.text(Constants.VERSION)), - Placeholder.component( - "commit", - Component.text(Constants.GIT_COMMIT.substring(0, 8)) - .clickEvent(ClickEvent.clickEvent(ClickEvent.Action.OPEN_URL, Constants.getGithubCommitLink())) - .hoverEvent(HoverEvent.showText(Component.text("Click me to open: " + Constants.getGithubCommitLink()))) - ))); - } - // ......: ...... - @HelpCommand - @Description("shows the help page") - public void help(CommandIssuer issuer) { - final String barFormat = "========================================"; - final String commandFormat = "/rb : "; - - TextComponent.Builder message = Component.text(); - message.append(MiniMessage.miniMessage().deserialize(barFormat)); - - getSubCommands().forEach((subCommand, registeredCommand) -> { - String[] split = registeredCommand.getCommand().split(" "); - if (split.length > 1 && subCommand.equalsIgnoreCase(split[1])) { - message.appendNewline().append(MiniMessage.miniMessage().deserialize(commandFormat, Placeholder.component("sub-command", Component.text(subCommand)), - Placeholder.component("description", MiniMessage.miniMessage().deserialize(registeredCommand.getHelpText())) - )); - } - }); - - message.appendNewline().append(MiniMessage.miniMessage().deserialize(barFormat)); - - sendMessage(issuer, message.build()); - } - @Subcommand("clean") - @Description("cleans up the uuid cache WARNING... command above could cause performance issues") - @Private - public void cleanUp(CommandIssuer issuer) { - if (StopperUUIDCleanupTask.isRunning) { - sendMessage(issuer, - Component.text("cleanup is currently running!").color(NamedTextColor.RED)); - return; - } - sendMessage(issuer, - Component.text("cleanup is Starting, you should see the output status in the proxy console").color(NamedTextColor.GOLD)); - plugin.executeAsync(new StopperUUIDCleanupTask(plugin)); - } - - - - private List> subListProxies(List> data, final int currentPage, final int pageSize) { - return data.subList(((currentPage * pageSize) - pageSize), Ints.constrainToRange(currentPage * pageSize, 0, data.size())); - - } - @Subcommand("show") - @Description("Shows proxies in this network") - public void showProxies(CommandIssuer issuer, String[] args) { - final String closer = "========================================"; - final String pageTop = "Page: / Network ID: Proxies online: "; - final String proxy = " : online"; - final String proxyHere = " (#) "; - final String nextPage = ">>>>>"; - final String previousPage = "<<<<< "; - final String pageInvalid = "invalid page"; - final String noProxies = "No proxies were found :("; - - final int pageSize = 16; - - int currentPage; - if (args.length > 0) { - try { - currentPage = Integer.parseInt(args[0]); - if (currentPage < 1) currentPage = 1; - } catch (NumberFormatException e) { - sendMessage(issuer, MiniMessage.miniMessage().deserialize(pageInvalid)); - return; - } - } else currentPage = 1; - - var data = new ArrayList<>(plugin.proxyDataManager().eachProxyCount().entrySet()); - // there is no way this runs because there is always an heartbeat. - // if not could be some shenanigans done by devs :P - if (data.isEmpty()) { - sendMessage(issuer, MiniMessage.miniMessage().deserialize(noProxies)); - return; - } - // compute the total pages - int maxPages = (int) Math.ceil(data.size() / (double) pageSize); - if (currentPage > maxPages) currentPage = maxPages; - var subList = subListProxies(data, currentPage, pageSize); - TextComponent.Builder builder = Component.text(); - builder.append(MiniMessage.miniMessage().deserialize(closer)).appendNewline(); - builder.append(MiniMessage.miniMessage().deserialize(pageTop, - Placeholder.component("current", Component.text(currentPage)), - Placeholder.component("max", Component.text(maxPages)), - Placeholder.component("network", Component.text(plugin.proxyDataManager().networkId())), - Placeholder.component("proxies", Component.text(data.size())) - - - )).appendNewline(); - int left = pageSize; - for (Map.Entry entrySet : subList) { - builder.append(MiniMessage.miniMessage().deserialize(proxy, - - Placeholder.component("proxy", Component.text(entrySet.getKey())), - Placeholder.component("here", Component.text(plugin.proxyDataManager().proxyId().equals(entrySet.getKey()) ? proxyHere : "")), - Placeholder.component("players", Component.text(entrySet.getValue())) - - )).appendNewline(); - left--; - } - while(left > 0) { - builder.appendNewline(); - left--; - } - if (currentPage > 1) { - builder.append(MiniMessage.miniMessage().deserialize(previousPage) - .color(NamedTextColor.WHITE).clickEvent(ClickEvent.runCommand("/rb show " + (currentPage - 1)))); - } else { - builder.append(MiniMessage.miniMessage().deserialize(previousPage).color(NamedTextColor.GRAY)); - } - if (subList.size() == pageSize && !subListProxies(data, currentPage + 1, pageSize).isEmpty()) { - builder.append(MiniMessage.miniMessage().deserialize(nextPage) - .color(NamedTextColor.WHITE).clickEvent(ClickEvent.runCommand("/rb show " + (currentPage + 1)))); - } else { - builder.append(MiniMessage.miniMessage().deserialize(nextPage).color(NamedTextColor.GRAY)); - } - builder.appendNewline(); - builder.append(MiniMessage.miniMessage().deserialize(closer)); - sendMessage(issuer, builder.build()); - - } -} diff --git a/commands/src/main/java/com/imaginarycode/minecraft/redisbungee/commands/legacy/CommandFind.java b/commands/src/main/java/com/imaginarycode/minecraft/redisbungee/commands/legacy/CommandFind.java deleted file mode 100644 index 0a73d364..00000000 --- a/commands/src/main/java/com/imaginarycode/minecraft/redisbungee/commands/legacy/CommandFind.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee.commands.legacy; - -import co.aikar.commands.CommandIssuer; -import co.aikar.commands.annotation.CommandAlias; -import co.aikar.commands.annotation.CommandPermission; -import co.aikar.commands.annotation.Default; -import com.imaginarycode.minecraft.redisbungee.commands.utils.AdventureBaseCommand; - -@CommandAlias("find|rfind") -@CommandPermission("redisbungee.command.find") -public class CommandFind extends AdventureBaseCommand { - - private final LegacyRedisBungeeCommands rootCommand; - - public CommandFind(LegacyRedisBungeeCommands rootCommand) { - this.rootCommand = rootCommand; - } - - @Default - public void find(CommandIssuer issuer, String[] args) { - rootCommand.find(issuer, args); - } - -} diff --git a/commands/src/main/java/com/imaginarycode/minecraft/redisbungee/commands/legacy/CommandGList.java b/commands/src/main/java/com/imaginarycode/minecraft/redisbungee/commands/legacy/CommandGList.java deleted file mode 100644 index 54cc9858..00000000 --- a/commands/src/main/java/com/imaginarycode/minecraft/redisbungee/commands/legacy/CommandGList.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee.commands.legacy; - -import co.aikar.commands.CommandIssuer; -import co.aikar.commands.annotation.CommandAlias; -import co.aikar.commands.annotation.CommandPermission; -import co.aikar.commands.annotation.Default; -import com.imaginarycode.minecraft.redisbungee.commands.utils.AdventureBaseCommand; - -@CommandAlias("glist|rglist") -@CommandPermission("redisbungee.command.glist") -public class CommandGList extends AdventureBaseCommand { - - private final LegacyRedisBungeeCommands rootCommand; - - public CommandGList(LegacyRedisBungeeCommands rootCommand) { - this.rootCommand = rootCommand; - } - - @Default - public void gList(CommandIssuer issuer, String[] args) { - rootCommand.gList(issuer, args); - } - -} diff --git a/commands/src/main/java/com/imaginarycode/minecraft/redisbungee/commands/legacy/CommandIp.java b/commands/src/main/java/com/imaginarycode/minecraft/redisbungee/commands/legacy/CommandIp.java deleted file mode 100644 index 410ae916..00000000 --- a/commands/src/main/java/com/imaginarycode/minecraft/redisbungee/commands/legacy/CommandIp.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee.commands.legacy; - -import co.aikar.commands.CommandIssuer; -import co.aikar.commands.annotation.CommandAlias; -import co.aikar.commands.annotation.CommandPermission; -import co.aikar.commands.annotation.Default; -import com.imaginarycode.minecraft.redisbungee.commands.utils.AdventureBaseCommand; - -@CommandAlias("ip|playerip|rip|rplayerip") -@CommandPermission("redisbungee.command.ip") -public class CommandIp extends AdventureBaseCommand { - - private final LegacyRedisBungeeCommands rootCommand; - - public CommandIp(LegacyRedisBungeeCommands rootCommand) { - this.rootCommand = rootCommand; - } - - - @Default - public void ip(CommandIssuer issuer, String[] args) { - this.rootCommand.ip(issuer, args); - } -} diff --git a/commands/src/main/java/com/imaginarycode/minecraft/redisbungee/commands/legacy/CommandLastSeen.java b/commands/src/main/java/com/imaginarycode/minecraft/redisbungee/commands/legacy/CommandLastSeen.java deleted file mode 100644 index f44ea8ef..00000000 --- a/commands/src/main/java/com/imaginarycode/minecraft/redisbungee/commands/legacy/CommandLastSeen.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee.commands.legacy; - -import co.aikar.commands.CommandIssuer; -import co.aikar.commands.annotation.CommandAlias; -import co.aikar.commands.annotation.CommandPermission; -import co.aikar.commands.annotation.Default; -import com.imaginarycode.minecraft.redisbungee.commands.utils.AdventureBaseCommand; - -@CommandAlias("lastseen|rlastseend") -@CommandPermission("redisbungee.command.lastseen") -public class CommandLastSeen extends AdventureBaseCommand { - - - private final LegacyRedisBungeeCommands rootCommand; - - public CommandLastSeen(LegacyRedisBungeeCommands rootCommand) { - this.rootCommand = rootCommand; - } - - @Default - public void lastSeen(CommandIssuer issuer, String[] args) { - this.rootCommand.lastSeen(issuer,args); - } -} diff --git a/commands/src/main/java/com/imaginarycode/minecraft/redisbungee/commands/legacy/CommandPProxy.java b/commands/src/main/java/com/imaginarycode/minecraft/redisbungee/commands/legacy/CommandPProxy.java deleted file mode 100644 index 70a949ca..00000000 --- a/commands/src/main/java/com/imaginarycode/minecraft/redisbungee/commands/legacy/CommandPProxy.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee.commands.legacy; - -import co.aikar.commands.CommandIssuer; -import co.aikar.commands.annotation.CommandAlias; -import co.aikar.commands.annotation.CommandPermission; -import co.aikar.commands.annotation.Default; -import com.imaginarycode.minecraft.redisbungee.commands.utils.AdventureBaseCommand; - -@CommandAlias("pproxy") -@CommandPermission("redisbungee.command.pproxy") -public class CommandPProxy extends AdventureBaseCommand { - private final LegacyRedisBungeeCommands rootCommand; - - public CommandPProxy(LegacyRedisBungeeCommands rootCommand) { - this.rootCommand = rootCommand; - } - - @Default - public void playerProxy(CommandIssuer issuer, String[] args) { - this.rootCommand.playerProxy(issuer,args); - } - -} diff --git a/commands/src/main/java/com/imaginarycode/minecraft/redisbungee/commands/legacy/CommandPlist.java b/commands/src/main/java/com/imaginarycode/minecraft/redisbungee/commands/legacy/CommandPlist.java deleted file mode 100644 index 04e16093..00000000 --- a/commands/src/main/java/com/imaginarycode/minecraft/redisbungee/commands/legacy/CommandPlist.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee.commands.legacy; - -import co.aikar.commands.CommandIssuer; -import co.aikar.commands.annotation.CommandAlias; -import co.aikar.commands.annotation.CommandPermission; -import co.aikar.commands.annotation.Default; -import com.imaginarycode.minecraft.redisbungee.commands.utils.AdventureBaseCommand; - -@CommandAlias("plist|rplist") -@CommandPermission("redisbungee.command.plist") -public class CommandPlist extends AdventureBaseCommand { - - - private final LegacyRedisBungeeCommands rootCommand; - - public CommandPlist(LegacyRedisBungeeCommands rootCommand) { - this.rootCommand = rootCommand; - } - - @Default - public void playerList(CommandIssuer issuer, String[] args) { - this.rootCommand.playerList(issuer, args); - } - -} diff --git a/commands/src/main/java/com/imaginarycode/minecraft/redisbungee/commands/legacy/CommandSendToAll.java b/commands/src/main/java/com/imaginarycode/minecraft/redisbungee/commands/legacy/CommandSendToAll.java deleted file mode 100644 index ad9e1daf..00000000 --- a/commands/src/main/java/com/imaginarycode/minecraft/redisbungee/commands/legacy/CommandSendToAll.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee.commands.legacy; - -import co.aikar.commands.CommandIssuer; -import co.aikar.commands.annotation.CommandAlias; -import co.aikar.commands.annotation.CommandPermission; -import co.aikar.commands.annotation.Default; -import com.imaginarycode.minecraft.redisbungee.commands.utils.AdventureBaseCommand; - -@CommandAlias("sendtoall|rsendtoall") -@CommandPermission("redisbungee.command.sendtoall") -public class CommandSendToAll extends AdventureBaseCommand { - - - private final LegacyRedisBungeeCommands rootCommand; - - public CommandSendToAll(LegacyRedisBungeeCommands rootCommand) { - this.rootCommand = rootCommand; - } - @Default - public void sendToAll(CommandIssuer issuer, String[] args) { - this.rootCommand.sendToAll(issuer, args); - } -} diff --git a/commands/src/main/java/com/imaginarycode/minecraft/redisbungee/commands/legacy/CommandServerId.java b/commands/src/main/java/com/imaginarycode/minecraft/redisbungee/commands/legacy/CommandServerId.java deleted file mode 100644 index c62c2f51..00000000 --- a/commands/src/main/java/com/imaginarycode/minecraft/redisbungee/commands/legacy/CommandServerId.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee.commands.legacy; - -import co.aikar.commands.CommandIssuer; -import co.aikar.commands.annotation.CommandAlias; -import co.aikar.commands.annotation.CommandPermission; -import co.aikar.commands.annotation.Default; -import com.imaginarycode.minecraft.redisbungee.commands.utils.AdventureBaseCommand; - -@CommandAlias("serverid|rserverid") -@CommandPermission("redisbungee.command.serverid") -public class CommandServerId extends AdventureBaseCommand { - - - private final LegacyRedisBungeeCommands rootCommand; - - public CommandServerId(LegacyRedisBungeeCommands rootCommand) { - this.rootCommand = rootCommand; - } - @Default - public void serverId(CommandIssuer issuer) { - this.rootCommand.serverId(issuer); - } -} diff --git a/commands/src/main/java/com/imaginarycode/minecraft/redisbungee/commands/legacy/CommandServerIds.java b/commands/src/main/java/com/imaginarycode/minecraft/redisbungee/commands/legacy/CommandServerIds.java deleted file mode 100644 index 85b53b76..00000000 --- a/commands/src/main/java/com/imaginarycode/minecraft/redisbungee/commands/legacy/CommandServerIds.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee.commands.legacy; - -import co.aikar.commands.CommandIssuer; -import co.aikar.commands.annotation.CommandAlias; -import co.aikar.commands.annotation.CommandPermission; -import co.aikar.commands.annotation.Default; -import com.imaginarycode.minecraft.redisbungee.commands.utils.AdventureBaseCommand; - -@CommandAlias("serverids|rserverids") -@CommandPermission("redisbungee.command.serverids") -public class CommandServerIds extends AdventureBaseCommand { - - - private final LegacyRedisBungeeCommands rootCommand; - - public CommandServerIds(LegacyRedisBungeeCommands rootCommand) { - this.rootCommand = rootCommand; - } - - @Default - public void serverIds(CommandIssuer issuer) { - this.rootCommand.serverIds(issuer); - } - - -} diff --git a/commands/src/main/java/com/imaginarycode/minecraft/redisbungee/commands/legacy/LegacyRedisBungeeCommands.java b/commands/src/main/java/com/imaginarycode/minecraft/redisbungee/commands/legacy/LegacyRedisBungeeCommands.java deleted file mode 100644 index 6253e969..00000000 --- a/commands/src/main/java/com/imaginarycode/minecraft/redisbungee/commands/legacy/LegacyRedisBungeeCommands.java +++ /dev/null @@ -1,260 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee.commands.legacy; - -import co.aikar.commands.CommandIssuer; -import co.aikar.commands.CommandManager; -import co.aikar.commands.annotation.CommandAlias; -import co.aikar.commands.annotation.CommandPermission; -import co.aikar.commands.annotation.Subcommand; -import com.google.common.base.Joiner; -import com.google.common.collect.HashMultimap; -import com.google.common.collect.Multimap; -import com.imaginarycode.minecraft.redisbungee.api.RedisBungeePlugin; -import com.imaginarycode.minecraft.redisbungee.commands.utils.AdventureBaseCommand; -import net.kyori.adventure.text.Component; -import net.kyori.adventure.text.TextComponent; -import net.kyori.adventure.text.format.NamedTextColor; - -import java.net.InetAddress; -import java.text.SimpleDateFormat; -import java.util.Set; -import java.util.TreeSet; -import java.util.UUID; - -@CommandAlias("rbl|redisbungeelegacy") -@CommandPermission("redisbungee.legacy.use") -public class LegacyRedisBungeeCommands extends AdventureBaseCommand { - - private final RedisBungeePlugin plugin; - - public LegacyRedisBungeeCommands(CommandManager commandManager, RedisBungeePlugin plugin) { - this.plugin = plugin; - var commands = plugin.configuration().commandsConfiguration().legacySubCommandsConfiguration(); - if (!plugin.configuration().commandsConfiguration().redisbungeeLegacyEnabled()) throw new IllegalStateException("someone tried to init me while disabled!"); - if (commands == null) throw new NullPointerException("commands config is null!!"); - - if (commands.installGlist()) commandManager.registerCommand(new CommandGList(this)); - if (commands.installFind()) commandManager.registerCommand(new CommandFind(this)); - if (commands.installIp()) commandManager.registerCommand(new CommandIp(this)); - if (commands.installLastseen()) commandManager.registerCommand(new CommandLastSeen(this)); - if (commands.installPlist()) commandManager.registerCommand(new CommandPlist(this)); - if (commands.installPproxy()) commandManager.registerCommand(new CommandPProxy(this)); - if (commands.installSendtoall()) commandManager.registerCommand(new CommandSendToAll(this)); - if (commands.installServerid()) commandManager.registerCommand(new CommandServerId(this)); - if (commands.installServerids()) commandManager.registerCommand(new CommandServerIds(this)); - } - - private static final Component NO_PLAYER_SPECIFIED = - Component.text("You must specify a player name.", NamedTextColor.RED); - private static final Component PLAYER_NOT_FOUND = - Component.text("No such player found.", NamedTextColor.RED); - private static final Component NO_COMMAND_SPECIFIED = - Component.text("You must specify a command to be run.", NamedTextColor.RED); - - private static String playerPlural(int num) { - return num == 1 ? num + " player is" : num + " players are"; - } - - @Subcommand("glist") - @CommandPermission("redisbungee.command.glist") - public void gList(CommandIssuer issuer, String[] args) { - plugin.executeAsync(() -> { - int count = plugin.getAbstractRedisBungeeApi().getPlayerCount(); - Component playersOnline = Component.text(playerPlural(count) + " currently online.", NamedTextColor.YELLOW); - if (args.length > 0 && args[0].equals("showall")) { - Multimap serverToPlayers = plugin.getAbstractRedisBungeeApi().getServerToPlayers(); - Multimap human = HashMultimap.create(); - serverToPlayers.forEach((key, value) -> { - // if for any reason UUID translation fails just return the uuid as name, to make command finish executing. - String playerName = plugin.getUuidTranslator().getNameFromUuid(value, false); - human.put(key, playerName != null ? playerName : value.toString()); - }); - for (String server : new TreeSet<>(serverToPlayers.keySet())) { - Component serverName = Component.text("[" + server + "] ", NamedTextColor.GREEN); - Component serverCount = Component.text("(" + serverToPlayers.get(server).size() + "): ", NamedTextColor.YELLOW); - Component serverPlayers = Component.text(Joiner.on(", ").join(human.get(server)), NamedTextColor.WHITE); - sendMessage(issuer, Component.textOfChildren(serverName, serverCount, serverPlayers)); - } - sendMessage(issuer, playersOnline); - } else { - sendMessage(issuer, playersOnline); - sendMessage(issuer, Component.text("To see all players online, use /glist showall.", NamedTextColor.YELLOW)); - } - - }); - } - - @Subcommand("find") - @CommandPermission("redisbungee.command.find") - public void find(CommandIssuer issuer, String[] args) { - plugin.executeAsync(() -> { - if (args.length > 0) { - UUID uuid = plugin.getUuidTranslator().getTranslatedUuid(args[0], true); - if (uuid == null) { - sendMessage(issuer, PLAYER_NOT_FOUND); - return; - } - String proxyId = plugin.playerDataManager().getProxyFor(uuid); - if (proxyId != null) { - String serverId = plugin.playerDataManager().getServerFor(uuid); - Component message = Component.text(args[0] + " is on proxy " + proxyId + " on server " + serverId +".", NamedTextColor.BLUE); - sendMessage(issuer, message); - } else { - sendMessage(issuer, PLAYER_NOT_FOUND); - } - } else { - sendMessage(issuer, NO_PLAYER_SPECIFIED); - } - }); - - } - - @Subcommand("lastseen") - @CommandPermission("redisbungee.command.lastseen") - public void lastSeen(CommandIssuer issuer, String[] args) { - plugin.executeAsync(() -> { - if (args.length > 0) { - UUID uuid = plugin.getUuidTranslator().getTranslatedUuid(args[0], true); - if (uuid == null) { - sendMessage(issuer, PLAYER_NOT_FOUND); - return; - } - long secs = plugin.getAbstractRedisBungeeApi().getLastOnline(uuid); - TextComponent.Builder message = Component.text(); - if (secs == 0) { - message.color(NamedTextColor.GREEN); - message.content(args[0] + " is currently online."); - } else if (secs != -1) { - message.color(NamedTextColor.BLUE); - message.content(args[0] + " was last online on " + new SimpleDateFormat().format(secs) + "."); - } else { - message.color(NamedTextColor.RED); - message.content(args[0] + " has never been online."); - } - sendMessage(issuer, message.build()); - } else { - sendMessage(issuer, NO_PLAYER_SPECIFIED); - } - - - }); - } - - @Subcommand("ip") - @CommandPermission("redisbungee.command.ip") - public void ip(CommandIssuer issuer, String[] args) { - plugin.executeAsync(() -> { - if (args.length > 0) { - UUID uuid = plugin.getUuidTranslator().getTranslatedUuid(args[0], true); - if (uuid == null) { - sendMessage(issuer, PLAYER_NOT_FOUND); - return; - } - InetAddress ia = plugin.getAbstractRedisBungeeApi().getPlayerIp(uuid); - if (ia != null) { - TextComponent message = Component.text(args[0] + " is connected from " + ia.toString() + ".", NamedTextColor.GREEN); - sendMessage(issuer, message); - } else { - sendMessage(issuer, PLAYER_NOT_FOUND); - } - } else { - sendMessage(issuer, NO_PLAYER_SPECIFIED); - } - }); - } - - @Subcommand("pproxy") - @CommandPermission("redisbungee.command.pproxy") - public void playerProxy(CommandIssuer issuer, String[] args) { - plugin.executeAsync(() -> { - if (args.length > 0) { - UUID uuid = plugin.getUuidTranslator().getTranslatedUuid(args[0], true); - if (uuid == null) { - sendMessage(issuer, PLAYER_NOT_FOUND); - return; - } - String proxy = plugin.getAbstractRedisBungeeApi().getProxy(uuid); - if (proxy != null) { - TextComponent message = Component.text(args[0] + " is connected to " + proxy + ".", NamedTextColor.GREEN); - sendMessage(issuer, message); - } else { - sendMessage(issuer, PLAYER_NOT_FOUND); - } - } else { - sendMessage(issuer, NO_PLAYER_SPECIFIED); - } - }); - - } - - @Subcommand("sendtoall") - @CommandPermission("redisbungee.command.sendtoall") - public void sendToAll(CommandIssuer issuer, String[] args) { - if (args.length > 0) { - String command = Joiner.on(" ").skipNulls().join(args); - plugin.getAbstractRedisBungeeApi().sendProxyCommand(command); - TextComponent message = Component.text("Sent the command /" + command + " to all proxies.", NamedTextColor.GREEN); - sendMessage(issuer, message); - } else { - sendMessage(issuer, NO_COMMAND_SPECIFIED); - } - - } - - @Subcommand("serverid") - @CommandPermission("redisbungee.command.serverid") - public void serverId(CommandIssuer issuer) { - sendMessage(issuer, Component.text("You are on " + plugin.getAbstractRedisBungeeApi().getProxyId() + ".", NamedTextColor.YELLOW)); - } - - @Subcommand("serverids") - @CommandPermission("redisbungee.command.serverids") - public void serverIds(CommandIssuer issuer) { - sendMessage(issuer, Component.text("All Proxies IDs: " + Joiner.on(", ").join(plugin.getAbstractRedisBungeeApi().getAllProxies()), NamedTextColor.YELLOW)); - } - - - @Subcommand("plist") - @CommandPermission("redisbungee.command.plist") - public void playerList(CommandIssuer issuer, String[] args) { - plugin.executeAsync(() -> { - String proxy = args.length >= 1 ? args[0] : plugin.configuration().getProxyId(); - if (!plugin.proxyDataManager().proxiesIds().contains(proxy)) { - sendMessage(issuer, Component.text(proxy + " is not a valid proxy. See /serverids for valid proxies.", NamedTextColor.RED)); - return; - } - Set players = plugin.getAbstractRedisBungeeApi().getPlayersOnProxy(proxy); - Component playersOnline = Component.text(playerPlural(players.size()) + " currently on proxy " + proxy + ".", NamedTextColor.YELLOW); - if (args.length >= 2 && args[1].equals("showall")) { - Multimap serverToPlayers = plugin.getAbstractRedisBungeeApi().getServerToPlayers(); - Multimap human = HashMultimap.create(); - serverToPlayers.forEach((key, value) -> { - if (players.contains(value)) { - human.put(key, plugin.getUuidTranslator().getNameFromUuid(value, false)); - } - }); - for (String server : new TreeSet<>(human.keySet())) { - TextComponent serverName = Component.text("[" + server + "] ", NamedTextColor.RED); - TextComponent serverCount = Component.text("(" + human.get(server).size() + "): ", NamedTextColor.YELLOW); - TextComponent serverPlayers = Component.text(Joiner.on(", ").join(human.get(server)), NamedTextColor.WHITE); - sendMessage(issuer, Component.textOfChildren(serverName, serverCount, serverPlayers)); - } - sendMessage(issuer, playersOnline); - } else { - sendMessage(issuer, playersOnline); - sendMessage(issuer, Component.text("To see all players online, use /plist " + proxy + " showall.", NamedTextColor.YELLOW)); - } - }); - - } - -} \ No newline at end of file diff --git a/commands/src/main/java/com/imaginarycode/minecraft/redisbungee/commands/utils/AdventureBaseCommand.java b/commands/src/main/java/com/imaginarycode/minecraft/redisbungee/commands/utils/AdventureBaseCommand.java deleted file mode 100644 index 873e8ee4..00000000 --- a/commands/src/main/java/com/imaginarycode/minecraft/redisbungee/commands/utils/AdventureBaseCommand.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee.commands.utils; - -import co.aikar.commands.BaseCommand; -import co.aikar.commands.CommandIssuer; -import net.kyori.adventure.text.Component; - -/** - * this just dumb class that wraps the adventure stuff into base command - */ -public abstract class AdventureBaseCommand extends BaseCommand { - - public static void sendMessage(CommandIssuer issuer, Component component) { - CommandPlatformHelper.getPlatformHelper().sendMessage(issuer, component); - } - -} diff --git a/commands/src/main/java/com/imaginarycode/minecraft/redisbungee/commands/utils/CommandPlatformHelper.java b/commands/src/main/java/com/imaginarycode/minecraft/redisbungee/commands/utils/CommandPlatformHelper.java deleted file mode 100644 index a951e9dd..00000000 --- a/commands/src/main/java/com/imaginarycode/minecraft/redisbungee/commands/utils/CommandPlatformHelper.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee.commands.utils; - -import co.aikar.commands.CommandIssuer; -import com.imaginarycode.minecraft.redisbungee.api.RedisBungeePlugin; -import net.kyori.adventure.text.Component; - - -public abstract class CommandPlatformHelper { - - private static CommandPlatformHelper SINGLETON; - - public abstract void sendMessage(CommandIssuer issuer, Component component); - - public static void init(CommandPlatformHelper platformHelper) { - if (SINGLETON != null) { - throw new IllegalStateException("tried to re init Platform Helper"); - } - SINGLETON = platformHelper; - } - - - public static CommandPlatformHelper getPlatformHelper() { - return SINGLETON; - } - -} diff --git a/commands/src/main/java/com/imaginarycode/minecraft/redisbungee/commands/utils/StopperUUIDCleanupTask.java b/commands/src/main/java/com/imaginarycode/minecraft/redisbungee/commands/utils/StopperUUIDCleanupTask.java deleted file mode 100644 index 06dbe858..00000000 --- a/commands/src/main/java/com/imaginarycode/minecraft/redisbungee/commands/utils/StopperUUIDCleanupTask.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.imaginarycode.minecraft.redisbungee.commands.utils; - -import com.imaginarycode.minecraft.redisbungee.api.RedisBungeePlugin; -import com.imaginarycode.minecraft.redisbungee.api.tasks.UUIDCleanupTask; -import redis.clients.jedis.UnifiedJedis; - -public class StopperUUIDCleanupTask extends UUIDCleanupTask { - - public static boolean isRunning = false; - - public StopperUUIDCleanupTask(RedisBungeePlugin plugin) { - super(plugin); - } - - - @Override - public Void unifiedJedisTask(UnifiedJedis unifiedJedis) { - isRunning = true; - try { - super.unifiedJedisTask(unifiedJedis); - } catch (Exception ignored) {} - isRunning = false; - return null; - } -} diff --git a/copyright_print.txt b/copyright_print.txt index 685fc407..593c82a4 100644 --- a/copyright_print.txt +++ b/copyright_print.txt @@ -1,7 +1,7 @@ -Copyright (c) 2013-present RedisBungee contributors +Copyright (c) 2024-present ValioBungee contributors All rights reserved. This program and the accompanying materials -are made available under the terms of the Eclipse Public License v1.0 +are made available under the terms of the Apache License 2.0 which accompanies this distribution, and is available at -http://www.eclipse.org/legal/epl-v10.html \ No newline at end of file +https://www.apache.org/licenses/LICENSE-2.0.txt \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index f0a16c02..85d1d6e5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,2 +1,2 @@ -group=com.imaginarycode.minecraft -version=0.12.5 \ No newline at end of file +group=net.limework.plugins +version=1.0.0-SNAPSHOT \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index a4b76b9530d66f5e68d973ea569d8e19de379189..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 GIT binary patch literal 0 HcmV?d00001 literal 43583 zcma&N1CXTcmMvW9vTb(Rwr$&4wr$(C?dmSu>@vG-+vuvg^_??!{yS%8zW-#zn-LkA z5&1^$^{lnmUON?}LBF8_K|(?T0Ra(xUH{($5eN!MR#ZihR#HxkUPe+_R8Cn`RRs(P z_^*#_XlXmGv7!4;*Y%p4nw?{bNp@UZHv1?Um8r6)Fei3p@ClJn0ECfg1hkeuUU@Or zDaPa;U3fE=3L}DooL;8f;P0ipPt0Z~9P0)lbStMS)ag54=uL9ia-Lm3nh|@(Y?B`; zx_#arJIpXH!U{fbCbI^17}6Ri*H<>OLR%c|^mh8+)*h~K8Z!9)DPf zR2h?lbDZQ`p9P;&DQ4F0sur@TMa!Y}S8irn(%d-gi0*WxxCSk*A?3lGh=gcYN?FGl z7D=Js!i~0=u3rox^eO3i@$0=n{K1lPNU zwmfjRVmLOCRfe=seV&P*1Iq=^i`502keY8Uy-WNPwVNNtJFx?IwAyRPZo2Wo1+S(xF37LJZ~%i)kpFQ3Fw=mXfd@>%+)RpYQLnr}B~~zoof(JVm^^&f zxKV^+3D3$A1G;qh4gPVjhrC8e(VYUHv#dy^)(RoUFM?o%W-EHxufuWf(l*@-l+7vt z=l`qmR56K~F|v<^Pd*p~1_y^P0P^aPC##d8+HqX4IR1gu+7w#~TBFphJxF)T$2WEa zxa?H&6=Qe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UlP*?$YU9C_eAsuVHJ58?)zpbr30P*C`T z7y#ao`uE-SOG(Pi+`$=e^mle~)pRrdwL5)N;o{gpW21of(QE#U6w%*C~`v-z0QqBML!!5EeYA5IQB0 z^l01c;L6E(iytN!LhL}wfwP7W9PNAkb+)Cst?qg#$n;z41O4&v+8-zPs+XNb-q zIeeBCh#ivnFLUCwfS;p{LC0O7tm+Sf9Jn)~b%uwP{%69;QC)Ok0t%*a5M+=;y8j=v z#!*pp$9@!x;UMIs4~hP#pnfVc!%-D<+wsG@R2+J&%73lK|2G!EQC)O05TCV=&3g)C!lT=czLpZ@Sa%TYuoE?v8T8`V;e$#Zf2_Nj6nvBgh1)2 GZ~q4|mN%#X diff --git a/proxies/bungeecord/build.gradle.kts b/proxies/bungeecord/build.gradle.kts deleted file mode 100644 index 0e4274be..00000000 --- a/proxies/bungeecord/build.gradle.kts +++ /dev/null @@ -1,67 +0,0 @@ -plugins { - java - id("com.github.johnrengelman.shadow") version "8.1.1" - //id("xyz.jpenilla.run-waterfall") version "2.0.0" -} - -dependencies { - implementation(project(":RedisBungee-Bungee")) - compileOnly(libs.platform.bungeecord) { - exclude("com.google.guava", "guava") - exclude("com.google.code.gson", "gson") - exclude("net.kyori","adventure-api") - } - implementation(libs.adventure.platforms.bungeecord) - implementation(libs.adventure.gson) - implementation(libs.acf.bungeecord) - implementation(project(":RedisBungee-Commands")) -} - -description = "RedisBungee Bungeecord implementation" - -java { - withSourcesJar() -} - -tasks { - - //runWaterfall { - //waterfallVersion("1.20") - //environment["REDISBUNGEE_PROXY_ID"] = "bungeecord-1" - //["REDISBUNGEE_NETWORK_ID"] = "dev" - //} - compileJava { - options.encoding = Charsets.UTF_8.name() - options.release.set(17) - } - processResources { - filteringCharset = Charsets.UTF_8.name() - filesMatching("plugin.yml") { - filter { - it.replace("*{redisbungee.version}*", "$version", false) - } - } - - } - shadowJar { - relocate("redis.clients.jedis", "com.imaginarycode.minecraft.redisbungee.internal.jedis") - relocate("redis.clients.util", "com.imaginarycode.minecraft.redisbungee.internal.jedisutil") - relocate("org.apache.commons.pool", "com.imaginarycode.minecraft.redisbungee.internal.commonspool") - relocate("com.squareup.okhttp", "com.imaginarycode.minecraft.redisbungee.internal.okhttp") - relocate("okio", "com.imaginarycode.minecraft.redisbungee.internal.okio") - relocate("org.json", "com.imaginarycode.minecraft.redisbungee.internal.json") - // configurate shade - relocate("ninja.leaping.configurate", "com.imaginarycode.minecraft.redisbungee.internal.configurate") - relocate("org.yaml", "com.imaginarycode.minecraft.redisbungee.internal.yml") - relocate("com.google.common", "com.imaginarycode.minecraft.redisbungee.internal.com.google.common") - relocate("com.google.errorprone", "com.imaginarycode.minecraft.redisbungee.internal.com.google.errorprone") - relocate("com.google.gson", "com.imaginarycode.minecraft.redisbungee.internal.com.google.gson") - relocate("com.google.j2objc", "com.imaginarycode.minecraft.redisbungee.internal.com.google.j2objc") - relocate("com.google.thirdparty", "com.imaginarycode.minecraft.redisbungee.internal.com.google.thirdparty") - relocate("com.github.benmanes.caffeine", "com.imaginarycode.minecraft.redisbungee.internal.caffeine") - // acf shade - relocate("co.aikar.commands", "com.imaginarycode.minecraft.redisbungee.internal.acf.commands") - - } - -} diff --git a/proxies/bungeecord/bungeecord-api/build.gradle.kts b/proxies/bungeecord/bungeecord-api/build.gradle.kts deleted file mode 100644 index 8fd48400..00000000 --- a/proxies/bungeecord/bungeecord-api/build.gradle.kts +++ /dev/null @@ -1,50 +0,0 @@ -plugins { - `java-library` - `maven-publish` -} - -dependencies { - api(project(":RedisBungee-API")) - compileOnly(libs.platform.bungeecord) { - exclude("com.google.guava", "guava") - exclude("com.google.code.gson", "gson") - exclude("net.kyori","adventure-api") - } -} - -description = "RedisBungee Bungeecord API" - -java { - withJavadocJar() - withSourcesJar() -} - - -tasks { - withType { - dependsOn(project(":RedisBungee-API").getTasksByName("javadoc", false)) - val options = options as StandardJavadocDocletOptions - options.use() - options.isDocFilesSubDirs = true - options.links( - "https://ci.md-5.net/job/BungeeCord/ws/api/target/apidocs/", // bungeecord api - ) - val apiDocs = File(rootProject.projectDir, "api/build/docs/javadoc") - options.linksOffline("https://ci.limework.net/ValioBungee/api/build/docs/javadoc", apiDocs.path) - } - compileJava { - options.encoding = Charsets.UTF_8.name() - options.release.set(17) - } - javadoc { - options.encoding = Charsets.UTF_8.name() - } -} - -publishing { - publications { - create("maven") { - from(components["java"]) - } - } -} \ No newline at end of file diff --git a/proxies/bungeecord/bungeecord-api/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungeeAPI.java b/proxies/bungeecord/bungeecord-api/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungeeAPI.java deleted file mode 100644 index 5140fdbc..00000000 --- a/proxies/bungeecord/bungeecord-api/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungeeAPI.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee; - -import com.imaginarycode.minecraft.redisbungee.api.RedisBungeePlugin; -import net.md_5.bungee.api.config.ServerInfo; -import net.md_5.bungee.api.plugin.Plugin; -import org.checkerframework.checker.nullness.qual.NonNull; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.UUID; - -/** - * This platform class exposes some internal RedisBungee functions. You obtain an instance of this object by invoking {@link RedisBungeeAPI#getRedisBungeeApi()} - * or somehow you got the Plugin instance by you can call the api using {@link RedisBungeePlugin#getAbstractRedisBungeeApi()}. - * - * @author tuxed - * @since 0.2.3 | updated 0.8.0 - */ -public class RedisBungeeAPI extends AbstractRedisBungeeAPI { - - private static RedisBungeeAPI redisBungeeApi; - - public RedisBungeeAPI(RedisBungeePlugin plugin) { - super(plugin); - if (redisBungeeApi == null) { - redisBungeeApi = this; - } - } - - /** - * Get the server where the specified player is playing. This function also deals with the case of local players - * as well, and will return local information on them. - * - * @param player a player uuid - * @return {@link ServerInfo} Can be null if proxy can't find it. - * @see #getServerNameFor(UUID) - */ - @Nullable - public final ServerInfo getServerFor(@NonNull UUID player) { - String serverName = this.getServerNameFor(player); - if (serverName == null) return null; - return ((Plugin) this.plugin).getProxy().getServerInfo(serverName); - } - - /** - * Api instance - * - * @return the API instance. - * @since 0.6.5 - */ - public static RedisBungeeAPI getRedisBungeeApi() { - return redisBungeeApi; - } -} diff --git a/proxies/bungeecord/bungeecord-api/src/main/java/com/imaginarycode/minecraft/redisbungee/events/PlayerChangedServerNetworkEvent.java b/proxies/bungeecord/bungeecord-api/src/main/java/com/imaginarycode/minecraft/redisbungee/events/PlayerChangedServerNetworkEvent.java deleted file mode 100644 index a6b33f9a..00000000 --- a/proxies/bungeecord/bungeecord-api/src/main/java/com/imaginarycode/minecraft/redisbungee/events/PlayerChangedServerNetworkEvent.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee.events; - -import com.imaginarycode.minecraft.redisbungee.api.events.IPlayerChangedServerNetworkEvent; -import net.md_5.bungee.api.plugin.Event; - -import java.util.UUID; - -/** - * This event is sent when a player connects to a new server. RedisBungee sends the event only when - * the proxy the player has been connected to is different than the local proxy. - *

- * This event corresponds to {@link net.md_5.bungee.api.event.ServerConnectedEvent}, and is fired - * asynchronously. - * - * @since 0.3.4 - */ -public class PlayerChangedServerNetworkEvent extends Event implements IPlayerChangedServerNetworkEvent { - private final UUID uuid; - private final String previousServer; - private final String server; - - public PlayerChangedServerNetworkEvent(UUID uuid, String previousServer, String server) { - this.uuid = uuid; - this.previousServer = previousServer; - this.server = server; - } - - @Override - public UUID getUuid() { - return uuid; - } - - @Override - public String getServer() { - return server; - } - - @Override - public String getPreviousServer() { - return previousServer; - } -} diff --git a/proxies/bungeecord/bungeecord-api/src/main/java/com/imaginarycode/minecraft/redisbungee/events/PlayerJoinedNetworkEvent.java b/proxies/bungeecord/bungeecord-api/src/main/java/com/imaginarycode/minecraft/redisbungee/events/PlayerJoinedNetworkEvent.java deleted file mode 100644 index 51ff8423..00000000 --- a/proxies/bungeecord/bungeecord-api/src/main/java/com/imaginarycode/minecraft/redisbungee/events/PlayerJoinedNetworkEvent.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee.events; - -import com.imaginarycode.minecraft.redisbungee.api.events.IPlayerJoinedNetworkEvent; -import net.md_5.bungee.api.plugin.Event; - -import java.util.UUID; - -/** - * This event is sent when a player joins the network. RedisBungee sends the event only when - * the proxy the player has been connected to is different than the local proxy. - *

- * This event corresponds to {@link net.md_5.bungee.api.event.PostLoginEvent}, and is fired - * asynchronously. - * - * @since 0.3.4 - */ -public class PlayerJoinedNetworkEvent extends Event implements IPlayerJoinedNetworkEvent { - private final UUID uuid; - - public PlayerJoinedNetworkEvent(UUID uuid) { - this.uuid = uuid; - } - - @Override - public UUID getUuid() { - return uuid; - } -} diff --git a/proxies/bungeecord/bungeecord-api/src/main/java/com/imaginarycode/minecraft/redisbungee/events/PlayerLeftNetworkEvent.java b/proxies/bungeecord/bungeecord-api/src/main/java/com/imaginarycode/minecraft/redisbungee/events/PlayerLeftNetworkEvent.java deleted file mode 100644 index 3edf2bb0..00000000 --- a/proxies/bungeecord/bungeecord-api/src/main/java/com/imaginarycode/minecraft/redisbungee/events/PlayerLeftNetworkEvent.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee.events; - -import com.imaginarycode.minecraft.redisbungee.api.events.IPlayerLeftNetworkEvent; -import net.md_5.bungee.api.plugin.Event; - -import java.util.UUID; - -/** - * This event is sent when a player disconnects. RedisBungee sends the event only when - * the proxy the player has been connected to is different than the local proxy. - *

- * This event corresponds to {@link net.md_5.bungee.api.event.PlayerDisconnectEvent}, and is fired - * asynchronously. - * - * @since 0.3.4 - */ -public class PlayerLeftNetworkEvent extends Event implements IPlayerLeftNetworkEvent { - private final UUID uuid; - - public PlayerLeftNetworkEvent(UUID uuid) { - this.uuid = uuid; - } - - @Override - public UUID getUuid() { - return uuid; - } -} diff --git a/proxies/bungeecord/bungeecord-api/src/main/java/com/imaginarycode/minecraft/redisbungee/events/PubSubMessageEvent.java b/proxies/bungeecord/bungeecord-api/src/main/java/com/imaginarycode/minecraft/redisbungee/events/PubSubMessageEvent.java deleted file mode 100644 index b328c401..00000000 --- a/proxies/bungeecord/bungeecord-api/src/main/java/com/imaginarycode/minecraft/redisbungee/events/PubSubMessageEvent.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee.events; - -import com.imaginarycode.minecraft.redisbungee.api.events.IPubSubMessageEvent; -import net.md_5.bungee.api.plugin.Event; - -/** - * This event is posted when a PubSub message is received. - *

- * Warning: This event is fired in a separate thread! - * - * @since 0.2.6 - */ - -public class PubSubMessageEvent extends Event implements IPubSubMessageEvent { - private final String channel; - private final String message; - - public PubSubMessageEvent(String channel, String message) { - this.channel = channel; - this.message = message; - } - - @Override - public String getChannel() { - return channel; - } - - @Override - public String getMessage() { - return message; - } -} diff --git a/proxies/bungeecord/src/main/java/com/imaginarycode/minecraft/redisbungee/BungeeCommandPlatformHelper.java b/proxies/bungeecord/src/main/java/com/imaginarycode/minecraft/redisbungee/BungeeCommandPlatformHelper.java deleted file mode 100644 index 019d06f8..00000000 --- a/proxies/bungeecord/src/main/java/com/imaginarycode/minecraft/redisbungee/BungeeCommandPlatformHelper.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.imaginarycode.minecraft.redisbungee; - -import co.aikar.commands.BungeeCommandIssuer; -import co.aikar.commands.CommandIssuer; -import com.imaginarycode.minecraft.redisbungee.commands.utils.CommandPlatformHelper; -import net.kyori.adventure.text.Component; -import net.kyori.adventure.text.serializer.bungeecord.BungeeComponentSerializer; - -public class BungeeCommandPlatformHelper extends CommandPlatformHelper { - - @Override - public void sendMessage(CommandIssuer issuer, Component component) { - BungeeCommandIssuer bIssuer = (BungeeCommandIssuer) issuer; - bIssuer.getIssuer().sendMessage(BungeeComponentSerializer.get().serialize(component)); - } - -} diff --git a/proxies/bungeecord/src/main/java/com/imaginarycode/minecraft/redisbungee/BungeePlayerDataManager.java b/proxies/bungeecord/src/main/java/com/imaginarycode/minecraft/redisbungee/BungeePlayerDataManager.java deleted file mode 100644 index 8b7ff2f3..00000000 --- a/proxies/bungeecord/src/main/java/com/imaginarycode/minecraft/redisbungee/BungeePlayerDataManager.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee; - -import com.imaginarycode.minecraft.redisbungee.api.PlayerDataManager; -import com.imaginarycode.minecraft.redisbungee.api.RedisBungeePlugin; -import com.imaginarycode.minecraft.redisbungee.events.PlayerChangedServerNetworkEvent; -import com.imaginarycode.minecraft.redisbungee.events.PlayerLeftNetworkEvent; -import com.imaginarycode.minecraft.redisbungee.events.PubSubMessageEvent; -import net.kyori.adventure.text.serializer.bungeecord.BungeeComponentSerializer; -import net.md_5.bungee.api.connection.ProxiedPlayer; -import net.md_5.bungee.api.event.LoginEvent; -import net.md_5.bungee.api.event.PlayerDisconnectEvent; -import net.md_5.bungee.api.event.PostLoginEvent; -import net.md_5.bungee.api.event.ServerConnectedEvent; -import net.md_5.bungee.api.plugin.Listener; -import net.md_5.bungee.api.plugin.Plugin; -import net.md_5.bungee.event.EventHandler; - -import java.util.concurrent.TimeUnit; - - -public class BungeePlayerDataManager extends PlayerDataManager implements Listener { - - public BungeePlayerDataManager(RedisBungeePlugin plugin) { - super(plugin); - } - - @EventHandler - public void onPlayerChangedServerNetworkEvent(PlayerChangedServerNetworkEvent event) { - super.handleNetworkPlayerServerChange(event); - } - - @EventHandler - public void onNetworkPlayerQuit(PlayerLeftNetworkEvent event) { - super.handleNetworkPlayerQuit(event); - } - - @EventHandler - public void onPubSubMessageEvent(PubSubMessageEvent event) { - super.handlePubSubMessageEvent(event); - } - - @EventHandler - public void onServerConnectedEvent(ServerConnectedEvent event) { - final String currentServer = event.getServer().getInfo().getName(); - final String oldServer = event.getPlayer().getServer() == null ? null : event.getPlayer().getServer().getInfo().getName(); - super.playerChangedServer(event.getPlayer().getUniqueId(), oldServer, currentServer); - } - - @EventHandler - public void onLoginEvent(LoginEvent event) { - event.registerIntent((Plugin) plugin); - // check if online - if (getLastOnline(event.getConnection().getUniqueId()) == 0) { - // because something can go wrong and proxy somehow does not update player data correctly on shutdown - // we have to check proxy if it has the player - String proxyId = getProxyFor(event.getConnection().getUniqueId()); - if (proxyId == null || !plugin.proxyDataManager().isPlayerTrulyOnProxy(proxyId, event.getConnection().getUniqueId())) { - event.completeIntent((Plugin) plugin); - } else { - if (plugin.configuration().kickWhenOnline()) { - kickPlayer(event.getConnection().getUniqueId(), plugin.langConfiguration().messages().loggedInFromOtherLocation()); - // wait 3 seconds before releasing the event - plugin.executeAsyncAfter(() -> event.completeIntent((Plugin) plugin), TimeUnit.SECONDS, 3); - } else { - event.setCancelled(true); - event.setCancelReason(BungeeComponentSerializer.get().serialize(plugin.langConfiguration().messages().alreadyLoggedIn())); - event.completeIntent((Plugin) plugin); - } - } - } else { - event.completeIntent((Plugin) plugin); - } - - } - - @EventHandler - public void onLoginEvent(PostLoginEvent event) { - super.addPlayer(event.getPlayer().getUniqueId(), event.getPlayer().getName(), event.getPlayer().getAddress().getAddress()); - } - - @EventHandler - public void onDisconnectEvent(PlayerDisconnectEvent event) { - super.removePlayer(event.getPlayer().getUniqueId()); - } - - -} diff --git a/proxies/bungeecord/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungee.java b/proxies/bungeecord/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungee.java deleted file mode 100644 index d5ae22ba..00000000 --- a/proxies/bungeecord/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungee.java +++ /dev/null @@ -1,373 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee; - -import co.aikar.commands.BungeeCommandManager; -import com.imaginarycode.minecraft.redisbungee.api.PlayerDataManager; -import com.imaginarycode.minecraft.redisbungee.api.ProxyDataManager; -import com.imaginarycode.minecraft.redisbungee.api.RedisBungeeMode; -import com.imaginarycode.minecraft.redisbungee.api.RedisBungeePlugin; -import com.imaginarycode.minecraft.redisbungee.api.config.LangConfiguration; -import com.imaginarycode.minecraft.redisbungee.api.config.loaders.ConfigLoader; -import com.imaginarycode.minecraft.redisbungee.api.config.RedisBungeeConfiguration; -import com.imaginarycode.minecraft.redisbungee.api.config.loaders.LangConfigLoader; -import com.imaginarycode.minecraft.redisbungee.api.events.IPlayerChangedServerNetworkEvent; -import com.imaginarycode.minecraft.redisbungee.api.events.IPlayerJoinedNetworkEvent; -import com.imaginarycode.minecraft.redisbungee.api.events.IPlayerLeftNetworkEvent; -import com.imaginarycode.minecraft.redisbungee.api.events.IPubSubMessageEvent; -import com.imaginarycode.minecraft.redisbungee.api.summoners.Summoner; -import com.imaginarycode.minecraft.redisbungee.api.util.InitialUtils; -import com.imaginarycode.minecraft.redisbungee.api.util.uuid.NameFetcher; -import com.imaginarycode.minecraft.redisbungee.api.util.uuid.UUIDFetcher; -import com.imaginarycode.minecraft.redisbungee.api.util.uuid.UUIDTranslator; -import com.imaginarycode.minecraft.redisbungee.commands.CommandLoader; -import com.imaginarycode.minecraft.redisbungee.commands.utils.CommandPlatformHelper; -import com.imaginarycode.minecraft.redisbungee.events.PlayerChangedServerNetworkEvent; -import com.imaginarycode.minecraft.redisbungee.events.PlayerJoinedNetworkEvent; -import com.imaginarycode.minecraft.redisbungee.events.PlayerLeftNetworkEvent; -import com.imaginarycode.minecraft.redisbungee.events.PubSubMessageEvent; -import com.squareup.okhttp.Dispatcher; -import com.squareup.okhttp.OkHttpClient; -import net.kyori.adventure.text.Component; -import net.kyori.adventure.text.serializer.bungeecord.BungeeComponentSerializer; -import net.md_5.bungee.api.ProxyServer; -import net.md_5.bungee.api.connection.ProxiedPlayer; -import net.md_5.bungee.api.plugin.Event; -import net.md_5.bungee.api.plugin.Plugin; -import net.md_5.bungee.api.scheduler.ScheduledTask; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import redis.clients.jedis.JedisPool; - -import java.io.IOException; -import java.lang.reflect.Field; -import java.net.InetAddress; -import java.sql.Date; -import java.time.Instant; -import java.util.HashSet; -import java.util.Set; -import java.util.UUID; -import java.util.concurrent.*; -import java.util.logging.Level; - - -public class RedisBungee extends Plugin implements RedisBungeePlugin, ConfigLoader, LangConfigLoader { - - private static RedisBungeeAPI apiStatic; - private AbstractRedisBungeeAPI api; - private RedisBungeeMode redisBungeeMode; - private ProxyDataManager proxyDataManager; - private BungeePlayerDataManager playerDataManager; - private ScheduledTask heartbeatTask; - private ScheduledTask cleanupTask; - private Summoner summoner; - private UUIDTranslator uuidTranslator; - private RedisBungeeConfiguration configuration; - private LangConfiguration langConfiguration; - private OkHttpClient httpClient; - private BungeeCommandManager commandManager; - - private final Logger logger = LoggerFactory.getLogger("RedisBungee"); - - - @Override - public RedisBungeeConfiguration configuration() { - return this.configuration; - } - - @Override - public LangConfiguration langConfiguration() { - return this.langConfiguration; - } - - @Override - public AbstractRedisBungeeAPI getAbstractRedisBungeeApi() { - return this.api; - } - - @Override - public ProxyDataManager proxyDataManager() { - return this.proxyDataManager; - } - - @Override - public PlayerDataManager playerDataManager() { - return this.playerDataManager; - } - - @Override - public UUIDTranslator getUuidTranslator() { - return this.uuidTranslator; - } - - @Override - public void fireEvent(Object event) { - this.getProxy().getPluginManager().callEvent((Event) event); - } - - @Override - public boolean isOnlineMode() { - return this.getProxy().getConfig().isOnlineMode(); - } - - @Override - public void logInfo(String msg) { - this.logger.info(msg); - } - - @Override - public void logInfo(String format, Object... object) { - this.logger.info(format, object); - } - - @Override - public void logWarn(String msg) { - this.logger.warn(msg); - } - - @Override - public void logWarn(String format, Object... object) { - this.logger.warn(format, object); - } - - @Override - public void logFatal(String msg) { - this.logger.error(msg); - } - - @Override - public void logFatal(String format, Throwable throwable) { - this.logger.error(format, throwable); - } - - @Override - public ProxiedPlayer getPlayer(UUID uuid) { - return this.getProxy().getPlayer(uuid); - } - - @Override - public ProxiedPlayer getPlayer(String name) { - return this.getProxy().getPlayer(name); - } - - @Override - public UUID getPlayerUUID(String player) { - return this.getProxy().getPlayer(player).getUniqueId(); - } - - @Override - public String getPlayerName(UUID player) { - return this.getProxy().getPlayer(player).getName(); - } - - @Override - public boolean handlePlatformKick(UUID uuid, Component message) { - ProxiedPlayer player = getPlayer(uuid); - if (player == null) return false; - if (!player.isConnected()) return false; - player.disconnect(BungeeComponentSerializer.get().serialize(message)); - return true; - } - - @Override - public String getPlayerServerName(ProxiedPlayer player) { - return player.getServer().getInfo().getName(); - } - - @Override - public boolean isPlayerOnAServer(ProxiedPlayer player) { - return player.getServer() != null; - } - - @Override - public InetAddress getPlayerIp(ProxiedPlayer player) { - return player.getAddress().getAddress(); - } - - - @Override - public void initialize() { - logInfo("Initializing RedisBungee....."); - logInfo("Version: {}", Constants.VERSION); - ThreadFactory factory = ((ThreadPoolExecutor) getExecutorService()).getThreadFactory(); - ScheduledExecutorService service = Executors.newScheduledThreadPool(24, factory); - try { - Field field = Plugin.class.getDeclaredField("service"); - field.setAccessible(true); - ExecutorService builtinService = (ExecutorService) field.get(this); - field.set(this, service); - builtinService.shutdownNow(); - } catch (IllegalAccessException | NoSuchFieldException e) { - getLogger().log(Level.WARNING, "Can't replace BungeeCord thread pool with our own"); - getLogger().log(Level.WARNING, "skipping replacement....."); - } - try { - loadConfig(this, getDataFolder().toPath()); - loadLangConfig(this, getDataFolder().toPath()); - } catch (IOException e) { - throw new RuntimeException("Unable to load/save config", e); - } - // init the proxy data manager - this.proxyDataManager = new ProxyDataManager(this) { - @Override - public Set getLocalOnlineUUIDs() { - HashSet uuids = new HashSet<>(); - ProxyServer.getInstance().getPlayers().forEach((proxiedPlayer) -> uuids.add(proxiedPlayer.getUniqueId())); - return uuids; - } - - @Override - protected void handlePlatformCommandExecution(String command) { - logInfo("Dispatching {}", command); - ProxyServer.getInstance().getPluginManager().dispatchCommand(RedisBungeeCommandSender.getSingleton(), command); - } - }; - this.playerDataManager = new BungeePlayerDataManager(this); - - getProxy().getPluginManager().registerListener(this, this.playerDataManager); - getProxy().getPluginManager().registerListener(this, new RedisBungeeListener(this)); - // start listening - getProxy().getScheduler().runAsync(this, proxyDataManager); - // heartbeat - this.heartbeatTask = getProxy().getScheduler().schedule(this, () -> this.proxyDataManager.publishHeartbeat(), 0, 1, TimeUnit.SECONDS); - // cleanup - this.cleanupTask = getProxy().getScheduler().schedule(this, () -> this.proxyDataManager.correctionTask(), 0, 60, TimeUnit.SECONDS); - // init the http lib - httpClient = new OkHttpClient(); - Dispatcher dispatcher = new Dispatcher(getExecutorService()); - httpClient.setDispatcher(dispatcher); - NameFetcher.setHttpClient(httpClient); - UUIDFetcher.setHttpClient(httpClient); - InitialUtils.checkRedisVersion(this); - uuidTranslator = new UUIDTranslator(this); - - // register plugin messages channel. - getProxy().registerChannel("legacy:redisbungee"); - getProxy().registerChannel("RedisBungee"); - - // init the api - this.api = new RedisBungeeAPI(this); - apiStatic = (RedisBungeeAPI) this.api; - - // commands - CommandPlatformHelper.init(new BungeeCommandPlatformHelper()); - this.commandManager = new BungeeCommandManager(this); - CommandLoader.initCommands(this.commandManager, this); - - logInfo("RedisBungee initialized successfully "); - } - - @Override - public void stop() { - logInfo("Turning off redis connections....."); - getProxy().getPluginManager().unregisterListeners(this); - - if (this.cleanupTask != null) { - this.cleanupTask.cancel(); - } - if (heartbeatTask != null) { - heartbeatTask.cancel(); - } - try { - this.proxyDataManager.close(); - } catch (Exception e) { - throw new RuntimeException(e); - } - try { - this.summoner.close(); - } catch (IOException e) { - throw new RuntimeException(e); - } - if (this.commandManager != null) { - this.commandManager.unregisterCommands(); - } - logInfo("RedisBungee shutdown successfully"); - } - - @Override - public Summoner getSummoner() { - return this.summoner; - } - - @Override - public RedisBungeeMode getRedisBungeeMode() { - return this.redisBungeeMode; - } - - @Override - public void executeAsync(Runnable runnable) { - this.getProxy().getScheduler().runAsync(this, runnable); - } - - @Override - public void executeAsyncAfter(Runnable runnable, TimeUnit timeUnit, int time) { - this.getProxy().getScheduler().schedule(this, runnable, time, timeUnit); - } - - @Override - public void onEnable() { - initialize(); - } - - @Override - public void onDisable() { - stop(); - } - - @Override - public IPlayerChangedServerNetworkEvent createPlayerChangedServerNetworkEvent(UUID uuid, String previousServer, String server) { - return new PlayerChangedServerNetworkEvent(uuid, previousServer, server); - } - - @Override - public IPlayerJoinedNetworkEvent createPlayerJoinedNetworkEvent(UUID uuid) { - return new PlayerJoinedNetworkEvent(uuid); - } - - @Override - public IPlayerLeftNetworkEvent createPlayerLeftNetworkEvent(UUID uuid) { - return new PlayerLeftNetworkEvent(uuid); - } - - @Override - public IPubSubMessageEvent createPubSubEvent(String channel, String message) { - return new PubSubMessageEvent(channel, message); - } - - @Override - public void onConfigLoad(RedisBungeeConfiguration configuration, Summoner summoner, RedisBungeeMode mode) { - this.configuration = configuration; - this.redisBungeeMode = mode; - this.summoner = summoner; - } - - /** - * This returns an instance of {@link RedisBungeeAPI} - * - * @return the {@link AbstractRedisBungeeAPI} object instance. - * @deprecated Please use {@link RedisBungeeAPI#getRedisBungeeApi()} this class intended to for old plugins that no longer updated. - */ - @Deprecated - public static RedisBungeeAPI getApi() { - return apiStatic; - } - - @Deprecated - public JedisPool getPool() { - return api.getJedisPool(); - } - - - @Override - public void onLangConfigLoad(LangConfiguration langConfiguration) { - this.langConfiguration = langConfiguration; - } -} diff --git a/proxies/bungeecord/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungeeCommandSender.java b/proxies/bungeecord/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungeeCommandSender.java deleted file mode 100644 index b8a3949e..00000000 --- a/proxies/bungeecord/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungeeCommandSender.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee; - -import net.md_5.bungee.api.CommandSender; -import net.md_5.bungee.api.chat.BaseComponent; - -import java.util.Collection; -import java.util.Collections; - -public class RedisBungeeCommandSender implements CommandSender { - private static final RedisBungeeCommandSender singleton; - - static { - singleton = new RedisBungeeCommandSender(); - } - - public static RedisBungeeCommandSender getSingleton() { - return singleton; - } - - @Override - public String getName() { - return "RedisBungee"; - } - - @Override - public void sendMessage(String s) { - - } - - @Override - public void sendMessages(String... strings) { - - } - - @Override - public void sendMessage(BaseComponent... baseComponents) { - - } - - @Override - public void sendMessage(BaseComponent baseComponent) { - - } - - @Override - public Collection getGroups() { - return null; - } - - @Override - public void addGroups(String... strings) { - - } - - @Override - public void removeGroups(String... strings) { - - } - - @Override - public boolean hasPermission(String s) { - return true; - } - - @Override - public void setPermission(String s, boolean b) { - - } - - @Override - public Collection getPermissions() { - return Collections.emptySet(); - } -} diff --git a/proxies/bungeecord/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungeeListener.java b/proxies/bungeecord/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungeeListener.java deleted file mode 100644 index 0a611813..00000000 --- a/proxies/bungeecord/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungeeListener.java +++ /dev/null @@ -1,192 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee; - -import com.google.common.base.Joiner; -import com.google.common.collect.HashMultimap; -import com.google.common.collect.Multimap; -import com.google.common.io.ByteArrayDataInput; -import com.google.common.io.ByteArrayDataOutput; -import com.google.common.io.ByteStreams; -import com.imaginarycode.minecraft.redisbungee.api.RedisBungeePlugin; -import com.imaginarycode.minecraft.redisbungee.api.config.HandleMotdOrder; -import net.kyori.adventure.text.serializer.bungeecord.BungeeComponentSerializer; -import net.md_5.bungee.api.AbstractReconnectHandler; -import net.md_5.bungee.api.ProxyServer; -import net.md_5.bungee.api.config.ServerInfo; -import net.md_5.bungee.api.connection.ProxiedPlayer; -import net.md_5.bungee.api.connection.Server; -import net.md_5.bungee.api.event.PluginMessageEvent; -import net.md_5.bungee.api.event.ProxyPingEvent; -import net.md_5.bungee.api.event.ServerConnectEvent; -import net.md_5.bungee.api.plugin.Listener; -import net.md_5.bungee.event.EventHandler; -import net.md_5.bungee.event.EventPriority; - -import java.util.*; - -import static com.imaginarycode.minecraft.redisbungee.api.util.serialize.MultiMapSerialization.*; - -public class RedisBungeeListener implements Listener { - - private final RedisBungeePlugin plugin; - - public RedisBungeeListener(RedisBungeePlugin plugin) { - this.plugin = plugin; - } - - @EventHandler(priority = EventPriority.LOWEST) - public void onPingFirst(ProxyPingEvent event) { - if (plugin.configuration().handleMotdOrder() != HandleMotdOrder.FIRST) { - return; - } - onPing0(event); - } - - @EventHandler(priority = EventPriority.NORMAL) - public void onPingNormal(ProxyPingEvent event) { - if (plugin.configuration().handleMotdOrder() != HandleMotdOrder.NORMAL) { - return; - } - onPing0(event); - } - - @EventHandler(priority = EventPriority.HIGHEST) - public void onPingLast(ProxyPingEvent event) { - if (plugin.configuration().handleMotdOrder() != HandleMotdOrder.LAST) { - return; - } - onPing0(event); - } - - private void onPing0(ProxyPingEvent event) { - if (!plugin.configuration().handleMotd()) return; - if (plugin.configuration().getExemptAddresses().contains(event.getConnection().getAddress().getAddress())) return; - ServerInfo forced = AbstractReconnectHandler.getForcedHost(event.getConnection()); - - if (forced != null && event.getConnection().getListener().isPingPassthrough()) return; - event.getResponse().getPlayers().setOnline(plugin.proxyDataManager().totalNetworkPlayers()); - } - - @SuppressWarnings("UnstableApiUsage") - @EventHandler - public void onPluginMessage(PluginMessageEvent event) { - if ((event.getTag().equals("legacy:redisbungee") || event.getTag().equals("RedisBungee")) && event.getSender() instanceof Server) { - final String currentChannel = event.getTag(); - final byte[] data = Arrays.copyOf(event.getData(), event.getData().length); - plugin.executeAsync(() -> { - ByteArrayDataInput in = ByteStreams.newDataInput(data); - - String subchannel = in.readUTF(); - ByteArrayDataOutput out = ByteStreams.newDataOutput(); - String type; - - switch (subchannel) { - case "PlayerList" -> { - out.writeUTF("PlayerList"); - Set original = Collections.emptySet(); - type = in.readUTF(); - if (type.equals("ALL")) { - out.writeUTF("ALL"); - original = plugin.proxyDataManager().networkPlayers(); - } else { - out.writeUTF(type); - try { - original = plugin.getAbstractRedisBungeeApi().getPlayersOnServer(type); - } catch (IllegalArgumentException ignored) { - } - } - Set players = new HashSet<>(); - for (UUID uuid : original) - players.add(plugin.getUuidTranslator().getNameFromUuid(uuid, false)); - out.writeUTF(Joiner.on(',').join(players)); - } - case "PlayerCount" -> { - out.writeUTF("PlayerCount"); - type = in.readUTF(); - if (type.equals("ALL")) { - out.writeUTF("ALL"); - out.writeInt(plugin.proxyDataManager().totalNetworkPlayers()); - } else { - out.writeUTF(type); - try { - out.writeInt(plugin.getAbstractRedisBungeeApi().getPlayersOnServer(type).size()); - } catch (IllegalArgumentException e) { - out.writeInt(0); - } - } - } - case "LastOnline" -> { - String user = in.readUTF(); - out.writeUTF("LastOnline"); - out.writeUTF(user); - out.writeLong(plugin.getAbstractRedisBungeeApi().getLastOnline(Objects.requireNonNull(plugin.getUuidTranslator().getTranslatedUuid(user, true)))); - } - case "ServerPlayers" -> { - String type1 = in.readUTF(); - out.writeUTF("ServerPlayers"); - Multimap multimap = plugin.getAbstractRedisBungeeApi().getServerToPlayers(); - boolean includesUsers; - switch (type1) { - case "COUNT" -> includesUsers = false; - case "PLAYERS" -> includesUsers = true; - default -> { - // TODO: Should I raise an error? - return; - } - } - out.writeUTF(type1); - if (includesUsers) { - Multimap human = HashMultimap.create(); - for (Map.Entry entry : multimap.entries()) { - human.put(entry.getKey(), plugin.getUuidTranslator().getNameFromUuid(entry.getValue(), false)); - } - serializeMultimap(human, true, out); - } else { - serializeMultiset(multimap.keys(), out); - } - } - case "Proxy" -> { - out.writeUTF("Proxy"); - out.writeUTF(plugin.configuration().getProxyId()); - } - case "PlayerProxy" -> { - String username = in.readUTF(); - out.writeUTF("PlayerProxy"); - out.writeUTF(username); - out.writeUTF(plugin.getAbstractRedisBungeeApi().getProxy(Objects.requireNonNull(plugin.getUuidTranslator().getTranslatedUuid(username, true)))); - } - default -> { - return; - } - } - - ((Server) event.getSender()).sendData(currentChannel, out.toByteArray()); - }); - } - } - - @EventHandler - public void onServerConnectEvent(ServerConnectEvent event) { - if (event.getReason() == ServerConnectEvent.Reason.JOIN_PROXY && plugin.configuration().handleReconnectToLastServer()) { - ProxiedPlayer player = event.getPlayer(); - String lastServer = plugin.playerDataManager().getLastServerFor(event.getPlayer().getUniqueId()); - if (lastServer == null) return; - player.sendMessage(BungeeComponentSerializer.get().serialize(plugin.langConfiguration().messages().serverConnecting(player.getLocale(), lastServer))); - ServerInfo serverInfo = ProxyServer.getInstance().getServerInfo(lastServer); - if (serverInfo == null) { - player.sendMessage(BungeeComponentSerializer.get().serialize(plugin.langConfiguration().messages().serverNotFound(player.getLocale(), lastServer))); - return; - } - event.setTarget(serverInfo); - } - } -} diff --git a/proxies/bungeecord/src/main/resources/plugin.yml b/proxies/bungeecord/src/main/resources/plugin.yml deleted file mode 100644 index 3696555f..00000000 --- a/proxies/bungeecord/src/main/resources/plugin.yml +++ /dev/null @@ -1,6 +0,0 @@ -name: RedisBungee -main: com.imaginarycode.minecraft.redisbungee.RedisBungee -version: *{redisbungee.version}* -author: "astei, ProxioDev" -# This is used so that we can automatically override default BungeeCord behavior. -softDepends: ["cmd_find", "cmd_list"] \ No newline at end of file diff --git a/proxies/velocity/build.gradle.kts b/proxies/velocity/build.gradle.kts deleted file mode 100644 index 76818047..00000000 --- a/proxies/velocity/build.gradle.kts +++ /dev/null @@ -1,47 +0,0 @@ -plugins { - java - id("com.github.johnrengelman.shadow") version "8.1.1" - id("xyz.jpenilla.run-velocity") version "2.0.0" -} - -dependencies { - implementation(project(":RedisBungee-Velocity")) - compileOnly(libs.platform.velocity) - annotationProcessor(libs.platform.velocity) - implementation(project(":RedisBungee-Commands")) - implementation(libs.acf.velocity) - -} - -description = "RedisBungee Velocity implementation" - -java { - withSourcesJar() -} - -tasks { - runVelocity { - velocityVersion("3.4.0-SNAPSHOT") - environment["REDISBUNGEE_PROXY_ID"] = "velocity-1" - environment["REDISBUNGEE_NETWORK_ID"] = "dev" - } - compileJava { - options.encoding = Charsets.UTF_8.name() - options.release.set(17) - } - processResources { - filteringCharset = Charsets.UTF_8.name() - } - shadowJar { - relocate("redis.clients.jedis", "com.imaginarycode.minecraft.redisbungee.internal.jedis") - relocate("redis.clients.util", "com.imaginarycode.minecraft.redisbungee.internal.jedisutil") - relocate("org.apache.commons.pool", "com.imaginarycode.minecraft.redisbungee.internal.commonspool") - relocate("com.squareup.okhttp", "com.imaginarycode.minecraft.redisbungee.internal.okhttp") - relocate("okio", "com.imaginarycode.minecraft.redisbungee.internal.okio") - relocate("org.json", "com.imaginarycode.minecraft.redisbungee.internal.json") - // acf shade - relocate("co.aikar.commands", "com.imaginarycode.minecraft.redisbungee.internal.acf.commands") - } - -} - diff --git a/proxies/velocity/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungeeCommandSource.java b/proxies/velocity/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungeeCommandSource.java deleted file mode 100644 index 9f04ac10..00000000 --- a/proxies/velocity/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungeeCommandSource.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee; - - -import com.velocitypowered.api.command.CommandSource; -import com.velocitypowered.api.permission.Tristate; -import net.kyori.adventure.permission.PermissionChecker; - -public class RedisBungeeCommandSource implements CommandSource { - private static final RedisBungeeCommandSource singleton; - private final PermissionChecker permissionChecker = PermissionChecker.always(net.kyori.adventure.util.TriState.TRUE); - - static { - singleton = new RedisBungeeCommandSource(); - } - - public static RedisBungeeCommandSource getSingleton() { - return singleton; - } - - - @Override - public boolean hasPermission(String permission) { - return this.permissionChecker.test(permission); - } - - @Override - public Tristate getPermissionValue(String s) { - return Tristate.TRUE; - } - - @Override - public PermissionChecker getPermissionChecker() { - return this.permissionChecker; - } -} diff --git a/proxies/velocity/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungeeListener.java b/proxies/velocity/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungeeListener.java deleted file mode 100644 index c94e0c2a..00000000 --- a/proxies/velocity/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungeeListener.java +++ /dev/null @@ -1,199 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee; - -import com.google.common.base.Joiner; -import com.google.common.collect.HashMultimap; -import com.google.common.collect.Multimap; -import com.google.common.io.ByteArrayDataInput; -import com.google.common.io.ByteArrayDataOutput; -import com.google.common.io.ByteStreams; -import com.imaginarycode.minecraft.redisbungee.api.RedisBungeePlugin; -import com.imaginarycode.minecraft.redisbungee.api.config.HandleMotdOrder; -import com.velocitypowered.api.event.PostOrder; -import com.velocitypowered.api.event.Subscribe; -import com.velocitypowered.api.event.connection.PluginMessageEvent; -import com.velocitypowered.api.event.player.PlayerChooseInitialServerEvent; -import com.velocitypowered.api.event.proxy.ProxyPingEvent; -import com.velocitypowered.api.proxy.Player; -import com.velocitypowered.api.proxy.ServerConnection; -import com.velocitypowered.api.proxy.server.RegisteredServer; -import com.velocitypowered.api.proxy.server.ServerPing; - -import java.util.*; -import java.util.stream.Collectors; - -import static com.imaginarycode.minecraft.redisbungee.api.util.serialize.MultiMapSerialization.serializeMultimap; -import static com.imaginarycode.minecraft.redisbungee.api.util.serialize.MultiMapSerialization.serializeMultiset; - -public class RedisBungeeListener { - - private final RedisBungeePlugin plugin; - - public RedisBungeeListener(RedisBungeePlugin plugin) { - this.plugin = plugin; - } - - @Subscribe(order = PostOrder.FIRST) - public void onPingFirst(ProxyPingEvent event) { - if (plugin.configuration().handleMotdOrder() != HandleMotdOrder.FIRST) { - return; - } - onPing0(event); - } - - @Subscribe(order = PostOrder.NORMAL) - public void onPingNormal(ProxyPingEvent event) { - if (plugin.configuration().handleMotdOrder() != HandleMotdOrder.NORMAL) { - return; - } - onPing0(event); - } - - @Subscribe(order = PostOrder.LAST) - public void onPingLast(ProxyPingEvent event) { - if (plugin.configuration().handleMotdOrder() != HandleMotdOrder.LAST) { - return; - } - onPing0(event); - } - - private void onPing0(ProxyPingEvent event) { - if (!plugin.configuration().handleMotd()) return; - if (plugin.configuration().getExemptAddresses().contains(event.getConnection().getRemoteAddress().getAddress())) return; - - ServerPing.Builder ping = event.getPing().asBuilder(); - ping.onlinePlayers(plugin.proxyDataManager().totalNetworkPlayers()); - event.setPing(ping.build()); - } - - @Subscribe - public void onPluginMessage(PluginMessageEvent event) { - if (!(event.getSource() instanceof ServerConnection) || !RedisBungeeVelocityPlugin.IDENTIFIERS.contains(event.getIdentifier())) { - return; - } - - event.setResult(PluginMessageEvent.ForwardResult.handled()); - - plugin.executeAsync(() -> { - ByteArrayDataInput in = event.dataAsDataStream(); - - String subchannel = in.readUTF(); - ByteArrayDataOutput out = ByteStreams.newDataOutput(); - String type; - - switch (subchannel) { - case "PlayerList" -> { - out.writeUTF("PlayerList"); - Set original = Collections.emptySet(); - type = in.readUTF(); - if (type.equals("ALL")) { - out.writeUTF("ALL"); - original = plugin.proxyDataManager().networkPlayers(); - } else { - out.writeUTF(type); - try { - original = plugin.getAbstractRedisBungeeApi().getPlayersOnServer(type); - } catch (IllegalArgumentException ignored) { - } - } - Set players = original.stream() - .map(uuid -> plugin.getUuidTranslator().getNameFromUuid(uuid, false)) - .collect(Collectors.toSet()); - out.writeUTF(Joiner.on(',').join(players)); - } - case "PlayerCount" -> { - out.writeUTF("PlayerCount"); - type = in.readUTF(); - if (type.equals("ALL")) { - out.writeUTF("ALL"); - out.writeInt(plugin.proxyDataManager().totalNetworkPlayers()); - } else { - out.writeUTF(type); - try { - out.writeInt(plugin.getAbstractRedisBungeeApi().getPlayersOnServer(type).size()); - } catch (IllegalArgumentException e) { - out.writeInt(0); - } - } - } - case "LastOnline" -> { - String user = in.readUTF(); - out.writeUTF("LastOnline"); - out.writeUTF(user); - out.writeLong(plugin.getAbstractRedisBungeeApi().getLastOnline(Objects.requireNonNull(plugin.getUuidTranslator().getTranslatedUuid(user, true)))); - } - case "ServerPlayers" -> { - String type1 = in.readUTF(); - out.writeUTF("ServerPlayers"); - Multimap multimap = plugin.getAbstractRedisBungeeApi().getServerToPlayers(); - boolean includesUsers; - switch (type1) { - case "COUNT" -> includesUsers = false; - case "PLAYERS" -> includesUsers = true; - default -> { - // TODO: Should I raise an error? - return; - } - } - out.writeUTF(type1); - if (includesUsers) { - Multimap human = HashMultimap.create(); - for (Map.Entry entry : multimap.entries()) { - human.put(entry.getKey(), plugin.getUuidTranslator().getNameFromUuid(entry.getValue(), false)); - } - serializeMultimap(human, true, out); - } else { - serializeMultiset(multimap.keys(), out); - } - } - case "Proxy" -> { - out.writeUTF("Proxy"); - out.writeUTF(plugin.configuration().getProxyId()); - } - case "PlayerProxy" -> { - String username = in.readUTF(); - out.writeUTF("PlayerProxy"); - out.writeUTF(username); - out.writeUTF(plugin.getAbstractRedisBungeeApi().getProxy(Objects.requireNonNull(plugin.getUuidTranslator().getTranslatedUuid(username, true)))); - } - default -> { - return; - } - } - try { - // ServerConnection throws IllegalStateException when connection dies somehow so just ignore :/ - ((ServerConnection) event.getSource()).sendPluginMessage(event.getIdentifier(), out.toByteArray()); - } catch (IllegalStateException ignored) { - } - }); - - } - - @Subscribe - public void onPlayerChooseInitialServerEvent(PlayerChooseInitialServerEvent event) { - if (plugin.configuration().handleReconnectToLastServer()) { - Player player = event.getPlayer(); - String lastServer = plugin.playerDataManager().getLastServerFor(player.getUniqueId()); - if (lastServer == null) return; - player.sendMessage(plugin.langConfiguration().messages().serverConnecting(player.getPlayerSettings().getLocale(), lastServer)); - Optional optionalRegisteredServer = ((RedisBungeeVelocityPlugin) plugin).getProxy().getServer(lastServer); - if (optionalRegisteredServer.isEmpty()) { - player.sendMessage(plugin.langConfiguration().messages().serverNotFound(player.getPlayerSettings().getLocale(), lastServer)); - return; - } - RegisteredServer server = optionalRegisteredServer.get(); - event.setInitialServer(server); - } - } - - -} diff --git a/proxies/velocity/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungeeVelocityPlugin.java b/proxies/velocity/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungeeVelocityPlugin.java deleted file mode 100644 index 0a1ffe0a..00000000 --- a/proxies/velocity/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungeeVelocityPlugin.java +++ /dev/null @@ -1,387 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee; - -import co.aikar.commands.VelocityCommandManager; -import com.google.inject.Inject; -import com.imaginarycode.minecraft.redisbungee.api.PlayerDataManager; -import com.imaginarycode.minecraft.redisbungee.api.ProxyDataManager; -import com.imaginarycode.minecraft.redisbungee.api.RedisBungeeMode; -import com.imaginarycode.minecraft.redisbungee.api.RedisBungeePlugin; -import com.imaginarycode.minecraft.redisbungee.commands.CommandLoader; -import com.imaginarycode.minecraft.redisbungee.commands.utils.CommandPlatformHelper; -import com.imaginarycode.minecraft.redisbungee.api.config.LangConfiguration; -import com.imaginarycode.minecraft.redisbungee.api.config.loaders.ConfigLoader; -import com.imaginarycode.minecraft.redisbungee.api.config.RedisBungeeConfiguration; -import com.imaginarycode.minecraft.redisbungee.api.config.loaders.LangConfigLoader; -import com.imaginarycode.minecraft.redisbungee.api.events.IPlayerChangedServerNetworkEvent; -import com.imaginarycode.minecraft.redisbungee.api.events.IPlayerJoinedNetworkEvent; -import com.imaginarycode.minecraft.redisbungee.api.events.IPlayerLeftNetworkEvent; -import com.imaginarycode.minecraft.redisbungee.api.events.IPubSubMessageEvent; -import com.imaginarycode.minecraft.redisbungee.api.summoners.Summoner; -import com.imaginarycode.minecraft.redisbungee.api.util.InitialUtils; -import com.imaginarycode.minecraft.redisbungee.api.util.uuid.NameFetcher; -import com.imaginarycode.minecraft.redisbungee.api.util.uuid.UUIDFetcher; -import com.imaginarycode.minecraft.redisbungee.api.util.uuid.UUIDTranslator; -import com.imaginarycode.minecraft.redisbungee.events.PlayerChangedServerNetworkEvent; -import com.imaginarycode.minecraft.redisbungee.events.PlayerJoinedNetworkEvent; -import com.imaginarycode.minecraft.redisbungee.events.PlayerLeftNetworkEvent; -import com.imaginarycode.minecraft.redisbungee.events.PubSubMessageEvent; -import com.squareup.okhttp.Dispatcher; -import com.squareup.okhttp.OkHttpClient; -import com.velocitypowered.api.event.PostOrder; -import com.velocitypowered.api.event.Subscribe; -import com.velocitypowered.api.event.proxy.ProxyInitializeEvent; -import com.velocitypowered.api.event.proxy.ProxyShutdownEvent; -import com.velocitypowered.api.plugin.Plugin; -import com.velocitypowered.api.plugin.annotation.DataDirectory; -import com.velocitypowered.api.proxy.Player; -import com.velocitypowered.api.proxy.ProxyServer; -import com.velocitypowered.api.proxy.messages.ChannelIdentifier; -import com.velocitypowered.api.proxy.messages.LegacyChannelIdentifier; -import com.velocitypowered.api.proxy.messages.MinecraftChannelIdentifier; -import com.velocitypowered.api.scheduler.ScheduledTask; -import net.kyori.adventure.text.Component; -import org.slf4j.Logger; -import redis.clients.jedis.exceptions.JedisConnectionException; - -import java.io.IOException; -import java.io.InputStream; -import java.net.InetAddress; -import java.nio.file.Path; -import java.sql.Date; -import java.time.Duration; -import java.time.Instant; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.UUID; -import java.util.concurrent.Executors; -import java.util.concurrent.TimeUnit; - -@Plugin(id = "redisbungee", name = "RedisBungee", version = Constants.VERSION, url = "https://github.com/ProxioDev/RedisBungee", authors = {"astei", "ProxioDev"}) -public class RedisBungeeVelocityPlugin implements RedisBungeePlugin, ConfigLoader, LangConfigLoader, ServerObjectFetcher { - private final ProxyServer server; - private final Logger logger; - private final Path dataFolder; - private final AbstractRedisBungeeAPI api; - private Summoner jedisSummoner; - private RedisBungeeMode redisBungeeMode; - private final UUIDTranslator uuidTranslator; - private RedisBungeeConfiguration configuration; - private LangConfiguration langConfiguration; - private final OkHttpClient httpClient; - - private final ProxyDataManager proxyDataManager; - - private final VelocityPlayerDataManager playerDataManager; - - private ScheduledTask cleanUpTask; - private ScheduledTask heartbeatTask; - - public static final List IDENTIFIERS = List.of( - MinecraftChannelIdentifier.create("legacy", "redisbungee"), - new LegacyChannelIdentifier("RedisBungee"), - // This is needed for clients before 1.13 - new LegacyChannelIdentifier("legacy:redisbungee") - ); - - private VelocityCommandManager commandManager; - - @Inject - public RedisBungeeVelocityPlugin(ProxyServer server, Logger logger, @DataDirectory Path dataDirectory) { - this.server = server; - this.logger = logger; - this.dataFolder = dataDirectory; - logInfo("Version: {}", Constants.VERSION); - try { - loadConfig(this, dataDirectory); - loadLangConfig(this, dataDirectory); - } catch (IOException e) { - throw new RuntimeException("Unable to load/save config", e); - } catch (JedisConnectionException e) { - throw new RuntimeException("Unable to connect to your Redis server!", e); - } - this.api = new RedisBungeeAPI(this); - InitialUtils.checkRedisVersion(this); - this.proxyDataManager = new ProxyDataManager(this) { - @Override - public Set getLocalOnlineUUIDs() { - HashSet players = new HashSet<>(); - server.getAllPlayers().forEach(player -> players.add(player.getUniqueId())); - return players; - } - - @Override - protected void handlePlatformCommandExecution(String command) { - server.getCommandManager().executeAsync(RedisBungeeCommandSource.getSingleton(), command); - } - }; - this.playerDataManager = new VelocityPlayerDataManager(this); - uuidTranslator = new UUIDTranslator(this); - this.httpClient = new OkHttpClient(); - Dispatcher dispatcher = new Dispatcher(Executors.newFixedThreadPool(6)); - this.httpClient.setDispatcher(dispatcher); - NameFetcher.setHttpClient(httpClient); - UUIDFetcher.setHttpClient(httpClient); - } - - - @Override - public Summoner getSummoner() { - return this.jedisSummoner; - } - - @Override - public AbstractRedisBungeeAPI getAbstractRedisBungeeApi() { - return this.api; - } - - @Override - public ProxyDataManager proxyDataManager() { - return this.proxyDataManager; - } - - @Override - public PlayerDataManager playerDataManager() { - return this.playerDataManager; - } - - @Override - public UUIDTranslator getUuidTranslator() { - return this.uuidTranslator; - } - - - @Override - public void executeAsync(Runnable runnable) { - this.getProxy().getScheduler().buildTask(this, runnable).schedule(); - } - - @Override - public void executeAsyncAfter(Runnable runnable, TimeUnit timeUnit, int time) { - this.getProxy().getScheduler().buildTask(this, runnable).delay(time, timeUnit).schedule(); - } - - @Override - public void fireEvent(Object event) { - this.getProxy().getEventManager().fireAndForget(event); - } - - @Override - public boolean isOnlineMode() { - return this.getProxy().getConfiguration().isOnlineMode(); - } - - @Override - public void logInfo(String msg) { - this.getLogger().info(msg); - } - - @Override - public void logInfo(String format, Object... object) { - logger.info(format, object); - } - - @Override - public void logWarn(String msg) { - this.getLogger().warn(msg); - } - - @Override - public void logWarn(String format, Object... object) { - logger.warn(format, object); - } - - @Override - public void logFatal(String msg) { - this.getLogger().error(msg); - } - - @Override - public void logFatal(String format, Throwable throwable) { - logger.error(format, throwable); - } - - @Override - public RedisBungeeConfiguration configuration() { - return this.configuration; - } - - @Override - public LangConfiguration langConfiguration() { - return this.langConfiguration; - } - - @Override - public Player getPlayer(UUID uuid) { - return this.getProxy().getPlayer(uuid).orElse(null); - } - - @Override - public Player getPlayer(String name) { - return this.getProxy().getPlayer(name).orElse(null); - } - - @Override - public UUID getPlayerUUID(String player) { - return this.getProxy().getPlayer(player).map(Player::getUniqueId).orElse(null); - } - - @Override - public String getPlayerName(UUID player) { - return this.getProxy().getPlayer(player).map(Player::getUsername).orElse(null); - } - - - @Override - public boolean handlePlatformKick(UUID uuid, Component message) { - Player player = getPlayer(uuid); - if (player == null) return false; - player.disconnect(message); - return true; - } - - @Override - public String getPlayerServerName(Player player) { - return player.getCurrentServer().map(serverConnection -> serverConnection.getServerInfo().getName()).orElse(null); - } - - @Override - public boolean isPlayerOnAServer(Player player) { - return player.getCurrentServer().isPresent(); - } - - @Override - public InetAddress getPlayerIp(Player player) { - return player.getRemoteAddress().getAddress(); - } - - @Override - public void initialize() { - logInfo("Initializing RedisBungee....."); - // start heartbeat task - // heartbeat and clean up - this.heartbeatTask = server.getScheduler().buildTask(this, this.proxyDataManager::publishHeartbeat).repeat(Duration.ofSeconds(1)).schedule(); - this.cleanUpTask = server.getScheduler().buildTask(this, this.proxyDataManager::correctionTask).repeat(Duration.ofSeconds(60)).schedule(); - - server.getEventManager().register(this, this.playerDataManager); - server.getEventManager().register(this, new RedisBungeeListener(this)); - - // subscribe - server.getScheduler().buildTask(this, this.proxyDataManager).schedule(); - - // register plugin messages - IDENTIFIERS.forEach(getProxy().getChannelRegistrar()::register); - - // load commands - CommandPlatformHelper.init(new VelocityCommandPlatformHelper()); - this.commandManager = new VelocityCommandManager(this.getProxy(), this); - CommandLoader.initCommands(this.commandManager, this); - - logInfo("RedisBungee initialized successfully "); - } - - @Override - public void stop() { - logInfo("Turning off redis connections....."); - // Poison the PubSub listener - if (cleanUpTask != null) { - cleanUpTask.cancel(); - } - if (heartbeatTask != null) { - heartbeatTask.cancel(); - } - - - try { - this.proxyDataManager.close(); - this.jedisSummoner.close(); - } catch (Exception e) { - throw new RuntimeException(e); - } - - this.httpClient.getDispatcher().getExecutorService().shutdown(); - try { - logInfo("waiting for httpclient thread-pool termination....."); - this.httpClient.getDispatcher().getExecutorService().awaitTermination(20, TimeUnit.SECONDS); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } - if (commandManager != null) commandManager.unregisterCommands(); - logInfo("RedisBungee shutdown complete"); - } - - @Override - public void onConfigLoad(RedisBungeeConfiguration configuration, Summoner summoner, RedisBungeeMode mode) { - this.jedisSummoner = summoner; - this.configuration = configuration; - this.redisBungeeMode = mode; - } - - @Override - public void onLangConfigLoad(LangConfiguration langConfiguration) { - this.langConfiguration = langConfiguration; - } - - @Override - public RedisBungeeMode getRedisBungeeMode() { - return this.redisBungeeMode; - } - - - @Subscribe(order = PostOrder.FIRST) - public void onProxyInitializeEvent(ProxyInitializeEvent event) { - initialize(); - } - - @Subscribe(order = PostOrder.LAST) - public void onProxyShutdownEvent(ProxyShutdownEvent event) { - stop(); - } - - - @Override - public IPlayerChangedServerNetworkEvent createPlayerChangedServerNetworkEvent(UUID uuid, String previousServer, String server) { - return new PlayerChangedServerNetworkEvent(uuid, previousServer, server); - } - - @Override - public IPlayerJoinedNetworkEvent createPlayerJoinedNetworkEvent(UUID uuid) { - return new PlayerJoinedNetworkEvent(uuid); - } - - @Override - public IPlayerLeftNetworkEvent createPlayerLeftNetworkEvent(UUID uuid) { - return new PlayerLeftNetworkEvent(uuid); - } - - @Override - public IPubSubMessageEvent createPubSubEvent(String channel, String message) { - return new PubSubMessageEvent(channel, message); - } - - public ProxyServer getProxy() { - return server; - } - - public Logger getLogger() { - return logger; - } - - public Path getDataFolder() { - return this.dataFolder; - } - - public InputStream getResourceAsStream(String name) { - return this.getClass().getClassLoader().getResourceAsStream(name); - } -} diff --git a/proxies/velocity/src/main/java/com/imaginarycode/minecraft/redisbungee/VelocityCommandPlatformHelper.java b/proxies/velocity/src/main/java/com/imaginarycode/minecraft/redisbungee/VelocityCommandPlatformHelper.java deleted file mode 100644 index 07cd9ded..00000000 --- a/proxies/velocity/src/main/java/com/imaginarycode/minecraft/redisbungee/VelocityCommandPlatformHelper.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee; - -import co.aikar.commands.CommandIssuer; -import co.aikar.commands.VelocityCommandIssuer; -import com.imaginarycode.minecraft.redisbungee.commands.utils.CommandPlatformHelper; -import net.kyori.adventure.text.Component; - -public class VelocityCommandPlatformHelper extends CommandPlatformHelper { - - @Override - public void sendMessage(CommandIssuer issuer, Component component) { - VelocityCommandIssuer vIssuer = (VelocityCommandIssuer) issuer; - vIssuer.getIssuer().sendMessage(component); - } - -} diff --git a/proxies/velocity/src/main/java/com/imaginarycode/minecraft/redisbungee/VelocityPlayerDataManager.java b/proxies/velocity/src/main/java/com/imaginarycode/minecraft/redisbungee/VelocityPlayerDataManager.java deleted file mode 100644 index ceb998c7..00000000 --- a/proxies/velocity/src/main/java/com/imaginarycode/minecraft/redisbungee/VelocityPlayerDataManager.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee; - -import com.imaginarycode.minecraft.redisbungee.api.PlayerDataManager; -import com.imaginarycode.minecraft.redisbungee.api.RedisBungeePlugin; -import com.imaginarycode.minecraft.redisbungee.api.config.RedisBungeeConfiguration; -import com.imaginarycode.minecraft.redisbungee.events.PlayerChangedServerNetworkEvent; -import com.imaginarycode.minecraft.redisbungee.events.PlayerLeftNetworkEvent; -import com.imaginarycode.minecraft.redisbungee.events.PubSubMessageEvent; -import com.velocitypowered.api.event.Continuation; -import com.velocitypowered.api.event.ResultedEvent; -import com.velocitypowered.api.event.Subscribe; -import com.velocitypowered.api.event.connection.DisconnectEvent; -import com.velocitypowered.api.event.connection.LoginEvent; -import com.velocitypowered.api.event.connection.PostLoginEvent; -import com.velocitypowered.api.event.player.ServerConnectedEvent; -import com.velocitypowered.api.proxy.Player; -import net.kyori.adventure.text.Component; - -import java.util.concurrent.TimeUnit; - -public class VelocityPlayerDataManager extends PlayerDataManager { - public VelocityPlayerDataManager(RedisBungeePlugin plugin) { - super(plugin); - } - - @Subscribe - public void onPlayerChangedServerNetworkEvent(PlayerChangedServerNetworkEvent event) { - handleNetworkPlayerServerChange(event); - } - - @Subscribe - public void onNetworkPlayerQuit(PlayerLeftNetworkEvent event) { - handleNetworkPlayerQuit(event); - } - - @Subscribe - public void onPubSubMessageEvent(PubSubMessageEvent event) { - handlePubSubMessageEvent(event); - } - - @Subscribe - public void onServerConnectedEvent(ServerConnectedEvent event) { - final String currentServer = event.getServer().getServerInfo().getName(); - final String oldServer; - if (event.getPreviousServer().isPresent()) { - oldServer = event.getPreviousServer().get().getServerInfo().getName(); - } else { - oldServer = null; - } - super.playerChangedServer(event.getPlayer().getUniqueId(), oldServer, currentServer); - } - - @Subscribe - public void onLoginEvent(LoginEvent event, Continuation continuation) { - // check if online - if (getLastOnline(event.getPlayer().getUniqueId()) == 0) { - // because something can go wrong and proxy somehow does not update player data correctly on shutdown - // we have to check proxy if it has the player - String proxyId = getProxyFor(event.getPlayer().getUniqueId()); - if (proxyId == null || !plugin.proxyDataManager().isPlayerTrulyOnProxy(proxyId, event.getPlayer().getUniqueId())) { - continuation.resume(); - } else { - if (plugin.configuration().kickWhenOnline()) { - kickPlayer(event.getPlayer().getUniqueId(), plugin.langConfiguration().messages().loggedInFromOtherLocation()); - // wait 3 seconds before releasing the event - plugin.executeAsyncAfter(continuation::resume, TimeUnit.SECONDS, 3); - } else { - event.setResult(ResultedEvent.ComponentResult.denied(plugin.langConfiguration().messages().alreadyLoggedIn())); - continuation.resume(); - } - } - } else { - continuation.resume(); - } - } - - @Subscribe - public void onLoginEvent(PostLoginEvent event) { - addPlayer(event.getPlayer().getUniqueId(), event.getPlayer().getUsername(), event.getPlayer().getRemoteAddress().getAddress()); - } - - @Subscribe - public void onDisconnectEvent(DisconnectEvent event) { - if (event.getLoginStatus() == DisconnectEvent.LoginStatus.SUCCESSFUL_LOGIN || event.getLoginStatus() == DisconnectEvent.LoginStatus.PRE_SERVER_JOIN) { - removePlayer(event.getPlayer().getUniqueId()); - } - } -} diff --git a/proxies/velocity/velocity-api/build.gradle.kts b/proxies/velocity/velocity-api/build.gradle.kts deleted file mode 100644 index 440601b4..00000000 --- a/proxies/velocity/velocity-api/build.gradle.kts +++ /dev/null @@ -1,62 +0,0 @@ -plugins { - `java-library` - `maven-publish` -} - -dependencies { - api(project(":RedisBungee-API")) { - // Since velocity already includes guava / configurate / guava exlude them - exclude("com.google.guava", "guava") - exclude("com.google.code.gson", "gson") - exclude("org.spongepowered", "configurate-yaml") - exclude("com.github.ben-manes.caffeine", "caffeine") - // exclude also adventure api - exclude("net.kyori", "adventure-api") - exclude("net.kyori", "adventure-text-serializer-gson") - exclude("net.kyori", "adventure-text-serializer-legacy") - exclude("net.kyori", "adventure-text-serializer-plain") - exclude("net.kyori", "adventure-text-minimessage") - } - compileOnly(libs.platform.velocity) - -} - -description = "RedisBungee Velocity API" - -java { - withJavadocJar() - withSourcesJar() -} - -tasks { - withType { - dependsOn(project(":RedisBungee-API").getTasksByName("javadoc", false)) - val options = options as StandardJavadocDocletOptions - options.use() - options.isDocFilesSubDirs = true - options.links( - "https://jd.papermc.io/velocity/3.0.0/", // velocity api - ) - val apiDocs = File(rootProject.projectDir, "api/build/docs/javadoc") - options.linksOffline("https://ci.limework.net/ValioBungee/api/build/docs/javadoc", apiDocs.path) - } - compileJava { - options.encoding = Charsets.UTF_8.name() - options.release.set(17) - } - javadoc { - options.encoding = Charsets.UTF_8.name() - } - processResources { - filteringCharset = Charsets.UTF_8.name() - } - -} - -publishing { - publications { - create("maven") { - from(components["java"]) - } - } -} diff --git a/proxies/velocity/velocity-api/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungeeAPI.java b/proxies/velocity/velocity-api/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungeeAPI.java deleted file mode 100644 index 01d55fce..00000000 --- a/proxies/velocity/velocity-api/src/main/java/com/imaginarycode/minecraft/redisbungee/RedisBungeeAPI.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee; - -import com.imaginarycode.minecraft.redisbungee.api.RedisBungeePlugin; -import com.velocitypowered.api.proxy.server.RegisteredServer; -import com.velocitypowered.api.proxy.server.ServerInfo; -import org.checkerframework.checker.nullness.qual.NonNull; -import org.checkerframework.checker.nullness.qual.Nullable; - -import java.util.UUID; - -/** - * This platform class exposes some internal RedisBungee functions. You obtain an instance of this object by invoking {@link RedisBungeeAPI#getRedisBungeeApi()} - * or somehow you got the Plugin instance by you can call the api using {@link RedisBungeePlugin#getAbstractRedisBungeeApi()}. - * - * @author tuxed - * @since 0.2.3 - */ -public class RedisBungeeAPI extends AbstractRedisBungeeAPI { - - private static RedisBungeeAPI redisBungeeApi; - - public RedisBungeeAPI(RedisBungeePlugin plugin) { - super(plugin); - if (redisBungeeApi == null) { - redisBungeeApi = this; - } - - } - - /** - * Get the server where the specified player is playing. This function also deals with the case of local players - * as well, and will return local information on them. - * - * @param player a player uuid - * @return {@link ServerInfo} Can be null if proxy can't find it. - * @see #getServerNameFor(UUID) - */ - @Nullable - public final ServerInfo getServerFor(@NonNull UUID player) { - String serverName = this.getServerNameFor(player); - if (serverName == null) return null; - return ((ServerObjectFetcher) this.plugin).getProxy().getServer(serverName).map((RegisteredServer::getServerInfo)).orElse(null); - } - - /** - * Api instance - * - * @return the API instance. - * @since 0.6.5 - */ - public static RedisBungeeAPI getRedisBungeeApi() { - return redisBungeeApi; - } -} diff --git a/proxies/velocity/velocity-api/src/main/java/com/imaginarycode/minecraft/redisbungee/ServerObjectFetcher.java b/proxies/velocity/velocity-api/src/main/java/com/imaginarycode/minecraft/redisbungee/ServerObjectFetcher.java deleted file mode 100644 index 786361e0..00000000 --- a/proxies/velocity/velocity-api/src/main/java/com/imaginarycode/minecraft/redisbungee/ServerObjectFetcher.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.imaginarycode.minecraft.redisbungee; - -import com.velocitypowered.api.proxy.ProxyServer; - -public interface ServerObjectFetcher { - - ProxyServer getProxy(); - - -} diff --git a/proxies/velocity/velocity-api/src/main/java/com/imaginarycode/minecraft/redisbungee/events/PlayerChangedServerNetworkEvent.java b/proxies/velocity/velocity-api/src/main/java/com/imaginarycode/minecraft/redisbungee/events/PlayerChangedServerNetworkEvent.java deleted file mode 100644 index 0ba58caa..00000000 --- a/proxies/velocity/velocity-api/src/main/java/com/imaginarycode/minecraft/redisbungee/events/PlayerChangedServerNetworkEvent.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee.events; - - -import com.imaginarycode.minecraft.redisbungee.api.events.IPlayerChangedServerNetworkEvent; - -import java.util.UUID; - -/** - * This event is sent when a player connects to a new server. RedisBungee sends the event only when - * the proxy the player has been connected to is different than the local proxy. - *

- * This event corresponds to {@link com.velocitypowered.api.event.player.ServerConnectedEvent}, and is fired - * asynchronously. - * - * @since 0.3.4 - */ -public class PlayerChangedServerNetworkEvent implements IPlayerChangedServerNetworkEvent { - private final UUID uuid; - private final String previousServer; - private final String server; - - public PlayerChangedServerNetworkEvent(UUID uuid, String previousServer, String server) { - this.uuid = uuid; - this.previousServer = previousServer; - this.server = server; - } - - @Override - public UUID getUuid() { - return uuid; - } - - @Override - public String getServer() { - return server; - } - - @Override - public String getPreviousServer() { - return previousServer; - } -} diff --git a/proxies/velocity/velocity-api/src/main/java/com/imaginarycode/minecraft/redisbungee/events/PlayerJoinedNetworkEvent.java b/proxies/velocity/velocity-api/src/main/java/com/imaginarycode/minecraft/redisbungee/events/PlayerJoinedNetworkEvent.java deleted file mode 100644 index f60adb05..00000000 --- a/proxies/velocity/velocity-api/src/main/java/com/imaginarycode/minecraft/redisbungee/events/PlayerJoinedNetworkEvent.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee.events; - - -import com.imaginarycode.minecraft.redisbungee.api.events.IPlayerJoinedNetworkEvent; - -import java.util.UUID; - -/** - * This event is sent when a player joins the network. RedisBungee sends the event only when - * the proxy the player has been connected to is different than the local proxy. - *

- * This event corresponds to {@link com.velocitypowered.api.event.connection.PostLoginEvent}, and is fired - * asynchronously. - * - * @since 0.3.4 - */ -public class PlayerJoinedNetworkEvent implements IPlayerJoinedNetworkEvent { - private final UUID uuid; - - public PlayerJoinedNetworkEvent(UUID uuid) { - this.uuid = uuid; - } - - @Override - public UUID getUuid() { - return uuid; - } -} diff --git a/proxies/velocity/velocity-api/src/main/java/com/imaginarycode/minecraft/redisbungee/events/PlayerLeftNetworkEvent.java b/proxies/velocity/velocity-api/src/main/java/com/imaginarycode/minecraft/redisbungee/events/PlayerLeftNetworkEvent.java deleted file mode 100644 index 745c7776..00000000 --- a/proxies/velocity/velocity-api/src/main/java/com/imaginarycode/minecraft/redisbungee/events/PlayerLeftNetworkEvent.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee.events; - - -import com.imaginarycode.minecraft.redisbungee.api.events.IPlayerLeftNetworkEvent; - -import java.util.UUID; - -/** - * This event is sent when a player disconnects. RedisBungee sends the event only when - * the proxy the player has been connected to is different than the local proxy. - *

- * This event corresponds to {@link com.velocitypowered.api.event.connection.DisconnectEvent}, and is fired - * asynchronously. - * - * @since 0.3.4 - */ -public class PlayerLeftNetworkEvent implements IPlayerLeftNetworkEvent { - private final UUID uuid; - - public PlayerLeftNetworkEvent(UUID uuid) { - this.uuid = uuid; - } - - @Override - public UUID getUuid() { - return uuid; - } -} diff --git a/proxies/velocity/velocity-api/src/main/java/com/imaginarycode/minecraft/redisbungee/events/PubSubMessageEvent.java b/proxies/velocity/velocity-api/src/main/java/com/imaginarycode/minecraft/redisbungee/events/PubSubMessageEvent.java deleted file mode 100644 index 1ceaa530..00000000 --- a/proxies/velocity/velocity-api/src/main/java/com/imaginarycode/minecraft/redisbungee/events/PubSubMessageEvent.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2013-present RedisBungee contributors - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * - * http://www.eclipse.org/legal/epl-v10.html - */ - -package com.imaginarycode.minecraft.redisbungee.events; - - -import com.imaginarycode.minecraft.redisbungee.api.events.IPubSubMessageEvent; - -/** - * This event is posted when a PubSub message is received. - *

- * Warning: This event is fired in a separate thread! - * - * @since 0.2.6 - */ - -public class PubSubMessageEvent implements IPubSubMessageEvent { - private final String channel; - private final String message; - - public PubSubMessageEvent(String channel, String message) { - this.channel = channel; - this.message = message; - } - - @Override - public String getChannel() { - return channel; - } - - @Override - public String getMessage() { - return message; - } -} diff --git a/settings.gradle.kts b/settings.gradle.kts deleted file mode 100644 index ad9ce8e9..00000000 --- a/settings.gradle.kts +++ /dev/null @@ -1,95 +0,0 @@ -pluginManagement { - repositories { - gradlePluginPortal() - } -} - -rootProject.name = "ValioBungee" - -include(":RedisBungee-API") -project(":RedisBungee-API").projectDir = file("api") - -include(":RedisBungee-Commands") -project(":RedisBungee-Commands").projectDir = file("commands") - -include(":RedisBungee-Velocity") -project(":RedisBungee-Velocity").projectDir = file("proxies/velocity") - -include(":RedisBungee-Bungee") -project(":RedisBungee-Bungee").projectDir = file("proxies/bungeecord/bungeecord-api") - -include(":RedisBungee-Proxy-Bungee") -project(":RedisBungee-Proxy-Bungee").projectDir = file("proxies/bungeecord") - -include(":RedisBungee-Velocity") -project(":RedisBungee-Velocity").projectDir = file("proxies/velocity/velocity-api") - -include(":RedisBungee-Proxy-Velocity") -project(":RedisBungee-Proxy-Velocity").projectDir = file("proxies/velocity") - - - - -dependencyResolutionManagement { - repositories { - mavenCentral() - maven { - name = "PaperMC" - url = uri("https://repo.papermc.io/repository/maven-public/") - } - maven { - // hosts the bungeecord apis - name = "sonatype" - url = uri("https://oss.sonatype.org/content/repositories/snapshots") - } - - maven { - url = uri("https://jitpack.io") - } - - } - versionCatalogs { - val jedisVersion = "5.2.0" - val configurateVersion = "3.7.3" - val guavaVersion = "31.1-jre" - val okHttpVersion = "2.7.5" - val caffeineVersion = "3.1.8" - val adventureVersion = "4.17.0" - val acf = "e2005dd62d" // use our own fork 'same upstream with jitpack file only' - val bungeecordApiVersion = "1.21-R0.1-SNAPSHOT" - val velocityVersion = "3.4.0-SNAPSHOT"; - - - create("libs") { - - library("guava", "com.google.guava:guava:$guavaVersion") - library("jedis", "redis.clients:jedis:$jedisVersion") - library("okhttp", "com.squareup.okhttp:okhttp:$okHttpVersion") - library("configurate", "org.spongepowered:configurate-yaml:$configurateVersion") - library("caffeine", "com.github.ben-manes.caffeine:caffeine:$caffeineVersion") - - library("adventure-api", "net.kyori:adventure-api:$adventureVersion") - library("adventure-gson", "net.kyori:adventure-text-serializer-gson:$adventureVersion") - library("adventure-legacy", "net.kyori:adventure-text-serializer-legacy:$adventureVersion") - library("adventure-plain", "net.kyori:adventure-text-serializer-plain:$adventureVersion") - library("adventure-miniMessage", "net.kyori:adventure-text-minimessage:$adventureVersion") - - library("acf-core", "com.github.ProxioDev.commands:acf-core:$acf") - library("acf-bungeecord", "com.github.ProxioDev.commands:acf-bungee:$acf") - library("acf-velocity", "com.github.ProxioDev.commands:acf-velocity:$acf") - - library("platform-bungeecord","net.md-5:bungeecord-api:$bungeecordApiVersion") - library("adventure-platforms-bungeecord", "net.kyori:adventure-platform-bungeecord:4.3.2") - - library("platform-velocity", "com.velocitypowered:velocity-api:$velocityVersion") - - - - - } - - - } - - -}