Skip to content

Commit c366a82

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents e90baa6 + d49272a commit c366a82

File tree

241 files changed

+4621
-1105
lines changed

Some content is hidden

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

241 files changed

+4621
-1105
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ jobs:
1111

1212
steps:
1313
- name: Checkout Repository
14-
uses: actions/checkout@v4
14+
uses: actions/checkout@v5
1515
with:
1616
persist-credentials: false
1717
- name: Set up Gradle
18-
uses: gradle/actions/setup-gradle@v4
18+
uses: gradle/actions/setup-gradle@v5
1919
- name: Set up JDK 17
20-
uses: actions/setup-java@v4
20+
uses: actions/setup-java@v5
2121
with:
2222
distribution: 'temurin'
2323
java-version: 17

.github/workflows/publish.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,26 @@ jobs:
1212
runs-on: ubuntu-24.04
1313
steps:
1414
- name: Checkout Repository
15-
uses: actions/checkout@v4
15+
uses: actions/checkout@v5
1616
with:
1717
persist-credentials: false
1818
- name: Set up Gradle
19-
uses: gradle/actions/setup-gradle@v4
19+
uses: gradle/actions/setup-gradle@v5
2020
- name: Set up JDK 17
21-
uses: actions/setup-java@v4
21+
uses: actions/setup-java@v5
2222
with:
2323
distribution: 'temurin'
2424
java-version: 17
2525
check-latest: true
26-
- name: Publish
26+
- name: Build
27+
run: ./gradlew build
28+
- name: Publish to Hangar
2729
env:
2830
HANGAR_TOKEN: ${{ secrets.HANGAR_TOKEN }}
31+
run: ./gradlew publishAllPublicationsToHangar --stacktrace
32+
continue-on-error: true
33+
- name: Publish to Modrinth
34+
env:
2935
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
30-
run: ./gradlew build modrinth publishAllPublicationsToHangar --stacktrace
36+
run: ./gradlew modrinth --stacktrace
37+
continue-on-error: true

.github/workflows/update-gradle-wrapper.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
runs-on: ubuntu-24.04
1010
steps:
1111
- name: Checkout Repository
12-
uses: actions/checkout@v4
12+
uses: actions/checkout@v5
1313
with:
1414
persist-credentials: false
1515
- name: Update Gradle Wrapper

.gitignore

Lines changed: 19 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -1,115 +1,36 @@
1-
### Java files ###
2-
*.class
1+
# Gradle
32

4-
# Package Files
5-
#*.jar
6-
*.war
7-
*.ear
8-
9-
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
10-
hs_err_pid*
3+
.gradle/
4+
build/
5+
out/
6+
classes/
7+
.kotlin/
118

9+
# Eclipse
1210

11+
*.launch
1312

14-
### Intellij ###
15-
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm
16-
# Ignore project files
17-
*.iml
13+
# Idea
1814

19-
# Ignore IDEA directory
20-
.idea/*
15+
.idea/
2116
!.idea/copyright/*
2217
!.idea/scopes/*
23-
24-
# Include the project's dictionary
25-
!.idea/dictionaries/
26-
!.idea/dictionaries/*
27-
28-
# File-based project format:
18+
*.iml
2919
*.ipr
3020
*.iws
3121

32-
### Plugin-specific files: ###
33-
# IntelliJ
34-
/out/
35-
36-
# mpeltonen/sbt-idea plugin
37-
.idea_modules/
22+
# VSCode
3823

39-
# JIRA plugin
40-
atlassian-ide-plugin.xml
41-
42-
# Crashlytics plugin (for Android Studio and IntelliJ)
43-
com_crashlytics_export_strings.xml
44-
crashlytics.properties
45-
crashlytics-build.properties
46-
47-
48-
49-
### Eclipse ###
50-
*.pydevproject
51-
.metadata
52-
.gradle
53-
bin/
54-
tmp/
55-
*.tmp
56-
*.bak
57-
*.swp
58-
*~.nib
59-
local.properties
6024
.settings/
61-
.loadpath
62-
63-
# Eclipse Core
64-
.project
65-
66-
# External tool builders
67-
.externalToolBuilders/
68-
69-
# Locally stored "Eclipse launch configurations"
70-
*.launch
71-
72-
# CDT-specific
73-
.cproject
74-
75-
# JDT-specific (Eclipse Java Development Tools)
25+
.vscode/
26+
bin/
7627
.classpath
28+
.project
7729

78-
# PDT-specific
79-
.buildpath
80-
81-
# sbteclipse plugin
82-
.target
83-
84-
# TeXlipse plugin
85-
.texlipse
86-
87-
88-
89-
### Maven ###
90-
target/
91-
pom.xml.tag
92-
pom.xml.releaseBackup
93-
pom.xml.versionsBackup
94-
pom.xml.next
95-
release.properties
96-
dependency-reduced-pom.xml
97-
buildNumber.properties
98-
99-
100-
101-
### NetBeans ###
102-
nbproject/private/
103-
build/
104-
nbbuild/
105-
dist/
106-
nbdist/
107-
nbactions.xml
108-
nb-configuration.xml
109-
.nb-gradle/
30+
# macOS
11031

111-
### MacOS ###
11232
.DS_Store
11333

114-
### Run Folder (ViaProxy) ###
115-
common/run/
34+
# Misc
35+
36+
run/

api/src/main/java/com/viaversion/viaversion/api/ViaAPI.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ default int getPlayerVersion(UUID uuid) {
123123
boolean isInjected(UUID uuid);
124124

125125
/**
126-
* Returns whether Via injected into this player connection. Note that this method may not work on
126+
* Returns the injected UserConnection if present. Note that this method may not work on
127127
* clientside implementations and is generally not recommended to be used. Use {@link ConnectionManager} instead.
128128
*
129129
* @param uuid uuid of the player
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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.configuration;
24+
25+
public record RateLimitConfig(boolean enabled, int maxRate, String maxRateKickMessage, int warningRate, int maxWarnings,
26+
long trackingPeriodNanos, String warningKickMessage, String ratePlaceholder) {
27+
}

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,43 +147,53 @@ public interface ViaVersionConfig extends Config {
147147
*
148148
* @return The number of packets a client can send per second.
149149
*/
150+
@Deprecated(forRemoval = true)
150151
int getMaxPPS();
151152

