Skip to content

Commit

Permalink
Release version 1.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
MrMicky-FR committed Jul 16, 2022
1 parent 429b4d9 commit 9f977b0
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Setup JDK ${{ matrix.java-version }}
uses: actions/setup-java@v2
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
allprojects {
group 'com.azuriom'
version '1.1.1'
version '1.1.2'
}

subprojects {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
*/
public class HttpDecoder extends ByteToMessageDecoder {

// Since Spigot 1.19, netty-codec-http is no longer included in SpigotMC.
// PaperMC must be used instead to have instant commands.
private final boolean supported = isSupported();

private final AzLinkPlugin plugin;

public HttpDecoder(AzLinkPlugin plugin) {
Expand Down Expand Up @@ -64,6 +68,11 @@ protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) {
// ignore
}

if (!supported) {
logUnsupported();
return;
}

pipeline.addLast("codec-http", new HttpServerCodec());
pipeline.addLast("aggregator", new HttpObjectAggregator(65536));
pipeline.addLast("handler", new HttpHandler(this.plugin));
Expand All @@ -73,8 +82,26 @@ protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) {
in.release();
}

private void logUnsupported() {
this.plugin.getLogger().error("AzLink is not compatible with your server software, please use Paper instead!");
this.plugin.getLogger().error("Paper offers significant performance improvements, bug fixes, security");
this.plugin.getLogger().error("enhancements and optional features for server owners to enhance their server.");
this.plugin.getLogger().error("");
this.plugin.getLogger().error("Download: https://papermc.io/downloads");
}

private boolean isHttp(int magic1, int magic2, int magic3, int magic4) {
return magic1 == 'G' && magic2 == 'E' && magic3 == 'T' && magic4 == ' ' || // GET
magic1 == 'P' && magic2 == 'O' && magic3 == 'S' && magic4 == 'T'; // POST
}

private boolean isSupported() {
try {
Class.forName("io.netty.handler.codec.http.HttpServerCodec");

return true;
} catch (ClassNotFoundException e) {
return false;
}
}
}

0 comments on commit 9f977b0

Please sign in to comment.