Compare commits

...

131 Commits
v2.2.5 ... main

Author SHA1 Message Date
RaphiMC
1125600dbe
Bump version to 3.0.2-SNAPSHOT 2024-06-22 16:24:56 +02:00
RaphiMC
eb09342e0e
Release 3.0.1 2024-06-22 16:14:34 +02:00
RaphiMC
02044a0511
Greatly improved performance when checking VersionRanges 2024-06-21 15:23:24 +02:00
EnZaXD
4279e089b7
Merge pull request #38 from ViaVersion/dependabot/gradle/net.raphimc.class-token-replacer-1.1.2
Bump net.raphimc.class-token-replacer from 1.1.0 to 1.1.2
2024-06-20 17:54:20 +02:00
dependabot[bot]
d71ea30670
Bump net.raphimc.class-token-replacer from 1.1.0 to 1.1.2
Bumps net.raphimc.class-token-replacer from 1.1.0 to 1.1.2.

---
updated-dependencies:
- dependency-name: net.raphimc.class-token-replacer
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-20 15:53:26 +00:00
RK_01
986431417b
Merge pull request #37 from ViaVersion/dependabot/gradle/net.raphimc.class-token-replacer-1.1.0
Bump net.raphimc.class-token-replacer from 1.0.1 to 1.1.0
2024-06-19 18:48:48 +02:00
dependabot[bot]
cf72f8db79
Bump net.raphimc.class-token-replacer from 1.0.1 to 1.1.0
Bumps net.raphimc.class-token-replacer from 1.0.1 to 1.1.0.

