Skip to content

Commit a8e1c87

Browse files
committed
Merge remote-tracking branch 'PaperMC/dev/3.0.0' into merge/dev3.0.0
# Conflicts: # build-logic/src/main/kotlin/velocity-publish.gradle.kts # proxy/src/main/java/com/velocitypowered/proxy/protocol/packet/chat/RateLimitedCommandHandler.java
2 parents 3b71249 + 14160e1 commit a8e1c87

File tree

279 files changed

+5422
-1793
lines changed

Some content is hidden

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

279 files changed

+5422
-1793
lines changed

.github/workflows/gradle.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ on: [push]
66

77
jobs:
88
build:
9-
runs-on: ubuntu-22.04
9+
runs-on: ubuntu-24.04
1010
steps:
1111
- name: Checkout Repository
12-
uses: actions/checkout@v4
12+
uses: actions/checkout@v6
1313
with:
1414
persist-credentials: false
1515
- name: Set up Gradle
16-
uses: gradle/actions/setup-gradle@v4
16+
uses: gradle/actions/setup-gradle@v5
1717
- name: Set up JDK 21
18-
uses: actions/setup-java@v4
18+
uses: actions/setup-java@v5
1919
with:
2020
java-version: 21
2121
distribution: 'zulu'

api/build.gradle.kts

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ dependencies {
2424
api(libs.guava)
2525

2626
// DEPRECATED: Will be removed in Velocity Polymer
27-
api("com.moandjiezana.toml:toml4j:0.7.2")
27+
api("io.hotmoka:toml4j:0.7.3")
2828

2929
api(platform(libs.adventure.bom))
3030
api("net.kyori:adventure-api")
@@ -55,22 +55,20 @@ tasks {
5555
}
5656
}
5757
withType<Javadoc> {
58-
exclude("com/velocitypowered/api/plugin/ap/**")
59-
6058
val o = options as StandardJavadocDocletOptions
6159
o.encoding = "UTF-8"
62-
o.source = "17"
60+
o.source = "21"
6361

6462
o.use()
6563
o.links(
66-
"https://www.slf4j.org/apidocs/",
64+
"https://www.javadocs.dev/org.slf4j/slf4j-api/${libs.slf4j.get().version}/",
6765
"https://guava.dev/releases/${libs.guava.get().version}/api/docs/",
6866
"https://google.github.io/guice/api-docs/${libs.guice.get().version}/javadoc/",
69-
"https://docs.oracle.com/en/java/javase/17/docs/api/",
67+
"https://docs.oracle.com/en/java/javase/21/docs/api/",
7068
"https://jd.advntr.dev/api/${libs.adventure.bom.get().version}/",
7169
"https://jd.advntr.dev/text-minimessage/${libs.adventure.bom.get().version}/",
7270
"https://jd.advntr.dev/key/${libs.adventure.bom.get().version}/",
73-
"https://javadoc.io/doc/com.github.ben-manes.caffeine/caffeine/${libs.caffeine.get().version}/",
71+
"https://www.javadocs.dev/com.github.ben-manes.caffeine/caffeine/${libs.caffeine.get().version}/",
7472
)
7573

7674
o.tags(
@@ -79,8 +77,5 @@ tasks {
7977
"implNote:a:Implementation Note:",
8078
"sinceMinecraft:a:Since Minecraft:"
8179
)
82-
83-
// Disable the crazy super-strict doclint tool in Java 8
84-
o.addStringOption("Xdoclint:none", "-quiet")
8580
}
8681
}

