Skip to content

Commit 69547fe

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents 324777d + 97b411a commit 69547fe

File tree

236 files changed

+6360
-1317
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

236 files changed

+6360
-1317
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Java CI with Gradle
22

3-
on: [push, pull_request]
3+
on: [push, pull_request, workflow_dispatch]
44

55
jobs:
66
build:

.github/workflows/publish.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
branches:
55
- master
66
- dev
7+
workflow_dispatch:
78

89
jobs:
910
publish:

SECURITY.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Security Policy
2+
3+
## Reporting a Vulnerability
4+
5+
If you discover a **security vulnerability**, please **do not** open a public issue. Instead, use one of the following **confidential contact methods**:
6+
7+
* **Email:** [[email protected]](mailto:[email protected])
8+
* **Discord:** Join our [Discord server](https://discord.gg/viaversion) and visit the [#exploit-report](https://discord.com/channels/316206679014244363/1388847764137316485) channel for further instructions.
9+
10+
If your issue is **not security-related** (e.g., bug reports, feature requests, or usage questions), please use the [GitHub Issues page](https://github.com/ViaVersion/ViaVersion/issues) or contact us via the [Discord server](https://discord.gg/viaversion).

api/build.gradle.kts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,16 @@ dependencies {
2424
}
2525
implementation(rootProject.libs.text) {
2626
exclude("com.google.code.gson", "gson")
27-
exclude("com.google.guava", "guava")
2827
exclude("com.viaversion", "nbt")
2928
}
3029
api(libs.snakeYaml)
3130

3231
compileOnlyApi(libs.netty)
33-
compileOnlyApi(libs.guava)
32+
compileOnlyApi(libs.guava) {
33+
exclude("com.google.errorprone", "error_prone_annotations")
34+
exclude("org.jspecify", "jspecify")
35+
exclude("com.google.j2objc", "j2objc-annotations")
36+
}
3437
compileOnlyApi(libs.checkerQual)
3538
}
3639

api/src/main/java-templates/com/viaversion/viaversion/util/VersionInfo.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
3-
* Copyright (C) 2016-2024 ViaVersion and contributors
3+
* Copyright (C) 2016-2025 ViaVersion and contributors
44
*
55
* Permission is hereby granted, free of charge, to any person obtaining a copy
66
* of this software and associated documentation files (the "Software"), to deal

api/src/main/java/com/viaversion/viaversion/api/configuration/ViaVersionConfig.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -233,13 +233,6 @@ public interface ViaVersionConfig extends Config {
233233
*/
234234
boolean isChunkBorderFix();
235235

236-
/**
237-
* Should we fix nbt array's in json chat messages for 1.12 clients
238-
*
239-
* @return true if enabled
240-
*/
241-
boolean is1_12NBTArrayFix();
242-
243236
/**
244237
* Should we make team colours based on the last colour in team prefix
245238
*

api/src/main/java/com/viaversion/viaversion/api/connection/UserConnection.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
import com.viaversion.viaversion.api.configuration.ViaVersionConfig;
2626
import com.viaversion.viaversion.api.data.entity.EntityTracker;
27+
import com.viaversion.viaversion.api.data.item.ItemHasher;
2728
import com.viaversion.viaversion.api.minecraft.ClientWorld;
2829
import com.viaversion.viaversion.api.protocol.Protocol;
2930
import com.viaversion.viaversion.api.protocol.packet.PacketTracker;
@@ -99,6 +100,23 @@ public interface UserConnection {
99100
*/
100101
void addEntityTracker(Class<? extends Protocol> protocolClass, EntityTracker tracker);
101102

103+
/**
104+
* Adds an item hasher to the user connection.
105+
*
106+
* @param protocolClass protocol class
107+
* @param itemHasher item hasher
108+
*/
109+
void addItemHasher(Class<? extends Protocol> protocolClass, ItemHasher itemHasher);
110+
111+
/**
112+
* Returns the item hasher by the given protocol class if present.
113+
*
114+
* @param protocolClass protocol class
115+
* @param <T> item hasher type
116+
* @return item hasher if present
117+
*/
118+
@Nullable <T extends ItemHasher> T getItemHasher(Class<? extends Protocol> protocolClass);
119+
102120
/**
103121
* Returns the client world by the given protocol class if present.
104122
*

api/src/main/java/com/viaversion/viaversion/api/data/MappingDataBase.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,8 @@ public int getNewSoundId(final int id) {
208208
}
209209

210210
@Override
211-
public int getOldSoundId(final int i) {
212-
return soundMappings.getNewIdOrDefault(i, 0);
211+
public int getOldSoundId(final int id) {
212+
return soundMappings.inverse().getNewIdOrDefault(id, 0);
213213
}
214214

215215
@Override
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*
2+
* This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion
3+
* Copyright (C) 2016-2025 ViaVersion and contributors
4+
*
5+
* Permission is hereby granted, free of charge, to any person obtaining a copy
6+
* of this software and associated documentation files (the "Software"), to deal
7+
* in the Software without restriction, including without limitation the rights
8+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
* copies of the Software, and to permit persons to whom the Software is
10+
* furnished to do so, subject to the following conditions:
11+
*
12+
* The above copyright notice and this permission notice shall be included in all
13+
* copies or substantial portions of the Software.
14+
*
15+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
* SOFTWARE.
22+
*/
23+
package com.viaversion.viaversion.api.data.item;
24+
25+
import java.util.List;
26+
27+
/**
28+
* Used for converting items to hashed items and caching them for later use during serverbound packets.
29+
* <p>
30+
* Most of this stays in the internal module given non-permanent, imperfect caching as well as missing converters.
31+
*/
32+
public interface ItemHasher {
33+
34+
/**
35+
* Returns whether this connection is currently processing a clientbound player inventory packet.
36+
* <p>
37+
* Used for checking when it is necessary to track/process item data hashes.
38+
*
39+
* @return true if processing a clientbound inventory packet, false otherwise
40+
*/
41+
boolean isProcessingClientboundInventoryPacket();
42+
43+
void setProcessingClientboundInventoryPacket(boolean processingClientboundInventoryPacket);
44+
45+
/**
46+
* Sets the enchantment registry for this connection.
47+
*
48+
* @param enchantments list of enchantment identifiers
49+
*/
50+
void setEnchantments(List<String> enchantments);
51+
}

api/src/main/java/com/viaversion/viaversion/api/minecraft/GameProfile.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,31 @@
2222
*/
2323
package com.viaversion.viaversion.api.minecraft;
2424

25+
import java.util.ArrayList;
26+
import java.util.HashMap;
27+
import java.util.List;
28+
import java.util.Map;
2529
import java.util.UUID;
2630
import org.checkerframework.checker.nullness.qual.Nullable;
2731

2832
public record GameProfile(@Nullable String name, @Nullable UUID id, Property[] properties) {
2933

34+
public GameProfile(@Nullable final String name, @Nullable final UUID id) {
35+
this(name, id, new Property[0]);
36+
}
37+
38+
public Map<String, List<Property>> propertiesMap() {
39+
final Map<String, List<Property>> map = new HashMap<>();
40+
for (Property property : properties) {
41+
map.computeIfAbsent(property.name(), k -> new ArrayList<>()).add(property);
42+
}
43+
return map;
44+
}
45+
3046
public record Property(String name, String value, @Nullable String signature) {
47+
48+
public Property(final String name, final String value) {
49+
this(name, value, null);
50+
}
3151
}
3252
}

0 commit comments

Comments
 (0)