Skip to content

Commit 8e82509

Browse files
committed
Local Repository Syncronization. Major Changes. Code Rebase. Etc.
1 parent 9b0f599 commit 8e82509

File tree

122 files changed

+3521
-2483
lines changed

Some content is hidden

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

122 files changed

+3521
-2483
lines changed

.DS_Store

-2 KB
Binary file not shown.

.github/workflows/release.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,15 @@ jobs:
1212
steps:
1313
- name: Checkout Repository
1414
uses: actions/checkout@v4
15-
- name: Validate Gradle Wrapper
16-
uses: gradle/actions/wrapper-validation@v4
15+
with:
16+
persist-credentials: false
17+
- name: Set up Gradle
18+
uses: gradle/actions/setup-gradle@v4
1719
- name: Set up JDK 17
1820
uses: actions/setup-java@v4
1921
with:
2022
java-version: 17
2123
distribution: 'temurin'
22-
cache: 'gradle'
2324
- name: Build with Gradle
2425
run: ./gradlew build
2526

@@ -31,7 +32,7 @@ jobs:
3132
done
3233
3334
- name: Automatic Releases
34-
uses: marvinpinto/action-automatic-releases@v1.2.1
35+
uses: marvinpinto/action-automatic-releases@master
3536
with:
3637
title: "ApiaryProxy"
3738
automatic_release_tag: "latest"

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public interface CommandSource extends Audience, PermissionSubject {
2727
* for more information on the format.
2828
**/
2929
default void sendRichMessage(final @NotNull String message) {
30-
this.sendMessage(MiniMessage.miniMessage().deserialize(message));
30+
this.sendMessage(MiniMessage.miniMessage().deserialize(message, this));
3131
}
3232

3333
/**
@@ -43,7 +43,7 @@ default void sendRichMessage(
4343
final @NotNull String message,
4444
final @NotNull TagResolver @NotNull... resolvers
4545
) {
46-
this.sendMessage(MiniMessage.miniMessage().deserialize(message, resolvers));
46+
this.sendMessage(MiniMessage.miniMessage().deserialize(message, this, resolvers));
4747
}
4848

4949
/**

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

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

15-
FIRST, EARLY, NORMAL, LATE, LAST, CUSTOM
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+
/**
22+
* Indicates the listener should be invoked early, but after listeners with {@link #FIRST}.
23+
* This order is suitable for handling the event before most other listeners.
24+
*/
25+
EARLY,
26+
27+
/**
28+
* Indicates the listener should be invoked in the normal order of execution.
29+
* This is the default and most commonly used order.
30+
*/
31+
NORMAL,
32+
33+
/**
34+
* Indicates the listener should be invoked later in the execution order,
35+
* after listeners with {@link #NORMAL}.
36+
* This order is suitable for listeners that should observe the results of
37+
* earlier listeners.
38+
*/
39+
LATE,
40+
41+
/**
42+
* Indicates the listener should be invoked last, after all other listeners.
43+
* This order is suitable for listeners that should run only after all others
44+
* have completed handling the event.
45+
*/
46+
LAST,
47+
48+
/**
49+
* Previously used to specify that {@link Subscribe#priority()} should be used.
50+
*
51+
* @deprecated No longer required, you only need to specify {@link Subscribe#priority()}.
52+
*/
53+
@Deprecated
54+
CUSTOM
1655

1756
}

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,9 @@
3232
* The priority of this event handler. Priorities are used to determine the order in which event
3333
* handlers are called. The higher the priority, the earlier the event handler will be called.
3434
*
35-
* <p>Note that due to compatibility constraints, you must specify {@link PostOrder#CUSTOM}
36-
* in order to use this field.</p>
37-
*
3835
* @return the priority
3936
*/
40-
short priority() default Short.MIN_VALUE;
37+
short priority() default 0;
4138

4239
/**
4340
* Whether the handler must be called asynchronously. By default, all event handlers are called

api/src/main/java/com/velocitypowered/api/event/command/CommandExecuteEvent.java

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public final class CommandExecuteEvent implements ResultedEvent<CommandResult> {
2626
private final CommandSource commandSource;
2727
private final String command;
2828
private CommandResult result;
29+
private InvocationInfo invocationInfo;
2930

3031
/**
3132
* Constructs a CommandExecuteEvent.
@@ -34,9 +35,21 @@ public final class CommandExecuteEvent implements ResultedEvent<CommandResult> {
3435
* @param command the command being executed without first slash
3536
*/
3637
public CommandExecuteEvent(final CommandSource commandSource, final String command) {
38+
this(commandSource, command, new InvocationInfo(SignedState.UNSUPPORTED, Source.API));
39+
}
40+
41+
/**
42+
* Constructs a CommandExecuteEvent.
43+
*
44+
* @param commandSource the source executing the command
45+
* @param command the command being executed without first slash
46+
* @param invocationInfo the invocation info of this command
47+
*/
48+
public CommandExecuteEvent(final CommandSource commandSource, final String command, final InvocationInfo invocationInfo) {
3749
this.commandSource = Preconditions.checkNotNull(commandSource, "commandSource");
3850
this.command = Preconditions.checkNotNull(command, "command");
3951
this.result = CommandResult.allowed();
52+
this.invocationInfo = invocationInfo;
4053
}
4154

4255
/**
@@ -61,6 +74,16 @@ public String getCommand() {
6174
return command;
6275
}
6376

77+
/**
78+
* Returns the info of the command invocation.
79+
*
80+
* @since 3.4.0
81+
* @return invocation info
82+
*/
83+
public InvocationInfo getInvocationInfo() {
84+
return this.invocationInfo;
85+
}
86+
6487
@Override
6588
public CommandResult getResult() {
6689
return result;
@@ -80,6 +103,75 @@ public String toString() {
80103
+ '}';
81104
}
82105

106+
/**
107+
* Represents information about a command invocation, including its signed state and source.
108+
*
109+
* @since 3.4.0
110+
*/
111+
public record InvocationInfo(SignedState signedState, Source source) {
112+
}
113+
114+
/**
115+
* Represents the signed state of a command invocation.
116+
*
117+
* @since 3.4.0
118+
*/
119+
public enum SignedState {
120+
/**
121+
* Indicates that the command was executed from a signed source with signed message arguments,
122+
* This is currently only possible by typing a command in chat with signed arguments.
123+
*
124+
* <p><b>Note:</b> Cancelling the {@link CommandExecuteEvent} in this state will result in the player being kicked.</p>
125+
*
126+
* @since 3.4.0
127+
*/
128+
SIGNED_WITH_ARGS,
129+
/**
130+
* Indicates that the command was executed from a signed source with no signed message arguments,
131+
* This is currently only possible by typing a command in chat.
132+
*
133+
* @since 3.4.0
134+
*/
135+
SIGNED_WITHOUT_ARGS,
136+
/**
137+
* Indicates that the command was executed from an unsigned source,
138+
* such as clicking on a component with a {@link net.kyori.adventure.text.event.ClickEvent.Action#RUN_COMMAND}.
139+
*
140+
* <p>Clients running version 1.20.5 or later will send this state.</p>
141+
*
142+
* @since 3.4.0
143+
*/
144+
UNSIGNED,
145+
/**
146+
* Indicates that the command invocation does not support signing.
147+
*
148+
* <p>This state is sent by clients running versions prior to 1.19.3.</p>
149+
*
150+
* @since 3.4.0
151+
*/
152+
UNSUPPORTED
153+
}
154+
155+
/**
156+
* Represents the source of a command invocation.
157+
*
158+
* @since 3.4.0
159+
*/
160+
public enum Source {
161+
/**
162+
* Indicates that the command was invoked by a player.
163+
*
164+
* @since 3.4.0
165+
*/
166+
PLAYER,
167+
/**
168+
* Indicates that the command was invoked programmatically through an API call.
169+
*
170+
* @since 3.4.0
171+
*/
172+
API
173+
}
174+
83175
/**
84176
* Represents the result of the {@link CommandExecuteEvent}.
85177
*/

api/src/main/java/com/velocitypowered/api/event/command/PlayerAvailableCommandsEvent.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
import static com.google.common.base.Preconditions.checkNotNull;
1111

12-
import com.google.common.annotations.Beta;
1312
import com.mojang.brigadier.tree.RootCommandNode;
1413
import com.velocitypowered.api.event.annotation.AwaitingEvent;
1514
import com.velocitypowered.api.proxy.Player;
@@ -21,7 +20,6 @@
2120
* client.
2221
*/
2322
@AwaitingEvent
24-
@Beta
2523
public class PlayerAvailableCommandsEvent {
2624

2725
private final Player player;

api/src/main/java/com/velocitypowered/api/event/player/KickedFromServerEvent.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ public String toString() {
214214

215215
/**
216216
* Notifies the player with the specified message but does nothing else. This is only a valid
217-
* result to use if the player was trying to connect to a different server, otherwise it is
217+
* result to use if the player was trying to connect to a different server, otherwise it is
218218
* treated like a {@link DisconnectPlayer} result.
219219
*/
220220
public static final class Notify implements ServerKickResult {

api/src/main/java/com/velocitypowered/api/event/player/ServerPostConnectEvent.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
package com.velocitypowered.api.event.player;
99

10-
import com.google.common.annotations.Beta;
1110
import com.google.common.base.Preconditions;
1211
import com.velocitypowered.api.proxy.Player;
1312
import com.velocitypowered.api.proxy.server.RegisteredServer;
@@ -18,7 +17,6 @@
1817
* available in {@link Player#getCurrentServer()}. Velocity will not wait on this event to finish
1918
* firing.
2019
*/
21-
@Beta
2220
public class ServerPostConnectEvent {
2321
private final Player player;
2422
private final RegisteredServer previousServer;

api/src/main/java/com/velocitypowered/api/event/proxy/server/ServerRegisteredEvent.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
package com.velocitypowered.api.event.proxy.server;
99

10-
import com.google.common.annotations.Beta;
1110
import com.google.common.base.Preconditions;
1211
import com.velocitypowered.api.proxy.server.RegisteredServer;
1312
import com.velocitypowered.api.proxy.server.ServerInfo;
@@ -23,7 +22,6 @@
2322
* @param registeredServer A {@link RegisteredServer} that has been registered.
2423
* @since 3.3.0
2524
*/
26-
@Beta
2725
public record ServerRegisteredEvent(@NotNull RegisteredServer registeredServer) {
2826
public ServerRegisteredEvent {
2927
Preconditions.checkNotNull(registeredServer, "registeredServer");

0 commit comments

Comments
 (0)