Skip to content

Commit

Permalink
Even more renames, start hiding some API internals
Browse files Browse the repository at this point in the history
  • Loading branch information
astei committed Oct 29, 2023
1 parent 95cd4c4 commit 6f88c02
Show file tree
Hide file tree
Showing 163 changed files with 682 additions and 848 deletions.
24 changes: 12 additions & 12 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@

name: Java CI with Gradle

on: [push, pull_request]
on: [ push, pull_request ]

jobs:
build-17:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: gradle/wrapper-validation-action@v1
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'temurin'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build
- uses: actions/checkout@v3
- uses: gradle/wrapper-validation-action@v1
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'temurin'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Velocity is licensed under the GPLv3 license.
* First-class support for Paper, Sponge, Fabric and Forge. (Other implementations
may work, but we make every endeavor to support these server implementations
specifically.)

## Building

Velocity is built with [Gradle](https://gradle.org). We recommend using the
Expand Down
12 changes: 6 additions & 6 deletions api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ tasks {
o.source = "8"

o.links(
"https://www.slf4j.org/apidocs/",
"https://guava.dev/releases/${libs.guava.get().version}/api/docs/",
"https://google.github.io/guice/api-docs/${libs.guice.get().version}/javadoc/",
"https://docs.oracle.com/en/java/javase/11/docs/api/",
"https://jd.advntr.dev/api/${libs.adventure.bom.get().version}/",
"https://javadoc.io/doc/com.github.ben-manes.caffeine/caffeine"
"https://www.slf4j.org/apidocs/",
"https://guava.dev/releases/${libs.guava.get().version}/api/docs/",
"https://google.github.io/guice/api-docs/${libs.guice.get().version}/javadoc/",
"https://docs.oracle.com/en/java/javase/11/docs/api/",
"https://jd.advntr.dev/api/${libs.adventure.bom.get().version}/",
"https://javadoc.io/doc/com.github.ben-manes.caffeine/caffeine"
)

// Disable the crazy super-strict doclint tool in Java 8
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,20 @@
import com.mojang.brigadier.tree.LiteralCommandNode;

/**
* A command that uses Brigadier for parsing the command and
* providing suggestions to the client.
* A command that uses Brigadier for parsing the command and providing suggestions to the client.
*/
public final class BrigadierCommand implements Command {

/**
* The return code used by a {@link com.mojang.brigadier.Command} to indicate
* the command execution should be forwarded to the backend server.
* The return code used by a {@link com.mojang.brigadier.Command} to indicate the command
* execution should be forwarded to the backend server.
*/
public static final int FORWARD = 0xF6287429;

private final LiteralCommandNode<CommandSource> node;

/**
* Constructs a {@link BrigadierCommand} from the node returned by
* the given builder.
* Constructs a {@link BrigadierCommand} from the node returned by the given builder.
*
* @param builder the {@link LiteralCommandNode} builder
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@

package com.velocitypowered.api.command;

import com.velocitypowered.api.proxy.Player;
import com.velocitypowered.api.proxy.player.Player;

/**
* Represents a command that can be executed by a {@link CommandSource}
* such as a {@link Player} or the console.
* Represents a command that can be executed by a {@link CommandSource} such as a {@link Player} or
* the console.
*
* <p><strong>You must not subclass <code>Command</code></strong>. Use one of the following
* <i>registrable</i> subinterfaces:</p>
Expand All @@ -30,4 +30,5 @@
* </ul>
*/
public interface Command {

}
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,15 @@
public interface CommandManager {

/**
* Returns a builder to create a {@link CommandMeta} with
* the given alias.
* Returns a builder to create a {@link CommandMeta} with the given alias.
*
* @param alias the first command alias
* @return a {@link CommandMeta} builder
*/
CommandMeta.Builder buildMeta(String alias);

/**
* Returns a builder to create a {@link CommandMeta} for
* the given Brigadier command.
* Returns a builder to create a {@link CommandMeta} for the given Brigadier command.
*
* @param command the command
* @return a {@link CommandMeta} builder
Expand All @@ -38,11 +36,12 @@ public interface CommandManager {
/**
* Registers the specified command with the specified aliases.
*
* @param alias the first command alias
* @param command the command to register
* @param alias the first command alias
* @param command the command to register
* @param otherAliases additional aliases
* @throws IllegalArgumentException if one of the given aliases is already registered, or
* the given command does not implement a registrable {@link Command} subinterface
* @throws IllegalArgumentException if one of the given aliases is already registered, or the
* given command does not implement a registrable {@link Command}
* subinterface
* @see Command for a list of registrable subinterfaces
*/
default void register(String alias, Command command, String... otherAliases) {
Expand All @@ -60,10 +59,11 @@ default void register(String alias, Command command, String... otherAliases) {
/**
* Registers the specified command with the given metadata.
*
* @param meta the command metadata
* @param meta the command metadata
* @param command the command to register
* @throws IllegalArgumentException if one of the given aliases is already registered, or
* the given command does not implement a registrable {@link Command} subinterface
* @throws IllegalArgumentException if one of the given aliases is already registered, or the
* given command does not implement a registrable {@link Command}
* subinterface
* @see Command for a list of registrable subinterfaces
*/
void register(CommandMeta meta, Command command);
Expand Down Expand Up @@ -93,27 +93,26 @@ default void register(String alias, Command command, String... otherAliases) {
/**
* Attempts to asynchronously execute a command from the given {@code cmdLine}.
*
* @param source the source to execute the command for
* @param source the source to execute the command for
* @param cmdLine the command to run
* @return a future that may be completed with the result of the command execution.
* Can be completed exceptionally if an exception is thrown during execution.
* @return a future that may be completed with the result of the command execution. Can be
* completed exceptionally if an exception is thrown during execution.
*/
CompletableFuture<Boolean> executeAsync(CommandSource source, String cmdLine);

/**
* Attempts to asynchronously execute a command from the given {@code cmdLine}
* without firing a {@link CommandExecuteEvent}.
* Attempts to asynchronously execute a command from the given {@code cmdLine} without firing a
* {@link CommandExecuteEvent}.
*
* @param source the source to execute the command for
* @param source the source to execute the command for
* @param cmdLine the command to run
* @return a future that may be completed with the result of the command execution.
* Can be completed exceptionally if an exception is thrown during execution.
* @return a future that may be completed with the result of the command execution. Can be
* completed exceptionally if an exception is thrown during execution.
*/
CompletableFuture<Boolean> executeImmediatelyAsync(CommandSource source, String cmdLine);

/**
* Returns an immutable collection of the case-insensitive aliases registered
* on this manager.
* Returns an immutable collection of the case-insensitive aliases registered on this manager.
*
* @return the registered aliases
*/
Expand Down
20 changes: 10 additions & 10 deletions api/src/main/java/com/velocitypowered/api/command/CommandMeta.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,25 @@
public interface CommandMeta {

/**
* Returns a non-empty collection containing the case-insensitive aliases
* used to execute the command.
* Returns a non-empty collection containing the case-insensitive aliases used to execute the
* command.
*
* @return the command aliases
*/
Collection<String> aliases();

/**
* Returns an immutable collection containing command nodes that provide
* additional argument metadata and tab-complete suggestions.
* Note some {@link Command} implementations may not support hinting.
* Returns an immutable collection containing command nodes that provide additional argument
* metadata and tab-complete suggestions. Note some {@link Command} implementations may not
* support hinting.
*
* @return the hinting command nodes
*/
Collection<CommandNode<CommandSource>> hints();

/**
* Returns the plugin who registered the command.
* Note some {@link Command} registrations may not provide this information.
* Returns the plugin who registered the command. Note some {@link Command} registrations may not
* provide this information.
*
* @return the registering plugin
*/
Expand All @@ -55,13 +55,13 @@ interface Builder {
Builder aliases(String... aliases);

/**
* Specifies a command node providing additional argument metadata and
* tab-complete suggestions.
* Specifies a command node providing additional argument metadata and tab-complete
* suggestions.
*
* @param node the command node
* @return this builder, for chaining
* @throws IllegalArgumentException if the node is executable, i.e. has a non-null
* {@link com.mojang.brigadier.Command}, or has a redirect.
* {@link com.mojang.brigadier.Command}, or has a redirect.
*/
Builder hint(CommandNode<CommandSource> node);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@
* A command that can be executed with arbitrary arguments.
*
* <p>Modifying the command tree (e.g. registering a command via
* {@link CommandManager#register(CommandMeta, Command)}) during
* permission checking and suggestions provision results in
* undefined behavior, which may include deadlocks.
* {@link CommandManager#register(CommandMeta, Command)}) during permission checking and suggestions
* provision results in undefined behavior, which may include deadlocks.
*
* @param <I> the type of the command invocation object
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
package com.velocitypowered.api.command;

/**
* A specialized sub-interface of {@code Command} which indicates the proxy should pass
* the command and its arguments directly without further processing.
* This is useful for bolting on external command frameworks to Velocity.
* A specialized sub-interface of {@code Command} which indicates the proxy should pass the command
* and its arguments directly without further processing. This is useful for bolting on external
* command frameworks to Velocity.
*/
public interface RawCommand extends InvocableCommand<RawCommand.Invocation> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
import org.checkerframework.checker.nullness.qual.NonNull;

/**
* A simple command, modelled after the convention popularized by
* Bukkit and BungeeCord.
* A simple command, modelled after the convention popularized by Bukkit and BungeeCord.
*
* <p>Prefer using {@link BrigadierCommand}, which is also
* backwards-compatible with older clients.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
import org.jetbrains.annotations.NotNull;

/**
* Represents an implementation of brigadier's {@link Message}, providing support for {@link
* Component} messages.
* Represents an implementation of brigadier's {@link Message}, providing support for
* {@link Component} messages.
*/
public final class VelocityBrigadierMessage implements Message, ComponentLike {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
package com.velocitypowered.api.event;

/**
* Represents a continuation of a paused event handler. Any of the resume methods
* may only be called once otherwise an {@link IllegalStateException} is expected.
* Represents a continuation of a paused event handler. Any of the resume methods may only be called
* once otherwise an {@link IllegalStateException} is expected.
*/
public interface Continuation {

Expand Down
34 changes: 17 additions & 17 deletions api/src/main/java/com/velocitypowered/api/event/EventManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,36 +15,36 @@
public interface EventManager {

/**
* Requests that the specified {@code listener} listen for events and associate it with the {@code
* plugin}.
* Requests that the specified {@code listener} listen for events and associate it with the
* {@code plugin}.
*
* @param plugin the plugin to associate with the listener
* @param plugin the plugin to associate with the listener
* @param listener the listener to register
*/
void register(Object plugin, Object listener);

/**
* Requests that the specified {@code handler} listen for events and associate it with the {@code
* plugin}.
* Requests that the specified {@code handler} listen for events and associate it with the
* {@code plugin}.
*
* @param plugin the plugin to associate with the handler
* @param plugin the plugin to associate with the handler
* @param eventClass the class for the event handler to register
* @param handler the handler to register
* @param <E> the event type to handle
* @param handler the handler to register
* @param <E> the event type to handle
*/
default <E> void register(Object plugin, Class<E> eventClass, EventHandler<E> handler) {
register(plugin, eventClass, PostOrder.NORMAL, handler);
}

/**
* Requests that the specified {@code handler} listen for events and associate it with the {@code
* plugin}.
* Requests that the specified {@code handler} listen for events and associate it with the
* {@code plugin}.
*
* @param plugin the plugin to associate with the handler
* @param plugin the plugin to associate with the handler
* @param eventClass the class for the event handler to register
* @param postOrder the order in which events should be posted to the handler
* @param handler the handler to register
* @param <E> the event type to handle
* @param postOrder the order in which events should be posted to the handler
* @param handler the handler to register
* @param <E> the event type to handle
*/
<E> void register(Object plugin, Class<E> eventClass, short postOrder,
EventHandler<E> handler);
Expand Down Expand Up @@ -78,17 +78,17 @@ default void fireAndForget(Object event) {
/**
* Unregisters a specific listener for a specific plugin.
*
* @param plugin the plugin associated with the listener
* @param plugin the plugin associated with the listener
* @param listener the listener to deregister
*/
void unregisterListener(Object plugin, Object listener);

/**
* Unregisters a specific event handler for a specific plugin.
*
* @param plugin the plugin to associate with the handler
* @param plugin the plugin to associate with the handler
* @param handler the handler to register
* @param <E> the event type to handle
* @param <E> the event type to handle
*/
<E> void unregister(Object plugin, EventHandler<E> handler);
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ public interface ResultedEvent<R extends ResultedEvent.Result> {
interface Result {

/**
* Returns whether the event is allowed to proceed. Plugins may choose to skip denied
* events, and the proxy will respect the result of this method.
* Returns whether the event is allowed to proceed. Plugins may choose to skip denied events,
* and the proxy will respect the result of this method.
*
* @return whether the event is allowed to proceed
*/
Expand Down
Loading

0 comments on commit 6f88c02

Please sign in to comment.