api/src/ap/java/com/velocitypowered/api/plugin/ap/PluginAnnotationProcessor.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
import java.io.BufferedWriter;
1515
import java.io.IOException;
1616
import java.io.Writer;
17-
import java.util.Objects;
1817
import java.util.Set;
1918
import javax.annotation.processing.AbstractProcessor;
2019
import javax.annotation.processing.ProcessingEnvironment;
@@ -37,6 +36,15 @@
3736
@SupportedAnnotationTypes({"com.velocitypowered.api.plugin.Plugin"})
3837
public class PluginAnnotationProcessor extends AbstractProcessor {
3938

39+
/**
40+
* Creates a new {@code PluginAnnotationProcessor}.
41+
*
42+
* <p>The processor is instantiated by the Java compiler and initialized via
43+
* {@link #init(ProcessingEnvironment)}.</p>
44+
*/
45+
public PluginAnnotationProcessor() {
46+
}
47+
4048
private ProcessingEnvironment environment;
4149
private String pluginClassFound;
4250
private boolean warnedAboutMultiplePlugins;
@@ -68,8 +76,8 @@ public synchronized boolean process(Set<? extends TypeElement> annotations,
6876

6977
Name qualifiedName = ((TypeElement) element).getQualifiedName();
7078

71-
if (Objects.equals(pluginClassFound, qualifiedName.toString())) {
72-
if (!warnedAboutMultiplePlugins) {
79+
if (pluginClassFound != null) {
80+
if (!pluginClassFound.equals(qualifiedName.toString()) && !warnedAboutMultiplePlugins) {
7381
environment.getMessager()
7482
.printMessage(Diagnostic.Kind.WARNING, "Velocity does not yet currently support "
7583
+ "multiple plugins. We are using " + pluginClassFound

api/src/ap/java/com/velocitypowered/api/plugin/ap/SerializedPluginDescription.java

Lines changed: 76 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,20 @@
2424
*/
2525
public final class SerializedPluginDescription {
2626

27-
public static final Pattern ID_PATTERN = Pattern.compile("[a-z][a-z0-9-_]{0,63}");
27+
/**
28+
* The string pattern used to validate plugin IDs.
29+
*
30+
* <p>Plugin IDs must start with a lowercase letter and may contain lowercase letters,
31+
* digits, hyphens, and underscores. The total length must not exceed 64 characters.</p>
32+
*/
33+
public static final String ID_PATTERN_STRING = "[a-z][a-z0-9-_]{0,63}";
34+
/**
35+
* The compiled pattern used to validate plugin IDs.
36+
*
37+
* <p>Plugin IDs must start with a lowercase letter and may contain lowercase letters,
38+
* digits, hyphens, and underscores. The total length must not exceed 64 characters.</p>
39+
*/
40+
public static final Pattern ID_PATTERN = Pattern.compile(ID_PATTERN_STRING);
2841

2942
// @Nullable is used here to make GSON skip these in the serialized file
3043
private final String id;
@@ -63,34 +76,78 @@ static SerializedPluginDescription from(Plugin plugin, String qualifiedName) {
6376
.collect(Collectors.toList()), dependencies, qualifiedName);
6477
}
6578

79+
/**
80+
* Gets the ID of the plugin this dependency refers to.
81+
*
82+
* @return the plugin ID
83+
*/
6684
public String getId() {
6785
return id;
6886
}
6987

88+
/**
89+
* Gets the human-readable name of the plugin.
90+
*
91+
* @return the plugin's name, or {@code null} if not specified
92+
*/
7093
public @Nullable String getName() {
7194
return name;
7295
}
7396

97+
/**
98+
* Gets the version string of the plugin.
99+
*
100+
* @return the plugin version, or {@code null} if not specified
101+
*/
74102
public @Nullable String getVersion() {
75103
return version;
76104
}
77105

106+
/**
107+
* Gets the plugin's description, typically a short summary of its functionality.
108+
*
109+
* @return the description, or {@code null} if not specified
110+
*/
78111
public @Nullable String getDescription() {
79112
return description;
80113
}
81114

115+
/**
116+
* Gets the website URL for the plugin.
117+
*
118+
* <p>This is often used to link to documentation, support, or the plugin's homepage.</p>
119+
*
120+
* @return the plugin URL, or {@code null} if not specified
121+
*/
82122
public @Nullable String getUrl() {
83123
return url;
84124
}
85125

126+
/**
127+
* Gets the list of authors who contributed to the plugin.
128+
*
129+
* @return an immutable list of authors; empty if none were specified
130+
*/
86131
public List<String> getAuthors() {
87132
return authors == null ? ImmutableList.of() : authors;
88133
}
89134

135+
/**
136+
* Gets the list of declared dependencies for the plugin.
137+
*
138+
* <p>Dependencies may be required or optional and describe other plugins, this one depends.</p>
139+
*
140+
* @return an immutable list of plugin dependencies
141+
*/
90142
public List<Dependency> getDependencies() {
91143
return dependencies == null ? ImmutableList.of() : dependencies;
92144
}
93145

146+
/**
147+
* Gets the fully qualified name of the plugin's main class.
148+
*
149+
* @return the main class name
150+
*/
94151
public String getMain() {
95152
return main;
96153
}
@@ -141,15 +198,33 @@ public static final class Dependency {
141198
private final String id;
142199
private final boolean optional;
143200

201+
/**
202+
* Constructs a new dependency class.
203+
*
204+
* @param id the ID of the dependent plugin
205+
* @param optional whether the dependency is optional
206+
*/
144207
public Dependency(String id, boolean optional) {
145208
this.id = id;
146209
this.optional = optional;
147210
}
148211

212+
/**
213+
* Gets the ID of the plugin this dependency refers to.
214+
*
215+
* @return the plugin ID
216+
*/
149217
public String getId() {
150218
return id;
151219
}
152220

221+
/**
222+
* Indicates whether this dependency is optional.
223+
*
224+
* <p>Optional dependencies are not required for the plugin to load.</p>
225+
*
226+
* @return {@code true} if the dependency is optional; {@code false} otherwise
227+
*/
153228
public boolean isOptional() {
154229
return optional;
155230
}

api/src/main/java/com/velocitypowered/api/command/CommandSource.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,22 @@ public interface CommandSource extends Audience, PermissionSubject {
2323
* Sends a message with the MiniMessage format to this source.
2424
*
2525
* @param message MiniMessage content
26-
* @see <a href="https://docs.advntr.dev/minimessage/format.html">MiniMessage docs</a>
26+
* @see <a href="https://docs.papermc.io/adventure/minimessage/format/">MiniMessage docs</a>
2727
* for more information on the format.
28-
**/
28+
*/
2929
default void sendRichMessage(final @NotNull String message) {
3030
this.sendMessage(MiniMessage.miniMessage().deserialize(message, this));
3131
}
3232

3333
/**
34-
* Sends a message with the MiniMessage format to this source.
35-
*
36-
* @param message MiniMessage content
37-
* @param resolvers resolvers to use
38-
* @see <a href="https://docs.advntr.dev/minimessage/">MiniMessage docs</a>
39-
* and <a href="https://docs.advntr.dev/minimessage/dynamic-replacements">MiniMessage Placeholders docs</a>
40-
* for more information on the format.
41-
**/
34+
* Sends a message with the MiniMessage format to this source.
35+
*
36+
* @param message MiniMessage content
37+
* @param resolvers resolvers to use
38+
* @see <a href="https://docs.papermc.io/adventure/minimessage/">MiniMessage docs</a>
39+
* and <a href="https://docs.papermc.io/adventure/minimessage/dynamic-replacements">MiniMessage Placeholders docs</a>
40+
* for more information on the format.
41+
*/
4242
default void sendRichMessage(
4343
final @NotNull String message,
4444
final @NotNull TagResolver @NotNull... resolvers
@@ -47,13 +47,13 @@ default void sendRichMessage(
4747
}
4848

4949
/**
50-
* Sends a plain message to this source.
51-
*
52-
* @param message plain message
53-
* @apiNote This method will not apply any form of parse to the text provided,
54-
* however, it is recommended not to use legacy color codes as this is a deprecated format
50+
* Sends a plain message to this source.
51+
*
52+
* @param message plain message
53+
* @apiNote This method will not apply any form of parse to the text provided,
54+
* however, it is recommended not to use legacy color codes as this is a deprecated format
5555
* and not recommended.
56-
*/
56+
*/
5757
default void sendPlainMessage(final @NotNull String message) {
5858
this.sendMessage(Component.text(message));
5959
}

api/src/main/java/com/velocitypowered/api/command/VelocityBrigadierMessage.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@
2020
*/
2121
public final class VelocityBrigadierMessage implements Message, ComponentLike {
2222

23+
/**
24+
* Creates a new {@link VelocityBrigadierMessage} using the given {@link Component} as the message.
25+
*
26+
* @param message the component to use as the tooltip message
27+
* @return a new instance of {@link VelocityBrigadierMessage}
28+
*/
2329
public static VelocityBrigadierMessage tooltip(Component message) {
2430
return new VelocityBrigadierMessage(message);
2531
}

api/src/main/java/com/velocitypowered/api/event/Continuation.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ public interface Continuation {
2020

2121
/**
2222
* Resumes the continuation after the executed task failed.
23+
*
24+
* @param exception the {@link Throwable} that caused the failure
2325
*/
2426
void resumeWithException(Throwable exception);
25-
}
27+
}

api/src/main/java/com/velocitypowered/api/event/EventHandler.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,28 @@
1313
* Represents an interface to perform direct dispatch of an event. This makes integration easier to
1414
* achieve with platforms such as RxJava. While this interface can be used to implement an awaiting
1515
* event handler, {@link AwaitingEventExecutor} provides a more idiomatic means to doing so.
16+
*
17+
* @param <E> the event type this handler accepts
1618
*/
1719
@FunctionalInterface
1820
public interface EventHandler<E> {
1921

22+
/**
23+
* Executes this handler synchronously with the given event.
24+
*
25+
* @param event the event to handle
26+
*/
2027
void execute(E event);
2128

29+
/**
30+
* Executes this handler asynchronously with the given event.
31+
*
32+
* <p>If asynchronous handling is not implemented, the event is executed synchronously
33+
* and this method returns {@code null}.</p>
34+
*
35+
* @param event the event to handle
36+
* @return an {@link EventTask} representing the async task, or {@code null} if not async
37+
*/
2238
default @Nullable EventTask executeAsync(E event) {
2339
execute(event);
2440
return null;

api/src/main/java/com/velocitypowered/api/event/EventManager.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ <E> void register(Object plugin, Class<E> eventClass, PostOrder postOrder,
6060
*
6161
* @param plugin the plugin to associate with the handler
6262
* @param eventClass the class for the event handler to register
63-
* @param postOrder the relative order in which events should be posted to the handler
63+
* @param postOrder the relative order in which events should be posted to the handler. The higher
64+
* the priority, the earlier the event handler will be called
6465
* @param handler the handler to register
6566
* @param <E> the event type to handle
6667
*/
@@ -72,6 +73,7 @@ <E> void register(Object plugin, Class<E> eventClass, short postOrder,
7273
* servicing connections while a plugin handles a potentially long-running operation such as a
7374
* database query.
7475
*
76+
* @param <E> the event type
7577
* @param event the event to fire
7678
* @return a {@link CompletableFuture} representing the posted event
7779
*/

api/src/main/java/com/velocitypowered/api/event/PostOrder.java

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,34 @@
1212
*/
1313
public enum PostOrder {
1414

15-
FIRST, EARLY, NORMAL, LATE, LAST,
15+
/**
16+
* Indicates the listener should be invoked first, before any other listener.
17+
* This order is suitable for listeners that must handle the event before others.
18+
*/
19+
FIRST,
20+
/**
21+
* Indicates the listener should be invoked early, but after listeners with {@link #FIRST}.
22+
* This order is suitable for handling the event before most other listeners.
23+
*/
24+
EARLY,
25+
/**
26+
* Indicates the listener should be invoked in the normal order of execution.
27+
* This is the default and most commonly used order.
28+
*/
29+
NORMAL,
30+
/**
31+
* Indicates the listener should be invoked later in the execution order,
32+
* after listeners with {@link #NORMAL}.
33+
* This order is suitable for listeners that should observe the results of
34+
* earlier listeners.
35+
*/
36+
LATE,
37+
/**
38+
* Indicates the listener should be invoked last, after all other listeners.
39+
* This order is suitable for listeners that should run only after all others
40+
* have completed handling the event.
41+
*/
42+
LAST,
1643

1744
/**
1845
* Previously used to specify that {@link Subscribe#priority()} should be used.

0 commit comments

Comments
 (0)