From 56859329638bce8b076800a098e53e58b0ab4763 Mon Sep 17 00:00:00 2001 From: Bierque Jason Date: Fri, 5 Jan 2024 21:22:50 +0100 Subject: [PATCH] Support Version 1.19.4 - 1.20.2 Folia --- .github/workflows/test-build.yml | 2 +- .idea/gradle.xml | 6 + .../2991c4e37c4db4f55a4531d477d63c4557e0d9d3 | 29 --- .../6f39a584a2cd7a9d3df30c78276dd602e6c7f5b6 | 0 .idea/sonarlint/issuestore/index.pb | 212 +++++++----------- .../2991c4e37c4db4f55a4531d477d63c4557e0d9d3 | 0 .../6f39a584a2cd7a9d3df30c78276dd602e6c7f5b6 | 0 .idea/sonarlint/securityhotspotstore/index.pb | 212 +++++++----------- api/build.gradle.kts | 3 + .../api/event/SkyblockChangeEvent.java | 0 .../api/event/SkyblockRemoveEvent.java | 0 .../api/exceptions}/DatabaseException.java | 2 +- .../MaxIslandSizeExceedException.java | 2 +- .../skyfolia/api/skyblock/Island.java | 2 +- .../skyfolia/api/skyblock/Players.java | 0 .../api/skyblock/model/IslandType.java | 0 .../skyblock/model/PermissionRoleIsland.java | 0 .../api/skyblock/model/PermissionsIsland.java | 0 .../skyfolia/api/skyblock/model/Position.java | 0 .../skyfolia/api/skyblock/model/RoleType.java | 0 .../api/skyblock/model/WarpIsland.java | 0 .../skyfolia/api/world/WorldFeedback.java | 43 ++++ build.gradle.kts | 54 +++-- nms/v1_19_R3/build.gradle.kts | 17 ++ .../utils/nms/v1_19_R3/PlayerNMS.java | 46 ++++ .../skyfolia/utils/nms/v1_19_R3/WorldNMS.java | 182 +++++++++++++++ nms/v1_20_R1/build.gradle.kts | 17 ++ .../utils/nms/v1_20_R1/PlayerNMS.java | 46 ++++ .../skyfolia/utils/nms/v1_20_R1/WorldNMS.java | 181 +++++++++++++++ nms/v1_20_R2/build.gradle.kts | 17 ++ .../utils/nms/v1_20_R2/PlayerNMS.java | 33 +-- .../skyfolia/utils/nms/v1_20_R2/WorldNMS.java | 60 +---- plugin/build.gradle.kts | 17 ++ .../main/java/fr/euphyllia/skyfolia/Main.java | 2 +- .../fr/euphyllia/skyfolia/api/InterneAPI.java | 2 +- .../skyfolia/commands/SkyFoliaCommand.java | 0 .../commands/SubCommandInterface.java | 0 .../skyfolia/commands/SubCommands.java | 0 .../subcommands/CreateSubCommand.java | 5 +- .../subcommands/DeleteSubCommand.java | 0 .../subcommands/DemoteSubCommand.java | 0 .../subcommands/InviteSubCommand.java | 0 .../commands/subcommands/KickSubCommand.java | 0 .../commands/subcommands/LeaveSubCommand.java | 0 .../subcommands/PermissionSubCommand.java | 0 .../subcommands/PrivateSubCommand.java | 0 .../subcommands/PromoteSubCommand.java | 0 .../subcommands/SetBiomeSubCommand.java | 0 .../subcommands/SetHomeSubCommand.java | 0 .../subcommands/SetWarpSubCommand.java | 0 .../subcommands/TeleportSubCommand.java | 3 +- .../subcommands/TransferSubCommand.java | 0 .../commands/subcommands/VisitSubCommand.java | 0 .../commands/subcommands/WarpSubCommand.java | 0 .../skyfolia/configuration/ConfigToml.java | 0 .../skyfolia/configuration/LanguageToml.java | 0 .../configuration/section/MariaDBConfig.java | 0 .../configuration/section/WorldConfig.java | 0 .../skyfolia/database/DatabaseLoader.java | 0 .../database/execute/MariaDBExecute.java | 0 .../skyfolia/database/model/DBCallback.java | 0 .../database/model/DBCallbackInt.java | 0 .../skyfolia/database/model/DBConnect.java | 0 .../skyfolia/database/model/DBInterface.java | 0 .../skyfolia/database/model/DBWork.java | 0 .../database/query/MariaDBCreateTable.java | 2 +- .../query/MariaDBTransactionQuery.java | 0 .../database/query/exec/IslandDataQuery.java | 2 +- .../query/exec/IslandMemberQuery.java | 0 .../database/query/exec/IslandQuery.java | 0 .../query/exec/IslandUpdateQuery.java | 0 .../database/query/exec/IslandWarpQuery.java | 0 .../skyfolia/database/sgbd/MariaDB.java | 0 .../skyfolia/database/stream/AsciiStream.java | 0 .../database/stream/BinaryStream.java | 0 .../listeners/bukkitevents/JoinEvent.java | 2 +- .../euphyllia/skyfolia/managers/Managers.java | 0 .../managers/skyblock/IslandHook.java | 2 +- .../managers/skyblock/SkyblockCache.java | 0 .../managers/skyblock/SkyblockManager.java | 0 .../managers/world/WorldsManager.java | 5 +- .../euphyllia/skyfolia/utils/IslandUtils.java | 0 .../euphyllia/skyfolia/utils/PlayerUtils.java | 32 +++ .../euphyllia/skyfolia/utils/RegionUtils.java | 0 .../skyfolia/utils/WorldEditUtils.java | 3 +- .../euphyllia/skyfolia/utils/WorldUtils.java | 24 ++ .../utils/generators/VoidWorldGen.java | 0 .../utils/models/CallbackLocation.java | 0 {src => plugin/src}/main/resources/plugin.yml | 0 settings.gradle.kts | 5 + 90 files changed, 869 insertions(+), 403 deletions(-) delete mode 100644 .idea/sonarlint/issuestore/2/9/2991c4e37c4db4f55a4531d477d63c4557e0d9d3 delete mode 100644 .idea/sonarlint/issuestore/6/f/6f39a584a2cd7a9d3df30c78276dd602e6c7f5b6 delete mode 100644 .idea/sonarlint/securityhotspotstore/2/9/2991c4e37c4db4f55a4531d477d63c4557e0d9d3 delete mode 100644 .idea/sonarlint/securityhotspotstore/6/f/6f39a584a2cd7a9d3df30c78276dd602e6c7f5b6 create mode 100644 api/build.gradle.kts rename {src => api/src}/main/java/fr/euphyllia/skyfolia/api/event/SkyblockChangeEvent.java (100%) rename {src => api/src}/main/java/fr/euphyllia/skyfolia/api/event/SkyblockRemoveEvent.java (100%) rename {src/main/java/fr/euphyllia/skyfolia/utils/exception => api/src/main/java/fr/euphyllia/skyfolia/api/exceptions}/DatabaseException.java (86%) rename {src/main/java/fr/euphyllia/skyfolia/utils/exception => api/src/main/java/fr/euphyllia/skyfolia/api/exceptions}/MaxIslandSizeExceedException.java (88%) rename {src => api/src}/main/java/fr/euphyllia/skyfolia/api/skyblock/Island.java (95%) rename {src => api/src}/main/java/fr/euphyllia/skyfolia/api/skyblock/Players.java (100%) rename {src => api/src}/main/java/fr/euphyllia/skyfolia/api/skyblock/model/IslandType.java (100%) rename {src => api/src}/main/java/fr/euphyllia/skyfolia/api/skyblock/model/PermissionRoleIsland.java (100%) rename {src => api/src}/main/java/fr/euphyllia/skyfolia/api/skyblock/model/PermissionsIsland.java (100%) rename {src => api/src}/main/java/fr/euphyllia/skyfolia/api/skyblock/model/Position.java (100%) rename {src => api/src}/main/java/fr/euphyllia/skyfolia/api/skyblock/model/RoleType.java (100%) rename {src => api/src}/main/java/fr/euphyllia/skyfolia/api/skyblock/model/WarpIsland.java (100%) create mode 100644 api/src/main/java/fr/euphyllia/skyfolia/api/world/WorldFeedback.java create mode 100644 nms/v1_19_R3/build.gradle.kts create mode 100644 nms/v1_19_R3/src/main/java/fr/euphyllia/skyfolia/utils/nms/v1_19_R3/PlayerNMS.java create mode 100644 nms/v1_19_R3/src/main/java/fr/euphyllia/skyfolia/utils/nms/v1_19_R3/WorldNMS.java create mode 100644 nms/v1_20_R1/build.gradle.kts create mode 100644 nms/v1_20_R1/src/main/java/fr/euphyllia/skyfolia/utils/nms/v1_20_R1/PlayerNMS.java create mode 100644 nms/v1_20_R1/src/main/java/fr/euphyllia/skyfolia/utils/nms/v1_20_R1/WorldNMS.java create mode 100644 nms/v1_20_R2/build.gradle.kts rename src/main/java/fr/euphyllia/skyfolia/utils/PlayerUtils.java => nms/v1_20_R2/src/main/java/fr/euphyllia/skyfolia/utils/nms/v1_20_R2/PlayerNMS.java (63%) rename src/main/java/fr/euphyllia/skyfolia/utils/WorldUtils.java => nms/v1_20_R2/src/main/java/fr/euphyllia/skyfolia/utils/nms/v1_20_R2/WorldNMS.java (82%) create mode 100644 plugin/build.gradle.kts rename {src => plugin/src}/main/java/fr/euphyllia/skyfolia/Main.java (97%) rename {src => plugin/src}/main/java/fr/euphyllia/skyfolia/api/InterneAPI.java (98%) rename {src => plugin/src}/main/java/fr/euphyllia/skyfolia/commands/SkyFoliaCommand.java (100%) rename {src => plugin/src}/main/java/fr/euphyllia/skyfolia/commands/SubCommandInterface.java (100%) rename {src => plugin/src}/main/java/fr/euphyllia/skyfolia/commands/SubCommands.java (100%) rename {src => plugin/src}/main/java/fr/euphyllia/skyfolia/commands/subcommands/CreateSubCommand.java (96%) rename {src => plugin/src}/main/java/fr/euphyllia/skyfolia/commands/subcommands/DeleteSubCommand.java (100%) rename {src => plugin/src}/main/java/fr/euphyllia/skyfolia/commands/subcommands/DemoteSubCommand.java (100%) rename {src => plugin/src}/main/java/fr/euphyllia/skyfolia/commands/subcommands/InviteSubCommand.java (100%) rename {src => plugin/src}/main/java/fr/euphyllia/skyfolia/commands/subcommands/KickSubCommand.java (100%) rename {src => plugin/src}/main/java/fr/euphyllia/skyfolia/commands/subcommands/LeaveSubCommand.java (100%) rename {src => plugin/src}/main/java/fr/euphyllia/skyfolia/commands/subcommands/PermissionSubCommand.java (100%) rename {src => plugin/src}/main/java/fr/euphyllia/skyfolia/commands/subcommands/PrivateSubCommand.java (100%) rename {src => plugin/src}/main/java/fr/euphyllia/skyfolia/commands/subcommands/PromoteSubCommand.java (100%) rename {src => plugin/src}/main/java/fr/euphyllia/skyfolia/commands/subcommands/SetBiomeSubCommand.java (100%) rename {src => plugin/src}/main/java/fr/euphyllia/skyfolia/commands/subcommands/SetHomeSubCommand.java (100%) rename {src => plugin/src}/main/java/fr/euphyllia/skyfolia/commands/subcommands/SetWarpSubCommand.java (100%) rename {src => plugin/src}/main/java/fr/euphyllia/skyfolia/commands/subcommands/TeleportSubCommand.java (95%) rename {src => plugin/src}/main/java/fr/euphyllia/skyfolia/commands/subcommands/TransferSubCommand.java (100%) rename {src => plugin/src}/main/java/fr/euphyllia/skyfolia/commands/subcommands/VisitSubCommand.java (100%) rename {src => plugin/src}/main/java/fr/euphyllia/skyfolia/commands/subcommands/WarpSubCommand.java (100%) rename {src => plugin/src}/main/java/fr/euphyllia/skyfolia/configuration/ConfigToml.java (100%) rename {src => plugin/src}/main/java/fr/euphyllia/skyfolia/configuration/LanguageToml.java (100%) rename {src => plugin/src}/main/java/fr/euphyllia/skyfolia/configuration/section/MariaDBConfig.java (100%) rename {src => plugin/src}/main/java/fr/euphyllia/skyfolia/configuration/section/WorldConfig.java (100%) rename {src => plugin/src}/main/java/fr/euphyllia/skyfolia/database/DatabaseLoader.java (100%) rename {src => plugin/src}/main/java/fr/euphyllia/skyfolia/database/execute/MariaDBExecute.java (100%) rename {src => plugin/src}/main/java/fr/euphyllia/skyfolia/database/model/DBCallback.java (100%) rename {src => plugin/src}/main/java/fr/euphyllia/skyfolia/database/model/DBCallbackInt.java (100%) rename {src => plugin/src}/main/java/fr/euphyllia/skyfolia/database/model/DBConnect.java (100%) rename {src => plugin/src}/main/java/fr/euphyllia/skyfolia/database/model/DBInterface.java (100%) rename {src => plugin/src}/main/java/fr/euphyllia/skyfolia/database/model/DBWork.java (100%) rename {src => plugin/src}/main/java/fr/euphyllia/skyfolia/database/query/MariaDBCreateTable.java (98%) rename {src => plugin/src}/main/java/fr/euphyllia/skyfolia/database/query/MariaDBTransactionQuery.java (100%) rename {src => plugin/src}/main/java/fr/euphyllia/skyfolia/database/query/exec/IslandDataQuery.java (98%) rename {src => plugin/src}/main/java/fr/euphyllia/skyfolia/database/query/exec/IslandMemberQuery.java (100%) rename {src => plugin/src}/main/java/fr/euphyllia/skyfolia/database/query/exec/IslandQuery.java (100%) rename {src => plugin/src}/main/java/fr/euphyllia/skyfolia/database/query/exec/IslandUpdateQuery.java (100%) rename {src => plugin/src}/main/java/fr/euphyllia/skyfolia/database/query/exec/IslandWarpQuery.java (100%) rename {src => plugin/src}/main/java/fr/euphyllia/skyfolia/database/sgbd/MariaDB.java (100%) rename {src => plugin/src}/main/java/fr/euphyllia/skyfolia/database/stream/AsciiStream.java (100%) rename {src => plugin/src}/main/java/fr/euphyllia/skyfolia/database/stream/BinaryStream.java (100%) rename {src => plugin/src}/main/java/fr/euphyllia/skyfolia/listeners/bukkitevents/JoinEvent.java (92%) rename {src => plugin/src}/main/java/fr/euphyllia/skyfolia/managers/Managers.java (100%) rename {src => plugin/src}/main/java/fr/euphyllia/skyfolia/managers/skyblock/IslandHook.java (98%) rename {src => plugin/src}/main/java/fr/euphyllia/skyfolia/managers/skyblock/SkyblockCache.java (100%) rename {src => plugin/src}/main/java/fr/euphyllia/skyfolia/managers/skyblock/SkyblockManager.java (100%) rename {src => plugin/src}/main/java/fr/euphyllia/skyfolia/managers/world/WorldsManager.java (89%) rename {src => plugin/src}/main/java/fr/euphyllia/skyfolia/utils/IslandUtils.java (100%) create mode 100644 plugin/src/main/java/fr/euphyllia/skyfolia/utils/PlayerUtils.java rename {src => plugin/src}/main/java/fr/euphyllia/skyfolia/utils/RegionUtils.java (100%) rename {src => plugin/src}/main/java/fr/euphyllia/skyfolia/utils/WorldEditUtils.java (98%) create mode 100644 plugin/src/main/java/fr/euphyllia/skyfolia/utils/WorldUtils.java rename {src => plugin/src}/main/java/fr/euphyllia/skyfolia/utils/generators/VoidWorldGen.java (100%) rename {src => plugin/src}/main/java/fr/euphyllia/skyfolia/utils/models/CallbackLocation.java (100%) rename {src => plugin/src}/main/resources/plugin.yml (100%) diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index f3359a9..cc039cd 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -18,4 +18,4 @@ jobs: - name: Permission gradlew run: chmod +x gradlew - name: Build SkyFolia jar - run: ./gradlew reobfJar \ No newline at end of file + run: ./gradlew shadowJar \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 2a65317..9d63d0c 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -9,6 +9,12 @@ diff --git a/.idea/sonarlint/issuestore/2/9/2991c4e37c4db4f55a4531d477d63c4557e0d9d3 b/.idea/sonarlint/issuestore/2/9/2991c4e37c4db4f55a4531d477d63c4557e0d9d3 deleted file mode 100644 index 4fa8f7e..0000000 --- a/.idea/sonarlint/issuestore/2/9/2991c4e37c4db4f55a4531d477d63c4557e0d9d3 +++ /dev/null @@ -1,29 +0,0 @@ - -Q -java:S3740l"/Provide the parametrized type for this generic.(8ШŊ1 -q -java:S1192"NDefine a constant instead of duplicating this literal "sky-overworld" 3 times.(8֨Ŋ1 -N -java:S1444",Make this "public static config" field final(8بŊ1 -O -java:S1444"-Make this "public static version" field final(8٨Ŋ1 -P -java:S1444"3Make this "public static mariaDBConfig" field final(8ڨŊ1 -T -java:S1444"2Make this "public static worldConfigs" field final(ل8ۨŊ1 -L -java:S1444"/Make this "public static maxIsland" field final(8ܨŊ1 -S -java:S1444"1Make this "public static islandTypes" field final(8ݨŊ1 -f -java:S1444 "DMake this "public static clearInventoryWhenDeleteIsland" field final(צ8ިŊ1 -b -java:S1444!"EMake this "public static clearEnderChestWhenDeleteIsland" field final(ф8Ŋ1 -m -java:S1444""KMake this "public static resetExperiencePlayerWhenDeleteIsland" field final(8Ŋ1 -? -java:S2386"Make this member "protected".(ل8߬Ŋ1 -? -java:S2386"Make this member "protected".(8߬Ŋ1 -W -java:S1118":Add a private constructor to hide the implicit public one.(լ8Ŋ1 \ No newline at end of file diff --git a/.idea/sonarlint/issuestore/6/f/6f39a584a2cd7a9d3df30c78276dd602e6c7f5b6 b/.idea/sonarlint/issuestore/6/f/6f39a584a2cd7a9d3df30c78276dd602e6c7f5b6 deleted file mode 100644 index e69de29..0000000 diff --git a/.idea/sonarlint/issuestore/index.pb b/.idea/sonarlint/issuestore/index.pb index dd4a930..f70b1ce 100644 --- a/.idea/sonarlint/issuestore/index.pb +++ b/.idea/sonarlint/issuestore/index.pb @@ -3,146 +3,104 @@ build.gradle.kts,d\b\dbcff70658daf80b53ce624f6adcaa529df5ed8d 9 readme.md,2\7\275d783e298228506068436512433d343feb52aa -] --src/main/java/fr/euphyllia/skyfolia/Main.java,6\f\6f39a584a2cd7a9d3df30c78276dd602e6c7f5b6 C settings.gradle.kts,7\4\749edfcc96398253e5b3416184e95c46621da850 -q -Asrc/main/java/fr/euphyllia/skyfolia/configuration/ConfigToml.java,2\9\2991c4e37c4db4f55a4531d477d63c4557e0d9d3 : .gitignore,a\5\a5cc2925ca8258af241be7e5b0381edf30266302 +A +.github/workflows,9\3\93d7c4b8379b044a4f4d044d632200ac9ae24251 +P + .github/workflows/test-build.yml,2\3\23859ec96080198aa2547504b5e6d823beec3ac3 +~ +Nnms/v1_20_R2/src/main/java/fr/euphyllia/skyfolia/utils/nms/v1_20_R2/World.JAVA,b\b\bb6679cd8acccde0f23df8f95e7ad4638dfe3050 +~ +Nnms/v1_20_R2/src/main/java/fr/euphyllia/skyfolia/utils/nms/v1_20_R2/world.java,5\f\5f69b8886bb12e47defd6d4f40cbe9c6475f115f +M +nms/v1_20_R2/build.gradle.kts,f\c\fc04285c026eee3661ad8004ded41730056c7ba2 +~ +Nnms/v1_20_R2/src/main/java/fr/euphyllia/skyfolia/utils/nms/v1_20_R2/World.java,7\5\7574c50ef9c60a2eaa46616aa4e25eebdfab0357 +G +plugin/build.gradle.kts,e\b\eb592fc14dde861a02b43162ff249725b5669f84 p -@src/main/java/fr/euphyllia/skyfolia/database/DatabaseLoader.java,6\f\6fad360e12b787e164486627b2dee9e0c6489327 -| -Lsrc/main/java/fr/euphyllia/skyfolia/configuration/section/MariaDBConfig.java,b\a\ba796b7047cc07527e9a61a1551ac155f4cfa81d -n ->src/main/java/fr/euphyllia/skyfolia/database/sgbd/MariaDB.java,d\a\dab9e76a8888e2e43f7127e325aa615338dc60c8 +@plugin/src/main/java/fr/euphyllia/skyfolia/utils/WorldUtils.java,d\6\d6913539d210a0e92b71d294a1de5cbece3bf2d1 +x +Hplugin/src/main/java/fr/euphyllia/skyfolia/utils/nms/v1_20_R2/World.java,9\a\9a884b7dc1a83ee559352e8bb75755542e22a886 q -Asrc/main/java/fr/euphyllia/skyfolia/database/model/DBConnect.java,8\7\8757cab0f2ccc0774e812e5e563a44ed8a63bed6 -s -Csrc/main/java/fr/euphyllia/skyfolia/database/model/DBInterface.java,d\0\d0ae09e4666b0581c704eb196245c76f2c205d94 -r -Bsrc/main/java/fr/euphyllia/skyfolia/database/model/DBCallback.java,9\b\9ba66ee620deb35a0dc002eb049d15f1c0c6c604 -u -Esrc/main/java/fr/euphyllia/skyfolia/database/model/DBCallbackInt.java,9\a\9a495bc063bfbca950326d829507ed334bbc0741 -n ->src/main/java/fr/euphyllia/skyfolia/database/model/DBWork.java,d\3\d379c608a294caa7d40bd75d5c0c8fb038f4f584 -t -Dsrc/main/java/fr/euphyllia/skyfolia/database/stream/AsciiStream.java,1\6\16666d1fdf6ab7a6f409b07a9ed00d6660e5745c -u -Esrc/main/java/fr/euphyllia/skyfolia/database/stream/BinaryStream.java,f\a\fa2dbee3cb8446753bb3a4581cb7479d8713017c +Aplugin/src/main/java/fr/euphyllia/skyfolia/utils/IslandUtils.java,1\2\12c7b15aa4575099cb0b105ba34244c0588f9108 +7 +gradlew,5\b\5bbfa66edb4db3c7c33c5181f43510990d3307f9 +d +4plugin/src/main/java/fr/euphyllia/skyfolia/Main.java,8\e\8ed930256e02d150e4834bbd09941bd558960565 +k +;api/src/main/java/fr/euphyllia/skyfolia/api/InterneAPI.java,6\0\6081c84838eda902f4296aad4d12ce76310daa46 +D +api/build.gradle.kts,b\e\be15954d0f5a5b97c5c8371a82f36a1fa3ab405d +p +@api/src/main/java/fr/euphyllia/skyfolia/api/skyblock/Island.java,8\9\89bf0f66e7ffa7bd86c597d636cd9f0b16bdb1a3 +q +Aapi/src/main/java/fr/euphyllia/skyfolia/api/skyblock/Players.java,6\b\6b06fa46f729046b79c13d7d45fa65a9bdb18075 z -Jsrc/main/java/fr/euphyllia/skyfolia/database/query/MariaDBCreateTable.java,c\b\cb76b976218e8cf1b674759b1235ec23636d124b - -Osrc/main/java/fr/euphyllia/skyfolia/database/query/MariaDBTransactionQuery.java,5\9\5939500d442b96b118298964b83e8bebd7fab3d8 +Japi/src/main/java/fr/euphyllia/skyfolia/api/skyblock/model/IslandType.java,c\4\c45d10742061fc489f986000d0e0e9c1a2514dd5 + +Tapi/src/main/java/fr/euphyllia/skyfolia/api/skyblock/model/PermissionRoleIsland.java,9\2\9296466fd2f9f65739cf9e3cb9a5fa0797e72a04 z -Jsrc/main/java/fr/euphyllia/skyfolia/utils/exception/DatabaseException.java,7\a\7a5f152546f4c8285770f1f7c03aa336dd467822 -g -7src/main/java/fr/euphyllia/skyfolia/api/InterneAPI.java,2\f\2fca606c521e61a9bdb9f5646c8ddef759f2be1d -x -Hsrc/main/java/fr/euphyllia/skyfolia/database/execute/MariaDBExecute.java,c\5\c5d9965bcc43c5f4bed732c54ccd2371dcf966a3 -v -Fsrc/main/java/fr/euphyllia/skyfolia/utils/generators/VoidWorldGen.java,2\4\2403b3f108c9fb0b6bea49e6ce38bfd042084be0 -u -Esrc/main/java/fr/euphyllia/skyfolia/managers/world/WorldsManager.java,4\f\4fe305c1ab6bf791747f3061abf53a3e996f5df2 +Japi/src/main/java/fr/euphyllia/skyfolia/api/event/SkyblockRemoveEvent.java,e\1\e1080f6b7fdf5e33d3009167a4ad5a693f6da916 +z +Japi/src/main/java/fr/euphyllia/skyfolia/api/event/SkyblockChangeEvent.java,4\2\42a799e591b4f62bff0f6c0478012a1f2c82d75f z -Jsrc/main/java/fr/euphyllia/skyfolia/configuration/section/WorldConfig.java,4\4\44d5855572032eac98c6e87102395051ab5922b7 -j -:src/main/java/fr/euphyllia/skyfolia/managers/Managers.java,a\5\a5304625e025540ab5f38979d029900927b6b51a -l -plugin/src/main/java/fr/euphyllia/skyfolia/api/InterneAPI.java,5\9\5907f703436100f5a07ba94c21ad6b71303f052f x -Hsrc/main/java/fr/euphyllia/skyfolia/database/query/exec/IslandQuery.java,6\f\6fa9dd782aad323f6940dd67592e26190670d55a -q -Asrc/main/java/fr/euphyllia/skyfolia/commands/SkyFoliaCommand.java,6\5\65aae2902abf00a673f5fbc631db6b67271c82f9 -m -=src/main/java/fr/euphyllia/skyfolia/commands/SubCommands.java,6\2\624239b3ba60876c923d46507fb10d588cc488f7 -~ -Nsrc/main/java/fr/euphyllia/skyfolia/commands/subcommands/CreateSubCommand.java,3\3\3305e601c907002d6e13e6c2293ac57df34894bd -u -Esrc/main/java/fr/euphyllia/skyfolia/commands/SubCommandInterface.java,4\6\4695d4c8eca93d4dff01eec9f4a1d851e770271b -z -Jsrc/main/java/fr/euphyllia/skyfolia/managers/skyblock/SkyblockManager.java,e\c\ec45b5213a5ff0a45400d04f11cfe399009161dc -t -Dsrc/main/java/fr/euphyllia/skyfolia/api/skyblock/model/Position.java,1\f\1f1f267e4a0d2a95e19dfa7a24f40fb8cb8d6cfa -j -:src/main/java/fr/euphyllia/skyfolia/utils/RegionUtils.java,a\a\aa6f671c5bb4cdaa6d6c479db407041f8100cae9 -m -=src/main/java/fr/euphyllia/skyfolia/utils/WorldEditUtils.java,3\0\30a000bec3de9a67027e3894e4b98b0b6baba2a9 -v -Fsrc/main/java/fr/euphyllia/skyfolia/api/skyblock/model/IslandType.java,6\2\620aea5b3a1b1236a0b6122cc015f1caeb286fb6 -~ -Nsrc/main/java/fr/euphyllia/skyfolia/commands/subcommands/DeleteSubCommand.java,f\3\f3402fea05c7d5b15486a92d931184926a926b84 -j -:src/main/java/fr/euphyllia/skyfolia/utils/PlayerUtils.java,4\3\43f8f4b587797b15d14c9c06b089d5b9cfadc8b9 -~ -Nsrc/main/java/fr/euphyllia/skyfolia/database/query/exec/IslandUpdateQuery.java,7\5\753653a633c234dc09036ed1d8b410d04fb20aa1 -v -Fsrc/main/java/fr/euphyllia/skyfolia/api/event/SkyblockRemoveEvent.java,c\c\cc255d6a8f3edb3167cf4da7ef043cec25c36fd6 -v -Fsrc/main/java/fr/euphyllia/skyfolia/utils/models/CallbackLocation.java,5\9\590404782c69a8bd4e266034cc57d3ffc3bc30c3 - -Psrc/main/java/fr/euphyllia/skyfolia/commands/subcommands/TeleportSubCommand.java,c\c\cc3fba50ed07e3f04c2422dff0760ab20b85dfa6 -i -9src/main/java/fr/euphyllia/skyfolia/utils/WorldUtils.java,9\8\98d1c179995b3a1a2eebb18ffe10b26b61bbce42 - -Psrc/main/java/fr/euphyllia/skyfolia/commands/subcommands/SetBiomeSubCommand.java,8\3\83f650f3eed01c24078424587098878ae4b35c80 - -Osrc/main/java/fr/euphyllia/skyfolia/commands/subcommands/SetHomeSubCommand.java,4\8\48b3bc6ce1e9ee76dc099badcf88ccdd7dba68b9 +Hplugin/src/main/java/fr/euphyllia/skyfolia/commands/SkyFoliaCommand.java,3\a\3a9d3297f65b52faad6f2da2cbb91cb7262a6c75 + +Splugin/src/main/java/fr/euphyllia/skyfolia/database/query/exec/IslandDataQuery.java,2\1\2173569133315e4d10a5dee40bf76c90ff06c138 | -Lsrc/main/java/fr/euphyllia/skyfolia/database/query/exec/IslandWarpQuery.java,c\6\c6c26983936988feb55d1b82a8ad22a6abe3fec0 - -Osrc/main/java/fr/euphyllia/skyfolia/commands/subcommands/SetWarpSubCommand.java,8\d\8d00a6fa3b6e506336ab4209c2460a62b02d88a3 -~ -Nsrc/main/java/fr/euphyllia/skyfolia/database/query/exec/IslandMemberQuery.java,3\d\3d95ff3c5ddc4cb79266eca87c7f1197cf9e5f7f -~ -Nsrc/main/java/fr/euphyllia/skyfolia/commands/subcommands/DemoteSubCommand.java,5\a\5a38f36e8cbc7c8240fe2b54c9564f202c67a8d3 -v -Fsrc/main/java/fr/euphyllia/skyfolia/api/skyblock/model/WarpIsland.java,9\f\9fc60c4e7628c1e3aa3563018e13745cfb7adf70 -u -Esrc/main/java/fr/euphyllia/skyfolia/managers/skyblock/IslandHook.java,b\7\b72eda6118ee6cc8e263def8a13b3ae934b485b4 - -Osrc/main/java/fr/euphyllia/skyfolia/commands/subcommands/PrivateSubCommand.java,2\f\2fe5048ff39fb764c489e956e082188264271861 - -Psrc/main/java/fr/euphyllia/skyfolia/commands/subcommands/TransferSubCommand.java,a\b\ab4b2a552631065e64cfee8e3c04a374ba90aad4 -} -Msrc/main/java/fr/euphyllia/skyfolia/commands/subcommands/VisitSubCommand.java,5\9\5936dedab617b6140331e383423c0b00311c1db9 -~ -Nsrc/main/java/fr/euphyllia/skyfolia/commands/subcommands/InviteSubCommand.java,e\f\ef93e0bc90a9a6d49151814d5178a0415f31626f +Lplugin/src/main/java/fr/euphyllia/skyfolia/managers/skyblock/IslandHook.java,7\e\7e5d42f253643b53d5181e25173c258595c190d4 + +Qplugin/src/main/java/fr/euphyllia/skyfolia/database/query/MariaDBCreateTable.java,e\1\e1e385322bc0cc3ad8589771f5acc56b85c7db6b | -Lsrc/main/java/fr/euphyllia/skyfolia/commands/subcommands/KickSubCommand.java,a\a\aacecdafec66f2492cdd169cc0c25466076e648c -} -Msrc/main/java/fr/euphyllia/skyfolia/commands/subcommands/LeaveSubCommand.java,6\5\653269707c01720238cf03d6b7d563b4c121391d - -Rsrc/main/java/fr/euphyllia/skyfolia/commands/subcommands/PermissionSubCommand.java,a\e\ae465e707d2debdcb5d589801d157a5a32ad06e6 +Lplugin/src/main/java/fr/euphyllia/skyfolia/managers/world/WorldsManager.java,1\3\1357c8a8712aa5028f6dfdb3fd1acc38e3593964 +t +Dapi/src/main/java/fr/euphyllia/skyfolia/api/world/FeedbackWorld.java,f\5\f5498ae3b3d0667f9b6fcfeefecb2d3be218d229 +q +Aplugin/src/main/java/fr/euphyllia/skyfolia/managers/Managers.java,8\c\8cd928d82dc8ede2e36a204eaef10ea7e985a3ed +q +Aplugin/src/main/java/fr/euphyllia/skyfolia/utils/PlayerUtils.java,6\b\6ba26d47bdbbe71d188de4fb627fb21c05f6e5a9  -Osrc/main/java/fr/euphyllia/skyfolia/commands/subcommands/PromoteSubCommand.java,c\d\cdd6b717d83355faa17ba58b5a374fdbaf8a5f8d -| -Lsrc/main/java/fr/euphyllia/skyfolia/commands/subcommands/WarpSubCommand.java,6\c\6cb80dd7b5c8a71f6bf80f19d5ccb506991c109b -| -Lsrc/main/java/fr/euphyllia/skyfolia/database/query/exec/IslandDataQuery.java,6\6\66ecc8d94786db66f7fa649a0976008cb3dbeb9d - -Usrc/main/java/fr/euphyllia/skyfolia/utils/exception/MaxIslandSizeExceedException.java,2\0\20970056294008ba48d769949038b948b6a8d983 -j -:src/main/java/fr/euphyllia/skyfolia/utils/IslandUtils.java,f\1\f14540eba19259385982dad1fbfdd7e2a7614794 -s -Csrc/main/java/fr/euphyllia/skyfolia/configuration/LanguageToml.java,0\4\04646adaeb37b14fd7b17b08b90d7f5122d18cf7 -A -.github/workflows,9\3\93d7c4b8379b044a4f4d044d632200ac9ae24251 -P - .github/workflows/test-build.yml,2\3\23859ec96080198aa2547504b5e6d823beec3ac3 -x -Hsrc/main/java/fr/euphyllia/skyfolia/managers/skyblock/SkyblockCache.java,0\f\0f7206c4152e26101920cf82fdb3afef578c0903 -y -Isrc/main/java/fr/euphyllia/skyfolia/listeners/bukkitevents/JoinEvent.java,f\c\fce1b352aa9f8a46b25151de2957c542fb96af17 \ No newline at end of file +Onms/v1_20_R2/src/main/java/fr/euphyllia/skyfolia/utils/nms/v1_20_R2/Player.java,5\1\51f581ae196dfba201a3a15f6e36cbfacd1bb044 + +Qnms/v1_20_R2/src/main/java/fr/euphyllia/skyfolia/utils/nms/v1_20_R2/WorldNMS.java,0\3\0301d4f1df558a505fc2fa1d4e30121bf9852425 + +Rnms/v1_20_R2/src/main/java/fr/euphyllia/skyfolia/utils/nms/v1_20_R2/PlayerNMS.java,7\9\79e247488edfaac6d11e28f44facf64930e92581 + +Wplugin/src/main/java/fr/euphyllia/skyfolia/commands/subcommands/TeleportSubCommand.java,4\d\4da4b88624103cce66c27987970cb3ef7cc63b72 +M +nms/v1_19_R3/build.gradle.kts,b\b\bbad3bff2eb2fe1535b553598233a9d5a7480896 + +Rnms/v1_19_R3/src/main/java/fr/euphyllia/skyfolia/utils/nms/v1_19_R3/PlayerNMS.java,9\d\9d4390b7c9d7a4bb201aeb0cb342d5ea352bbdc2 + +Qnms/v1_19_R3/src/main/java/fr/euphyllia/skyfolia/utils/nms/v1_19_R3/WorldNMS.java,4\6\46459def7e6b882bc8e3b92d259be8ae50b44713 +M +nms/v1_20_R1/build.gradle.kts,3\c\3c9de4f1b765ef91a5f5918f02f87100535f4a98 + +Qnms/v1_20_R1/src/main/java/fr/euphyllia/skyfolia/utils/nms/v1_20_R1/WorldNMS.java,9\3\938e9219285f10b9cecc924c9fd83ebf4923bf14 + +Rnms/v1_20_R1/src/main/java/fr/euphyllia/skyfolia/utils/nms/v1_20_R1/PlayerNMS.java,1\9\190dc284326d7d2028192e0a6a2e52ef1280d0fc + +Rnms/v1_20_R3/src/main/java/fr/euphyllia/skyfolia/utils/nms/v1_20_R3/PlayerNMS.java,b\d\bd9bd36fc678c44497b51a0ed5add4db999abe61 + +Qnms/v1_20_R3/src/main/java/fr/euphyllia/skyfolia/utils/nms/v1_20_R3/WorldNMS.java,f\e\fe3119ffacc5b73e9f3b3cd0a7e0915308aee704 +M +nms/v1_20_R3/build.gradle.kts,6\6\66f6b89775f4196374327a4ecc99b41711e6bfca \ No newline at end of file diff --git a/.idea/sonarlint/securityhotspotstore/2/9/2991c4e37c4db4f55a4531d477d63c4557e0d9d3 b/.idea/sonarlint/securityhotspotstore/2/9/2991c4e37c4db4f55a4531d477d63c4557e0d9d3 deleted file mode 100644 index e69de29..0000000 diff --git a/.idea/sonarlint/securityhotspotstore/6/f/6f39a584a2cd7a9d3df30c78276dd602e6c7f5b6 b/.idea/sonarlint/securityhotspotstore/6/f/6f39a584a2cd7a9d3df30c78276dd602e6c7f5b6 deleted file mode 100644 index e69de29..0000000 diff --git a/.idea/sonarlint/securityhotspotstore/index.pb b/.idea/sonarlint/securityhotspotstore/index.pb index dd4a930..f70b1ce 100644 --- a/.idea/sonarlint/securityhotspotstore/index.pb +++ b/.idea/sonarlint/securityhotspotstore/index.pb @@ -3,146 +3,104 @@ build.gradle.kts,d\b\dbcff70658daf80b53ce624f6adcaa529df5ed8d 9 readme.md,2\7\275d783e298228506068436512433d343feb52aa -] --src/main/java/fr/euphyllia/skyfolia/Main.java,6\f\6f39a584a2cd7a9d3df30c78276dd602e6c7f5b6 C settings.gradle.kts,7\4\749edfcc96398253e5b3416184e95c46621da850 -q -Asrc/main/java/fr/euphyllia/skyfolia/configuration/ConfigToml.java,2\9\2991c4e37c4db4f55a4531d477d63c4557e0d9d3 : .gitignore,a\5\a5cc2925ca8258af241be7e5b0381edf30266302 +A +.github/workflows,9\3\93d7c4b8379b044a4f4d044d632200ac9ae24251 +P + .github/workflows/test-build.yml,2\3\23859ec96080198aa2547504b5e6d823beec3ac3 +~ +Nnms/v1_20_R2/src/main/java/fr/euphyllia/skyfolia/utils/nms/v1_20_R2/World.JAVA,b\b\bb6679cd8acccde0f23df8f95e7ad4638dfe3050 +~ +Nnms/v1_20_R2/src/main/java/fr/euphyllia/skyfolia/utils/nms/v1_20_R2/world.java,5\f\5f69b8886bb12e47defd6d4f40cbe9c6475f115f +M +nms/v1_20_R2/build.gradle.kts,f\c\fc04285c026eee3661ad8004ded41730056c7ba2 +~ +Nnms/v1_20_R2/src/main/java/fr/euphyllia/skyfolia/utils/nms/v1_20_R2/World.java,7\5\7574c50ef9c60a2eaa46616aa4e25eebdfab0357 +G +plugin/build.gradle.kts,e\b\eb592fc14dde861a02b43162ff249725b5669f84 p -@src/main/java/fr/euphyllia/skyfolia/database/DatabaseLoader.java,6\f\6fad360e12b787e164486627b2dee9e0c6489327 -| -Lsrc/main/java/fr/euphyllia/skyfolia/configuration/section/MariaDBConfig.java,b\a\ba796b7047cc07527e9a61a1551ac155f4cfa81d -n ->src/main/java/fr/euphyllia/skyfolia/database/sgbd/MariaDB.java,d\a\dab9e76a8888e2e43f7127e325aa615338dc60c8 +@plugin/src/main/java/fr/euphyllia/skyfolia/utils/WorldUtils.java,d\6\d6913539d210a0e92b71d294a1de5cbece3bf2d1 +x +Hplugin/src/main/java/fr/euphyllia/skyfolia/utils/nms/v1_20_R2/World.java,9\a\9a884b7dc1a83ee559352e8bb75755542e22a886 q -Asrc/main/java/fr/euphyllia/skyfolia/database/model/DBConnect.java,8\7\8757cab0f2ccc0774e812e5e563a44ed8a63bed6 -s -Csrc/main/java/fr/euphyllia/skyfolia/database/model/DBInterface.java,d\0\d0ae09e4666b0581c704eb196245c76f2c205d94 -r -Bsrc/main/java/fr/euphyllia/skyfolia/database/model/DBCallback.java,9\b\9ba66ee620deb35a0dc002eb049d15f1c0c6c604 -u -Esrc/main/java/fr/euphyllia/skyfolia/database/model/DBCallbackInt.java,9\a\9a495bc063bfbca950326d829507ed334bbc0741 -n ->src/main/java/fr/euphyllia/skyfolia/database/model/DBWork.java,d\3\d379c608a294caa7d40bd75d5c0c8fb038f4f584 -t -Dsrc/main/java/fr/euphyllia/skyfolia/database/stream/AsciiStream.java,1\6\16666d1fdf6ab7a6f409b07a9ed00d6660e5745c -u -Esrc/main/java/fr/euphyllia/skyfolia/database/stream/BinaryStream.java,f\a\fa2dbee3cb8446753bb3a4581cb7479d8713017c +Aplugin/src/main/java/fr/euphyllia/skyfolia/utils/IslandUtils.java,1\2\12c7b15aa4575099cb0b105ba34244c0588f9108 +7 +gradlew,5\b\5bbfa66edb4db3c7c33c5181f43510990d3307f9 +d +4plugin/src/main/java/fr/euphyllia/skyfolia/Main.java,8\e\8ed930256e02d150e4834bbd09941bd558960565 +k +;api/src/main/java/fr/euphyllia/skyfolia/api/InterneAPI.java,6\0\6081c84838eda902f4296aad4d12ce76310daa46 +D +api/build.gradle.kts,b\e\be15954d0f5a5b97c5c8371a82f36a1fa3ab405d +p +@api/src/main/java/fr/euphyllia/skyfolia/api/skyblock/Island.java,8\9\89bf0f66e7ffa7bd86c597d636cd9f0b16bdb1a3 +q +Aapi/src/main/java/fr/euphyllia/skyfolia/api/skyblock/Players.java,6\b\6b06fa46f729046b79c13d7d45fa65a9bdb18075 z -Jsrc/main/java/fr/euphyllia/skyfolia/database/query/MariaDBCreateTable.java,c\b\cb76b976218e8cf1b674759b1235ec23636d124b - -Osrc/main/java/fr/euphyllia/skyfolia/database/query/MariaDBTransactionQuery.java,5\9\5939500d442b96b118298964b83e8bebd7fab3d8 +Japi/src/main/java/fr/euphyllia/skyfolia/api/skyblock/model/IslandType.java,c\4\c45d10742061fc489f986000d0e0e9c1a2514dd5 + +Tapi/src/main/java/fr/euphyllia/skyfolia/api/skyblock/model/PermissionRoleIsland.java,9\2\9296466fd2f9f65739cf9e3cb9a5fa0797e72a04 z -Jsrc/main/java/fr/euphyllia/skyfolia/utils/exception/DatabaseException.java,7\a\7a5f152546f4c8285770f1f7c03aa336dd467822 -g -7src/main/java/fr/euphyllia/skyfolia/api/InterneAPI.java,2\f\2fca606c521e61a9bdb9f5646c8ddef759f2be1d -x -Hsrc/main/java/fr/euphyllia/skyfolia/database/execute/MariaDBExecute.java,c\5\c5d9965bcc43c5f4bed732c54ccd2371dcf966a3 -v -Fsrc/main/java/fr/euphyllia/skyfolia/utils/generators/VoidWorldGen.java,2\4\2403b3f108c9fb0b6bea49e6ce38bfd042084be0 -u -Esrc/main/java/fr/euphyllia/skyfolia/managers/world/WorldsManager.java,4\f\4fe305c1ab6bf791747f3061abf53a3e996f5df2 +Japi/src/main/java/fr/euphyllia/skyfolia/api/event/SkyblockRemoveEvent.java,e\1\e1080f6b7fdf5e33d3009167a4ad5a693f6da916 +z +Japi/src/main/java/fr/euphyllia/skyfolia/api/event/SkyblockChangeEvent.java,4\2\42a799e591b4f62bff0f6c0478012a1f2c82d75f z -Jsrc/main/java/fr/euphyllia/skyfolia/configuration/section/WorldConfig.java,4\4\44d5855572032eac98c6e87102395051ab5922b7 -j -:src/main/java/fr/euphyllia/skyfolia/managers/Managers.java,a\5\a5304625e025540ab5f38979d029900927b6b51a -l -plugin/src/main/java/fr/euphyllia/skyfolia/api/InterneAPI.java,5\9\5907f703436100f5a07ba94c21ad6b71303f052f x -Hsrc/main/java/fr/euphyllia/skyfolia/database/query/exec/IslandQuery.java,6\f\6fa9dd782aad323f6940dd67592e26190670d55a -q -Asrc/main/java/fr/euphyllia/skyfolia/commands/SkyFoliaCommand.java,6\5\65aae2902abf00a673f5fbc631db6b67271c82f9 -m -=src/main/java/fr/euphyllia/skyfolia/commands/SubCommands.java,6\2\624239b3ba60876c923d46507fb10d588cc488f7 -~ -Nsrc/main/java/fr/euphyllia/skyfolia/commands/subcommands/CreateSubCommand.java,3\3\3305e601c907002d6e13e6c2293ac57df34894bd -u -Esrc/main/java/fr/euphyllia/skyfolia/commands/SubCommandInterface.java,4\6\4695d4c8eca93d4dff01eec9f4a1d851e770271b -z -Jsrc/main/java/fr/euphyllia/skyfolia/managers/skyblock/SkyblockManager.java,e\c\ec45b5213a5ff0a45400d04f11cfe399009161dc -t -Dsrc/main/java/fr/euphyllia/skyfolia/api/skyblock/model/Position.java,1\f\1f1f267e4a0d2a95e19dfa7a24f40fb8cb8d6cfa -j -:src/main/java/fr/euphyllia/skyfolia/utils/RegionUtils.java,a\a\aa6f671c5bb4cdaa6d6c479db407041f8100cae9 -m -=src/main/java/fr/euphyllia/skyfolia/utils/WorldEditUtils.java,3\0\30a000bec3de9a67027e3894e4b98b0b6baba2a9 -v -Fsrc/main/java/fr/euphyllia/skyfolia/api/skyblock/model/IslandType.java,6\2\620aea5b3a1b1236a0b6122cc015f1caeb286fb6 -~ -Nsrc/main/java/fr/euphyllia/skyfolia/commands/subcommands/DeleteSubCommand.java,f\3\f3402fea05c7d5b15486a92d931184926a926b84 -j -:src/main/java/fr/euphyllia/skyfolia/utils/PlayerUtils.java,4\3\43f8f4b587797b15d14c9c06b089d5b9cfadc8b9 -~ -Nsrc/main/java/fr/euphyllia/skyfolia/database/query/exec/IslandUpdateQuery.java,7\5\753653a633c234dc09036ed1d8b410d04fb20aa1 -v -Fsrc/main/java/fr/euphyllia/skyfolia/api/event/SkyblockRemoveEvent.java,c\c\cc255d6a8f3edb3167cf4da7ef043cec25c36fd6 -v -Fsrc/main/java/fr/euphyllia/skyfolia/utils/models/CallbackLocation.java,5\9\590404782c69a8bd4e266034cc57d3ffc3bc30c3 - -Psrc/main/java/fr/euphyllia/skyfolia/commands/subcommands/TeleportSubCommand.java,c\c\cc3fba50ed07e3f04c2422dff0760ab20b85dfa6 -i -9src/main/java/fr/euphyllia/skyfolia/utils/WorldUtils.java,9\8\98d1c179995b3a1a2eebb18ffe10b26b61bbce42 - -Psrc/main/java/fr/euphyllia/skyfolia/commands/subcommands/SetBiomeSubCommand.java,8\3\83f650f3eed01c24078424587098878ae4b35c80 - -Osrc/main/java/fr/euphyllia/skyfolia/commands/subcommands/SetHomeSubCommand.java,4\8\48b3bc6ce1e9ee76dc099badcf88ccdd7dba68b9 +Hplugin/src/main/java/fr/euphyllia/skyfolia/commands/SkyFoliaCommand.java,3\a\3a9d3297f65b52faad6f2da2cbb91cb7262a6c75 + +Splugin/src/main/java/fr/euphyllia/skyfolia/database/query/exec/IslandDataQuery.java,2\1\2173569133315e4d10a5dee40bf76c90ff06c138 | -Lsrc/main/java/fr/euphyllia/skyfolia/database/query/exec/IslandWarpQuery.java,c\6\c6c26983936988feb55d1b82a8ad22a6abe3fec0 - -Osrc/main/java/fr/euphyllia/skyfolia/commands/subcommands/SetWarpSubCommand.java,8\d\8d00a6fa3b6e506336ab4209c2460a62b02d88a3 -~ -Nsrc/main/java/fr/euphyllia/skyfolia/database/query/exec/IslandMemberQuery.java,3\d\3d95ff3c5ddc4cb79266eca87c7f1197cf9e5f7f -~ -Nsrc/main/java/fr/euphyllia/skyfolia/commands/subcommands/DemoteSubCommand.java,5\a\5a38f36e8cbc7c8240fe2b54c9564f202c67a8d3 -v -Fsrc/main/java/fr/euphyllia/skyfolia/api/skyblock/model/WarpIsland.java,9\f\9fc60c4e7628c1e3aa3563018e13745cfb7adf70 -u -Esrc/main/java/fr/euphyllia/skyfolia/managers/skyblock/IslandHook.java,b\7\b72eda6118ee6cc8e263def8a13b3ae934b485b4 - -Osrc/main/java/fr/euphyllia/skyfolia/commands/subcommands/PrivateSubCommand.java,2\f\2fe5048ff39fb764c489e956e082188264271861 - -Psrc/main/java/fr/euphyllia/skyfolia/commands/subcommands/TransferSubCommand.java,a\b\ab4b2a552631065e64cfee8e3c04a374ba90aad4 -} -Msrc/main/java/fr/euphyllia/skyfolia/commands/subcommands/VisitSubCommand.java,5\9\5936dedab617b6140331e383423c0b00311c1db9 -~ -Nsrc/main/java/fr/euphyllia/skyfolia/commands/subcommands/InviteSubCommand.java,e\f\ef93e0bc90a9a6d49151814d5178a0415f31626f +Lplugin/src/main/java/fr/euphyllia/skyfolia/managers/skyblock/IslandHook.java,7\e\7e5d42f253643b53d5181e25173c258595c190d4 + +Qplugin/src/main/java/fr/euphyllia/skyfolia/database/query/MariaDBCreateTable.java,e\1\e1e385322bc0cc3ad8589771f5acc56b85c7db6b | -Lsrc/main/java/fr/euphyllia/skyfolia/commands/subcommands/KickSubCommand.java,a\a\aacecdafec66f2492cdd169cc0c25466076e648c -} -Msrc/main/java/fr/euphyllia/skyfolia/commands/subcommands/LeaveSubCommand.java,6\5\653269707c01720238cf03d6b7d563b4c121391d - -Rsrc/main/java/fr/euphyllia/skyfolia/commands/subcommands/PermissionSubCommand.java,a\e\ae465e707d2debdcb5d589801d157a5a32ad06e6 +Lplugin/src/main/java/fr/euphyllia/skyfolia/managers/world/WorldsManager.java,1\3\1357c8a8712aa5028f6dfdb3fd1acc38e3593964 +t +Dapi/src/main/java/fr/euphyllia/skyfolia/api/world/FeedbackWorld.java,f\5\f5498ae3b3d0667f9b6fcfeefecb2d3be218d229 +q +Aplugin/src/main/java/fr/euphyllia/skyfolia/managers/Managers.java,8\c\8cd928d82dc8ede2e36a204eaef10ea7e985a3ed +q +Aplugin/src/main/java/fr/euphyllia/skyfolia/utils/PlayerUtils.java,6\b\6ba26d47bdbbe71d188de4fb627fb21c05f6e5a9  -Osrc/main/java/fr/euphyllia/skyfolia/commands/subcommands/PromoteSubCommand.java,c\d\cdd6b717d83355faa17ba58b5a374fdbaf8a5f8d -| -Lsrc/main/java/fr/euphyllia/skyfolia/commands/subcommands/WarpSubCommand.java,6\c\6cb80dd7b5c8a71f6bf80f19d5ccb506991c109b -| -Lsrc/main/java/fr/euphyllia/skyfolia/database/query/exec/IslandDataQuery.java,6\6\66ecc8d94786db66f7fa649a0976008cb3dbeb9d - -Usrc/main/java/fr/euphyllia/skyfolia/utils/exception/MaxIslandSizeExceedException.java,2\0\20970056294008ba48d769949038b948b6a8d983 -j -:src/main/java/fr/euphyllia/skyfolia/utils/IslandUtils.java,f\1\f14540eba19259385982dad1fbfdd7e2a7614794 -s -Csrc/main/java/fr/euphyllia/skyfolia/configuration/LanguageToml.java,0\4\04646adaeb37b14fd7b17b08b90d7f5122d18cf7 -A -.github/workflows,9\3\93d7c4b8379b044a4f4d044d632200ac9ae24251 -P - .github/workflows/test-build.yml,2\3\23859ec96080198aa2547504b5e6d823beec3ac3 -x -Hsrc/main/java/fr/euphyllia/skyfolia/managers/skyblock/SkyblockCache.java,0\f\0f7206c4152e26101920cf82fdb3afef578c0903 -y -Isrc/main/java/fr/euphyllia/skyfolia/listeners/bukkitevents/JoinEvent.java,f\c\fce1b352aa9f8a46b25151de2957c542fb96af17 \ No newline at end of file +Onms/v1_20_R2/src/main/java/fr/euphyllia/skyfolia/utils/nms/v1_20_R2/Player.java,5\1\51f581ae196dfba201a3a15f6e36cbfacd1bb044 + +Qnms/v1_20_R2/src/main/java/fr/euphyllia/skyfolia/utils/nms/v1_20_R2/WorldNMS.java,0\3\0301d4f1df558a505fc2fa1d4e30121bf9852425 + +Rnms/v1_20_R2/src/main/java/fr/euphyllia/skyfolia/utils/nms/v1_20_R2/PlayerNMS.java,7\9\79e247488edfaac6d11e28f44facf64930e92581 + +Wplugin/src/main/java/fr/euphyllia/skyfolia/commands/subcommands/TeleportSubCommand.java,4\d\4da4b88624103cce66c27987970cb3ef7cc63b72 +M +nms/v1_19_R3/build.gradle.kts,b\b\bbad3bff2eb2fe1535b553598233a9d5a7480896 + +Rnms/v1_19_R3/src/main/java/fr/euphyllia/skyfolia/utils/nms/v1_19_R3/PlayerNMS.java,9\d\9d4390b7c9d7a4bb201aeb0cb342d5ea352bbdc2 + +Qnms/v1_19_R3/src/main/java/fr/euphyllia/skyfolia/utils/nms/v1_19_R3/WorldNMS.java,4\6\46459def7e6b882bc8e3b92d259be8ae50b44713 +M +nms/v1_20_R1/build.gradle.kts,3\c\3c9de4f1b765ef91a5f5918f02f87100535f4a98 + +Qnms/v1_20_R1/src/main/java/fr/euphyllia/skyfolia/utils/nms/v1_20_R1/WorldNMS.java,9\3\938e9219285f10b9cecc924c9fd83ebf4923bf14 + +Rnms/v1_20_R1/src/main/java/fr/euphyllia/skyfolia/utils/nms/v1_20_R1/PlayerNMS.java,1\9\190dc284326d7d2028192e0a6a2e52ef1280d0fc + +Rnms/v1_20_R3/src/main/java/fr/euphyllia/skyfolia/utils/nms/v1_20_R3/PlayerNMS.java,b\d\bd9bd36fc678c44497b51a0ed5add4db999abe61 + +Qnms/v1_20_R3/src/main/java/fr/euphyllia/skyfolia/utils/nms/v1_20_R3/WorldNMS.java,f\e\fe3119ffacc5b73e9f3b3cd0a7e0915308aee704 +M +nms/v1_20_R3/build.gradle.kts,6\6\66f6b89775f4196374327a4ecc99b41711e6bfca \ No newline at end of file diff --git a/api/build.gradle.kts b/api/build.gradle.kts new file mode 100644 index 0000000..5fed63a --- /dev/null +++ b/api/build.gradle.kts @@ -0,0 +1,3 @@ +dependencies { + compileOnly("dev.folia:folia-api:1.20.2-R0.1-SNAPSHOT") +} \ No newline at end of file diff --git a/src/main/java/fr/euphyllia/skyfolia/api/event/SkyblockChangeEvent.java b/api/src/main/java/fr/euphyllia/skyfolia/api/event/SkyblockChangeEvent.java similarity index 100% rename from src/main/java/fr/euphyllia/skyfolia/api/event/SkyblockChangeEvent.java rename to api/src/main/java/fr/euphyllia/skyfolia/api/event/SkyblockChangeEvent.java diff --git a/src/main/java/fr/euphyllia/skyfolia/api/event/SkyblockRemoveEvent.java b/api/src/main/java/fr/euphyllia/skyfolia/api/event/SkyblockRemoveEvent.java similarity index 100% rename from src/main/java/fr/euphyllia/skyfolia/api/event/SkyblockRemoveEvent.java rename to api/src/main/java/fr/euphyllia/skyfolia/api/event/SkyblockRemoveEvent.java diff --git a/src/main/java/fr/euphyllia/skyfolia/utils/exception/DatabaseException.java b/api/src/main/java/fr/euphyllia/skyfolia/api/exceptions/DatabaseException.java similarity index 86% rename from src/main/java/fr/euphyllia/skyfolia/utils/exception/DatabaseException.java rename to api/src/main/java/fr/euphyllia/skyfolia/api/exceptions/DatabaseException.java index c19b091..87d35a7 100644 --- a/src/main/java/fr/euphyllia/skyfolia/utils/exception/DatabaseException.java +++ b/api/src/main/java/fr/euphyllia/skyfolia/api/exceptions/DatabaseException.java @@ -1,4 +1,4 @@ -package fr.euphyllia.skyfolia.utils.exception; +package fr.euphyllia.skyfolia.api.exceptions; public class DatabaseException extends Exception { diff --git a/src/main/java/fr/euphyllia/skyfolia/utils/exception/MaxIslandSizeExceedException.java b/api/src/main/java/fr/euphyllia/skyfolia/api/exceptions/MaxIslandSizeExceedException.java similarity index 88% rename from src/main/java/fr/euphyllia/skyfolia/utils/exception/MaxIslandSizeExceedException.java rename to api/src/main/java/fr/euphyllia/skyfolia/api/exceptions/MaxIslandSizeExceedException.java index c3160c8..264c39e 100644 --- a/src/main/java/fr/euphyllia/skyfolia/utils/exception/MaxIslandSizeExceedException.java +++ b/api/src/main/java/fr/euphyllia/skyfolia/api/exceptions/MaxIslandSizeExceedException.java @@ -1,4 +1,4 @@ -package fr.euphyllia.skyfolia.utils.exception; +package fr.euphyllia.skyfolia.api.exceptions; public class MaxIslandSizeExceedException extends Exception { diff --git a/src/main/java/fr/euphyllia/skyfolia/api/skyblock/Island.java b/api/src/main/java/fr/euphyllia/skyfolia/api/skyblock/Island.java similarity index 95% rename from src/main/java/fr/euphyllia/skyfolia/api/skyblock/Island.java rename to api/src/main/java/fr/euphyllia/skyfolia/api/skyblock/Island.java index 2d821b8..60e9d34 100644 --- a/src/main/java/fr/euphyllia/skyfolia/api/skyblock/Island.java +++ b/api/src/main/java/fr/euphyllia/skyfolia/api/skyblock/Island.java @@ -1,8 +1,8 @@ package fr.euphyllia.skyfolia.api.skyblock; +import fr.euphyllia.skyfolia.api.exceptions.MaxIslandSizeExceedException; import fr.euphyllia.skyfolia.api.skyblock.model.Position; import fr.euphyllia.skyfolia.api.skyblock.model.WarpIsland; -import fr.euphyllia.skyfolia.utils.exception.MaxIslandSizeExceedException; import org.bukkit.Location; import org.jetbrains.annotations.Nullable; diff --git a/src/main/java/fr/euphyllia/skyfolia/api/skyblock/Players.java b/api/src/main/java/fr/euphyllia/skyfolia/api/skyblock/Players.java similarity index 100% rename from src/main/java/fr/euphyllia/skyfolia/api/skyblock/Players.java rename to api/src/main/java/fr/euphyllia/skyfolia/api/skyblock/Players.java diff --git a/src/main/java/fr/euphyllia/skyfolia/api/skyblock/model/IslandType.java b/api/src/main/java/fr/euphyllia/skyfolia/api/skyblock/model/IslandType.java similarity index 100% rename from src/main/java/fr/euphyllia/skyfolia/api/skyblock/model/IslandType.java rename to api/src/main/java/fr/euphyllia/skyfolia/api/skyblock/model/IslandType.java diff --git a/src/main/java/fr/euphyllia/skyfolia/api/skyblock/model/PermissionRoleIsland.java b/api/src/main/java/fr/euphyllia/skyfolia/api/skyblock/model/PermissionRoleIsland.java similarity index 100% rename from src/main/java/fr/euphyllia/skyfolia/api/skyblock/model/PermissionRoleIsland.java rename to api/src/main/java/fr/euphyllia/skyfolia/api/skyblock/model/PermissionRoleIsland.java diff --git a/src/main/java/fr/euphyllia/skyfolia/api/skyblock/model/PermissionsIsland.java b/api/src/main/java/fr/euphyllia/skyfolia/api/skyblock/model/PermissionsIsland.java similarity index 100% rename from src/main/java/fr/euphyllia/skyfolia/api/skyblock/model/PermissionsIsland.java rename to api/src/main/java/fr/euphyllia/skyfolia/api/skyblock/model/PermissionsIsland.java diff --git a/src/main/java/fr/euphyllia/skyfolia/api/skyblock/model/Position.java b/api/src/main/java/fr/euphyllia/skyfolia/api/skyblock/model/Position.java similarity index 100% rename from src/main/java/fr/euphyllia/skyfolia/api/skyblock/model/Position.java rename to api/src/main/java/fr/euphyllia/skyfolia/api/skyblock/model/Position.java diff --git a/src/main/java/fr/euphyllia/skyfolia/api/skyblock/model/RoleType.java b/api/src/main/java/fr/euphyllia/skyfolia/api/skyblock/model/RoleType.java similarity index 100% rename from src/main/java/fr/euphyllia/skyfolia/api/skyblock/model/RoleType.java rename to api/src/main/java/fr/euphyllia/skyfolia/api/skyblock/model/RoleType.java diff --git a/src/main/java/fr/euphyllia/skyfolia/api/skyblock/model/WarpIsland.java b/api/src/main/java/fr/euphyllia/skyfolia/api/skyblock/model/WarpIsland.java similarity index 100% rename from src/main/java/fr/euphyllia/skyfolia/api/skyblock/model/WarpIsland.java rename to api/src/main/java/fr/euphyllia/skyfolia/api/skyblock/model/WarpIsland.java diff --git a/api/src/main/java/fr/euphyllia/skyfolia/api/world/WorldFeedback.java b/api/src/main/java/fr/euphyllia/skyfolia/api/world/WorldFeedback.java new file mode 100644 index 0000000..3a9d44e --- /dev/null +++ b/api/src/main/java/fr/euphyllia/skyfolia/api/world/WorldFeedback.java @@ -0,0 +1,43 @@ +package fr.euphyllia.skyfolia.api.world; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.bukkit.World; + +/** + * Ce code provient d'ici : MoreFoWorld et CraftBukkit + */ +public final class WorldFeedback { + + private static final Logger logger = LogManager.getLogger(WorldFeedback.class); + + public enum Feedback { + WORLD_ALREADY_EXISTS, + WORLD_DUPLICATED, + WORLD_FOLDER_INVALID, + WORLD_DEFAULT, + SUCCESS; + + public FeedbackWorld toFeedbackWorld(World world) { + return new FeedbackWorld(world, this); + } + + public FeedbackWorld toFeedbackWorld() { + return new FeedbackWorld(this); + } + } + + public static class FeedbackWorld { + public final World world; + public final Feedback feedback; + + public FeedbackWorld(World world, Feedback feedback) { + this.world = world; + this.feedback = feedback; + } + + public FeedbackWorld(Feedback feedback) { + this(null, feedback); + } + } +} \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index 8c692ef..17b2179 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,6 +1,6 @@ plugins { + id("java-library") id("java") - id("io.papermc.paperweight.userdev") version "1.5.10" // Check for new versions at https://plugins.gradle.org/plugin/io.papermc.paperweight.userdev id("com.github.johnrengelman.shadow") version "8.1.1" } @@ -13,42 +13,38 @@ val sonatypeRepo = "https://oss.sonatype.org/content/groups/public/"; val engineHubRepo = "https://maven.enginehub.org/repo/"; val essentialsRepo = "https://repo.essentialsx.net/releases" -repositories { - mavenCentral() - maven(paperRepo) - maven(sonatypeRepo) - maven(engineHubRepo) - maven(essentialsRepo) -} dependencies { - paperweight.foliaDevBundle("1.20.2-R0.1-SNAPSHOT") // Car j'ai besoin du code de Folia - implementation("net.kyori:adventure-text-minimessage:4.14.0") - implementation("com.electronwill.night-config:toml:3.6.6") - implementation("com.google.guava:guava:33.0.0-jre") - implementation("org.apache.logging.log4j:log4j-api:2.22.0") - implementation("org.apache.logging.log4j:log4j-core:2.22.0") - implementation("org.mariadb.jdbc:mariadb-java-client:3.1.2") - implementation("com.zaxxer:HikariCP:5.0.1") - compileOnly("com.sk89q.worldedit:worldedit-bukkit:7.2.9") { isTransitive = false } - compileOnly("com.sk89q.worldedit:worldedit-core:7.2.0-SNAPSHOT") { isTransitive = false } - compileOnly("net.essentialsx:EssentialsXSpawn:2.19.7") { isTransitive = false } - compileOnly("net.essentialsx:EssentialsX:2.19.7") { isTransitive = false } + implementation (project(":nms:v1_19_R3", "reobf")) + implementation (project(":nms:v1_20_R1", "reobf")) + implementation (project(":nms:v1_20_R2", "reobf")) + implementation (project(":plugin")) testImplementation(platform("org.junit:junit-bom:5.9.2")) testImplementation("org.junit.jupiter:junit-jupiter:5.9.2") } -tasks.test { - useJUnitPlatform() -} - -tasks { - assemble { - dependsOn(reobfJar) +allprojects { + apply(plugin = "java") + apply(plugin = "java-library") + apply(plugin = "com.github.johnrengelman.shadow") + + repositories { + mavenCentral() + maven(paperRepo) + maven(sonatypeRepo) + maven(engineHubRepo) + maven(essentialsRepo) } - compileJava { - options.encoding = "UTF-8" + + tasks { + compileJava { + options.encoding = "UTF-8" + } } } +tasks.test { + useJUnitPlatform() +} + diff --git a/nms/v1_19_R3/build.gradle.kts b/nms/v1_19_R3/build.gradle.kts new file mode 100644 index 0000000..c88b41f --- /dev/null +++ b/nms/v1_19_R3/build.gradle.kts @@ -0,0 +1,17 @@ +plugins { + id("io.papermc.paperweight.userdev") version "1.5.10" // Check for new versions at https://plugins.gradle.org/plugin/io.papermc.paperweight.userdev +} + +dependencies { + paperweight.foliaDevBundle("1.19.4-R0.1-SNAPSHOT") + compileOnly(project(":api")) +} + +tasks { + assemble { + dependsOn(reobfJar) + } + compileJava { + options.encoding = "UTF-8" + } +} \ No newline at end of file diff --git a/nms/v1_19_R3/src/main/java/fr/euphyllia/skyfolia/utils/nms/v1_19_R3/PlayerNMS.java b/nms/v1_19_R3/src/main/java/fr/euphyllia/skyfolia/utils/nms/v1_19_R3/PlayerNMS.java new file mode 100644 index 0000000..6f3d11e --- /dev/null +++ b/nms/v1_19_R3/src/main/java/fr/euphyllia/skyfolia/utils/nms/v1_19_R3/PlayerNMS.java @@ -0,0 +1,46 @@ +package fr.euphyllia.skyfolia.utils.nms.v1_19_R3; + +import org.bukkit.Location; +import org.bukkit.entity.Player; +import org.bukkit.plugin.java.JavaPlugin; +import org.jetbrains.annotations.NotNull; + +public class PlayerNMS { + + public static void refreshPlayerChunk(Player player, int chunkX, int chunkZ) { + org.bukkit.craftbukkit.v1_19_R3.entity.CraftPlayer craftPlayer = ((org.bukkit.craftbukkit.v1_19_R3.entity.CraftPlayer) player); + final net.minecraft.world.level.chunk.LevelChunk levelChunk = craftPlayer.getHandle().level.getChunk(chunkX, chunkZ); + final net.minecraft.network.protocol.game.ClientboundLevelChunkWithLightPacket refresh = new net.minecraft.network.protocol.game.ClientboundLevelChunkWithLightPacket(levelChunk, levelChunk.getLevel().getLightEngine(), null, null, true); + craftPlayer.getHandle().connection.send(refresh); + } + + /** + * Create a personal border just for the player. + * + * @param player Player + * @param centerBorder The center of the border + * @param colorBorder Border color: Blue/Red/Green + * @param borderSize Border size + * @param warningBlocks Sets the warning distance that causes the screen to be tinted red when the player is within the specified number of blocks from the border. + * @param warningTime Sets the warning time that causes the screen to be tinted red when a contracting border will reach the player within the specified time. + */ + public static void setOwnWorldBorder(JavaPlugin main, Player player, @NotNull Location centerBorder, @NotNull String colorBorder, double borderSize, int warningBlocks, int warningTime) { + player.getScheduler().run(main, scheduledTask -> { + final net.minecraft.world.level.border.WorldBorder worldBorderPlayer = new net.minecraft.world.level.border.WorldBorder(); + worldBorderPlayer.world = ((org.bukkit.craftbukkit.v1_19_R3.CraftWorld) centerBorder.getWorld()).getHandle(); + worldBorderPlayer.setCenter(centerBorder.getBlockX(), centerBorder.getBlockZ()); + worldBorderPlayer.setSize(borderSize); + worldBorderPlayer.setWarningBlocks(warningBlocks); + worldBorderPlayer.setWarningTime(warningTime); + switch (colorBorder) { + case "RED" -> worldBorderPlayer.lerpSizeBetween(borderSize, borderSize - 1.0, 20000000L); + case "GREEN" -> worldBorderPlayer.lerpSizeBetween(borderSize - 0.1, borderSize, 20000000L); + } + final net.minecraft.network.protocol.game.ClientboundInitializeBorderPacket updateWorldBorderPacket = new net.minecraft.network.protocol.game.ClientboundInitializeBorderPacket(worldBorderPlayer); + org.bukkit.craftbukkit.v1_19_R3.entity.CraftPlayer craftPlayer = ((org.bukkit.craftbukkit.v1_19_R3.entity.CraftPlayer) player); + craftPlayer.getHandle().connection.send(updateWorldBorderPacket); + }, null); + } + + +} diff --git a/nms/v1_19_R3/src/main/java/fr/euphyllia/skyfolia/utils/nms/v1_19_R3/WorldNMS.java b/nms/v1_19_R3/src/main/java/fr/euphyllia/skyfolia/utils/nms/v1_19_R3/WorldNMS.java new file mode 100644 index 0000000..3f43560 --- /dev/null +++ b/nms/v1_19_R3/src/main/java/fr/euphyllia/skyfolia/utils/nms/v1_19_R3/WorldNMS.java @@ -0,0 +1,182 @@ +package fr.euphyllia.skyfolia.utils.nms.v1_19_R3; + +import com.google.common.collect.ImmutableList; +import com.mojang.datafixers.util.Pair; +import com.mojang.serialization.DynamicOps; +import com.mojang.serialization.Lifecycle; +import fr.euphyllia.skyfolia.api.world.WorldFeedback; +import net.minecraft.core.registries.Registries; +import net.minecraft.nbt.NbtOps; +import net.minecraft.nbt.Tag; +import net.minecraft.resources.RegistryOps; +import net.minecraft.resources.ResourceKey; +import net.minecraft.server.WorldLoader; +import net.minecraft.server.dedicated.DedicatedServer; +import net.minecraft.server.dedicated.DedicatedServerProperties; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.util.GsonHelper; +import net.minecraft.util.datafix.DataFixers; +import net.minecraft.world.Difficulty; +import net.minecraft.world.entity.ai.village.VillageSiege; +import net.minecraft.world.entity.npc.CatSpawner; +import net.minecraft.world.entity.npc.WanderingTraderSpawner; +import net.minecraft.world.level.*; +import net.minecraft.world.level.biome.BiomeManager; +import net.minecraft.world.level.dimension.LevelStem; +import net.minecraft.world.level.levelgen.PatrolSpawner; +import net.minecraft.world.level.levelgen.PhantomSpawner; +import net.minecraft.world.level.levelgen.WorldDimensions; +import net.minecraft.world.level.levelgen.WorldOptions; +import net.minecraft.world.level.storage.LevelStorageSource; +import net.minecraft.world.level.storage.PrimaryLevelData; +import net.minecraft.world.level.storage.WorldData; +import org.bukkit.Bukkit; +import org.bukkit.GameMode; +import org.bukkit.World; +import org.bukkit.WorldCreator; +import org.bukkit.craftbukkit.v1_19_R3.CraftServer; +import org.bukkit.craftbukkit.v1_19_R3.CraftWorld; +import org.bukkit.craftbukkit.v1_19_R3.generator.CraftWorldInfo; +import org.bukkit.event.world.WorldLoadEvent; +import org.bukkit.generator.BiomeProvider; +import org.bukkit.generator.ChunkGenerator; +import org.bukkit.generator.WorldInfo; + +import java.io.File; +import java.io.IOException; +import java.util.List; +import java.util.Locale; + + +public class WorldNMS { + + public static WorldFeedback.FeedbackWorld createWorld(WorldCreator creator) { + CraftServer craftServer = (CraftServer) Bukkit.getServer(); + DedicatedServer console = craftServer.getServer(); + + String name = creator.name(); + + String levelName = console.getProperties().levelName; + if (name.equals(levelName) + || (console.isNetherEnabled() && name.equals(levelName + "_nether")) + || (craftServer.getAllowEnd() && name.equals(levelName + "_the_end")) + ) { + return WorldFeedback.Feedback.WORLD_DEFAULT.toFeedbackWorld(); + } + + ChunkGenerator generator = creator.generator(); + BiomeProvider biomeProvider = creator.biomeProvider(); + File folder = new File(craftServer.getWorldContainer(), name); + org.bukkit.World world = craftServer.getWorld(name); + + CraftWorld worldByKey = (CraftWorld) craftServer.getWorld(creator.key()); + if (world != null || worldByKey != null) { + if (world != worldByKey) { + return WorldFeedback.Feedback.WORLD_DUPLICATED.toFeedbackWorld(); + } + } + + if ((folder.exists()) && (!folder.isDirectory())) { + return WorldFeedback.Feedback.WORLD_FOLDER_INVALID.toFeedbackWorld(); + } + + if (generator == null) { + generator = craftServer.getGenerator(name); + } + + if (biomeProvider == null) { + biomeProvider = craftServer.getBiomeProvider(name); + } + + ResourceKey actualDimension = switch (creator.environment()) { + case NORMAL -> LevelStem.OVERWORLD; + case NETHER -> LevelStem.NETHER; + case THE_END -> LevelStem.END; + default -> throw new IllegalArgumentException("Illegal dimension"); + }; + + LevelStorageSource.LevelStorageAccess worldSession; + try { + worldSession = LevelStorageSource.createDefault(craftServer.getWorldContainer().toPath()).createAccess(name, actualDimension); + } catch (IOException ex) { + throw new RuntimeException(ex); + } + + boolean hardcore = creator.hardcore(); + + PrimaryLevelData worlddata; + WorldLoader.DataLoadContext worldloader_a = console.worldLoader; + net.minecraft.core.Registry iregistry = worldloader_a.datapackDimensions().registryOrThrow(Registries.LEVEL_STEM); + DynamicOps dynamicops = RegistryOps.create(NbtOps.INSTANCE, worldloader_a.datapackWorldgen()); + Pair pair = worldSession.getDataTag(dynamicops, worldloader_a.dataConfiguration(), iregistry, worldloader_a.datapackWorldgen().allRegistriesLifecycle()); + + + if (pair != null) { + worlddata = (PrimaryLevelData) pair.getFirst(); + iregistry = pair.getSecond().dimensions(); + } else { + LevelSettings worldsettings; + WorldOptions worldoptions = new WorldOptions(creator.seed(), creator.generateStructures(), false); + WorldDimensions worlddimensions; + + DedicatedServerProperties.WorldDimensionData properties = new DedicatedServerProperties.WorldDimensionData(GsonHelper.parse((creator.generatorSettings().isEmpty()) ? "{}" : creator.generatorSettings()), creator.type().name().toLowerCase(Locale.ROOT)); + + worldsettings = new LevelSettings(name, getGameType(GameMode.SURVIVAL), hardcore, Difficulty.EASY, false, new GameRules(), worldloader_a.dataConfiguration()); + worlddimensions = properties.create(worldloader_a.datapackWorldgen()); + + WorldDimensions.Complete worlddimensions_b = worlddimensions.bake(iregistry); + Lifecycle lifecycle = worlddimensions_b.lifecycle().add(worldloader_a.datapackWorldgen().allRegistriesLifecycle()); + + worlddata = new PrimaryLevelData(worldsettings, worldoptions, worlddimensions_b.specialWorldProperty(), lifecycle); + iregistry = worlddimensions_b.dimensions(); + } + worlddata.customDimensions = iregistry; + worlddata.checkName(name); + worlddata.setModdedInfo(console.getServerModName(), console.getModdedStatus().shouldReportAsModified()); + + long j = BiomeManager.obfuscateSeed(creator.seed()); + List list = ImmutableList.of(new PhantomSpawner(), new PatrolSpawner(), new CatSpawner(), new VillageSiege(), new WanderingTraderSpawner(worlddata)); + LevelStem worlddimension = iregistry.get(actualDimension); + + WorldInfo worldInfo = new CraftWorldInfo(worlddata, worldSession, creator.environment(), worlddimension.type().value(), worlddimension.generator(), craftServer.getHandle().getServer().registryAccess()); // Paper + if (biomeProvider == null && generator != null) { + biomeProvider = generator.getDefaultBiomeProvider(worldInfo); + } + + if (console.options.has("forceUpgrade")) { + net.minecraft.server.Main.convertWorldButItWorks( + actualDimension, worldSession, DataFixers.getDataFixer(), worlddimension.generator().getTypeNameForDataFixer(), console.options.has("eraseCache") + ); + } + + ResourceKey worldKey; + worldKey = ResourceKey.create(Registries.DIMENSION, new net.minecraft.resources.ResourceLocation(creator.key().getNamespace().toLowerCase(java.util.Locale.ENGLISH), creator.key().getKey().toLowerCase(java.util.Locale.ENGLISH))); // Paper + + ServerLevel internal = new ServerLevel(console, console.executor, worldSession, worlddata, worldKey, worlddimension, craftServer.getServer().progressListenerFactory.create(11), + worlddata.isDebugWorld(), j, creator.environment() == World.Environment.NORMAL ? list : ImmutableList.of(), true, creator.environment(), generator, biomeProvider); + + if (internal.randomSpawnSelection == null) { + internal.randomSpawnSelection = new ChunkPos(internal.getChunkSource().randomState().sampler().findSpawnPosition()); + } + + console.addLevel(internal); + + internal.setSpawnSettings(true, true); + + internal.keepSpawnInMemory = creator.keepSpawnLoaded().toBooleanOrElse(internal.getWorld().getKeepSpawnInMemory()); // Paper + + io.papermc.paper.threadedregions.RegionizedServer.getInstance().addWorld(internal); + + Bukkit.getPluginManager().callEvent(new WorldLoadEvent(internal.getWorld())); + return WorldFeedback.Feedback.SUCCESS.toFeedbackWorld(internal.getWorld()); + } + + static GameType getGameType(GameMode gameMode) { + return switch (gameMode) { + case SURVIVAL -> GameType.SURVIVAL; + case CREATIVE -> GameType.CREATIVE; + case ADVENTURE -> GameType.ADVENTURE; + case SPECTATOR -> GameType.SPECTATOR; + }; + } +} diff --git a/nms/v1_20_R1/build.gradle.kts b/nms/v1_20_R1/build.gradle.kts new file mode 100644 index 0000000..d8efaa7 --- /dev/null +++ b/nms/v1_20_R1/build.gradle.kts @@ -0,0 +1,17 @@ +plugins { + id("io.papermc.paperweight.userdev") version "1.5.10" // Check for new versions at https://plugins.gradle.org/plugin/io.papermc.paperweight.userdev +} + +dependencies { + paperweight.foliaDevBundle("1.20.1-R0.1-SNAPSHOT") + compileOnly(project(":api")) +} + +tasks { + assemble { + dependsOn(reobfJar) + } + compileJava { + options.encoding = "UTF-8" + } +} \ No newline at end of file diff --git a/nms/v1_20_R1/src/main/java/fr/euphyllia/skyfolia/utils/nms/v1_20_R1/PlayerNMS.java b/nms/v1_20_R1/src/main/java/fr/euphyllia/skyfolia/utils/nms/v1_20_R1/PlayerNMS.java new file mode 100644 index 0000000..938a93a --- /dev/null +++ b/nms/v1_20_R1/src/main/java/fr/euphyllia/skyfolia/utils/nms/v1_20_R1/PlayerNMS.java @@ -0,0 +1,46 @@ +package fr.euphyllia.skyfolia.utils.nms.v1_20_R1; + +import org.bukkit.Location; +import org.bukkit.entity.Player; +import org.bukkit.plugin.java.JavaPlugin; +import org.jetbrains.annotations.NotNull; + +public class PlayerNMS { + + public static void refreshPlayerChunk(Player player, int chunkX, int chunkZ) { + org.bukkit.craftbukkit.v1_20_R1.entity.CraftPlayer craftPlayer = ((org.bukkit.craftbukkit.v1_20_R1.entity.CraftPlayer) player); + final net.minecraft.world.level.chunk.LevelChunk levelChunk = craftPlayer.getHandle().level().getChunk(chunkX, chunkZ); + final net.minecraft.network.protocol.game.ClientboundLevelChunkWithLightPacket refresh = new net.minecraft.network.protocol.game.ClientboundLevelChunkWithLightPacket(levelChunk, levelChunk.getLevel().getLightEngine(), null, null, true); + craftPlayer.getHandle().connection.send(refresh); + } + + /** + * Create a personal border just for the player. + * + * @param player Player + * @param centerBorder The center of the border + * @param colorBorder Border color: Blue/Red/Green + * @param borderSize Border size + * @param warningBlocks Sets the warning distance that causes the screen to be tinted red when the player is within the specified number of blocks from the border. + * @param warningTime Sets the warning time that causes the screen to be tinted red when a contracting border will reach the player within the specified time. + */ + public static void setOwnWorldBorder(JavaPlugin main, Player player, @NotNull Location centerBorder, @NotNull String colorBorder, double borderSize, int warningBlocks, int warningTime) { + player.getScheduler().run(main, scheduledTask -> { + final net.minecraft.world.level.border.WorldBorder worldBorderPlayer = new net.minecraft.world.level.border.WorldBorder(); + worldBorderPlayer.world = ((org.bukkit.craftbukkit.v1_20_R1.CraftWorld) centerBorder.getWorld()).getHandle(); + worldBorderPlayer.setCenter(centerBorder.getBlockX(), centerBorder.getBlockZ()); + worldBorderPlayer.setSize(borderSize); + worldBorderPlayer.setWarningBlocks(warningBlocks); + worldBorderPlayer.setWarningTime(warningTime); + switch (colorBorder) { + case "RED" -> worldBorderPlayer.lerpSizeBetween(borderSize, borderSize - 1.0, 20000000L); + case "GREEN" -> worldBorderPlayer.lerpSizeBetween(borderSize - 0.1, borderSize, 20000000L); + } + final net.minecraft.network.protocol.game.ClientboundInitializeBorderPacket updateWorldBorderPacket = new net.minecraft.network.protocol.game.ClientboundInitializeBorderPacket(worldBorderPlayer); + org.bukkit.craftbukkit.v1_20_R1.entity.CraftPlayer craftPlayer = ((org.bukkit.craftbukkit.v1_20_R1.entity.CraftPlayer) player); + craftPlayer.getHandle().connection.send(updateWorldBorderPacket); + }, null); + } + + +} diff --git a/nms/v1_20_R1/src/main/java/fr/euphyllia/skyfolia/utils/nms/v1_20_R1/WorldNMS.java b/nms/v1_20_R1/src/main/java/fr/euphyllia/skyfolia/utils/nms/v1_20_R1/WorldNMS.java new file mode 100644 index 0000000..936fd5b --- /dev/null +++ b/nms/v1_20_R1/src/main/java/fr/euphyllia/skyfolia/utils/nms/v1_20_R1/WorldNMS.java @@ -0,0 +1,181 @@ +package fr.euphyllia.skyfolia.utils.nms.v1_20_R1; + +import com.google.common.collect.ImmutableList; +import com.mojang.datafixers.util.Pair; +import com.mojang.serialization.DynamicOps; +import com.mojang.serialization.Lifecycle; +import fr.euphyllia.skyfolia.api.world.WorldFeedback; +import net.minecraft.core.registries.Registries; +import net.minecraft.nbt.NbtOps; +import net.minecraft.nbt.Tag; +import net.minecraft.resources.RegistryOps; +import net.minecraft.resources.ResourceKey; +import net.minecraft.server.WorldLoader; +import net.minecraft.server.dedicated.DedicatedServer; +import net.minecraft.server.dedicated.DedicatedServerProperties; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.util.GsonHelper; +import net.minecraft.util.datafix.DataFixers; +import net.minecraft.world.Difficulty; +import net.minecraft.world.entity.ai.village.VillageSiege; +import net.minecraft.world.entity.npc.CatSpawner; +import net.minecraft.world.entity.npc.WanderingTraderSpawner; +import net.minecraft.world.level.*; +import net.minecraft.world.level.biome.BiomeManager; +import net.minecraft.world.level.dimension.LevelStem; +import net.minecraft.world.level.levelgen.PatrolSpawner; +import net.minecraft.world.level.levelgen.PhantomSpawner; +import net.minecraft.world.level.levelgen.WorldDimensions; +import net.minecraft.world.level.levelgen.WorldOptions; +import net.minecraft.world.level.storage.LevelStorageSource; +import net.minecraft.world.level.storage.PrimaryLevelData; +import net.minecraft.world.level.storage.WorldData; +import org.bukkit.Bukkit; +import org.bukkit.GameMode; +import org.bukkit.WorldCreator; +import org.bukkit.craftbukkit.v1_20_R1.CraftServer; +import org.bukkit.craftbukkit.v1_20_R1.CraftWorld; +import org.bukkit.craftbukkit.v1_20_R1.generator.CraftWorldInfo; +import org.bukkit.event.world.WorldLoadEvent; +import org.bukkit.generator.BiomeProvider; +import org.bukkit.generator.ChunkGenerator; +import org.bukkit.generator.WorldInfo; + +import java.io.File; +import java.io.IOException; +import java.util.List; +import java.util.Locale; + + +public class WorldNMS { + + public static WorldFeedback.FeedbackWorld createWorld(WorldCreator creator) { + CraftServer craftServer = (CraftServer) Bukkit.getServer(); + DedicatedServer console = craftServer.getServer(); + + String name = creator.name(); + + String levelName = console.getProperties().levelName; + if (name.equals(levelName) + || (console.isNetherEnabled() && name.equals(levelName + "_nether")) + || (craftServer.getAllowEnd() && name.equals(levelName + "_the_end")) + ) { + return WorldFeedback.Feedback.WORLD_DEFAULT.toFeedbackWorld(); + } + + ChunkGenerator generator = creator.generator(); + BiomeProvider biomeProvider = creator.biomeProvider(); + File folder = new File(craftServer.getWorldContainer(), name); + org.bukkit.World world = craftServer.getWorld(name); + + CraftWorld worldByKey = (CraftWorld) craftServer.getWorld(creator.key()); + if (world != null || worldByKey != null) { + if (world != worldByKey) { + return WorldFeedback.Feedback.WORLD_DUPLICATED.toFeedbackWorld(); + } + } + + if ((folder.exists()) && (!folder.isDirectory())) { + return WorldFeedback.Feedback.WORLD_FOLDER_INVALID.toFeedbackWorld(); + } + + if (generator == null) { + generator = craftServer.getGenerator(name); + } + + if (biomeProvider == null) { + biomeProvider = craftServer.getBiomeProvider(name); + } + + ResourceKey actualDimension = switch (creator.environment()) { + case NORMAL -> LevelStem.OVERWORLD; + case NETHER -> LevelStem.NETHER; + case THE_END -> LevelStem.END; + default -> throw new IllegalArgumentException("Illegal dimension"); + }; + + LevelStorageSource.LevelStorageAccess worldSession; + try { + worldSession = LevelStorageSource.createDefault(craftServer.getWorldContainer().toPath()).createAccess(name, actualDimension); + } catch (IOException ex) { + throw new RuntimeException(ex); + } + + boolean hardcore = creator.hardcore(); + + PrimaryLevelData worlddata; + WorldLoader.DataLoadContext worldloader_a = console.worldLoader; + net.minecraft.core.Registry iregistry = worldloader_a.datapackDimensions().registryOrThrow(Registries.LEVEL_STEM); + DynamicOps dynamicops = RegistryOps.create(NbtOps.INSTANCE, worldloader_a.datapackWorldgen()); + Pair pair = worldSession.getDataTag(dynamicops, worldloader_a.dataConfiguration(), iregistry, worldloader_a.datapackWorldgen().allRegistriesLifecycle()); + + + if (pair != null) { + worlddata = (PrimaryLevelData) pair.getFirst(); + iregistry = pair.getSecond().dimensions(); + } else { + LevelSettings worldsettings; + WorldOptions worldoptions = new WorldOptions(creator.seed(), creator.generateStructures(), false); + WorldDimensions worlddimensions; + + DedicatedServerProperties.WorldDimensionData properties = new DedicatedServerProperties.WorldDimensionData(GsonHelper.parse((creator.generatorSettings().isEmpty()) ? "{}" : creator.generatorSettings()), creator.type().name().toLowerCase(Locale.ROOT)); + + worldsettings = new LevelSettings(name, getGameType(GameMode.SURVIVAL), hardcore, Difficulty.EASY, false, new GameRules(), worldloader_a.dataConfiguration()); + worlddimensions = properties.create(worldloader_a.datapackWorldgen()); + + WorldDimensions.Complete worlddimensions_b = worlddimensions.bake(iregistry); + Lifecycle lifecycle = worlddimensions_b.lifecycle().add(worldloader_a.datapackWorldgen().allRegistriesLifecycle()); + + worlddata = new PrimaryLevelData(worldsettings, worldoptions, worlddimensions_b.specialWorldProperty(), lifecycle); + iregistry = worlddimensions_b.dimensions(); + } + worlddata.customDimensions = iregistry; + worlddata.checkName(name); + worlddata.setModdedInfo(console.getServerModName(), console.getModdedStatus().shouldReportAsModified()); + + long j = BiomeManager.obfuscateSeed(creator.seed()); + List list = ImmutableList.of(new PhantomSpawner(), new PatrolSpawner(), new CatSpawner(), new VillageSiege(), new WanderingTraderSpawner(worlddata)); + LevelStem worlddimension = iregistry.get(actualDimension); + + WorldInfo worldInfo = new CraftWorldInfo(worlddata, worldSession, creator.environment(), worlddimension.type().value(), worlddimension.generator(), craftServer.getHandle().getServer().registryAccess()); // Paper + if (biomeProvider == null && generator != null) { + biomeProvider = generator.getDefaultBiomeProvider(worldInfo); + } + + if (console.options.has("forceUpgrade")) { + net.minecraft.server.Main.convertWorldButItWorks( + actualDimension, worldSession, DataFixers.getDataFixer(), worlddimension.generator().getTypeNameForDataFixer(), console.options.has("eraseCache") + ); + } + + ResourceKey worldKey; + worldKey = ResourceKey.create(Registries.DIMENSION, new net.minecraft.resources.ResourceLocation(creator.key().getNamespace().toLowerCase(java.util.Locale.ENGLISH), creator.key().getKey().toLowerCase(java.util.Locale.ENGLISH))); // Paper + + ServerLevel internal = new ServerLevel(console, console.executor, worldSession, worlddata, worldKey, worlddimension, console.progressListenerFactory.create(11), + worlddata.isDebugWorld(), j, creator.environment() == org.bukkit.World.Environment.NORMAL ? list : ImmutableList.of(), true, null, creator.environment(), generator, biomeProvider); + + if (internal.randomSpawnSelection == null) { + internal.randomSpawnSelection = new ChunkPos(internal.getChunkSource().randomState().sampler().findSpawnPosition()); + } + + console.addLevel(internal); + + internal.setSpawnSettings(true, true); + + internal.keepSpawnInMemory = creator.keepSpawnLoaded().toBooleanOrElse(internal.getWorld().getKeepSpawnInMemory()); // Paper + + io.papermc.paper.threadedregions.RegionizedServer.getInstance().addWorld(internal); + + Bukkit.getPluginManager().callEvent(new WorldLoadEvent(internal.getWorld())); + return WorldFeedback.Feedback.SUCCESS.toFeedbackWorld(internal.getWorld()); + } + + static GameType getGameType(GameMode gameMode) { + return switch (gameMode) { + case SURVIVAL -> GameType.SURVIVAL; + case CREATIVE -> GameType.CREATIVE; + case ADVENTURE -> GameType.ADVENTURE; + case SPECTATOR -> GameType.SPECTATOR; + }; + } +} diff --git a/nms/v1_20_R2/build.gradle.kts b/nms/v1_20_R2/build.gradle.kts new file mode 100644 index 0000000..b725516 --- /dev/null +++ b/nms/v1_20_R2/build.gradle.kts @@ -0,0 +1,17 @@ +plugins { + id("io.papermc.paperweight.userdev") version "1.5.10" // Check for new versions at https://plugins.gradle.org/plugin/io.papermc.paperweight.userdev +} + +dependencies { + paperweight.foliaDevBundle("1.20.2-R0.1-SNAPSHOT") + compileOnly(project(":api")) +} + +tasks { + assemble { + dependsOn(reobfJar) + } + compileJava { + options.encoding = "UTF-8" + } +} \ No newline at end of file diff --git a/src/main/java/fr/euphyllia/skyfolia/utils/PlayerUtils.java b/nms/v1_20_R2/src/main/java/fr/euphyllia/skyfolia/utils/nms/v1_20_R2/PlayerNMS.java similarity index 63% rename from src/main/java/fr/euphyllia/skyfolia/utils/PlayerUtils.java rename to nms/v1_20_R2/src/main/java/fr/euphyllia/skyfolia/utils/nms/v1_20_R2/PlayerNMS.java index f4f7960..7009ffa 100644 --- a/src/main/java/fr/euphyllia/skyfolia/utils/PlayerUtils.java +++ b/nms/v1_20_R2/src/main/java/fr/euphyllia/skyfolia/utils/nms/v1_20_R2/PlayerNMS.java @@ -1,33 +1,11 @@ -package fr.euphyllia.skyfolia.utils; +package fr.euphyllia.skyfolia.utils.nms.v1_20_R2; -import com.earth2me.essentials.Essentials; -import com.earth2me.essentials.spawn.EssentialsSpawn; -import fr.euphyllia.skyfolia.Main; -import org.bukkit.Bukkit; import org.bukkit.Location; -import org.bukkit.World; import org.bukkit.entity.Player; -import org.bukkit.event.player.PlayerTeleportEvent; +import org.bukkit.plugin.java.JavaPlugin; import org.jetbrains.annotations.NotNull; -public class PlayerUtils { - - public static void teleportPlayerSpawn(Main main, Player player) { - player.getScheduler().run(main, scheduledTask -> { - World world = Bukkit.getWorlds().get(0); - try { - EssentialsSpawn essentialsSpawn = (EssentialsSpawn) Bukkit.getPluginManager().getPlugin("EssentialsSpawn"); - Essentials essentials = (Essentials) Bukkit.getPluginManager().getPlugin("Essentials"); - if (essentialsSpawn != null && essentialsSpawn.isEnabled() && essentials != null && essentials.isEnabled()) { - player.teleportAsync(essentialsSpawn.getSpawn(essentials.getUser(player.getUniqueId()).getGroup()), PlayerTeleportEvent.TeleportCause.PLUGIN); - } else { - player.teleportAsync(world.getSpawnLocation(), PlayerTeleportEvent.TeleportCause.PLUGIN); - } - } catch (Exception e) { - player.teleportAsync(world.getSpawnLocation(), PlayerTeleportEvent.TeleportCause.PLUGIN); - } - }, null); - } +public class PlayerNMS { public static void refreshPlayerChunk(Player player, int chunkX, int chunkZ) { org.bukkit.craftbukkit.v1_20_R2.entity.CraftPlayer craftPlayer = ((org.bukkit.craftbukkit.v1_20_R2.entity.CraftPlayer) player); @@ -36,7 +14,6 @@ public static void refreshPlayerChunk(Player player, int chunkX, int chunkZ) { craftPlayer.getHandle().connection.send(refresh); } - /** * Create a personal border just for the player. * @@ -47,7 +24,7 @@ public static void refreshPlayerChunk(Player player, int chunkX, int chunkZ) { * @param warningBlocks Sets the warning distance that causes the screen to be tinted red when the player is within the specified number of blocks from the border. * @param warningTime Sets the warning time that causes the screen to be tinted red when a contracting border will reach the player within the specified time. */ - public static void setOwnWorldBorder(Main main, Player player, @NotNull Location centerBorder, @NotNull String colorBorder, double borderSize, int warningBlocks, int warningTime) { + public static void setOwnWorldBorder(JavaPlugin main, Player player, @NotNull Location centerBorder, @NotNull String colorBorder, double borderSize, int warningBlocks, int warningTime) { player.getScheduler().run(main, scheduledTask -> { final net.minecraft.world.level.border.WorldBorder worldBorderPlayer = new net.minecraft.world.level.border.WorldBorder(); worldBorderPlayer.world = ((org.bukkit.craftbukkit.v1_20_R2.CraftWorld) centerBorder.getWorld()).getHandle(); @@ -64,4 +41,6 @@ public static void setOwnWorldBorder(Main main, Player player, @NotNull Location craftPlayer.getHandle().connection.send(updateWorldBorderPacket); }, null); } + + } diff --git a/src/main/java/fr/euphyllia/skyfolia/utils/WorldUtils.java b/nms/v1_20_R2/src/main/java/fr/euphyllia/skyfolia/utils/nms/v1_20_R2/WorldNMS.java similarity index 82% rename from src/main/java/fr/euphyllia/skyfolia/utils/WorldUtils.java rename to nms/v1_20_R2/src/main/java/fr/euphyllia/skyfolia/utils/nms/v1_20_R2/WorldNMS.java index 8f2c067..9f66774 100644 --- a/src/main/java/fr/euphyllia/skyfolia/utils/WorldUtils.java +++ b/nms/v1_20_R2/src/main/java/fr/euphyllia/skyfolia/utils/nms/v1_20_R2/WorldNMS.java @@ -1,9 +1,10 @@ -package fr.euphyllia.skyfolia.utils; +package fr.euphyllia.skyfolia.utils.nms.v1_20_R2; import com.google.common.collect.ImmutableList; import com.mojang.datafixers.util.Pair; import com.mojang.serialization.DynamicOps; import com.mojang.serialization.Lifecycle; +import fr.euphyllia.skyfolia.api.world.WorldFeedback; import net.minecraft.core.registries.Registries; import net.minecraft.nbt.NbtOps; import net.minecraft.nbt.Tag; @@ -29,11 +30,8 @@ import net.minecraft.world.level.storage.LevelStorageSource; import net.minecraft.world.level.storage.PrimaryLevelData; import net.minecraft.world.level.storage.WorldData; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; import org.bukkit.Bukkit; import org.bukkit.GameMode; -import org.bukkit.World; import org.bukkit.WorldCreator; import org.bukkit.craftbukkit.v1_20_R2.CraftServer; import org.bukkit.craftbukkit.v1_20_R2.CraftWorld; @@ -48,14 +46,10 @@ import java.util.List; import java.util.Locale; -/** - * Ce code provient d'ici : MoreFoWorld et CraftBukkit - */ -public final class WorldUtils { - private static final Logger logger = LogManager.getLogger(WorldUtils.class); +public class WorldNMS { - public static FeedbackWorld addWorld(WorldCreator creator) { + public static WorldFeedback.FeedbackWorld createWorld(WorldCreator creator) { CraftServer craftServer = (CraftServer) Bukkit.getServer(); DedicatedServer console = craftServer.getServer(); @@ -66,23 +60,23 @@ public static FeedbackWorld addWorld(WorldCreator creator) { || (console.isNetherEnabled() && name.equals(levelName + "_nether")) || (craftServer.getAllowEnd() && name.equals(levelName + "_the_end")) ) { - return Feedback.WORLD_DEFAULT.toFeedbackWorld(); + return WorldFeedback.Feedback.WORLD_DEFAULT.toFeedbackWorld(); } ChunkGenerator generator = creator.generator(); BiomeProvider biomeProvider = creator.biomeProvider(); File folder = new File(craftServer.getWorldContainer(), name); - World world = craftServer.getWorld(name); + org.bukkit.World world = craftServer.getWorld(name); CraftWorld worldByKey = (CraftWorld) craftServer.getWorld(creator.key()); if (world != null || worldByKey != null) { if (world != worldByKey) { - return Feedback.WORLD_DUPLICATED.toFeedbackWorld(); + return WorldFeedback.Feedback.WORLD_DUPLICATED.toFeedbackWorld(); } } if ((folder.exists()) && (!folder.isDirectory())) { - return Feedback.WORLD_FOLDER_INVALID.toFeedbackWorld(); + return WorldFeedback.Feedback.WORLD_FOLDER_INVALID.toFeedbackWorld(); } if (generator == null) { @@ -158,7 +152,7 @@ public static FeedbackWorld addWorld(WorldCreator creator) { worldKey = ResourceKey.create(Registries.DIMENSION, new net.minecraft.resources.ResourceLocation(creator.key().getNamespace().toLowerCase(java.util.Locale.ENGLISH), creator.key().getKey().toLowerCase(java.util.Locale.ENGLISH))); // Paper ServerLevel internal = new ServerLevel(console, console.executor, worldSession, worlddata, worldKey, worlddimension, console.progressListenerFactory.create(11), - worlddata.isDebugWorld(), j, creator.environment() == World.Environment.NORMAL ? list : ImmutableList.of(), true, null, creator.environment(), generator, biomeProvider); + worlddata.isDebugWorld(), j, creator.environment() == org.bukkit.World.Environment.NORMAL ? list : ImmutableList.of(), true, null, creator.environment(), generator, biomeProvider); if (internal.randomSpawnSelection == null) { internal.randomSpawnSelection = new ChunkPos(internal.getChunkSource().randomState().sampler().findSpawnPosition()); @@ -173,10 +167,10 @@ public static FeedbackWorld addWorld(WorldCreator creator) { io.papermc.paper.threadedregions.RegionizedServer.getInstance().addWorld(internal); Bukkit.getPluginManager().callEvent(new WorldLoadEvent(internal.getWorld())); - return Feedback.SUCCESS.toFeedbackWorld(internal.getWorld()); + return WorldFeedback.Feedback.SUCCESS.toFeedbackWorld(internal.getWorld()); } - public static GameType getGameType(GameMode gameMode) { + static GameType getGameType(GameMode gameMode) { return switch (gameMode) { case SURVIVAL -> GameType.SURVIVAL; case CREATIVE -> GameType.CREATIVE; @@ -184,34 +178,4 @@ public static GameType getGameType(GameMode gameMode) { case SPECTATOR -> GameType.SPECTATOR; }; } - - public enum Feedback { - WORLD_ALREADY_EXISTS, - WORLD_DUPLICATED, - WORLD_FOLDER_INVALID, - WORLD_DEFAULT, - SUCCESS; - - public FeedbackWorld toFeedbackWorld(CraftWorld world) { - return new FeedbackWorld(world, this); - } - - public FeedbackWorld toFeedbackWorld() { - return new FeedbackWorld(this); - } - } - - public static class FeedbackWorld { - public final CraftWorld world; - public final Feedback feedback; - - public FeedbackWorld(CraftWorld world, Feedback feedback) { - this.world = world; - this.feedback = feedback; - } - - public FeedbackWorld(Feedback feedback) { - this(null, feedback); - } - } -} \ No newline at end of file +} diff --git a/plugin/build.gradle.kts b/plugin/build.gradle.kts new file mode 100644 index 0000000..cc9082b --- /dev/null +++ b/plugin/build.gradle.kts @@ -0,0 +1,17 @@ +dependencies { + compileOnly("dev.folia:folia-api:1.20.2-R0.1-SNAPSHOT") + implementation(project(":api")) + implementation(project(":nms:v1_19_R3")) + implementation(project(":nms:v1_20_R2")) + implementation("net.kyori:adventure-text-minimessage:4.14.0") + implementation("com.electronwill.night-config:toml:3.6.6") + implementation("com.google.guava:guava:33.0.0-jre") + implementation("org.apache.logging.log4j:log4j-api:2.22.0") + implementation("org.apache.logging.log4j:log4j-core:2.22.0") + implementation("org.mariadb.jdbc:mariadb-java-client:3.1.2") + implementation("com.zaxxer:HikariCP:5.0.1") + compileOnly("com.sk89q.worldedit:worldedit-bukkit:7.2.9") { isTransitive = false } + compileOnly("com.sk89q.worldedit:worldedit-core:7.2.0-SNAPSHOT") { isTransitive = false } + compileOnly("net.essentialsx:EssentialsXSpawn:2.19.7") { isTransitive = false } + compileOnly("net.essentialsx:EssentialsX:2.19.7") { isTransitive = false } +} \ No newline at end of file diff --git a/src/main/java/fr/euphyllia/skyfolia/Main.java b/plugin/src/main/java/fr/euphyllia/skyfolia/Main.java similarity index 97% rename from src/main/java/fr/euphyllia/skyfolia/Main.java rename to plugin/src/main/java/fr/euphyllia/skyfolia/Main.java index fdc986b..259e1b2 100644 --- a/src/main/java/fr/euphyllia/skyfolia/Main.java +++ b/plugin/src/main/java/fr/euphyllia/skyfolia/Main.java @@ -2,9 +2,9 @@ import fr.euphyllia.skyfolia.api.InterneAPI; +import fr.euphyllia.skyfolia.api.exceptions.DatabaseException; import fr.euphyllia.skyfolia.commands.SkyFoliaCommand; import fr.euphyllia.skyfolia.managers.Managers; -import fr.euphyllia.skyfolia.utils.exception.DatabaseException; import org.apache.logging.log4j.Level; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/src/main/java/fr/euphyllia/skyfolia/api/InterneAPI.java b/plugin/src/main/java/fr/euphyllia/skyfolia/api/InterneAPI.java similarity index 98% rename from src/main/java/fr/euphyllia/skyfolia/api/InterneAPI.java rename to plugin/src/main/java/fr/euphyllia/skyfolia/api/InterneAPI.java index e7fe446..4fc15c2 100644 --- a/src/main/java/fr/euphyllia/skyfolia/api/InterneAPI.java +++ b/plugin/src/main/java/fr/euphyllia/skyfolia/api/InterneAPI.java @@ -1,6 +1,7 @@ package fr.euphyllia.skyfolia.api; import fr.euphyllia.skyfolia.Main; +import fr.euphyllia.skyfolia.api.exceptions.DatabaseException; import fr.euphyllia.skyfolia.configuration.ConfigToml; import fr.euphyllia.skyfolia.configuration.LanguageToml; import fr.euphyllia.skyfolia.database.DatabaseLoader; @@ -10,7 +11,6 @@ import fr.euphyllia.skyfolia.database.sgbd.MariaDB; import fr.euphyllia.skyfolia.managers.Managers; import fr.euphyllia.skyfolia.managers.skyblock.SkyblockManager; -import fr.euphyllia.skyfolia.utils.exception.DatabaseException; import net.kyori.adventure.text.minimessage.MiniMessage; import org.apache.logging.log4j.Level; import org.apache.logging.log4j.LogManager; diff --git a/src/main/java/fr/euphyllia/skyfolia/commands/SkyFoliaCommand.java b/plugin/src/main/java/fr/euphyllia/skyfolia/commands/SkyFoliaCommand.java similarity index 100% rename from src/main/java/fr/euphyllia/skyfolia/commands/SkyFoliaCommand.java rename to plugin/src/main/java/fr/euphyllia/skyfolia/commands/SkyFoliaCommand.java diff --git a/src/main/java/fr/euphyllia/skyfolia/commands/SubCommandInterface.java b/plugin/src/main/java/fr/euphyllia/skyfolia/commands/SubCommandInterface.java similarity index 100% rename from src/main/java/fr/euphyllia/skyfolia/commands/SubCommandInterface.java rename to plugin/src/main/java/fr/euphyllia/skyfolia/commands/SubCommandInterface.java diff --git a/src/main/java/fr/euphyllia/skyfolia/commands/SubCommands.java b/plugin/src/main/java/fr/euphyllia/skyfolia/commands/SubCommands.java similarity index 100% rename from src/main/java/fr/euphyllia/skyfolia/commands/SubCommands.java rename to plugin/src/main/java/fr/euphyllia/skyfolia/commands/SubCommands.java diff --git a/src/main/java/fr/euphyllia/skyfolia/commands/subcommands/CreateSubCommand.java b/plugin/src/main/java/fr/euphyllia/skyfolia/commands/subcommands/CreateSubCommand.java similarity index 96% rename from src/main/java/fr/euphyllia/skyfolia/commands/subcommands/CreateSubCommand.java rename to plugin/src/main/java/fr/euphyllia/skyfolia/commands/subcommands/CreateSubCommand.java index 9c71fa2..7df4b33 100644 --- a/src/main/java/fr/euphyllia/skyfolia/commands/subcommands/CreateSubCommand.java +++ b/plugin/src/main/java/fr/euphyllia/skyfolia/commands/subcommands/CreateSubCommand.java @@ -14,6 +14,7 @@ import fr.euphyllia.skyfolia.utils.PlayerUtils; import fr.euphyllia.skyfolia.utils.RegionUtils; import fr.euphyllia.skyfolia.utils.WorldEditUtils; +import fr.euphyllia.skyfolia.utils.nms.v1_20_R2.PlayerNMS; import org.apache.logging.log4j.Level; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -68,7 +69,7 @@ public boolean onCommand(@NotNull Main plugin, @NotNull CommandSender sender, @N this.setFirstHome(island, center); this.restoreGameMode(plugin, player, center); this.addOwnerIslandInMember(island, player); - PlayerUtils.setOwnWorldBorder(plugin, player, center, "", island.getSize(), 0, 0); + PlayerNMS.setOwnWorldBorder(plugin, player, center, "", island.getSize(), 0, 0); if (!LanguageToml.messageIslandCreateFinish.isEmpty()) { player.sendMessage(plugin.getInterneAPI().getMiniMessage().deserialize(LanguageToml.messageIslandCreateFinish)); } @@ -88,7 +89,7 @@ public boolean onCommand(@NotNull Main plugin, @NotNull CommandSender sender, @N } else { player.teleportAsync(home.location()); } - PlayerUtils.setOwnWorldBorder(plugin, player, center, "", rayon, 0, 0); + PlayerNMS.setOwnWorldBorder(plugin, player, center, "", rayon, 0, 0); }, null); } }); diff --git a/src/main/java/fr/euphyllia/skyfolia/commands/subcommands/DeleteSubCommand.java b/plugin/src/main/java/fr/euphyllia/skyfolia/commands/subcommands/DeleteSubCommand.java similarity index 100% rename from src/main/java/fr/euphyllia/skyfolia/commands/subcommands/DeleteSubCommand.java rename to plugin/src/main/java/fr/euphyllia/skyfolia/commands/subcommands/DeleteSubCommand.java diff --git a/src/main/java/fr/euphyllia/skyfolia/commands/subcommands/DemoteSubCommand.java b/plugin/src/main/java/fr/euphyllia/skyfolia/commands/subcommands/DemoteSubCommand.java similarity index 100% rename from src/main/java/fr/euphyllia/skyfolia/commands/subcommands/DemoteSubCommand.java rename to plugin/src/main/java/fr/euphyllia/skyfolia/commands/subcommands/DemoteSubCommand.java diff --git a/src/main/java/fr/euphyllia/skyfolia/commands/subcommands/InviteSubCommand.java b/plugin/src/main/java/fr/euphyllia/skyfolia/commands/subcommands/InviteSubCommand.java similarity index 100% rename from src/main/java/fr/euphyllia/skyfolia/commands/subcommands/InviteSubCommand.java rename to plugin/src/main/java/fr/euphyllia/skyfolia/commands/subcommands/InviteSubCommand.java diff --git a/src/main/java/fr/euphyllia/skyfolia/commands/subcommands/KickSubCommand.java b/plugin/src/main/java/fr/euphyllia/skyfolia/commands/subcommands/KickSubCommand.java similarity index 100% rename from src/main/java/fr/euphyllia/skyfolia/commands/subcommands/KickSubCommand.java rename to plugin/src/main/java/fr/euphyllia/skyfolia/commands/subcommands/KickSubCommand.java diff --git a/src/main/java/fr/euphyllia/skyfolia/commands/subcommands/LeaveSubCommand.java b/plugin/src/main/java/fr/euphyllia/skyfolia/commands/subcommands/LeaveSubCommand.java similarity index 100% rename from src/main/java/fr/euphyllia/skyfolia/commands/subcommands/LeaveSubCommand.java rename to plugin/src/main/java/fr/euphyllia/skyfolia/commands/subcommands/LeaveSubCommand.java diff --git a/src/main/java/fr/euphyllia/skyfolia/commands/subcommands/PermissionSubCommand.java b/plugin/src/main/java/fr/euphyllia/skyfolia/commands/subcommands/PermissionSubCommand.java similarity index 100% rename from src/main/java/fr/euphyllia/skyfolia/commands/subcommands/PermissionSubCommand.java rename to plugin/src/main/java/fr/euphyllia/skyfolia/commands/subcommands/PermissionSubCommand.java diff --git a/src/main/java/fr/euphyllia/skyfolia/commands/subcommands/PrivateSubCommand.java b/plugin/src/main/java/fr/euphyllia/skyfolia/commands/subcommands/PrivateSubCommand.java similarity index 100% rename from src/main/java/fr/euphyllia/skyfolia/commands/subcommands/PrivateSubCommand.java rename to plugin/src/main/java/fr/euphyllia/skyfolia/commands/subcommands/PrivateSubCommand.java diff --git a/src/main/java/fr/euphyllia/skyfolia/commands/subcommands/PromoteSubCommand.java b/plugin/src/main/java/fr/euphyllia/skyfolia/commands/subcommands/PromoteSubCommand.java similarity index 100% rename from src/main/java/fr/euphyllia/skyfolia/commands/subcommands/PromoteSubCommand.java rename to plugin/src/main/java/fr/euphyllia/skyfolia/commands/subcommands/PromoteSubCommand.java diff --git a/src/main/java/fr/euphyllia/skyfolia/commands/subcommands/SetBiomeSubCommand.java b/plugin/src/main/java/fr/euphyllia/skyfolia/commands/subcommands/SetBiomeSubCommand.java similarity index 100% rename from src/main/java/fr/euphyllia/skyfolia/commands/subcommands/SetBiomeSubCommand.java rename to plugin/src/main/java/fr/euphyllia/skyfolia/commands/subcommands/SetBiomeSubCommand.java diff --git a/src/main/java/fr/euphyllia/skyfolia/commands/subcommands/SetHomeSubCommand.java b/plugin/src/main/java/fr/euphyllia/skyfolia/commands/subcommands/SetHomeSubCommand.java similarity index 100% rename from src/main/java/fr/euphyllia/skyfolia/commands/subcommands/SetHomeSubCommand.java rename to plugin/src/main/java/fr/euphyllia/skyfolia/commands/subcommands/SetHomeSubCommand.java diff --git a/src/main/java/fr/euphyllia/skyfolia/commands/subcommands/SetWarpSubCommand.java b/plugin/src/main/java/fr/euphyllia/skyfolia/commands/subcommands/SetWarpSubCommand.java similarity index 100% rename from src/main/java/fr/euphyllia/skyfolia/commands/subcommands/SetWarpSubCommand.java rename to plugin/src/main/java/fr/euphyllia/skyfolia/commands/subcommands/SetWarpSubCommand.java diff --git a/src/main/java/fr/euphyllia/skyfolia/commands/subcommands/TeleportSubCommand.java b/plugin/src/main/java/fr/euphyllia/skyfolia/commands/subcommands/TeleportSubCommand.java similarity index 95% rename from src/main/java/fr/euphyllia/skyfolia/commands/subcommands/TeleportSubCommand.java rename to plugin/src/main/java/fr/euphyllia/skyfolia/commands/subcommands/TeleportSubCommand.java index c11b38e..b21a723 100644 --- a/src/main/java/fr/euphyllia/skyfolia/commands/subcommands/TeleportSubCommand.java +++ b/plugin/src/main/java/fr/euphyllia/skyfolia/commands/subcommands/TeleportSubCommand.java @@ -9,6 +9,7 @@ import fr.euphyllia.skyfolia.managers.skyblock.SkyblockManager; import fr.euphyllia.skyfolia.utils.PlayerUtils; import fr.euphyllia.skyfolia.utils.RegionUtils; +import fr.euphyllia.skyfolia.utils.nms.v1_20_R2.PlayerNMS; import org.apache.logging.log4j.Level; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -59,7 +60,7 @@ public boolean onCommand(@NotNull Main plugin, @NotNull CommandSender sender, @N loc = warpIsland.location(); } player.teleportAsync(loc); - PlayerUtils.setOwnWorldBorder(plugin, player, centerIsland, "", rayon, 0, 0); + PlayerNMS.setOwnWorldBorder(plugin, player, centerIsland, "", rayon, 0, 0); player.setGameMode(GameMode.SURVIVAL); }, null); }); diff --git a/src/main/java/fr/euphyllia/skyfolia/commands/subcommands/TransferSubCommand.java b/plugin/src/main/java/fr/euphyllia/skyfolia/commands/subcommands/TransferSubCommand.java similarity index 100% rename from src/main/java/fr/euphyllia/skyfolia/commands/subcommands/TransferSubCommand.java rename to plugin/src/main/java/fr/euphyllia/skyfolia/commands/subcommands/TransferSubCommand.java diff --git a/src/main/java/fr/euphyllia/skyfolia/commands/subcommands/VisitSubCommand.java b/plugin/src/main/java/fr/euphyllia/skyfolia/commands/subcommands/VisitSubCommand.java similarity index 100% rename from src/main/java/fr/euphyllia/skyfolia/commands/subcommands/VisitSubCommand.java rename to plugin/src/main/java/fr/euphyllia/skyfolia/commands/subcommands/VisitSubCommand.java diff --git a/src/main/java/fr/euphyllia/skyfolia/commands/subcommands/WarpSubCommand.java b/plugin/src/main/java/fr/euphyllia/skyfolia/commands/subcommands/WarpSubCommand.java similarity index 100% rename from src/main/java/fr/euphyllia/skyfolia/commands/subcommands/WarpSubCommand.java rename to plugin/src/main/java/fr/euphyllia/skyfolia/commands/subcommands/WarpSubCommand.java diff --git a/src/main/java/fr/euphyllia/skyfolia/configuration/ConfigToml.java b/plugin/src/main/java/fr/euphyllia/skyfolia/configuration/ConfigToml.java similarity index 100% rename from src/main/java/fr/euphyllia/skyfolia/configuration/ConfigToml.java rename to plugin/src/main/java/fr/euphyllia/skyfolia/configuration/ConfigToml.java diff --git a/src/main/java/fr/euphyllia/skyfolia/configuration/LanguageToml.java b/plugin/src/main/java/fr/euphyllia/skyfolia/configuration/LanguageToml.java similarity index 100% rename from src/main/java/fr/euphyllia/skyfolia/configuration/LanguageToml.java rename to plugin/src/main/java/fr/euphyllia/skyfolia/configuration/LanguageToml.java diff --git a/src/main/java/fr/euphyllia/skyfolia/configuration/section/MariaDBConfig.java b/plugin/src/main/java/fr/euphyllia/skyfolia/configuration/section/MariaDBConfig.java similarity index 100% rename from src/main/java/fr/euphyllia/skyfolia/configuration/section/MariaDBConfig.java rename to plugin/src/main/java/fr/euphyllia/skyfolia/configuration/section/MariaDBConfig.java diff --git a/src/main/java/fr/euphyllia/skyfolia/configuration/section/WorldConfig.java b/plugin/src/main/java/fr/euphyllia/skyfolia/configuration/section/WorldConfig.java similarity index 100% rename from src/main/java/fr/euphyllia/skyfolia/configuration/section/WorldConfig.java rename to plugin/src/main/java/fr/euphyllia/skyfolia/configuration/section/WorldConfig.java diff --git a/src/main/java/fr/euphyllia/skyfolia/database/DatabaseLoader.java b/plugin/src/main/java/fr/euphyllia/skyfolia/database/DatabaseLoader.java similarity index 100% rename from src/main/java/fr/euphyllia/skyfolia/database/DatabaseLoader.java rename to plugin/src/main/java/fr/euphyllia/skyfolia/database/DatabaseLoader.java diff --git a/src/main/java/fr/euphyllia/skyfolia/database/execute/MariaDBExecute.java b/plugin/src/main/java/fr/euphyllia/skyfolia/database/execute/MariaDBExecute.java similarity index 100% rename from src/main/java/fr/euphyllia/skyfolia/database/execute/MariaDBExecute.java rename to plugin/src/main/java/fr/euphyllia/skyfolia/database/execute/MariaDBExecute.java diff --git a/src/main/java/fr/euphyllia/skyfolia/database/model/DBCallback.java b/plugin/src/main/java/fr/euphyllia/skyfolia/database/model/DBCallback.java similarity index 100% rename from src/main/java/fr/euphyllia/skyfolia/database/model/DBCallback.java rename to plugin/src/main/java/fr/euphyllia/skyfolia/database/model/DBCallback.java diff --git a/src/main/java/fr/euphyllia/skyfolia/database/model/DBCallbackInt.java b/plugin/src/main/java/fr/euphyllia/skyfolia/database/model/DBCallbackInt.java similarity index 100% rename from src/main/java/fr/euphyllia/skyfolia/database/model/DBCallbackInt.java rename to plugin/src/main/java/fr/euphyllia/skyfolia/database/model/DBCallbackInt.java diff --git a/src/main/java/fr/euphyllia/skyfolia/database/model/DBConnect.java b/plugin/src/main/java/fr/euphyllia/skyfolia/database/model/DBConnect.java similarity index 100% rename from src/main/java/fr/euphyllia/skyfolia/database/model/DBConnect.java rename to plugin/src/main/java/fr/euphyllia/skyfolia/database/model/DBConnect.java diff --git a/src/main/java/fr/euphyllia/skyfolia/database/model/DBInterface.java b/plugin/src/main/java/fr/euphyllia/skyfolia/database/model/DBInterface.java similarity index 100% rename from src/main/java/fr/euphyllia/skyfolia/database/model/DBInterface.java rename to plugin/src/main/java/fr/euphyllia/skyfolia/database/model/DBInterface.java diff --git a/src/main/java/fr/euphyllia/skyfolia/database/model/DBWork.java b/plugin/src/main/java/fr/euphyllia/skyfolia/database/model/DBWork.java similarity index 100% rename from src/main/java/fr/euphyllia/skyfolia/database/model/DBWork.java rename to plugin/src/main/java/fr/euphyllia/skyfolia/database/model/DBWork.java diff --git a/src/main/java/fr/euphyllia/skyfolia/database/query/MariaDBCreateTable.java b/plugin/src/main/java/fr/euphyllia/skyfolia/database/query/MariaDBCreateTable.java similarity index 98% rename from src/main/java/fr/euphyllia/skyfolia/database/query/MariaDBCreateTable.java rename to plugin/src/main/java/fr/euphyllia/skyfolia/database/query/MariaDBCreateTable.java index ac9ff87..3097493 100644 --- a/src/main/java/fr/euphyllia/skyfolia/database/query/MariaDBCreateTable.java +++ b/plugin/src/main/java/fr/euphyllia/skyfolia/database/query/MariaDBCreateTable.java @@ -1,12 +1,12 @@ package fr.euphyllia.skyfolia.database.query; import fr.euphyllia.skyfolia.api.InterneAPI; +import fr.euphyllia.skyfolia.api.exceptions.DatabaseException; import fr.euphyllia.skyfolia.api.skyblock.model.Position; import fr.euphyllia.skyfolia.configuration.ConfigToml; import fr.euphyllia.skyfolia.configuration.section.MariaDBConfig; import fr.euphyllia.skyfolia.database.execute.MariaDBExecute; import fr.euphyllia.skyfolia.utils.RegionUtils; -import fr.euphyllia.skyfolia.utils.exception.DatabaseException; import org.apache.logging.log4j.Level; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/src/main/java/fr/euphyllia/skyfolia/database/query/MariaDBTransactionQuery.java b/plugin/src/main/java/fr/euphyllia/skyfolia/database/query/MariaDBTransactionQuery.java similarity index 100% rename from src/main/java/fr/euphyllia/skyfolia/database/query/MariaDBTransactionQuery.java rename to plugin/src/main/java/fr/euphyllia/skyfolia/database/query/MariaDBTransactionQuery.java diff --git a/src/main/java/fr/euphyllia/skyfolia/database/query/exec/IslandDataQuery.java b/plugin/src/main/java/fr/euphyllia/skyfolia/database/query/exec/IslandDataQuery.java similarity index 98% rename from src/main/java/fr/euphyllia/skyfolia/database/query/exec/IslandDataQuery.java rename to plugin/src/main/java/fr/euphyllia/skyfolia/database/query/exec/IslandDataQuery.java index fe719cc..5528fab 100644 --- a/src/main/java/fr/euphyllia/skyfolia/database/query/exec/IslandDataQuery.java +++ b/plugin/src/main/java/fr/euphyllia/skyfolia/database/query/exec/IslandDataQuery.java @@ -1,11 +1,11 @@ package fr.euphyllia.skyfolia.database.query.exec; import fr.euphyllia.skyfolia.api.InterneAPI; +import fr.euphyllia.skyfolia.api.exceptions.MaxIslandSizeExceedException; import fr.euphyllia.skyfolia.api.skyblock.Island; import fr.euphyllia.skyfolia.api.skyblock.model.Position; import fr.euphyllia.skyfolia.database.execute.MariaDBExecute; import fr.euphyllia.skyfolia.managers.skyblock.IslandHook; -import fr.euphyllia.skyfolia.utils.exception.MaxIslandSizeExceedException; import org.apache.logging.log4j.Level; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/src/main/java/fr/euphyllia/skyfolia/database/query/exec/IslandMemberQuery.java b/plugin/src/main/java/fr/euphyllia/skyfolia/database/query/exec/IslandMemberQuery.java similarity index 100% rename from src/main/java/fr/euphyllia/skyfolia/database/query/exec/IslandMemberQuery.java rename to plugin/src/main/java/fr/euphyllia/skyfolia/database/query/exec/IslandMemberQuery.java diff --git a/src/main/java/fr/euphyllia/skyfolia/database/query/exec/IslandQuery.java b/plugin/src/main/java/fr/euphyllia/skyfolia/database/query/exec/IslandQuery.java similarity index 100% rename from src/main/java/fr/euphyllia/skyfolia/database/query/exec/IslandQuery.java rename to plugin/src/main/java/fr/euphyllia/skyfolia/database/query/exec/IslandQuery.java diff --git a/src/main/java/fr/euphyllia/skyfolia/database/query/exec/IslandUpdateQuery.java b/plugin/src/main/java/fr/euphyllia/skyfolia/database/query/exec/IslandUpdateQuery.java similarity index 100% rename from src/main/java/fr/euphyllia/skyfolia/database/query/exec/IslandUpdateQuery.java rename to plugin/src/main/java/fr/euphyllia/skyfolia/database/query/exec/IslandUpdateQuery.java diff --git a/src/main/java/fr/euphyllia/skyfolia/database/query/exec/IslandWarpQuery.java b/plugin/src/main/java/fr/euphyllia/skyfolia/database/query/exec/IslandWarpQuery.java similarity index 100% rename from src/main/java/fr/euphyllia/skyfolia/database/query/exec/IslandWarpQuery.java rename to plugin/src/main/java/fr/euphyllia/skyfolia/database/query/exec/IslandWarpQuery.java diff --git a/src/main/java/fr/euphyllia/skyfolia/database/sgbd/MariaDB.java b/plugin/src/main/java/fr/euphyllia/skyfolia/database/sgbd/MariaDB.java similarity index 100% rename from src/main/java/fr/euphyllia/skyfolia/database/sgbd/MariaDB.java rename to plugin/src/main/java/fr/euphyllia/skyfolia/database/sgbd/MariaDB.java diff --git a/src/main/java/fr/euphyllia/skyfolia/database/stream/AsciiStream.java b/plugin/src/main/java/fr/euphyllia/skyfolia/database/stream/AsciiStream.java similarity index 100% rename from src/main/java/fr/euphyllia/skyfolia/database/stream/AsciiStream.java rename to plugin/src/main/java/fr/euphyllia/skyfolia/database/stream/AsciiStream.java diff --git a/src/main/java/fr/euphyllia/skyfolia/database/stream/BinaryStream.java b/plugin/src/main/java/fr/euphyllia/skyfolia/database/stream/BinaryStream.java similarity index 100% rename from src/main/java/fr/euphyllia/skyfolia/database/stream/BinaryStream.java rename to plugin/src/main/java/fr/euphyllia/skyfolia/database/stream/BinaryStream.java diff --git a/src/main/java/fr/euphyllia/skyfolia/listeners/bukkitevents/JoinEvent.java b/plugin/src/main/java/fr/euphyllia/skyfolia/listeners/bukkitevents/JoinEvent.java similarity index 92% rename from src/main/java/fr/euphyllia/skyfolia/listeners/bukkitevents/JoinEvent.java rename to plugin/src/main/java/fr/euphyllia/skyfolia/listeners/bukkitevents/JoinEvent.java index 8cf1672..2bbd5e5 100644 --- a/src/main/java/fr/euphyllia/skyfolia/listeners/bukkitevents/JoinEvent.java +++ b/plugin/src/main/java/fr/euphyllia/skyfolia/listeners/bukkitevents/JoinEvent.java @@ -20,7 +20,7 @@ public JoinEvent(InterneAPI interneAPI) { } @EventHandler - public void onPlayerJoinEvent(PlayerJoinEvent playerJoinEvent) { + public void onLoadIslandInJoinEvent(PlayerJoinEvent playerJoinEvent) { ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor(); try { executor.execute(() -> { diff --git a/src/main/java/fr/euphyllia/skyfolia/managers/Managers.java b/plugin/src/main/java/fr/euphyllia/skyfolia/managers/Managers.java similarity index 100% rename from src/main/java/fr/euphyllia/skyfolia/managers/Managers.java rename to plugin/src/main/java/fr/euphyllia/skyfolia/managers/Managers.java diff --git a/src/main/java/fr/euphyllia/skyfolia/managers/skyblock/IslandHook.java b/plugin/src/main/java/fr/euphyllia/skyfolia/managers/skyblock/IslandHook.java similarity index 98% rename from src/main/java/fr/euphyllia/skyfolia/managers/skyblock/IslandHook.java rename to plugin/src/main/java/fr/euphyllia/skyfolia/managers/skyblock/IslandHook.java index f3ca157..ff407bb 100644 --- a/src/main/java/fr/euphyllia/skyfolia/managers/skyblock/IslandHook.java +++ b/plugin/src/main/java/fr/euphyllia/skyfolia/managers/skyblock/IslandHook.java @@ -1,11 +1,11 @@ package fr.euphyllia.skyfolia.managers.skyblock; import fr.euphyllia.skyfolia.Main; +import fr.euphyllia.skyfolia.api.exceptions.MaxIslandSizeExceedException; import fr.euphyllia.skyfolia.api.skyblock.Island; import fr.euphyllia.skyfolia.api.skyblock.Players; import fr.euphyllia.skyfolia.api.skyblock.model.Position; import fr.euphyllia.skyfolia.api.skyblock.model.WarpIsland; -import fr.euphyllia.skyfolia.utils.exception.MaxIslandSizeExceedException; import org.bukkit.Location; import org.jetbrains.annotations.Nullable; diff --git a/src/main/java/fr/euphyllia/skyfolia/managers/skyblock/SkyblockCache.java b/plugin/src/main/java/fr/euphyllia/skyfolia/managers/skyblock/SkyblockCache.java similarity index 100% rename from src/main/java/fr/euphyllia/skyfolia/managers/skyblock/SkyblockCache.java rename to plugin/src/main/java/fr/euphyllia/skyfolia/managers/skyblock/SkyblockCache.java diff --git a/src/main/java/fr/euphyllia/skyfolia/managers/skyblock/SkyblockManager.java b/plugin/src/main/java/fr/euphyllia/skyfolia/managers/skyblock/SkyblockManager.java similarity index 100% rename from src/main/java/fr/euphyllia/skyfolia/managers/skyblock/SkyblockManager.java rename to plugin/src/main/java/fr/euphyllia/skyfolia/managers/skyblock/SkyblockManager.java diff --git a/src/main/java/fr/euphyllia/skyfolia/managers/world/WorldsManager.java b/plugin/src/main/java/fr/euphyllia/skyfolia/managers/world/WorldsManager.java similarity index 89% rename from src/main/java/fr/euphyllia/skyfolia/managers/world/WorldsManager.java rename to plugin/src/main/java/fr/euphyllia/skyfolia/managers/world/WorldsManager.java index 66a6c38..a83c92f 100644 --- a/src/main/java/fr/euphyllia/skyfolia/managers/world/WorldsManager.java +++ b/plugin/src/main/java/fr/euphyllia/skyfolia/managers/world/WorldsManager.java @@ -1,6 +1,7 @@ package fr.euphyllia.skyfolia.managers.world; import fr.euphyllia.skyfolia.api.InterneAPI; +import fr.euphyllia.skyfolia.api.world.WorldFeedback; import fr.euphyllia.skyfolia.configuration.ConfigToml; import fr.euphyllia.skyfolia.configuration.section.WorldConfig; import fr.euphyllia.skyfolia.utils.WorldUtils; @@ -36,8 +37,8 @@ public void initWorld() { try { w = worldCreator.createWorld(); // Work with Paper, not Folia } catch (Exception ignored) { - WorldUtils.FeedbackWorld feedbackWorld = WorldUtils.addWorld(worldCreator); - if (feedbackWorld.feedback == WorldUtils.Feedback.SUCCESS) { + WorldFeedback.FeedbackWorld feedbackWorld = WorldUtils.addWorld(worldCreator); + if (feedbackWorld.feedback == WorldFeedback.Feedback.SUCCESS) { w = feedbackWorld.world; } else { logger.log(Level.FATAL, "WORLD IMPOSSIBLE TO CREATE"); diff --git a/src/main/java/fr/euphyllia/skyfolia/utils/IslandUtils.java b/plugin/src/main/java/fr/euphyllia/skyfolia/utils/IslandUtils.java similarity index 100% rename from src/main/java/fr/euphyllia/skyfolia/utils/IslandUtils.java rename to plugin/src/main/java/fr/euphyllia/skyfolia/utils/IslandUtils.java diff --git a/plugin/src/main/java/fr/euphyllia/skyfolia/utils/PlayerUtils.java b/plugin/src/main/java/fr/euphyllia/skyfolia/utils/PlayerUtils.java new file mode 100644 index 0000000..ad46a21 --- /dev/null +++ b/plugin/src/main/java/fr/euphyllia/skyfolia/utils/PlayerUtils.java @@ -0,0 +1,32 @@ +package fr.euphyllia.skyfolia.utils; + +import com.earth2me.essentials.Essentials; +import com.earth2me.essentials.spawn.EssentialsSpawn; +import fr.euphyllia.skyfolia.Main; +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.World; +import org.bukkit.entity.Player; +import org.bukkit.event.player.PlayerTeleportEvent; +import org.jetbrains.annotations.NotNull; + +public class PlayerUtils { + + public static void teleportPlayerSpawn(Main main, Player player) { + player.getScheduler().run(main, scheduledTask -> { + World world = Bukkit.getWorlds().get(0); + try { + EssentialsSpawn essentialsSpawn = (EssentialsSpawn) Bukkit.getPluginManager().getPlugin("EssentialsSpawn"); + Essentials essentials = (Essentials) Bukkit.getPluginManager().getPlugin("Essentials"); + if (essentialsSpawn != null && essentialsSpawn.isEnabled() && essentials != null && essentials.isEnabled()) { + player.teleportAsync(essentialsSpawn.getSpawn(essentials.getUser(player.getUniqueId()).getGroup()), PlayerTeleportEvent.TeleportCause.PLUGIN); + } else { + player.teleportAsync(world.getSpawnLocation(), PlayerTeleportEvent.TeleportCause.PLUGIN); + } + } catch (Exception e) { + player.teleportAsync(world.getSpawnLocation(), PlayerTeleportEvent.TeleportCause.PLUGIN); + } + }, null); + } + +} diff --git a/src/main/java/fr/euphyllia/skyfolia/utils/RegionUtils.java b/plugin/src/main/java/fr/euphyllia/skyfolia/utils/RegionUtils.java similarity index 100% rename from src/main/java/fr/euphyllia/skyfolia/utils/RegionUtils.java rename to plugin/src/main/java/fr/euphyllia/skyfolia/utils/RegionUtils.java diff --git a/src/main/java/fr/euphyllia/skyfolia/utils/WorldEditUtils.java b/plugin/src/main/java/fr/euphyllia/skyfolia/utils/WorldEditUtils.java similarity index 98% rename from src/main/java/fr/euphyllia/skyfolia/utils/WorldEditUtils.java rename to plugin/src/main/java/fr/euphyllia/skyfolia/utils/WorldEditUtils.java index acee958..f3366f3 100644 --- a/src/main/java/fr/euphyllia/skyfolia/utils/WorldEditUtils.java +++ b/plugin/src/main/java/fr/euphyllia/skyfolia/utils/WorldEditUtils.java @@ -23,6 +23,7 @@ import fr.euphyllia.skyfolia.api.skyblock.Island; import fr.euphyllia.skyfolia.api.skyblock.model.IslandType; import fr.euphyllia.skyfolia.api.skyblock.model.Position; +import fr.euphyllia.skyfolia.utils.nms.v1_20_R2.PlayerNMS; import org.apache.logging.log4j.Level; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -167,7 +168,7 @@ public static void changeBiome(Main plugin, Island island, org.bukkit.World worl logger.log(Level.INFO, "fini ?"); positions.forEach((position, locTemp) -> { Bukkit.getServer().getRegionScheduler().run(plugin, locTemp, scheduledTask -> { - PlayerUtils.refreshPlayerChunk(player, locTemp.getChunk().getX(), locTemp.getChunk().getZ()); + PlayerNMS.refreshPlayerChunk(player, locTemp.getChunk().getX(), locTemp.getChunk().getZ()); }); }); } diff --git a/plugin/src/main/java/fr/euphyllia/skyfolia/utils/WorldUtils.java b/plugin/src/main/java/fr/euphyllia/skyfolia/utils/WorldUtils.java new file mode 100644 index 0000000..1ee640e --- /dev/null +++ b/plugin/src/main/java/fr/euphyllia/skyfolia/utils/WorldUtils.java @@ -0,0 +1,24 @@ +package fr.euphyllia.skyfolia.utils; + +import fr.euphyllia.skyfolia.api.world.WorldFeedback; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.bukkit.Bukkit; +import org.bukkit.WorldCreator; + +/** + * Ce code provient d'ici : MoreFoWorld et CraftBukkit + */ +public final class WorldUtils { + + private static final Logger logger = LogManager.getLogger(WorldUtils.class); + + public static WorldFeedback.FeedbackWorld addWorld(WorldCreator creator) { + final String versionMC = Bukkit.getServer().getClass().getPackage().getName().split("\\.")[3]; + return switch (versionMC) { + case "v1_20_R2" -> fr.euphyllia.skyfolia.utils.nms.v1_20_R2.WorldNMS.createWorld(creator); + default -> throw new RuntimeException("Pas pris en charge"); + }; + + } +} \ No newline at end of file diff --git a/src/main/java/fr/euphyllia/skyfolia/utils/generators/VoidWorldGen.java b/plugin/src/main/java/fr/euphyllia/skyfolia/utils/generators/VoidWorldGen.java similarity index 100% rename from src/main/java/fr/euphyllia/skyfolia/utils/generators/VoidWorldGen.java rename to plugin/src/main/java/fr/euphyllia/skyfolia/utils/generators/VoidWorldGen.java diff --git a/src/main/java/fr/euphyllia/skyfolia/utils/models/CallbackLocation.java b/plugin/src/main/java/fr/euphyllia/skyfolia/utils/models/CallbackLocation.java similarity index 100% rename from src/main/java/fr/euphyllia/skyfolia/utils/models/CallbackLocation.java rename to plugin/src/main/java/fr/euphyllia/skyfolia/utils/models/CallbackLocation.java diff --git a/src/main/resources/plugin.yml b/plugin/src/main/resources/plugin.yml similarity index 100% rename from src/main/resources/plugin.yml rename to plugin/src/main/resources/plugin.yml diff --git a/settings.gradle.kts b/settings.gradle.kts index 44164c0..e4c4368 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,2 +1,7 @@ rootProject.name = "SkyFolia" +include("plugin") +include("api") +include("nms:v1_19_R3") +include("nms:v1_20_R1") +include("nms:v1_20_R2") \ No newline at end of file