152153
/**
153154
* Get the kick message sent if the user hits the max packets per second.
154155
*
155156
* @return Kick message, with colour codes using '&'
156157
*/
158+
@Deprecated(forRemoval = true)
157159
String getMaxPPSKickMessage();
158160

159161
/**
160162
* The time in seconds that should be tracked for warnings
161163
*
162164
* @return Time in seconds that should be tracked for warnings
163165
*/
166+
@Deprecated(forRemoval = true)
164167
int getTrackingPeriod();
165168

166169
/**
167170
* The number of packets per second to count as a warning
168171
*
169172
* @return The number of packets per second to count as a warning.
170173
*/
174+
@Deprecated(forRemoval = true)
171175
int getWarningPPS();
172176

173177
/**
174178
* Get the maximum number of warnings the client can have in the interval
175179
*
176180
* @return The number of packets a client can send per second.
177181
*/
182+
@Deprecated(forRemoval = true)
178183
int getMaxWarnings();
179184

180185
/**
181186
* Get the kick message sent if the user goes over the warnings in the interval
182187
*
183188
* @return Kick message, with colour codes using '&'
184189
*/
190+
@Deprecated(forRemoval = true)
185191
String getMaxWarningsKickMessage();
186192

193+
RateLimitConfig getPacketTrackerConfig();
194+
195+
RateLimitConfig getPacketSizeTrackerConfig();
196+
187197
/**
188198
* Send supported versions in the status response packet
189199
*
@@ -263,6 +273,8 @@ public interface ViaVersionConfig extends Config {
263273
*/
264274
String getBlockedDisconnectMsg();
265275

276+
boolean logBlockedJoins();
277+
266278
/**
267279
* Get the message sent to players being kicked on reload.
268280
* Players are kicked to stop the server crashing
@@ -478,4 +490,12 @@ public interface ViaVersionConfig extends Config {
478490
* @return true if enabled
479491
*/
480492
boolean fix1_21PlacementRotation();
493+
494+
/**
495+
* If enabled, cancel swing packets sent while having an inventory opened on 1.15.2 and below servers.
496+
* This can cause false positives with anti-cheat plugins.
497+
*
498+
* @return true if enabled
499+
*/
500+
boolean cancelSwingInInventory();
481501
}

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

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,6 @@
3030
*/
3131
public interface StorableObject {
3232

33-
/**
34-
* Returns whether the object should be uncached on a server switch.
35-
*
36-
* @return whether the object should be uncached on a server switch
37-
*/
38-
default boolean clearOnServerSwitch() {
39-
return true;
40-
}
41-
4233
default void onRemove() {
4334
}
4435
}

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

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -139,17 +139,7 @@ public interface UserConnection {
139139
/**
140140
* Clear stored objects, entity trackers and client worlds.
141141
*/
142-
default void clearStoredObjects() {
143-
clearStoredObjects(false);
144-
}
145-
146-
/**
147-
* Clear stored objects, entity trackers and client worlds.
148-
* If cleared for a proxy server switch, some stored objects and tracker data will be retained.
149-
*
150-
* @param isServerSwitch whether the clear is due to a server switch
151-
*/
152-
void clearStoredObjects(boolean isServerSwitch);
142+
void clearStoredObjects();
153143

154144
/**
155145
* Sends a raw packet to the connection on the current thread.
@@ -204,9 +194,15 @@ default void clearStoredObjects() {
204194
/**
205195
* Monitors serverbound packets and returns whether a packet can/should be processed.
206196
*
197+
* @param bytes the number of bytes in the packet
207198
* @return false if this packet should be cancelled
208199
*/
209-
boolean checkServerboundPacket();
200+
boolean checkServerboundPacket(int bytes);
201+
202+
@Deprecated(forRemoval = true)
203+
default boolean checkServerboundPacket() {
204+
return checkServerboundPacket(0);
205+
}
210206

211207
/**
212208
* Monitors clientbound packets and returns whether a packet can/should be processed.
@@ -219,6 +215,11 @@ default void clearStoredObjects() {
219215
* @see #checkClientboundPacket()
220216
* @see #checkServerboundPacket()
221217
*/
218+
default boolean checkIncomingPacket(final int bytes) {
219+
return isClientSide() ? checkClientboundPacket() : checkServerboundPacket(bytes);
220+
}
221+
222+
@Deprecated(forRemoval = true)
222223
default boolean checkIncomingPacket() {
223224
return isClientSide() ? checkClientboundPacket() : checkServerboundPacket();
224225
}

0 commit comments

Comments
 (0)