mirror of
https://github.com/PaperMC/Velocity.git
synced 2026-02-19 23:47:43 +01:00
Merge branch 'dev/1.1.0' into experiment/io_uring
This commit is contained in:
@@ -16,7 +16,7 @@ allprojects {
|
|||||||
apply plugin: "com.github.spotbugs"
|
apply plugin: "com.github.spotbugs"
|
||||||
|
|
||||||
group 'com.velocitypowered'
|
group 'com.velocitypowered'
|
||||||
version '1.1.2-SNAPSHOT'
|
version '1.1.3-SNAPSHOT'
|
||||||
|
|
||||||
ext {
|
ext {
|
||||||
// dependency versions
|
// dependency versions
|
||||||
|
|||||||
@@ -78,9 +78,9 @@ public class Java11VelocityCompressor implements VelocityCompressor {
|
|||||||
destination.writerIndex(destination.writerIndex() + produced);
|
destination.writerIndex(destination.writerIndex() + produced);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inflater.getBytesWritten() != uncompressedSize) {
|
if (!inflater.finished()) {
|
||||||
throw new DataFormatException("Did not write the exact expected number of"
|
throw new DataFormatException("Received a deflate stream that was too large, wanted "
|
||||||
+ " uncompressed bytes, expected " + uncompressedSize);
|
+ uncompressedSize);
|
||||||
}
|
}
|
||||||
source.readerIndex(origIdx + inflater.getTotalIn());
|
source.readerIndex(origIdx + inflater.getTotalIn());
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
|
|||||||
@@ -204,6 +204,7 @@ public class AvailableCommands implements MinecraftPacket {
|
|||||||
private final int redirectTo;
|
private final int redirectTo;
|
||||||
private final @Nullable ArgumentBuilder<CommandSource, ?> args;
|
private final @Nullable ArgumentBuilder<CommandSource, ?> args;
|
||||||
private @MonotonicNonNull CommandNode<CommandSource> built;
|
private @MonotonicNonNull CommandNode<CommandSource> built;
|
||||||
|
private boolean validated;
|
||||||
|
|
||||||
private WireNode(int idx, byte flags, int[] children, int redirectTo,
|
private WireNode(int idx, byte flags, int[] children, int redirectTo,
|
||||||
@Nullable ArgumentBuilder<CommandSource, ?> args) {
|
@Nullable ArgumentBuilder<CommandSource, ?> args) {
|
||||||
@@ -212,18 +213,34 @@ public class AvailableCommands implements MinecraftPacket {
|
|||||||
this.children = children;
|
this.children = children;
|
||||||
this.redirectTo = redirectTo;
|
this.redirectTo = redirectTo;
|
||||||
this.args = args;
|
this.args = args;
|
||||||
|
this.validated = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void validate(WireNode[] wireNodes) {
|
||||||
|
// Ensure all children exist. Note that we delay checking if the node has been built yet;
|
||||||
|
// that needs to come after this node is built.
|
||||||
|
for (int child : children) {
|
||||||
|
if (child < 0 || child >= wireNodes.length) {
|
||||||
|
throw new IllegalStateException("Node points to non-existent index " + child);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (redirectTo != -1) {
|
||||||
|
if (redirectTo < 0 || redirectTo >= wireNodes.length) {
|
||||||
|
throw new IllegalStateException("Redirect node points to non-existent index "
|
||||||
|
+ redirectTo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.validated = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean toNode(WireNode[] wireNodes) {
|
boolean toNode(WireNode[] wireNodes) {
|
||||||
if (this.built == null) {
|
if (!this.validated) {
|
||||||
// Ensure all children exist. Note that we delay checking if the node has been built yet;
|
this.validate(wireNodes);
|
||||||
// that needs to come after this node is built.
|
}
|
||||||
for (int child : children) {
|
|
||||||
if (child >= wireNodes.length) {
|
|
||||||
throw new IllegalStateException("Node points to non-existent index " + redirectTo);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (this.built == null) {
|
||||||
int type = flags & FLAG_NODE_TYPE;
|
int type = flags & FLAG_NODE_TYPE;
|
||||||
if (type == NODE_TYPE_ROOT) {
|
if (type == NODE_TYPE_ROOT) {
|
||||||
this.built = new RootCommandNode<>();
|
this.built = new RootCommandNode<>();
|
||||||
@@ -234,10 +251,6 @@ public class AvailableCommands implements MinecraftPacket {
|
|||||||
|
|
||||||
// Add any redirects
|
// Add any redirects
|
||||||
if (redirectTo != -1) {
|
if (redirectTo != -1) {
|
||||||
if (redirectTo >= wireNodes.length) {
|
|
||||||
throw new IllegalStateException("Node points to non-existent index " + redirectTo);
|
|
||||||
}
|
|
||||||
|
|
||||||
WireNode redirect = wireNodes[redirectTo];
|
WireNode redirect = wireNodes[redirectTo];
|
||||||
if (redirect.built != null) {
|
if (redirect.built != null) {
|
||||||
args.redirect(redirect.built);
|
args.redirect(redirect.built);
|
||||||
|
|||||||
Reference in New Issue
Block a user