Update to 26.3 #4
@@ -73,6 +73,7 @@ public final class PreLoginEvent implements ResultedEvent<PreLoginEvent.PreLogin
|
||||
|
||||
/**
|
||||
* Returns the UUID of the connecting player.
|
||||
*
|
||||
* <p>This value is {@code null} on 1.19.2 and lower,
|
||||
* up to 1.20.1 it is optional and from 1.20.2 it will always be available.</p>
|
||||
*
|
||||
|
||||
@@ -40,9 +40,9 @@ public final class PlayerClientBrandEvent {
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PlayerClientBrandEvent{"
|
||||
+ "player=" + player
|
||||
+ ", brand='" + brand + '\''
|
||||
+ '}';
|
||||
+ "player=" + player
|
||||
+ ", brand='" + brand + '\''
|
||||
+ '}';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
@@ -14,6 +14,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* This event is executed when a player entered the configuration state and can be configured by Velocity.
|
||||
*
|
||||
* <p>Velocity will wait for this event before continuing/ending the configuration state.</p>
|
||||
*
|
||||
* @param player The player who can be configured.
|
||||
|
||||
+1
@@ -15,6 +15,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
/**
|
||||
* This event is executed when a player is about to enter the configuration state.
|
||||
* It is <b>not</b> called for the initial configuration of a player after login.
|
||||
*
|
||||
* <p>Velocity will wait for this event before asking the client to enter configuration state.
|
||||
* However due to backend server being unable to keep the connection alive during state changes,
|
||||
* Velocity will only wait for a maximum of 5 seconds.</p>
|
||||
|
||||
+1
@@ -14,6 +14,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* This event is executed when a player has entered the configuration state.
|
||||
*
|
||||
* <p>From this moment on, until the {@link PlayerFinishedConfigurationEvent} is executed,
|
||||
* the {@linkplain Player#getProtocolState()} method is guaranteed
|
||||
* to return {@link ProtocolState#CONFIGURATION}.</p>
|
||||
|
||||
+1
@@ -14,6 +14,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* This event is executed when a player is about to finish the configuration state.
|
||||
*
|
||||
* <p>Velocity will wait for this event before asking the client to finish the configuration state.
|
||||
* However due to backend server being unable to keep the connection alive during state changes,
|
||||
* Velocity will only wait for a maximum of 5 seconds. If you need to hold a player in configuration
|
||||
|
||||
+1
@@ -14,6 +14,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* This event is executed when a player has finished the configuration state.
|
||||
*
|
||||
* <p>From this moment on, the {@link Player#getProtocolState()} method
|
||||
* will return {@link ProtocolState#PLAY}.</p>
|
||||
*
|
||||
|
||||
@@ -16,6 +16,7 @@ package com.velocitypowered.api.network;
|
||||
public enum ProtocolState {
|
||||
/**
|
||||
* Initial connection State.
|
||||
*
|
||||
* <p>This status can be caused by a {@link HandshakeIntent#STATUS},
|
||||
* {@link HandshakeIntent#LOGIN} or {@link HandshakeIntent#TRANSFER} intent.</p>
|
||||
* If the intent is LOGIN or TRANSFER, the next state will be {@link #LOGIN},
|
||||
@@ -24,6 +25,7 @@ public enum ProtocolState {
|
||||
HANDSHAKE,
|
||||
/**
|
||||
* Ping State of a connection.
|
||||
*
|
||||
* <p>Connections with the {@link HandshakeIntent#STATUS} intent will pass through this state
|
||||
* and be disconnected after it requests the ping from the server
|
||||
* and the server responds with the respective ping.</p>
|
||||
@@ -31,11 +33,13 @@ public enum ProtocolState {
|
||||
STATUS,
|
||||
/**
|
||||
* Authentication State of a connection.
|
||||
*
|
||||
* <p>At this moment the player is authenticating with the authentication servers.</p>
|
||||
*/
|
||||
LOGIN,
|
||||
/**
|
||||
* Configuration State of a connection.
|
||||
*
|
||||
* <p>At this point the player allows the server to send information
|
||||
* such as resource packs and plugin messages, at the same time the player
|
||||
* will send his client brand and the respective plugin messages
|
||||
@@ -46,6 +50,7 @@ public enum ProtocolState {
|
||||
CONFIGURATION,
|
||||
/**
|
||||
* Game State of a connection.
|
||||
*
|
||||
* <p>In this state is where the whole game runs, the server is able to change
|
||||
* the player's state to {@link #CONFIGURATION} as needed in versions 1.20.2 and higher.</p>
|
||||
*/
|
||||
|
||||
@@ -15,7 +15,6 @@ import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
* Represents three different states of a setting.
|
||||
*
|
||||
* <p>Possible values:</p>
|
||||
* <p></p>
|
||||
* <ul>
|
||||
* <li>{@link #TRUE} - a positive setting</li>
|
||||
* <li>{@link #FALSE} - a negative (negated) setting</li>
|
||||
|
||||
@@ -244,7 +244,7 @@ public interface Player extends
|
||||
* Gets the {@link ResourcePackInfo} of the currently applied
|
||||
* resource-pack or null if none.
|
||||
*
|
||||
* <p> Note that since 1.20.3 it is no longer recommended to use
|
||||
* <p>Note that since 1.20.3 it is no longer recommended to use
|
||||
* this method as it will only return the last applied
|
||||
* resource pack. To get all applied resource packs, use
|
||||
* {@link #getAppliedResourcePacks()} instead. </p>
|
||||
@@ -260,7 +260,7 @@ public interface Player extends
|
||||
* the user is currently downloading or is currently
|
||||
* prompted to install or null if none.
|
||||
*
|
||||
* <p> Note that since 1.20.3 it is no longer recommended to use
|
||||
* <p>Note that since 1.20.3 it is no longer recommended to use
|
||||
* this method as it will only return the last pending
|
||||
* resource pack. To get all pending resource packs, use
|
||||
* {@link #getPendingResourcePacks()} instead. </p>
|
||||
@@ -315,6 +315,7 @@ public interface Player extends
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p><strong>Note that this method does not send a plugin message to the server the player
|
||||
* is connected to.</strong> You should only use this method if you are trying to communicate
|
||||
* with a mod that is installed on the player's client.</p>
|
||||
@@ -400,7 +401,7 @@ public interface Player extends
|
||||
* and will not perform any actions.</b>
|
||||
* @see #playSound(Sound, Sound.Emitter)
|
||||
* @see <a href="https://docs.papermc.io/velocity/dev/pitfalls/#audience-operations-are-not-fully-supported">
|
||||
* Unsupported Adventure Operations</a>
|
||||
* Unsupported Adventure Operations</a>
|
||||
*/
|
||||
@Override
|
||||
default void playSound(@NotNull Sound sound) {
|
||||
@@ -413,7 +414,7 @@ public interface Player extends
|
||||
* and will not perform any actions.</b>
|
||||
* @see #playSound(Sound, Sound.Emitter)
|
||||
* @see <a href="https://docs.papermc.io/velocity/dev/pitfalls/#audience-operations-are-not-fully-supported">
|
||||
* Unsupported Adventure Operations</a>
|
||||
* Unsupported Adventure Operations</a>
|
||||
*/
|
||||
@Override
|
||||
default void playSound(@NotNull Sound sound, double x, double y, double z) {
|
||||
@@ -456,7 +457,7 @@ public interface Player extends
|
||||
* and will not perform any actions.</b>
|
||||
*
|
||||
* @see <a href="https://docs.papermc.io/velocity/dev/pitfalls/#audience-operations-are-not-fully-supported">
|
||||
* Unsupported Adventure Operations</a>
|
||||
* Unsupported Adventure Operations</a>
|
||||
*/
|
||||
@Override
|
||||
default void openBook(@NotNull Book book) {
|
||||
@@ -469,7 +470,7 @@ public interface Player extends
|
||||
* and will not perform any actions.</b>
|
||||
*
|
||||
* @see <a href="https://docs.papermc.io/velocity/dev/pitfalls/#audience-operations-are-not-fully-supported">
|
||||
* Unsupported Adventure Operations</a>
|
||||
* Unsupported Adventure Operations</a>
|
||||
*/
|
||||
@Override
|
||||
default void showDialog(@NotNull DialogLike dialog) {
|
||||
@@ -482,7 +483,7 @@ public interface Player extends
|
||||
* and will not perform any actions.</b>
|
||||
*
|
||||
* @see <a href="https://docs.papermc.io/velocity/dev/pitfalls/#audience-operations-are-not-fully-supported">
|
||||
* Unsupported Adventure Operations</a>
|
||||
* Unsupported Adventure Operations</a>
|
||||
*/
|
||||
@Override
|
||||
default void closeDialog() {
|
||||
|
||||
@@ -56,6 +56,7 @@ public interface KeySigned {
|
||||
* Validates the signature, expiry temporal and key against the
|
||||
* signer public key. Note: This will **not** check for
|
||||
* expiry. You can check for expiry with {@link KeySigned#hasExpired()}.
|
||||
*
|
||||
* <p>DOES NOT WORK YET FOR MESSAGES AND COMMANDS!</p>
|
||||
* Addendum: Does not work for 1.19.1 until the user has authenticated.
|
||||
*
|
||||
|
||||
@@ -237,8 +237,11 @@ public interface TabListEntry extends KeyIdentifiable {
|
||||
|
||||
/**
|
||||
* Sets the {@link IdentifiedKey} of the {@link TabListEntry}.
|
||||
*
|
||||
* <p>This only works for players currently <b>not</b> connected to this proxy.</p>
|
||||
*
|
||||
* <p>For any player currently connected to this proxy this will be filled automatically.</p>
|
||||
*
|
||||
* <p>Will ignore mismatching key revisions data.</p>
|
||||
*
|
||||
* @param chatSession session to set
|
||||
|
||||
@@ -20,7 +20,7 @@ brigadier = "com.velocitypowered:velocity-brigadier:1.0.0-SNAPSHOT"
|
||||
bstats = "org.bstats:bstats-base:3.2.1"
|
||||
caffeine = "com.github.ben-manes.caffeine:caffeine:3.2.4"
|
||||
checker-qual = "org.checkerframework:checker-qual:4.2.3"
|
||||
checkstyle = "com.puppycrawl.tools:checkstyle:10.9.3"
|
||||
checkstyle = "com.puppycrawl.tools:checkstyle:14.1.0"
|
||||
completablefutures = "com.spotify:completable-futures:0.3.6"
|
||||
configurate3-hocon = { module = "org.spongepowered:configurate-hocon", version.ref = "configurate3" }
|
||||
configurate3-yaml = { module = "org.spongepowered:configurate-yaml", version.ref = "configurate3" }
|
||||
|
||||
@@ -54,8 +54,8 @@ public class MoreByteBufUtils {
|
||||
BufferPreference preferred = nativeStuff.preferredBufferType();
|
||||
return switch (preferred) {
|
||||
case DIRECT_PREFERRED, HEAP_PREFERRED ->
|
||||
// The native prefers this type, but doesn't strictly require we provide it.
|
||||
true;
|
||||
// The native prefers this type, but doesn't strictly require we provide it.
|
||||
true;
|
||||
case DIRECT_REQUIRED -> buf.hasMemoryAddress();
|
||||
case HEAP_REQUIRED -> buf.hasArray();
|
||||
};
|
||||
|
||||
@@ -653,7 +653,7 @@ public class VelocityServer implements ProxyServer, ForwardingAudience {
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls {@link #shutdown(boolean, Component)} with the default reason "Proxy shutting down."
|
||||
* Calls {@link #shutdown(boolean, Component)} with the default reason "Proxy shutting down".
|
||||
*
|
||||
* @param explicitExit whether the user explicitly shut down the proxy
|
||||
*/
|
||||
|
||||
@@ -59,6 +59,6 @@ public record PingPassthroughMode(boolean version, boolean players,
|
||||
|
||||
public boolean enabled() {
|
||||
return this.version || this.players || this.description || this.favicon
|
||||
|| this.modinfo;
|
||||
|| this.modinfo;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Modern (Minecraft 1.20.3+) ResourcePackHandler
|
||||
* Modern (Minecraft 1.20.3+) ResourcePackHandler.
|
||||
*/
|
||||
public final class ModernResourcePackHandler extends ResourcePackHandler {
|
||||
private final ListMultimap<UUID, ResourcePackInfo> outstandingResourcePacks =
|
||||
|
||||
+1
@@ -118,6 +118,7 @@ public abstract sealed class ResourcePackHandler
|
||||
|
||||
/**
|
||||
* Processes a client response to a sent resource-pack.
|
||||
*
|
||||
* <p>Cases in which no action will be taken:</p>
|
||||
* <ul>
|
||||
*
|
||||
|
||||
@@ -545,6 +545,36 @@ public class VelocityEventManager implements EventManager {
|
||||
}
|
||||
}
|
||||
|
||||
private <E> void fire(final @Nullable CompletableFuture<E> future, final E event,
|
||||
final int offset, final boolean currentlyAsync, final HandlerRegistration[] registrations) {
|
||||
for (int i = offset; i < registrations.length; i++) {
|
||||
final HandlerRegistration registration = registrations[i];
|
||||
try {
|
||||
final EventTask eventTask = registration.handler.executeAsync(event);
|
||||
if (eventTask == null) {
|
||||
continue;
|
||||
}
|
||||
final ContinuationTask<E> continuationTask = new ContinuationTask<>(eventTask,
|
||||
registrations, future, event, i, currentlyAsync);
|
||||
if (currentlyAsync || !eventTask.requiresAsync()) {
|
||||
if (continuationTask.execute()) {
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
registration.plugin.getExecutorService().execute(continuationTask);
|
||||
}
|
||||
// fire will continue in another thread once the async task is
|
||||
// executed and the continuation is resumed
|
||||
return;
|
||||
} catch (final Throwable t) {
|
||||
logHandlerException(registration, t);
|
||||
}
|
||||
}
|
||||
if (future != null) {
|
||||
future.complete(event);
|
||||
}
|
||||
}
|
||||
|
||||
private static final int TASK_STATE_DEFAULT = 0;
|
||||
private static final int TASK_STATE_EXECUTING = 1;
|
||||
private static final int TASK_STATE_CONTINUE_IMMEDIATELY = 2;
|
||||
@@ -669,36 +699,6 @@ public class VelocityEventManager implements EventManager {
|
||||
}
|
||||
}
|
||||
|
||||
private <E> void fire(final @Nullable CompletableFuture<E> future, final E event,
|
||||
final int offset, final boolean currentlyAsync, final HandlerRegistration[] registrations) {
|
||||
for (int i = offset; i < registrations.length; i++) {
|
||||
final HandlerRegistration registration = registrations[i];
|
||||
try {
|
||||
final EventTask eventTask = registration.handler.executeAsync(event);
|
||||
if (eventTask == null) {
|
||||
continue;
|
||||
}
|
||||
final ContinuationTask<E> continuationTask = new ContinuationTask<>(eventTask,
|
||||
registrations, future, event, i, currentlyAsync);
|
||||
if (currentlyAsync || !eventTask.requiresAsync()) {
|
||||
if (continuationTask.execute()) {
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
registration.plugin.getExecutorService().execute(continuationTask);
|
||||
}
|
||||
// fire will continue in another thread once the async task is
|
||||
// executed and the continuation is resumed
|
||||
return;
|
||||
} catch (final Throwable t) {
|
||||
logHandlerException(registration, t);
|
||||
}
|
||||
}
|
||||
if (future != null) {
|
||||
future.complete(event);
|
||||
}
|
||||
}
|
||||
|
||||
private static void logHandlerException(
|
||||
final HandlerRegistration registration, final Throwable t) {
|
||||
final PluginDescription pluginDescription = registration.plugin.getDescription();
|
||||
|
||||
@@ -644,7 +644,7 @@ public enum ProtocolUtils {
|
||||
private static final int FORGE_MAX_ARRAY_LENGTH = Integer.MAX_VALUE & 0x1FFF9A;
|
||||
|
||||
/**
|
||||
* Reads an byte array for legacy version 1.7 from the specified {@code buf}
|
||||
* Reads an byte array for legacy version 1.7 from the specified {@code buf}.
|
||||
*
|
||||
* @param buf the buffer to read from
|
||||
* @return the read byte array
|
||||
@@ -685,7 +685,7 @@ public enum ProtocolUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes an byte array for legacy version 1.7 to the specified {@code buf}
|
||||
* Writes an byte array for legacy version 1.7 to the specified {@code buf}.
|
||||
*
|
||||
* @param b array
|
||||
* @param buf buf
|
||||
@@ -709,7 +709,7 @@ public enum ProtocolUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes an {@link ByteBuf} for legacy version 1.7 to the specified {@code buf}
|
||||
* Writes an {@link ByteBuf} for legacy version 1.7 to the specified {@code buf}.
|
||||
*
|
||||
* @param b array
|
||||
* @param buf buf
|
||||
|
||||
Reference in New Issue
Block a user