---
updated-dependencies:
- dependency-name: net.raphimc.class-token-replacer
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-19 15:32:36 +00:00
RaphiMC
5c854370eb
Bump version to 3.0.1-SNAPSHOT 2024-06-16 18:56:15 +02:00
RaphiMC
d99bc1ae6a
Release 3.0.0 2024-06-16 18:18:50 +02:00
FlorianMichael
daddc6d675
Remove DontBugMe command from VLCommandHandler
Removing this since the version checker isn't supported by ViaLoader anyway
2024-06-15 20:56:21 +02:00
RaphiMC
bd381cf483
Merge remote-tracking branch 'origin/main' 2024-06-15 15:11:39 +02:00
RaphiMC
273abf8190
Removed commands which are now in VV 2024-06-15 15:11:25 +02:00
FlorianMichael
1cfd131406
Gradle 8.8 2024-06-05 00:39:24 +02:00
FlorianMichael
1608cedd92
Update unsupported config options in VLViaConfig 2024-06-05 00:35:57 +02:00
RK_01
1081f19bba
Merge pull request #36 from ViaVersion/dependabot/gradle/com.google.guava-guava-33.2.1-jre
Bump com.google.guava:guava from 33.2.0-jre to 33.2.1-jre
2024-06-03 17:57:09 +02:00
dependabot[bot]
f31433ee73
Bump com.google.guava:guava from 33.2.0-jre to 33.2.1-jre
Bumps [com.google.guava:guava](https://github.com/google/guava) from 33.2.0-jre to 33.2.1-jre.
- [Release notes](https://github.com/google/guava/releases)
- [Commits](https://github.com/google/guava/commits)

---
updated-dependencies:
- dependency-name: com.google.guava:guava
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-03 15:55:47 +00:00
RK_01
a1f2e24c04
Merge pull request #35 from ViaVersion/dependabot/gradle/net.raphimc.class-token-replacer-1.0.1
Bump net.raphimc.class-token-replacer from 1.0.0 to 1.0.1
2024-05-23 18:04:07 +02:00
dependabot[bot]
280179a370
Bump net.raphimc.class-token-replacer from 1.0.0 to 1.0.1
Bumps net.raphimc.class-token-replacer from 1.0.0 to 1.0.1.

---
updated-dependencies:
- dependency-name: net.raphimc.class-token-replacer
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-23 15:40:07 +00:00
RaphiMC
d2b45fd415
Updated to ViaVersion 5 2024-05-17 17:31:33 +02:00
RaphiMC
64d0ad1a14
Added toolchain resolving plugin 2024-05-16 19:14:58 +02:00
RaphiMC
d6a1f08290
Updated README and dependencies 2024-05-10 20:36:45 +02:00
RaphiMC
b30cef9227
Merge remote-tracking branch 'origin/main'
# Conflicts:
#	build.gradle
2024-05-05 17:02:50 +02:00
RaphiMC
e58f763d26
Updated README and dependencies 2024-05-05 17:02:01 +02:00
RK_01
8fc2b95736
Merge pull request #34 from ViaVersion/dependabot/gradle/net.raphimc-ViaBedrock-0.0.7-SNAPSHOT
Bump net.raphimc:ViaBedrock from 0.0.6-SNAPSHOT to 0.0.7-SNAPSHOT
2024-05-02 17:09:07 +02:00
RK_01
3fa9af0b04
Merge pull request #33 from ViaVersion/dependabot/gradle/com.google.guava-guava-33.2.0-jre
Bump com.google.guava:guava from 33.1.0-jre to 33.2.0-jre
2024-05-02 17:09:00 +02:00
dependabot[bot]
053a50c120
Bump net.raphimc:ViaBedrock from 0.0.6-SNAPSHOT to 0.0.7-SNAPSHOT
Bumps net.raphimc:ViaBedrock from 0.0.6-SNAPSHOT to 0.0.7-SNAPSHOT.

---
updated-dependencies:
- dependency-name: net.raphimc:ViaBedrock
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-02 15:08:42 +00:00
dependabot[bot]
bea9562ec9
Bump com.google.guava:guava from 33.1.0-jre to 33.2.0-jre
Bumps [com.google.guava:guava](https://github.com/google/guava) from 33.1.0-jre to 33.2.0-jre.
- [Release notes](https://github.com/google/guava/releases)
- [Commits](https://github.com/google/guava/commits)

---
updated-dependencies:
- dependency-name: com.google.guava:guava
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-02 15:08:35 +00:00
RaphiMC
72dcde02cb
Bump version to 2.2.14-SNAPSHOT 2024-04-26 17:22:36 +02:00
RaphiMC
98ac0333f3
Release 2.2.13 2024-04-26 16:47:20 +02:00
RK_01
94c10dbb1a
Merge pull request #32 from ViaVersion/dependabot/gradle/org.slf4j-slf4j-api-2.0.13
Bump org.slf4j:slf4j-api from 2.0.12 to 2.0.13
2024-04-12 17:38:17 +02:00
dependabot[bot]
e65e30a976
Bump org.slf4j:slf4j-api from 2.0.12 to 2.0.13
Bumps org.slf4j:slf4j-api from 2.0.12 to 2.0.13.

---
updated-dependencies:
- dependency-name: org.slf4j:slf4j-api
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-12 15:38:01 +00:00
FlorianMichael
6b87889907
Gradle 8.7 2024-03-23 12:51:58 +01:00
RK_01
f61031a33a
Merge pull request #31 from ViaVersion/dependabot/gradle/net.raphimc-ViaBedrock-0.0.6-SNAPSHOT
Bump net.raphimc:ViaBedrock from 0.0.5-SNAPSHOT to 0.0.6-SNAPSHOT
2024-03-18 16:37:09 +01:00
dependabot[bot]
a4b35aca78
Bump net.raphimc:ViaBedrock from 0.0.5-SNAPSHOT to 0.0.6-SNAPSHOT
Bumps net.raphimc:ViaBedrock from 0.0.5-SNAPSHOT to 0.0.6-SNAPSHOT.

---
updated-dependencies:
- dependency-name: net.raphimc:ViaBedrock
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-18 15:16:18 +00:00
EnZaXD
728f571fbc
Merge pull request #30 from ViaVersion/dependabot/gradle/com.google.guava-guava-33.1.0-jre
Bump com.google.guava:guava from 33.0.0-jre to 33.1.0-jre
2024-03-14 16:50:49 +01:00
dependabot[bot]
e60ec0c24d
Bump com.google.guava:guava from 33.0.0-jre to 33.1.0-jre
Bumps [com.google.guava:guava](https://github.com/google/guava) from 33.0.0-jre to 33.1.0-jre.
- [Release notes](https://github.com/google/guava/releases)
- [Commits](https://github.com/google/guava/commits)

---
updated-dependencies:
- dependency-name: com.google.guava:guava
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-14 15:49:37 +00:00
RaphiMC
a73f6c99d1
Added FUNDING.yml 2024-03-05 18:25:35 +01:00
RaphiMC
2af017b4ec
Updated Via* 2024-03-04 22:17:33 +01:00
FlorianMichael
f976ac3b85
Updated ViaRewind platform implementation 2024-02-18 22:33:28 +01:00
FlorianMichael
2c4770ab69
Don't require ViaBedrock and ViaLegacy for pipeline utils 2024-02-18 20:27:24 +01:00
RaphiMC
b565635aa6
Added util class to get sorted protocol list 2024-02-14 21:06:56 +01:00
FlorianMichael
5754b07583
Fixed Via API usage 2024-02-14 19:58:55 +01:00
RaphiMC
289f5656b8
Updated Via API usage 2024-02-14 19:27:28 +01:00
RaphiMC
d8aff7f979
Fixed version comparisons 2024-02-14 17:09:53 +01:00
FlorianMichael
164f229aa0
[ci skip] Fixed example in README 2024-02-14 13:51:15 +01:00
FlorianMichael
e5138149b8
Updated Via* API usage 2024-02-14 13:48:13 +01:00
FlorianMichael
65b9a0bd64
Deleted VersionEnum class file and replaced with proper Via API 2024-02-14 00:44:31 +01:00
RaphiMC
2b44f2bf6f
Updated Via API usage 2024-02-13 23:45:05 +01:00
RaphiMC
b0ee047bd0
Moved Via config load to correct place 2024-02-13 23:30:03 +01:00
RK_01
b3c439e0fe
Merge pull request #29 from ViaVersion/dependabot/gradle/net.raphimc-ViaBedrock-0.0.5-SNAPSHOT
Bump net.raphimc:ViaBedrock from 0.0.4-SNAPSHOT to 0.0.5-SNAPSHOT
2024-02-08 16:14:38 +01:00
dependabot[bot]
57bb44dfa5
Bump net.raphimc:ViaBedrock from 0.0.4-SNAPSHOT to 0.0.5-SNAPSHOT
Bumps net.raphimc:ViaBedrock from 0.0.4-SNAPSHOT to 0.0.5-SNAPSHOT.

---
updated-dependencies:
- dependency-name: net.raphimc:ViaBedrock
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-08 15:13:38 +00:00
RK_01
2a813208a7
Merge pull request #28 from ViaVersion/dependabot/gradle/org.slf4j-slf4j-api-2.0.12
Bump org.slf4j:slf4j-api from 2.0.11 to 2.0.12
2024-02-06 16:51:28 +01:00
dependabot[bot]
70adf63f2c
Bump org.slf4j:slf4j-api from 2.0.11 to 2.0.12
Bumps org.slf4j:slf4j-api from 2.0.11 to 2.0.12.

---
updated-dependencies:
- dependency-name: org.slf4j:slf4j-api
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-06 15:50:38 +00:00
FlorianMichael
18d8ef9117
Correct implementation of ViaVersionPlatformImpl#hasPlugin 2024-01-21 12:16:31 +01:00
RK_01
57fcbe7725
Merge pull request #27 from ViaVersion/dependabot/gradle/org.slf4j-slf4j-api-2.0.11
Bump org.slf4j:slf4j-api from 2.0.10 to 2.0.11
2024-01-09 16:53:44 +01:00
dependabot[bot]
26e981a94d
Bump org.slf4j:slf4j-api from 2.0.10 to 2.0.11
Bumps org.slf4j:slf4j-api from 2.0.10 to 2.0.11.

---
updated-dependencies:
- dependency-name: org.slf4j:slf4j-api
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-09 15:15:54 +00:00
RaphiMC
bec10b1569
Merge remote-tracking branch 'origin/main' 2024-01-01 02:31:13 +01:00
RaphiMC
428a2aad8f
Updated copyright: 2024 2024-01-01 02:31:00 +01:00
RK_01
d9116788c9
Merge pull request #26 from ViaVersion/dependabot/gradle/org.slf4j-slf4j-api-2.0.10
Bump org.slf4j:slf4j-api from 2.0.9 to 2.0.10
2023-12-29 16:36:37 +01:00
dependabot[bot]
3c2b445934
Bump org.slf4j:slf4j-api from 2.0.9 to 2.0.10
Bumps org.slf4j:slf4j-api from 2.0.9 to 2.0.10.

---
updated-dependencies:
- dependency-name: org.slf4j:slf4j-api
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-29 15:36:14 +00:00
RK_01
cb32d8b264
Merge pull request #25 from ViaVersion/dependabot/gradle/com.google.guava-guava-33.0.0-jre
Bump com.google.guava:guava from 32.1.3-jre to 33.0.0-jre
2023-12-19 16:53:27 +01:00
dependabot[bot]
6e806dd31e
Bump com.google.guava:guava from 32.1.3-jre to 33.0.0-jre
Bumps [com.google.guava:guava](https://github.com/google/guava) from 32.1.3-jre to 33.0.0-jre.
- [Release notes](https://github.com/google/guava/releases)
- [Commits](https://github.com/google/guava/commits)

---
updated-dependencies:
- dependency-name: com.google.guava:guava
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-19 15:46:21 +00:00
RaphiMC
492f973e59
Actually added 1.20.5 to VersionEnum 2023-12-19 00:40:03 +01:00
RaphiMC
a83a50d2b7
Added 1.20.5 to VersionEnum 2023-12-19 00:36:31 +01:00
RaphiMC
ff5da9ed21
Updated gradle wrapper 2023-12-13 23:05:57 +01:00
RaphiMC
fa96c19326
Fixed RakMessageEncapsulationCodec 2023-12-11 00:58:24 +01:00
RaphiMC
c11aabae47
Updated ViaBedrock 2023-12-08 00:46:53 +01:00
RaphiMC
cbfa134a6e
Bump version to 2.2.13-SNAPSHOT 2023-12-07 16:30:54 +01:00
RaphiMC
b42553d6fe
Actual Release 2.2.12 2023-12-07 16:18:24 +01:00
RaphiMC
08a8106330
Release 2.2.12 2023-12-07 16:16:48 +01:00
RaphiMC
001b540eb4
Bump version to 2.2.12-SNAPSHOT 2023-12-05 19:59:37 +01:00
RaphiMC
c0e411bc14
Release 2.2.11 2023-12-05 19:40:21 +01:00
RaphiMC
337c355866
Merge remote-tracking branch 'origin/main' 2023-12-04 00:01:24 +01:00
RaphiMC
03fd2473e9
Fixed invalid RakNet frame behaviour 2023-12-04 00:01:07 +01:00
FlorianMichael
1a1e1deeda
Added VersionRange#equals to compare version ranges. 2023-11-24 17:59:50 +01:00
FlorianMichael
b25f99f1f4
Added VersionRange#fromString 2023-11-24 17:44:47 +01:00
FlorianMichael
d3b829f25c
Fixed VersionRange#toString not working with multiple ranges 2023-11-24 17:43:27 +01:00
FlorianMichael
9e90d1f098
Added VersionEnum#fromProtocolName 2023-11-24 17:34:00 +01:00
FlorianMichael
50c7f623a6
Updated copyright header 2023-11-24 17:11:10 +01:00
RaphiMC
e0dfc6556e
Updated README 2023-11-12 18:00:30 +01:00
RaphiMC
0e09507ede
Fixed protocol registry sorting issue 2023-11-12 02:44:23 +01:00
RaphiMC
f4bcebe13e
Fixed dependencies 2023-11-06 12:55:46 +01:00
RaphiMC
d9aaeb1bc6
Fixed dependencies 2023-11-06 12:48:19 +01:00
RaphiMC
07224d93a2
Only depend on VV common 2023-11-06 12:40:37 +01:00
RaphiMC
6fd4382d44
Updated jenkins link 2023-10-17 13:10:05 +02:00
RaphiMC
727a7359be
Added GH workflow for building 2023-10-17 12:58:37 +02:00
RaphiMC
041b7a86f7
Updated platforms 2023-10-11 20:46:42 +02:00
RaphiMC
05c5cc1725
Updated Via* 2023-10-11 20:36:01 +02:00
RK_01
0ac5893da4
Merge pull request #22 from FlorianMichael/main
Updated Via* API usage
2023-10-08 10:47:20 +02:00
FlorianMichael
67b6ca444c
Updated README 2023-10-08 09:31:47 +02:00
FlorianMichael
e46d9be16a
Updated Via* API usage 2023-10-08 09:30:40 +02:00
RaphiMC
bd1801e3aa
Added 1.20.3 to VersionEnum 2023-10-07 19:45:25 +02:00
RaphiMC
24f97129e0
Bump version to 2.2.11-SNAPSHOT 2023-10-07 19:37:59 +02:00
RaphiMC
9f670cf50d
Release 2.2.10 2023-10-07 19:25:06 +02:00
RaphiMC
26fb7deeb0
Updated Via* API usage (Via 4.8.1) 2023-10-07 19:13:21 +02:00
EnZaXD
949d5e9275
Mention ViaBedrock and updated VF description 2023-09-23 19:41:11 +02:00
RaphiMC
8af1db5e89
Bump version to 2.2.10-SNAPSHOT 2023-09-21 18:42:34 +02:00
RaphiMC
f41de68c55
Release 2.2.9 2023-09-21 18:03:25 +02:00
RaphiMC
c6d543be31
Merge remote-tracking branch 'origin/main' 2023-09-20 19:58:30 +02:00
RaphiMC
91cee66bb3
Updated ViaBedrock 2023-09-20 19:58:16 +02:00
FlorianMichael
1728fc2037
Updated ViaRewind usage 2023-09-10 22:32:37 +02:00
RaphiMC
d985f1548c
Fixed gradle dependency issues 2023-09-08 12:54:57 +02:00
RaphiMC
af77d74421
Removed custom repo for gradle plugins 2023-09-07 19:31:49 +02:00
RaphiMC
a26929a511
Replaced blossom with ClassTokenReplacer 2023-09-05 21:28:01 +02:00
RaphiMC
87d80dea5c
Updated ViaRewind usage 2023-09-04 19:08:26 +02:00
RK_01
4aa03b5441
Merge pull request #21 from ViaVersion/dependabot/gradle/org.slf4j-slf4j-api-2.0.9
Bump org.slf4j:slf4j-api from 2.0.7 to 2.0.9
2023-09-04 17:10:21 +02:00
dependabot[bot]
d66f12b4c7
Bump org.slf4j:slf4j-api from 2.0.7 to 2.0.9
Bumps org.slf4j:slf4j-api from 2.0.7 to 2.0.9.

---
updated-dependencies:
- dependency-name: org.slf4j:slf4j-api
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-04 15:10:12 +00:00
RaphiMC
389e54505b
Use implementation instead of compileOnly 2023-09-03 23:57:59 +02:00
RaphiMC
e30cd6f23b
Updated gradle 2023-09-03 22:35:26 +02:00
RaphiMC
9e1ead2829
Merge remote-tracking branch 'origin/main' 2023-09-03 00:49:57 +02:00
RaphiMC
9bcf32381e
Updated gradle 2023-09-03 00:49:48 +02:00
RK_01
2b000be0f6
Merge pull request #19 from ViaVersion/dependabot/gradle/org.yaml-snakeyaml-2.2
Bump org.yaml:snakeyaml from 2.1 to 2.2
2023-08-28 17:42:09 +02:00
dependabot[bot]
8da024be6b
Bump org.yaml:snakeyaml from 2.1 to 2.2
Bumps [org.yaml:snakeyaml](https://bitbucket.org/snakeyaml/snakeyaml) from 2.1 to 2.2.
- [Commits](https://bitbucket.org/snakeyaml/snakeyaml/branches/compare/snakeyaml-2.2..snakeyaml-2.1)

---
updated-dependencies:
- dependency-name: org.yaml:snakeyaml
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-08-28 15:21:13 +00:00
EnZaXD
ec9786cdf8
Update README.md 2023-08-15 22:33:01 +02:00
RaphiMC
4ffa6e3c60
Updated build.gradle 2023-08-15 21:24:41 +02:00
RaphiMC
b7ae73a28d
Bump version to 2.2.9-SNAPSHOT / Added 1.20.2 to VersionEnum 2023-08-09 22:40:33 +02:00
RaphiMC
03a93c8ba3
Release 2.2.8 2023-08-09 22:23:27 +02:00
RK_01
c571fbb335
Merge pull request #18 from ViaVersion/dependabot/gradle/org.yaml-snakeyaml-2.1
Bump org.yaml:snakeyaml from 2.0 to 2.1
2023-08-04 17:16:30 +02:00
dependabot[bot]
ee37b3a7e5
Bump org.yaml:snakeyaml from 2.0 to 2.1
Bumps [org.yaml:snakeyaml](https://bitbucket.org/snakeyaml/snakeyaml) from 2.0 to 2.1.
- [Commits](https://bitbucket.org/snakeyaml/snakeyaml/branches/compare/snakeyaml-2.1..snakeyaml-2.0)

---
updated-dependencies:
- dependency-name: org.yaml:snakeyaml
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-08-04 15:15:39 +00:00
EnZaXD
08b13e5faa
Added ViaBedrock to tutorial (#17) 2023-08-03 22:38:05 +02:00
EnZaXD
f1b7e9edfd
Updated link 2023-07-25 19:41:48 +02:00
RaphiMC
57178ef77b
Fixed build error 2023-07-24 20:57:04 +02:00
RaphiMC
7fb8546fbb
Improved VersionRange to allow multiple ranges 2023-07-24 20:53:54 +02:00
RaphiMC
a63f0d17b5
Updated build.gradle 2023-06-30 23:56:06 +02:00
RaphiMC
8b628cad9f
Bump version to 2.2.8-SNAPSHOT 2023-06-18 15:31:28 +02:00
RaphiMC
008ab37003
Release 2.2.7 2023-06-18 15:26:59 +02:00
RaphiMC
8b4c11975e
Renamed 1.20 protocol version 2023-06-12 16:54:47 +02:00
RaphiMC
ff65f86a95
Bump version to 2.2.7-SNAPSHOT 2023-06-09 12:19:35 +02:00
RaphiMC
a30937c339
Release 2.2.6 2023-06-09 12:16:10 +02:00
RaphiMC
dafa55e202
Corrected ordering of bedrock version 2023-06-08 20:15:33 +02:00
RaphiMC
dd8860f31e
Bump version to 2.2.6-SNAPSHOT 2023-06-08 14:02:53 +02:00
41 changed files with 373 additions and 687 deletions

1
.github/FUNDING.yml vendored Normal file
View File

@ -0,0 +1 @@
ko_fi: rk_01

25
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,25 @@
name: build
on: [push, pull_request, workflow_dispatch]
jobs:
build:
runs-on: ubuntu-22.04
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 21
check-latest: true
- name: Build with Gradle
run: ./gradlew build
- name: Upload Artifacts to GitHub
uses: actions/upload-artifact@v3
with:
name: Artifacts
path: build/libs/

View File

@ -1,6 +1,6 @@
<component name="CopyrightManager">
<copyright>
<option name="notice" value="This file is part of ViaProtocolHack - https://github.com/RaphiMC/ViaProtocolHack&#10;Copyright (C) &amp;#36;today.year RK_01/RaphiMC and contributors&#10;&#10;This program is free software: you can redistribute it and/or modify&#10;it under the terms of the GNU General Public License as published by&#10;the Free Software Foundation, either version 3 of the License, or&#10;(at your option) any later version.&#10;&#10;This program is distributed in the hope that it will be useful,&#10;but WITHOUT ANY WARRANTY; without even the implied warranty of&#10;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the&#10;GNU General Public License for more details.&#10;&#10;You should have received a copy of the GNU General Public License&#10;along with this program. If not, see &lt;http://www.gnu.org/licenses/&gt;." />
<option name="notice" value="This file is part of ViaLoader - https://github.com/RaphiMC/ViaLoader&#10;Copyright (C) 2020-&amp;#36;today.year RK_01/RaphiMC and contributors&#10;&#10;This program is free software: you can redistribute it and/or modify&#10;it under the terms of the GNU General Public License as published by&#10;the Free Software Foundation, either version 3 of the License, or&#10;(at your option) any later version.&#10;&#10;This program is distributed in the hope that it will be useful,&#10;but WITHOUT ANY WARRANTY; without even the implied warranty of&#10;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the&#10;GNU General Public License for more details.&#10;&#10;You should have received a copy of the GNU General Public License&#10;along with this program. If not, see &lt;http://www.gnu.org/licenses/&gt;." />
<option name="myName" value="GPL-3.0" />
</copyright>
</component>

View File

@ -1,11 +1,11 @@
# ViaLoader
Easy to use ViaVersion, (and optional ViaBackwards, ViaRewind, ViaLegacy and ViaAprilFools) platform implementation.
Easy to use ViaVersion, (and optional ViaBackwards, ViaRewind, ViaLegacy, ViaAprilFools and ViaBedrock) platform implementation.
ViaLoader is not usable by itself as a standalone software, as it is an implementation of a ViaVersion platform.
### Projects implementing ViaLoader
- [ViaProxy](https://github.com/ViaVersion/ViaProxy): Standalone proxy which allows players to join EVERY Minecraft server version (Classic, Alpha, Beta, Release, Bedrock).
- [ViaForge](https://github.com/ViaVersion/ViaForge): Clientside ViaVersion, ViaBackwards and ViaRewind implementation for Forge.
- [ViaForge](https://github.com/ViaVersion/ViaForge): Client-side Implementation of ViaVersion, ViaBackwards and ViaRewind for Legacy Minecraft Forge.
- [ViaFabricPlus](https://github.com/ViaVersion/ViaFabricPlus): Fabric mod to connect to EVERY Minecraft server version (Release, Beta, Alpha, Classic, Snapshots, Bedrock) with QoL fixes to the gameplay.
## Releases
@ -17,7 +17,7 @@ repositories {
}
dependencies {
implementation("net.raphimc:ViaLoader:2.2.5-SNAPSHOT") // Get latest version from releases
implementation("net.raphimc:ViaLoader:x.x.x") // Get latest version from releases
}
```
@ -33,42 +33,41 @@ dependencies {
<dependency>
<groupId>net.raphimc</groupId>
<artifactId>ViaLoader</artifactId>
<version>2.2.5</version> <!-- Get latest version from releases -->
<version>x.x.x</version> <!-- Get latest version from releases -->
</dependency>
</dependencies>
```
### Jar File
If you just want the latest jar file you can download it from this [Jenkins](https://ci.viaversion.com/view/All/job/ViaLoader/).
If you just want the latest jar file you can download it from [GitHub Actions](https://github.com/RaphiMC/ViaLoader/actions/workflows/build.yml) or the [ViaVersion Jenkins](https://ci.viaversion.com/view/All/job/ViaLoader/).
## Usage
To use ViaLoader in your project you need to decide what components of Via* you want to use.
ViaLoader is split into 5 different components:
ViaLoader is split into 6 different components:
- ViaVersion (Is the base component of ViaLoader [required])
- ViaBackwards (Allows older clients to join to newer server versions [needs ViaVersion])
- ViaRewind (Allows 1.8.x and 1.7.x clients to join to 1.9+ servers [needs ViaBackwards])
- ViaLegacy (Allows clients to join to <= 1.7.10 servers [needs ViaVersion])
- ViaAprilFools (Allows clients to join to some notable Minecraft snapshots [needs ViaBackwards])
- ViaBedrock (Allows clients to join to Bedrock edition servers [needs ViaVersion])
To include the subcomponents you have to add the ViaVersion maven repository to your build script:
In case you want to include ViaBedrock, you have to add the Lenni0451 maven repository to your build script:
```groovy
repositories {
maven {
name = "ViaVersion"
url "https://repo.viaversion.com"
name = "Lenni0451"
url = "https://maven.lenni0451.net/everything"
}
}
```
Here is an example dependency configuration for all components:
```groovy
implementation "com.viaversion:viaversion:4.7.0"
implementation("com.viaversion:viabackwards-common:4.7.0") {
exclude group: "com.viaversion", module: "viaversion" // Exclude transitive dependency. Include manually for more control
exclude group: "io.netty", module: "netty-all" // Don't include the outdated netty version
}
implementation "com.viaversion:viarewind-core:2.0.4-SNAPSHOT"
implementation "net.raphimc:ViaLegacy:2.2.17"
implementation "net.raphimc:ViaAprilFools:2.0.7"
implementation "com.viaversion:viaversion:5.0.1"
implementation "com.viaversion:viabackwards-common:5.0.1"
implementation "com.viaversion:viarewind-common:4.0.0"
implementation "net.raphimc:ViaLegacy:3.0.1"
implementation "net.raphimc:ViaAprilFools:3.0.0"
implementation "net.raphimc:ViaBedrock:0.0.9-SNAPSHOT"
```
## Implementation
@ -83,8 +82,8 @@ Here is an example implementation:
```java
Via.getManager().getProviders().use(VersionProvider.class, new BaseVersionProvider() {
@Override
public int getClosestServerProtocol(UserConnection connection) {
return ProtocolVersion.v1_8.getVersion(); // Change the logic here to select the target server version
public ProtocolVersion getClosestServerProtocol(UserConnection connection) {
return ProtocolVersion.v1_8; // Change the logic here to select the target server version
}
});
```
@ -100,7 +99,7 @@ After you have initialized the Via* platforms you can start implementing ViaLoad
The most important part is the modification of your netty pipeline. This is needed for ViaVersion to translate the packets in both ways.
Here is an example implementation:
```java
final UserConnection user = new UserConnectionImpl(channel, true);
final UserConnection user = new UserConnectionImpl(channel, true/*clientside or serverside*/);
new ProtocolPipelineImpl(user);
channel.pipeline().addBefore("packet_codec", VLPipeline.VIA_CODEC_NAME, new ViaCodec(user));
@ -115,13 +114,13 @@ Now you should have a working protocol translator implementation in your project
To change the protocol translation settings/features you can look into the ViaLoader folder.
You can find 5 config files there depending on the platforms loaded:
- viaversion.yml (ViaVersion)
- config.yml (ViaBackwards)
- viabackwards.yml (ViaBackwards)
- viarewind.yml (ViaRewind)
- vialegacy.yml (ViaLegacy)
- viabedrock.yml (ViaBedrock)
## Contact
If you encounter any issues, please report them on the
[issue tracker](https://github.com/RaphiMC/ViaLoader/issues).
[issue tracker](https://github.com/ViaVersion/ViaLoader/issues).
If you just want to talk or need help implementing ViaLoader feel free to join the ViaVersion
[Discord](https://discord.gg/viaversion).

View File

@ -1,25 +1,23 @@
plugins {
id "java-library"
id "maven-publish"
id "net.kyori.blossom" version "1.3.1"
id "net.raphimc.class-token-replacer" version "1.1.2"
}
java.toolchain.languageVersion = JavaLanguageVersion.of(8)
compileJava.options.encoding = compileTestJava.options.encoding = javadoc.options.encoding = "UTF-8"
base {
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
compileJava.options.encoding = compileTestJava.options.encoding = javadoc.options.encoding = "UTF-8"
group = project.maven_group
archivesBaseName = project.maven_name
version = project.maven_version
group = project.maven_group ?: rootProject.maven_group
archivesName = project.maven_name ?: rootProject.maven_name
version = project.maven_version ?: rootProject.maven_version
}
repositories {
mavenCentral()
maven {
name = "Lenni0451"
url "https://maven.lenni0451.net/releases"
}
maven {
name = "Lenni0451 Snapshots"
url "https://maven.lenni0451.net/snapshots"
url "https://maven.lenni0451.net/everything"
}
maven {
name = "OpenCollab Releases"
@ -33,36 +31,41 @@ repositories {
name = "ViaVersion"
url "https://repo.viaversion.com"
}
maven {
name = "Minecraft Libraries"
url "https://libraries.minecraft.net"
}
}
dependencies {
compileOnly "com.viaversion:viaversion:4.7.0"
compileOnly("com.viaversion:viabackwards-common:4.7.0") {
exclude group: "com.viaversion", module: "viaversion"
exclude group: "io.netty", module: "netty-all"
}
compileOnly "com.viaversion:viarewind-core:2.0.4-SNAPSHOT"
compileOnly "net.raphimc:ViaLegacy:2.2.17"
compileOnly "net.raphimc:ViaAprilFools:2.0.7"
compileOnly "net.raphimc:ViaBedrock:0.0.2-SNAPSHOT"
compileOnly "org.cloudburstmc.netty:netty-transport-raknet:1.0.0.CR1-SNAPSHOT"
compileOnly "com.viaversion:viaversion-common:5.0.1"
compileOnly "com.viaversion:viabackwards-common:5.0.1"
compileOnly "com.viaversion:viarewind-common:4.0.0"
compileOnly "net.raphimc:ViaLegacy:3.0.1"
compileOnly "net.raphimc:ViaAprilFools:3.0.0"
compileOnly "net.raphimc:ViaBedrock:0.0.9-SNAPSHOT"
compileOnly "org.cloudburstmc.netty:netty-transport-raknet:1.0.0.CR3-SNAPSHOT"
api "org.slf4j:slf4j-api:2.0.7"
api "org.yaml:snakeyaml:2.0"
api "com.google.guava:guava:33.2.1-jre"
api "org.slf4j:slf4j-api:2.0.13"
api "org.yaml:snakeyaml:2.2"
}
blossom {
replaceToken("\${version}", project.version, "src/main/java/net/raphimc/vialoader/ViaLoader.java")
sourceSets {
main {
classTokenReplacer {
property("\${version}", project.version)
}
}
}
java {
withSourcesJar()
withJavadocJar()
}
jar {
from("LICENSE") {
rename { "${it}_${project.archivesBaseName}" }
rename { "${it}_${project.name ?: rootProject.name}" }
}
}
@ -71,6 +74,7 @@ publishing {
maven {
name = "Via"
url = "https://repo.viaversion.com/"
credentials(PasswordCredentials)
authentication {
basic(BasicAuthentication)
@ -84,6 +88,28 @@ publishing {
version = project.maven_version
from components.java
pom {
name = "ViaLoader"
description = "Implementation of a ViaVersion based protocol translator platform"
url = "https://github.com/ViaVersion/ViaLoader"
licenses {
license {
name = "GPL-3.0 License"
url = "https://github.com/ViaVersion/ViaLoader/blob/main/LICENSE"
}
}
developers {
developer {
id = "RK_01"
}
}
scm {
connection = "scm:git:git://github.com/ViaVersion/ViaLoader.git"
developerConnection = "scm:git:ssh://github.com/ViaVersion/ViaLoader.git"
url = "https://github.com/ViaVersion/ViaLoader.git"
}
}
}
}
}

View File

@ -1,9 +1,7 @@
# Gradle properties
org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.configureondemand=true
# Project properties
maven_name=ViaLoader
maven_group=net.raphimc
maven_version=2.2.5
maven_name=ViaLoader
maven_version=3.0.2-SNAPSHOT

Binary file not shown.

View File

@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

35
gradlew vendored Normal file → Executable file
View File

@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
@ -80,13 +80,11 @@ do
esac
done
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
APP_NAME="Gradle"
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
@ -133,22 +131,29 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi
# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
@ -193,11 +198,15 @@ if "$cygwin" || "$msys" ; then
done
fi
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \

21
gradlew.bat vendored
View File

@ -26,6 +26,7 @@ if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@ -42,11 +43,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
@ -56,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail

View File

@ -5,4 +5,8 @@ pluginManagement {
}
}
plugins {
id "org.gradle.toolchains.foojay-resolver-convention" version "0.8.0"
}
rootProject.name = "ViaLoader"

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaLoader - https://github.com/RaphiMC/ViaLoader
* Copyright (C) 2023 RK_01/RaphiMC and contributors
* Copyright (C) 2020-2024 RK_01/RaphiMC and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -55,6 +55,8 @@ public class ViaLoader {
.commandHandler(commandHandler)
.build());
Via.getConfig().reload();
if (platformSuppliers != null) {
Via.getManager().addEnableListener(() -> {
for (Supplier<?> additionalPlatformSupplier : platformSuppliers) {

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaLoader - https://github.com/RaphiMC/ViaLoader
* Copyright (C) 2023 RK_01/RaphiMC and contributors
* Copyright (C) 2020-2024 RK_01/RaphiMC and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,50 +0,0 @@
/*
* This file is part of ViaLoader - https://github.com/RaphiMC/ViaLoader
* Copyright (C) 2023 RK_01/RaphiMC and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialoader.commands.subs;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.command.ViaCommandSender;
import com.viaversion.viaversion.api.command.ViaSubCommand;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import java.util.Set;
public class ConnectionsSubCommand extends ViaSubCommand {
@Override
public String name() {
return "connections";
}
@Override
public String description() {
return "Shows a list of all connections";
}
@Override
public boolean execute(ViaCommandSender viaCommandSender, String[] strings) {
final Set<UserConnection> users = Via.getManager().getConnectionManager().getConnections();
sendMessage(viaCommandSender, "&a--- Connected users ---");
for (UserConnection user : users) {
sendMessage(viaCommandSender, "&7[&6" + user.getProtocolInfo().getUsername() + "&7] UUID: &5" + user.getProtocolInfo().getUuid() + " &7Client-Protocol: &5" + ProtocolVersion.getProtocol(user.getProtocolInfo().getProtocolVersion()).getName() + " &7Server-Protocol: &5" + ProtocolVersion.getProtocol(user.getProtocolInfo().getServerProtocolVersion()).getName());
}
return true;
}
}

View File

@ -1,67 +0,0 @@
/*
* This file is part of ViaLoader - https://github.com/RaphiMC/ViaLoader
* Copyright (C) 2023 RK_01/RaphiMC and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialoader.commands.subs;
import com.viaversion.viaversion.api.command.ViaCommandSender;
import com.viaversion.viaversion.api.command.ViaSubCommand;
import io.netty.util.ResourceLeakDetector;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
public class LeakDetectSubCommand extends ViaSubCommand {
@Override
public String name() {
return "leakdetect";
}
@Override
public String description() {
return "Sets ResourceLeakDetector level";
}
@Override
public boolean execute(ViaCommandSender viaCommandSender, String[] strings) {
if (strings.length == 1) {
try {
ResourceLeakDetector.Level level = ResourceLeakDetector.Level.valueOf(strings[0]);
ResourceLeakDetector.setLevel(level);
viaCommandSender.sendMessage("Set leak detector level to " + level);
} catch (IllegalArgumentException e) {
viaCommandSender.sendMessage("Invalid level (" + Arrays.toString(ResourceLeakDetector.Level.values()) + ")");
}
} else {
viaCommandSender.sendMessage("Current leak detection level is " + ResourceLeakDetector.getLevel());
}
return true;
}
@Override
public List<String> onTabComplete(ViaCommandSender sender, String[] args) {
if (args.length == 1) {
return Arrays.stream(ResourceLeakDetector.Level.values())
.map(Enum::name)
.filter(it -> it.startsWith(args[0]))
.collect(Collectors.toList());
}
return super.onTabComplete(sender, args);
}
}

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaLoader - https://github.com/RaphiMC/ViaLoader
* Copyright (C) 2023 RK_01/RaphiMC and contributors
* Copyright (C) 2020-2024 RK_01/RaphiMC and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -30,7 +30,7 @@ public class ViaAprilFoolsPlatformImpl implements ViaAprilFoolsPlatform {
private static final Logger LOGGER = new JLoggerToSLF4J(LoggerFactory.getLogger("ViaAprilFools"));
public ViaAprilFoolsPlatformImpl() {
this.init(this.getDataFolder());
this.init(new File(this.getDataFolder(), "viaaprilfools.yml"));
}
@Override

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaLoader - https://github.com/RaphiMC/ViaLoader
* Copyright (C) 2023 RK_01/RaphiMC and contributors
* Copyright (C) 2020-2024 RK_01/RaphiMC and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -30,7 +30,7 @@ public class ViaBackwardsPlatformImpl implements ViaBackwardsPlatform {
private static final Logger LOGGER = new JLoggerToSLF4J(LoggerFactory.getLogger("ViaBackwards"));
public ViaBackwardsPlatformImpl() {
this.init(this.getDataFolder());
this.init(new File(this.getDataFolder(), "viabackwards.yml"));
}
@Override

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaLoader - https://github.com/RaphiMC/ViaLoader
* Copyright (C) 2023 RK_01/RaphiMC and contributors
* Copyright (C) 2020-2024 RK_01/RaphiMC and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -30,7 +30,7 @@ public class ViaBedrockPlatformImpl implements ViaBedrockPlatform {
private static final Logger LOGGER = new JLoggerToSLF4J(LoggerFactory.getLogger("ViaBedrock"));
public ViaBedrockPlatformImpl() {
this.init(this.getDataFolder());
this.init(new File(this.getDataFolder(), "viabedrock.yml"));
}
@Override

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaLoader - https://github.com/RaphiMC/ViaLoader
* Copyright (C) 2023 RK_01/RaphiMC and contributors
* Copyright (C) 2020-2024 RK_01/RaphiMC and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -30,7 +30,7 @@ public class ViaLegacyPlatformImpl implements ViaLegacyPlatform {
private static final Logger LOGGER = new JLoggerToSLF4J(LoggerFactory.getLogger("ViaLegacy"));
public ViaLegacyPlatformImpl() {
this.init(this.getDataFolder());
this.init(new File(this.getDataFolder(), "vialegacy.yml"));
}
@Override

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaLoader - https://github.com/RaphiMC/ViaLoader
* Copyright (C) 2023 RK_01/RaphiMC and contributors
* Copyright (C) 2020-2024 RK_01/RaphiMC and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -17,9 +17,8 @@
*/
package net.raphimc.vialoader.impl.platform;
import com.viaversion.viarewind.api.ViaRewindPlatform;
import com.viaversion.viaversion.api.Via;
import de.gerrygames.viarewind.api.ViaRewindConfigImpl;
import de.gerrygames.viarewind.api.ViaRewindPlatform;
import net.raphimc.vialoader.util.JLoggerToSLF4J;
import org.slf4j.LoggerFactory;
@ -31,9 +30,7 @@ public class ViaRewindPlatformImpl implements ViaRewindPlatform {
private static final Logger LOGGER = new JLoggerToSLF4J(LoggerFactory.getLogger("ViaRewind"));
public ViaRewindPlatformImpl() {
final ViaRewindConfigImpl config = new ViaRewindConfigImpl(new File(Via.getPlatform().getDataFolder(), "viarewind.yml"));
config.reloadConfig();
this.init(config);
this.init(new File(getDataFolder(), "viarewind.yml"));
}
@Override
@ -41,4 +38,9 @@ public class ViaRewindPlatformImpl implements ViaRewindPlatform {
return LOGGER;
}
@Override
public File getDataFolder() {
return Via.getPlatform().getDataFolder();
}
}

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaLoader - https://github.com/RaphiMC/ViaLoader
* Copyright (C) 2023 RK_01/RaphiMC and contributors
* Copyright (C) 2020-2024 RK_01/RaphiMC and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -20,8 +20,8 @@ package net.raphimc.vialoader.impl.platform;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.ViaAPI;
import com.viaversion.viaversion.api.command.ViaCommandSender;
import com.viaversion.viaversion.api.configuration.ConfigurationProvider;
import com.viaversion.viaversion.api.configuration.ViaVersionConfig;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.platform.ViaPlatform;
import com.viaversion.viaversion.configuration.AbstractViaConfig;
import com.viaversion.viaversion.libs.gson.JsonObject;
@ -39,13 +39,13 @@ import java.util.UUID;
import java.util.concurrent.TimeUnit;
import java.util.logging.Logger;
public class ViaVersionPlatformImpl implements ViaPlatform<UUID> {
public class ViaVersionPlatformImpl implements ViaPlatform<UserConnection> {
private static final Logger LOGGER = new JLoggerToSLF4J(LoggerFactory.getLogger("ViaVersion"));
private final File dataFolder;
private final AbstractViaConfig config;
private final ViaAPI<UUID> api;
private final ViaAPI<UserConnection> api;
public ViaVersionPlatformImpl(final File rootFolder) {
this.dataFolder = new File(rootFolder, "ViaLoader");
@ -70,7 +70,7 @@ public class ViaVersionPlatformImpl implements ViaPlatform<UUID> {
@Override
public String getPluginVersion() {
return VersionInfo.VERSION;
return VersionInfo.getVersion();
}
@Override
@ -122,14 +122,9 @@ public class ViaVersionPlatformImpl implements ViaPlatform<UUID> {
return true;
}
@Override
public boolean isOldClientsAllowed() {
return true;
}
@Override
public boolean hasPlugin(String s) {
return s.equalsIgnoreCase("ViaVersion") || s.equalsIgnoreCase("ViaBackwards") || s.equalsIgnoreCase("ViaRewind");
return false; // Used for ViaPlatform#getUnsupportedSoftwareClasses
}
@Override
@ -138,7 +133,7 @@ public class ViaVersionPlatformImpl implements ViaPlatform<UUID> {
}
@Override
public ViaAPI<UUID> getApi() {
public ViaAPI<UserConnection> getApi() {
return this.api;
}
@ -147,11 +142,6 @@ public class ViaVersionPlatformImpl implements ViaPlatform<UUID> {
return this.config;
}
@Override
public ConfigurationProvider getConfigurationProvider() {
return this.config;
}
@Override
public File getDataFolder() {
return this.dataFolder;
@ -167,12 +157,10 @@ public class ViaVersionPlatformImpl implements ViaPlatform<UUID> {
}
protected AbstractViaConfig createConfig() {
final AbstractViaConfig config = new VLViaConfig(new File(this.dataFolder, "viaversion.yml"));
config.reloadConfig();
return config;
return new VLViaConfig(new File(this.dataFolder, "viaversion.yml"), this.getLogger());
}
protected ViaAPI<UUID> createApi() {
protected ViaAPI<UserConnection> createApi() {
return new VLApiBase();
}

View File

@ -1,65 +0,0 @@
/*
* This file is part of ViaLoader - https://github.com/RaphiMC/ViaLoader
* Copyright (C) 2023 RK_01/RaphiMC and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialoader.impl.providers;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
import com.viaversion.viaversion.api.protocol.packet.State;
import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.protocols.protocol1_8.ServerboundPackets1_8;
import com.viaversion.viaversion.protocols.protocol1_9to1_8.Protocol1_9To1_8;
import com.viaversion.viaversion.protocols.protocol1_9to1_8.providers.MovementTransmitterProvider;
import com.viaversion.viaversion.protocols.protocol1_9to1_8.storage.MovementTracker;
import java.util.logging.Level;
public class VLMovementTransmitterProvider extends MovementTransmitterProvider {
@Override
public Object getFlyingPacket() {
return null;
}
@Override
public Object getGroundPacket() {
return null;
}
@Override
public void sendPlayer(UserConnection user) {
if (user.getProtocolInfo().getState() != State.PLAY) {
return;
}
if (user.getEntityTracker(Protocol1_9To1_8.class).clientEntityId() == -1) {
return;
}
final MovementTracker movementTracker = user.get(MovementTracker.class);
movementTracker.incrementIdlePacket();
try {
final PacketWrapper playerMovement = PacketWrapper.create(ServerboundPackets1_8.PLAYER_MOVEMENT, user);
playerMovement.write(Type.BOOLEAN, movementTracker.isGround()); // on ground
playerMovement.scheduleSendToServer(Protocol1_9To1_8.class);
} catch (Throwable e) {
Via.getPlatform().getLogger().log(Level.WARNING, "Failed to send player movement packet", e);
}
}
}

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaLoader - https://github.com/RaphiMC/ViaLoader
* Copyright (C) 2023 RK_01/RaphiMC and contributors
* Copyright (C) 2020-2024 RK_01/RaphiMC and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -18,9 +18,20 @@
package net.raphimc.vialoader.impl.viaversion;
import com.viaversion.viaversion.ViaAPIBase;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import io.netty.buffer.ByteBuf;
import java.util.UUID;
public class VLApiBase extends ViaAPIBase<UserConnection> {
public class VLApiBase extends ViaAPIBase<UUID> {
@Override
public ProtocolVersion getPlayerProtocolVersion(final UserConnection player) {
return player.getProtocolInfo().protocolVersion();
}
@Override
public void sendRawPacket(final UserConnection player, final ByteBuf packet) {
player.scheduleSendRawPacket(packet);
}
}

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaLoader - https://github.com/RaphiMC/ViaLoader
* Copyright (C) 2023 RK_01/RaphiMC and contributors
* Copyright (C) 2020-2024 RK_01/RaphiMC and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -18,14 +18,11 @@
package net.raphimc.vialoader.impl.viaversion;
import com.viaversion.viaversion.commands.ViaCommandHandler;
import net.raphimc.vialoader.commands.subs.ConnectionsSubCommand;
import net.raphimc.vialoader.commands.subs.LeakDetectSubCommand;
public class VLCommandHandler extends ViaCommandHandler {
public VLCommandHandler() {
this.registerSubCommand(new LeakDetectSubCommand());
this.registerSubCommand(new ConnectionsSubCommand());
this.removeSubCommand("dontbugme");
}
}

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaLoader - https://github.com/RaphiMC/ViaLoader
* Copyright (C) 2023 RK_01/RaphiMC and contributors
* Copyright (C) 2020-2024 RK_01/RaphiMC and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -18,11 +18,12 @@
package net.raphimc.vialoader.impl.viaversion;
import com.viaversion.viaversion.api.platform.ViaInjector;
import com.viaversion.viaversion.libs.fastutil.ints.IntLinkedOpenHashSet;
import com.viaversion.viaversion.libs.fastutil.ints.IntSortedSet;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import com.viaversion.viaversion.libs.fastutil.objects.ObjectLinkedOpenHashSet;
import com.viaversion.viaversion.libs.gson.JsonObject;
import net.raphimc.vialoader.netty.VLPipeline;
import net.raphimc.vialoader.util.VersionEnum;
import java.util.SortedSet;
public class VLInjector implements ViaInjector {
@ -35,16 +36,14 @@ public class VLInjector implements ViaInjector {
}
@Override
public int getServerProtocolVersion() {
return this.getServerProtocolVersions().firstInt();
public ProtocolVersion getServerProtocolVersion() {
return this.getServerProtocolVersions().first();
}
@Override
public IntSortedSet getServerProtocolVersions() {
final IntSortedSet versions = new IntLinkedOpenHashSet();
for (VersionEnum version : VersionEnum.OFFICIAL_SUPPORTED_PROTOCOLS) {
versions.add(version.getOriginalVersion());
}
public SortedSet<ProtocolVersion> getServerProtocolVersions() {
final SortedSet<ProtocolVersion> versions = new ObjectLinkedOpenHashSet<>();
versions.addAll(ProtocolVersion.getProtocols());
return versions;
}

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaLoader - https://github.com/RaphiMC/ViaLoader
* Copyright (C) 2023 RK_01/RaphiMC and contributors
* Copyright (C) 2020-2024 RK_01/RaphiMC and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -17,16 +17,12 @@
*/
package net.raphimc.vialoader.impl.viaversion;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.platform.ViaPlatformLoader;
import com.viaversion.viaversion.protocols.protocol1_9to1_8.providers.MovementTransmitterProvider;
import net.raphimc.vialoader.impl.providers.VLMovementTransmitterProvider;
public class VLLoader implements ViaPlatformLoader {
@Override
public void load() {
Via.getManager().getProviders().use(MovementTransmitterProvider.class, new VLMovementTransmitterProvider());
}
@Override

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaLoader - https://github.com/RaphiMC/ViaLoader
* Copyright (C) 2023 RK_01/RaphiMC and contributors
* Copyright (C) 2020-2024 RK_01/RaphiMC and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -25,20 +25,20 @@ import java.io.File;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
public class VLViaConfig extends AbstractViaConfig {
protected final List<String> UNSUPPORTED = Lists.newArrayList(
"checkforupdates", "bungee-ping-interval", "bungee-ping-save", "bungee-servers",
"velocity-ping-interval", "velocity-ping-save", "velocity-servers",
"check-for-updates", "velocity-ping-interval", "velocity-ping-save", "velocity-servers",
"block-protocols", "block-disconnect-msg", "reload-disconnect-msg", "max-pps",
"max-pps-kick-msg", "tracking-period", "tracking-warning-pps", "tracking-max-warnings", "tracking-max-kick-msg",
"blockconnection-method", "quick-move-action-fix", "item-cache", "change-1_9-hitbox", "change-1_14-hitbox",
"use-new-deathmessages", "nms-player-ticking"
);
public VLViaConfig(final File configFile) {
super(configFile);
public VLViaConfig(final File configFile, final Logger logger) {
super(configFile, logger);
}
@Override

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaLoader - https://github.com/RaphiMC/ViaLoader
* Copyright (C) 2023 RK_01/RaphiMC and contributors
* Copyright (C) 2020-2024 RK_01/RaphiMC and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaLoader - https://github.com/RaphiMC/ViaLoader
* Copyright (C) 2023 RK_01/RaphiMC and contributors
* Copyright (C) 2020-2024 RK_01/RaphiMC and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -18,18 +18,19 @@
package net.raphimc.vialoader.netty;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import com.viaversion.viaversion.api.protocol.version.VersionType;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import net.raphimc.viabedrock.api.protocol.BedrockBaseProtocol;
import net.raphimc.viabedrock.netty.BatchLengthCodec;
import net.raphimc.viabedrock.netty.PacketEncapsulationCodec;
import net.raphimc.viabedrock.protocol.BedrockBaseProtocol;
import net.raphimc.vialegacy.api.protocol.PreNettyBaseProtocol;
import net.raphimc.vialegacy.netty.PreNettyLengthPrepender;
import net.raphimc.vialegacy.netty.PreNettyLengthRemover;
import net.raphimc.vialegacy.protocols.release.protocol1_7_2_5to1_6_4.baseprotocols.PreNettyBaseProtocol;
import net.raphimc.vialoader.netty.viabedrock.DisconnectHandler;
import net.raphimc.vialoader.netty.viabedrock.RakMessageEncapsulationCodec;
import net.raphimc.vialoader.util.VersionEnum;
public abstract class VLLegacyPipeline extends ChannelInboundHandlerAdapter {
@ -44,9 +45,9 @@ public abstract class VLLegacyPipeline extends ChannelInboundHandlerAdapter {
public static final String VIABEDROCK_PACKET_ENCAPSULATION_HANDLER_NAME = "viabedrock-packet-encapsulation";
protected final UserConnection user;
protected final VersionEnum version;
protected final ProtocolVersion version;
public VLLegacyPipeline(final UserConnection user, final VersionEnum version) {
public VLLegacyPipeline(final UserConnection user, final ProtocolVersion version) {
this.user = user;
this.version = version;
}
@ -56,11 +57,12 @@ public abstract class VLLegacyPipeline extends ChannelInboundHandlerAdapter {
ctx.pipeline().addBefore(this.packetDecoderName(), VIA_DECODER_NAME, this.createViaDecoder());
ctx.pipeline().addBefore(this.packetEncoderName(), VIA_ENCODER_NAME, this.createViaEncoder());
if (this.version.isOlderThanOrEqualTo(VersionEnum.r1_6_4)) {
final ProtocolVersion r1_6_4 = ProtocolVersion.getProtocol(VersionType.RELEASE_INITIAL, 78);
if (r1_6_4.isKnown() && this.version.olderThanOrEqualTo(r1_6_4)) {
this.user.getProtocolInfo().getPipeline().add(PreNettyBaseProtocol.INSTANCE);
ctx.pipeline().addBefore(this.lengthSplitterName(), VIALEGACY_PRE_NETTY_LENGTH_PREPENDER_NAME, this.createViaLegacyPreNettyLengthPrepender());
ctx.pipeline().addBefore(this.lengthPrependerName(), VIALEGACY_PRE_NETTY_LENGTH_REMOVER_NAME, this.createViaLegacyPreNettyLengthRemover());
} else if (this.version.equals(VersionEnum.bedrockLatest)) {
} else if (this.version.getName().startsWith("Bedrock")) {
this.user.getProtocolInfo().getPipeline().add(BedrockBaseProtocol.INSTANCE);
ctx.pipeline().addBefore(this.lengthSplitterName(), VIABEDROCK_DISCONNECT_HANDLER_NAME, this.createViaBedrockDisconnectHandler());
ctx.pipeline().addBefore(this.lengthSplitterName(), VIABEDROCK_FRAME_ENCAPSULATION_HANDLER_NAME, this.createViaBedrockFrameEncapsulationHandler());

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaLoader - https://github.com/RaphiMC/ViaLoader
* Copyright (C) 2023 RK_01/RaphiMC and contributors
* Copyright (C) 2020-2024 RK_01/RaphiMC and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -18,18 +18,19 @@
package net.raphimc.vialoader.netty;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import com.viaversion.viaversion.api.protocol.version.VersionType;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.channel.ChannelPipeline;
import net.raphimc.viabedrock.api.protocol.BedrockBaseProtocol;
import net.raphimc.viabedrock.netty.BatchLengthCodec;
import net.raphimc.viabedrock.netty.PacketEncapsulationCodec;
import net.raphimc.viabedrock.protocol.BedrockBaseProtocol;
import net.raphimc.vialegacy.api.protocol.PreNettyBaseProtocol;
import net.raphimc.vialegacy.netty.PreNettyLengthCodec;
import net.raphimc.vialegacy.protocols.release.protocol1_7_2_5to1_6_4.baseprotocols.PreNettyBaseProtocol;
import net.raphimc.vialoader.netty.viabedrock.DisconnectHandler;
import net.raphimc.vialoader.netty.viabedrock.RakMessageEncapsulationCodec;
import net.raphimc.vialoader.util.VersionEnum;
public abstract class VLPipeline extends ChannelInboundHandlerAdapter {
@ -42,9 +43,9 @@ public abstract class VLPipeline extends ChannelInboundHandlerAdapter {
public static final String VIABEDROCK_PACKET_ENCAPSULATION_HANDLER_NAME = "viabedrock-packet-encapsulation";
protected final UserConnection user;
protected final VersionEnum version;
protected final ProtocolVersion version;
public VLPipeline(final UserConnection user, final VersionEnum version) {
public VLPipeline(final UserConnection user, final ProtocolVersion version) {
this.user = user;
this.version = version;
}
@ -53,10 +54,11 @@ public abstract class VLPipeline extends ChannelInboundHandlerAdapter {
public void handlerAdded(ChannelHandlerContext ctx) {
ctx.pipeline().addBefore(this.packetCodecName(), VIA_CODEC_NAME, this.createViaCodec());
if (this.version.isOlderThanOrEqualTo(VersionEnum.r1_6_4)) {
final ProtocolVersion r1_6_4 = ProtocolVersion.getProtocol(VersionType.RELEASE_INITIAL, 78);
if (r1_6_4.isKnown() && this.version.olderThanOrEqualTo(r1_6_4)) {
this.user.getProtocolInfo().getPipeline().add(PreNettyBaseProtocol.INSTANCE);
ctx.pipeline().addBefore(this.lengthCodecName(), VIALEGACY_PRE_NETTY_LENGTH_CODEC_NAME, this.createViaLegacyPreNettyLengthCodec());
} else if (this.version.equals(VersionEnum.bedrockLatest)) {
} else if (this.version.getName().startsWith("Bedrock")) {
this.user.getProtocolInfo().getPipeline().add(BedrockBaseProtocol.INSTANCE);
ctx.pipeline().addBefore(this.lengthCodecName(), VIABEDROCK_DISCONNECT_HANDLER_NAME, this.createViaBedrockDisconnectHandler());
ctx.pipeline().addBefore(this.lengthCodecName(), VIABEDROCK_FRAME_ENCAPSULATION_HANDLER_NAME, this.createViaBedrockFrameEncapsulationHandler());

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaLoader - https://github.com/RaphiMC/ViaLoader
* Copyright (C) 2023 RK_01/RaphiMC and contributors
* Copyright (C) 2020-2024 RK_01/RaphiMC and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaLoader - https://github.com/RaphiMC/ViaLoader
* Copyright (C) 2023 RK_01/RaphiMC and contributors
* Copyright (C) 2020-2024 RK_01/RaphiMC and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaLoader - https://github.com/RaphiMC/ViaLoader
* Copyright (C) 2023 RK_01/RaphiMC and contributors
* Copyright (C) 2020-2024 RK_01/RaphiMC and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaLoader - https://github.com/RaphiMC/ViaLoader
* Copyright (C) 2023 RK_01/RaphiMC and contributors
* Copyright (C) 2020-2024 RK_01/RaphiMC and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaLoader - https://github.com/RaphiMC/ViaLoader
* Copyright (C) 2023 RK_01/RaphiMC and contributors
* Copyright (C) 2020-2024 RK_01/RaphiMC and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaLoader - https://github.com/RaphiMC/ViaLoader
* Copyright (C) 2023 RK_01/RaphiMC and contributors
* Copyright (C) 2020-2024 RK_01/RaphiMC and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -21,6 +21,7 @@ import io.netty.buffer.ByteBuf;
import io.netty.buffer.CompositeByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToMessageCodec;
import net.raphimc.viabedrock.ViaBedrock;
import org.cloudburstmc.netty.channel.raknet.RakReliability;
import org.cloudburstmc.netty.channel.raknet.packet.RakMessage;
@ -36,7 +37,7 @@ public class RakMessageEncapsulationCodec extends MessageToMessageCodec<RakMessa
try {
buf.addComponent(true, ctx.alloc().ioBuffer(1).writeByte(FRAME_ID));
buf.addComponent(true, msg.retainedSlice());
out.add(buf.retain());
out.add(new RakMessage(buf.retain()));
} finally {
buf.release();
}
@ -52,8 +53,9 @@ public class RakMessageEncapsulationCodec extends MessageToMessageCodec<RakMessa
return;
}
final int id = in.readUnsignedByte();
if (id != FRAME_ID) {
throw new IllegalStateException("Invalid frame ID: " + id);
if (id != FRAME_ID) { // Mojang client seems to ignore invalid frames
ViaBedrock.getPlatform().getLogger().warning("Received invalid RakNet frame id: " + id);
return;
}
out.add(in.readRetainedSlice(in.readableBytes()));
}

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaLoader - https://github.com/RaphiMC/ViaLoader
* Copyright (C) 2023 RK_01/RaphiMC and contributors
* Copyright (C) 2020-2024 RK_01/RaphiMC and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -0,0 +1,34 @@
/*
* This file is part of ViaLoader - https://github.com/RaphiMC/ViaLoader
* Copyright (C) 2020-2024 RK_01/RaphiMC and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialoader.util;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class ProtocolVersionList {
public static List<ProtocolVersion> getProtocolsNewToOld() {
final List<ProtocolVersion> protocolVersions = new ArrayList<>(ProtocolVersion.getProtocols());
Collections.reverse(protocolVersions);
return Collections.unmodifiableList(protocolVersions);
}
}

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaLoader - https://github.com/RaphiMC/ViaLoader
* Copyright (C) 2023 RK_01/RaphiMC and contributors
* Copyright (C) 2020-2024 RK_01/RaphiMC and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -29,11 +29,6 @@ public class VLTask implements PlatformTask<Task> {
this.task = task;
}
@Override
public Task getObject() {
return this.task;
}
@Override
public void cancel() {
this.task.cancel();

View File

@ -1,303 +0,0 @@
/*
* This file is part of ViaLoader - https://github.com/RaphiMC/ViaLoader
* Copyright (C) 2023 RK_01/RaphiMC and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialoader.util;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import java.util.*;
public enum VersionEnum {
c0_0_15a_1(getViaLegacyProtocol("c0_0_15a_1")),
c0_0_16a_02(getViaLegacyProtocol("c0_0_16a_02")),
c0_0_18a_02(getViaLegacyProtocol("c0_0_18a_02")),
c0_0_19a_06(getViaLegacyProtocol("c0_0_19a_06")),
c0_0_20ac0_27(getViaLegacyProtocol("c0_0_20ac0_27")),
c0_30cpe(getViaLegacyProtocol("c0_30cpe")),
c0_28toc0_30(getViaLegacyProtocol("c0_28toc0_30")),
a1_0_15(getViaLegacyProtocol("a1_0_15")),
a1_0_16toa1_0_16_2(getViaLegacyProtocol("a1_0_16toa1_0_16_2")),
a1_0_17toa1_0_17_4(getViaLegacyProtocol("a1_0_17toa1_0_17_4")),
a1_1_0toa1_1_2_1(getViaLegacyProtocol("a1_1_0toa1_1_2_1")),
a1_2_0toa1_2_1_1(getViaLegacyProtocol("a1_2_0toa1_2_1_1")),
a1_2_2(getViaLegacyProtocol("a1_2_2")),
a1_2_3toa1_2_3_4(getViaLegacyProtocol("a1_2_3toa1_2_3_4")),
a1_2_3_5toa1_2_6(getViaLegacyProtocol("a1_2_3_5toa1_2_6")),
b1_0tob1_1_1(getViaLegacyProtocol("b1_0tob1_1_1")),
b1_1_2(getViaLegacyProtocol("b1_1_2")),
b1_2_0tob1_2_2(getViaLegacyProtocol("b1_2_0tob1_2_2")),
b1_3tob1_3_1(getViaLegacyProtocol("b1_3tob1_3_1")),
b1_4tob1_4_1(getViaLegacyProtocol("b1_4tob1_4_1")),
b1_5tob1_5_2(getViaLegacyProtocol("b1_5tob1_5_2")),
b1_6tob1_6_6(getViaLegacyProtocol("b1_6tob1_6_6")),
b1_7tob1_7_3(getViaLegacyProtocol("b1_7tob1_7_3")),
b1_8tob1_8_1(getViaLegacyProtocol("b1_8tob1_8_1")),
r1_0_0tor1_0_1(getViaLegacyProtocol("r1_0_0tor1_0_1")),
r1_1(getViaLegacyProtocol("r1_1")),
r1_2_1tor1_2_3(getViaLegacyProtocol("r1_2_1tor1_2_3")),
r1_2_4tor1_2_5(getViaLegacyProtocol("r1_2_4tor1_2_5")),
r1_3_1tor1_3_2(getViaLegacyProtocol("r1_3_1tor1_3_2")),
r1_4_2(getViaLegacyProtocol("r1_4_2")),
r1_4_4tor1_4_5(getViaLegacyProtocol("r1_4_4tor1_4_5")),
r1_4_6tor1_4_7(getViaLegacyProtocol("r1_4_6tor1_4_7")),
r1_5tor1_5_1(getViaLegacyProtocol("r1_5tor1_5_1")),
r1_5_2(getViaLegacyProtocol("r1_5_2")),
r1_6_1(getViaLegacyProtocol("r1_6_1")),
r1_6_2(getViaLegacyProtocol("r1_6_2")),
r1_6_4(getViaLegacyProtocol("r1_6_4")),
r1_7_2tor1_7_5(ProtocolVersion.v1_7_1),
r1_7_6tor1_7_10(ProtocolVersion.v1_7_6),
r1_8(ProtocolVersion.v1_8),
r1_9(ProtocolVersion.v1_9),
r1_9_1(ProtocolVersion.v1_9_1),
r1_9_2(ProtocolVersion.v1_9_2),
r1_9_3tor1_9_4(ProtocolVersion.v1_9_3),
r1_10(ProtocolVersion.v1_10),
r1_11(ProtocolVersion.v1_11),
r1_11_1to1_11_2(ProtocolVersion.v1_11_1),
r1_12(ProtocolVersion.v1_12),
r1_12_1(ProtocolVersion.v1_12_1),
r1_12_2(ProtocolVersion.v1_12_2),
r1_13(ProtocolVersion.v1_13),
r1_13_1(ProtocolVersion.v1_13_1),
r1_13_2(ProtocolVersion.v1_13_2),
s3d_shareware(getViaAprilFoolsProtocol("s3d_shareware")),
r1_14(ProtocolVersion.v1_14),
r1_14_1(ProtocolVersion.v1_14_1),
r1_14_2(ProtocolVersion.v1_14_2),
r1_14_3(ProtocolVersion.v1_14_3),
r1_14_4(ProtocolVersion.v1_14_4),
r1_15(ProtocolVersion.v1_15),
r1_15_1(ProtocolVersion.v1_15_1),
r1_15_2(ProtocolVersion.v1_15_2),
s20w14infinite(getViaAprilFoolsProtocol("s20w14infinite")),
r1_16(ProtocolVersion.v1_16),
r1_16_1(ProtocolVersion.v1_16_1),
sCombatTest8c(getViaAprilFoolsProtocol("sCombatTest8c")),
r1_16_2(ProtocolVersion.v1_16_2),
r1_16_3(ProtocolVersion.v1_16_3),
r1_16_4tor1_16_5(ProtocolVersion.v1_16_4),
r1_17(ProtocolVersion.v1_17),
r1_17_1(ProtocolVersion.v1_17_1),
r1_18tor1_18_1(ProtocolVersion.v1_18),
r1_18_2(ProtocolVersion.v1_18_2),
r1_19(ProtocolVersion.v1_19),
r1_19_1tor1_19_2(ProtocolVersion.v1_19_1),
r1_19_3(ProtocolVersion.v1_19_3),
bedrockLatest(getViaBedrockProtocol("bedrockLatest")),
r1_19_4(ProtocolVersion.v1_19_4),
r1_20(ProtocolVersion.v1_20),
//
UNKNOWN(ProtocolVersion.unknown), // Not in Registry
;
private static final Map<ProtocolVersion, VersionEnum> VERSION_REGISTRY = new HashMap<>();
public static final List<VersionEnum> SORTED_VERSIONS = new ArrayList<>();
public static final List<VersionEnum> OFFICIAL_SUPPORTED_PROTOCOLS = new ArrayList<>();
static {
for (VersionEnum version : VersionEnum.values()) {
if (version == UNKNOWN) continue;
if (!version.protocolVersion.isKnown()) continue;
VERSION_REGISTRY.put(version.protocolVersion, version);
}
for (VersionEnum version : VersionEnum.getAllVersions()) {
if (version.isNewerThan(VersionEnum.r1_6_4) && version != VersionEnum.s3d_shareware && version != VersionEnum.s20w14infinite && version != VersionEnum.sCombatTest8c && version != VersionEnum.bedrockLatest) {
OFFICIAL_SUPPORTED_PROTOCOLS.add(version);
}
}
SORTED_VERSIONS.add(r1_20);
SORTED_VERSIONS.add(r1_19_4);
SORTED_VERSIONS.add(r1_19_3);
SORTED_VERSIONS.add(r1_19_1tor1_19_2);
SORTED_VERSIONS.add(r1_19);
SORTED_VERSIONS.add(r1_18_2);
SORTED_VERSIONS.add(r1_18tor1_18_1);
SORTED_VERSIONS.add(r1_17_1);
SORTED_VERSIONS.add(r1_17);
SORTED_VERSIONS.add(r1_16_4tor1_16_5);
SORTED_VERSIONS.add(r1_16_3);
SORTED_VERSIONS.add(r1_16_2);
SORTED_VERSIONS.add(r1_16_1);
SORTED_VERSIONS.add(r1_16);
SORTED_VERSIONS.add(r1_15_2);
SORTED_VERSIONS.add(r1_15_1);
SORTED_VERSIONS.add(r1_15);
SORTED_VERSIONS.add(r1_14_4);
SORTED_VERSIONS.add(r1_14_3);
SORTED_VERSIONS.add(r1_14_2);
SORTED_VERSIONS.add(r1_14_1);
SORTED_VERSIONS.add(r1_14);
SORTED_VERSIONS.add(r1_13_2);
SORTED_VERSIONS.add(r1_13_1);
SORTED_VERSIONS.add(r1_13);
SORTED_VERSIONS.add(r1_12_2);
SORTED_VERSIONS.add(r1_12_1);
SORTED_VERSIONS.add(r1_12);
SORTED_VERSIONS.add(r1_11_1to1_11_2);
SORTED_VERSIONS.add(r1_11);
SORTED_VERSIONS.add(r1_10);
SORTED_VERSIONS.add(r1_9_3tor1_9_4);
SORTED_VERSIONS.add(r1_9_2);
SORTED_VERSIONS.add(r1_9_1);
SORTED_VERSIONS.add(r1_9);
SORTED_VERSIONS.add(r1_8);
SORTED_VERSIONS.add(r1_7_6tor1_7_10);
SORTED_VERSIONS.add(r1_7_2tor1_7_5);
SORTED_VERSIONS.add(r1_6_4);
SORTED_VERSIONS.add(r1_6_2);
SORTED_VERSIONS.add(r1_6_1);
SORTED_VERSIONS.add(r1_5_2);
SORTED_VERSIONS.add(r1_5tor1_5_1);
SORTED_VERSIONS.add(r1_4_6tor1_4_7);
SORTED_VERSIONS.add(r1_4_4tor1_4_5);
SORTED_VERSIONS.add(r1_4_2);
SORTED_VERSIONS.add(r1_3_1tor1_3_2);
SORTED_VERSIONS.add(r1_2_4tor1_2_5);
SORTED_VERSIONS.add(r1_2_1tor1_2_3);
SORTED_VERSIONS.add(r1_1);
SORTED_VERSIONS.add(r1_0_0tor1_0_1);
SORTED_VERSIONS.add(b1_8tob1_8_1);
SORTED_VERSIONS.add(b1_7tob1_7_3);
SORTED_VERSIONS.add(b1_6tob1_6_6);
SORTED_VERSIONS.add(b1_5tob1_5_2);
SORTED_VERSIONS.add(b1_4tob1_4_1);
SORTED_VERSIONS.add(b1_3tob1_3_1);
SORTED_VERSIONS.add(b1_2_0tob1_2_2);
SORTED_VERSIONS.add(b1_1_2);
SORTED_VERSIONS.add(b1_0tob1_1_1);
SORTED_VERSIONS.add(a1_2_3_5toa1_2_6);
SORTED_VERSIONS.add(a1_2_3toa1_2_3_4);
SORTED_VERSIONS.add(a1_2_2);
SORTED_VERSIONS.add(a1_2_0toa1_2_1_1);
SORTED_VERSIONS.add(a1_1_0toa1_1_2_1);
SORTED_VERSIONS.add(a1_0_17toa1_0_17_4);
SORTED_VERSIONS.add(a1_0_16toa1_0_16_2);
SORTED_VERSIONS.add(a1_0_15);
SORTED_VERSIONS.add(c0_28toc0_30);
SORTED_VERSIONS.add(c0_0_20ac0_27);
SORTED_VERSIONS.add(c0_0_19a_06);
SORTED_VERSIONS.add(c0_0_18a_02);
SORTED_VERSIONS.add(c0_0_16a_02);
SORTED_VERSIONS.add(c0_0_15a_1);
SORTED_VERSIONS.add(bedrockLatest);
SORTED_VERSIONS.add(sCombatTest8c);
SORTED_VERSIONS.add(s20w14infinite);
SORTED_VERSIONS.add(s3d_shareware);
SORTED_VERSIONS.add(c0_30cpe);
SORTED_VERSIONS.removeIf(v -> !v.protocolVersion.isKnown());
}
public static VersionEnum fromProtocolVersion(final ProtocolVersion protocolVersion) {
if (!protocolVersion.isKnown()) return UNKNOWN;
return VERSION_REGISTRY.getOrDefault(protocolVersion, UNKNOWN);
}
public static VersionEnum fromProtocolId(final int protocolId) {
return fromProtocolVersion(ProtocolVersion.getProtocol(protocolId));
}
public static VersionEnum fromUserConnection(final UserConnection userConnection) {
return fromUserConnection(userConnection, true);
}
public static VersionEnum fromUserConnection(final UserConnection userConnection, final boolean serverProtocol) {
return fromProtocolId(serverProtocol ? userConnection.getProtocolInfo().getServerProtocolVersion() : userConnection.getProtocolInfo().getProtocolVersion());
}
public static Collection<VersionEnum> getAllVersions() {
return VERSION_REGISTRY.values();
}
private static ProtocolVersion getViaLegacyProtocol(final String name) {
try {
return (ProtocolVersion) Class.forName("net.raphimc.vialegacy.api.LegacyProtocolVersion").getField(name).get(null);
} catch (Throwable e) {
return ProtocolVersion.unknown;
}
}
private static ProtocolVersion getViaAprilFoolsProtocol(final String name) {
try {
return (ProtocolVersion) Class.forName("net.raphimc.viaaprilfools.api.AprilFoolsProtocolVersion").getField(name).get(null);
} catch (Throwable e) {
return ProtocolVersion.unknown;
}
}
private static ProtocolVersion getViaBedrockProtocol(final String name) {
try {
return (ProtocolVersion) Class.forName("net.raphimc.viabedrock.api.BedrockProtocolVersion").getField(name).get(null);
} catch (Throwable e) {
return ProtocolVersion.unknown;
}
}
private final ProtocolVersion protocolVersion;
VersionEnum(final ProtocolVersion protocolVersion) {
this.protocolVersion = protocolVersion;
}
public ProtocolVersion getProtocol() {
return this.protocolVersion;
}
public String getName() {
return this.protocolVersion.getName();
}
public int getVersion() {
return this.protocolVersion.getVersion();
}
public int getOriginalVersion() {
return this.protocolVersion.getOriginalVersion();
}
public boolean isOlderThan(final VersionEnum other) {
return this.ordinal() < other.ordinal();
}
public boolean isOlderThanOrEqualTo(final VersionEnum other) {
return this.ordinal() <= other.ordinal();
}
public boolean isNewerThan(final VersionEnum other) {
return this.ordinal() > other.ordinal();
}
public boolean isNewerThanOrEqualTo(final VersionEnum other) {
return this.ordinal() >= other.ordinal();
}
public boolean isBetweenInclusive(final VersionEnum min, final VersionEnum max) {
return this.isNewerThanOrEqualTo(min) && this.isOlderThanOrEqualTo(max);
}
public boolean isBetweenExclusive(final VersionEnum min, final VersionEnum max) {
return this.isNewerThan(min) && this.isOlderThan(max);
}
}

View File

@ -1,6 +1,6 @@
/*
* This file is part of ViaLoader - https://github.com/RaphiMC/ViaLoader
* Copyright (C) 2023 RK_01/RaphiMC and contributors
* Copyright (C) 2020-2024 RK_01/RaphiMC and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -17,44 +17,120 @@
*/
package net.raphimc.vialoader.util;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
public class VersionRange {
private final VersionEnum lowerBound;
private final VersionEnum upperBound;
private final ProtocolVersion min;
private final ProtocolVersion max;
private final List<VersionRange> ranges;
public VersionRange(VersionEnum lowerBound, VersionEnum upperBound) {
if (lowerBound == null && upperBound == null) {
throw new RuntimeException("Invalid protocol range");
}
this.lowerBound = lowerBound;
this.upperBound = upperBound;
private VersionRange(final ProtocolVersion min, final ProtocolVersion max) {
this.min = min;
this.max = max;
this.ranges = new ArrayList<>();
}
public static VersionRange andNewer(final VersionEnum version) {
return new VersionRange(null, version);
}
public static VersionRange singleton(final VersionEnum version) {
return new VersionRange(version, version);
}
public static VersionRange andOlder(final VersionEnum version) {
public static VersionRange andNewer(final ProtocolVersion version) {
return new VersionRange(version, null);
}
public boolean contains(final VersionEnum protocolVersion) {
if (this.lowerBound != null && lowerBound.isOlderThan(protocolVersion)) return false;
public static VersionRange single(final ProtocolVersion version) {
return new VersionRange(version, version);
}
return this.upperBound == null || upperBound.isOlderThanOrEqualTo(protocolVersion);
public static VersionRange andOlder(final ProtocolVersion version) {
return new VersionRange(null, version);
}
public static VersionRange of(final ProtocolVersion min, final ProtocolVersion max) {
return new VersionRange(min, max);
}
public static VersionRange all() {
return new VersionRange(null, null);
}
public VersionRange add(final VersionRange range) {
this.ranges.add(range);
return this;
}
public boolean contains(final ProtocolVersion version) {
for (VersionRange range : this.ranges) {
if (range.contains(version)) return true;
}
if (this.min == null && this.max == null) return true;
else if (this.min == null) return version.olderThanOrEqualTo(this.max);
else if (this.max == null) return version.newerThanOrEqualTo(this.min);
return version.newerThanOrEqualTo(this.min) && version.olderThanOrEqualTo(this.max);
}
public ProtocolVersion getMin() {
return this.min;
}
public ProtocolVersion getMax() {
return this.max;
}
@Override
public String toString() {
if (lowerBound == null) return upperBound.getName() + "+";
if (upperBound == null) return lowerBound.getName() + "-";
if (lowerBound == upperBound) return lowerBound.getName();
if (this.min == null && this.max == null) return "*";
else {
StringBuilder rangeString = new StringBuilder();
if (!this.ranges.isEmpty()) {
for (VersionRange range : this.ranges) rangeString.append(", ").append(range.toString());
}
if (this.min == null) return "<= " + this.max.getName() + rangeString;
else if (this.max == null) return ">= " + this.min.getName() + rangeString;
else if (Objects.equals(this.min, this.max)) return this.min.getName();
else return this.min.getName() + " - " + this.max.getName() + rangeString;
}
}
return lowerBound.getName() + " - " + upperBound.getName();
@Override
public boolean equals(Object object) {
if (this == object) return true;
if (object == null || getClass() != object.getClass()) return false;
VersionRange that = (VersionRange) object;
return min == that.min && max == that.max && Objects.equals(ranges, that.ranges);
}
@Override
public int hashCode() {
return Objects.hash(min, max, ranges);
}
public static VersionRange fromString(String str) {
if ("*".equals(str)) return all();
else if (str.contains(",")) {
String[] rangeParts = str.split(", ");
VersionRange versionRange = null;
for (String part : rangeParts) {
if (versionRange == null) versionRange = parseSinglePart(part);
else versionRange.add(parseSinglePart(part));
}
return versionRange;
} else {
return parseSinglePart(str);
}
}
private static VersionRange parseSinglePart(String part) {
if (part.startsWith("<= ")) return andOlder(ProtocolVersion.getClosest(part.substring(3)));
else if (part.startsWith(">= ")) return andNewer(ProtocolVersion.getClosest(part.substring(3)));
else if (part.contains(" - ")) {
String[] rangeParts = part.split(" - ");
ProtocolVersion min = ProtocolVersion.getClosest(rangeParts[0]);
ProtocolVersion max = ProtocolVersion.getClosest(rangeParts[1]);
return of(min, max);
} else return single(ProtocolVersion.getClosest(part));
}
}