Merge branch 'master' into dev

This commit is contained in:
Myles 2021-02-09 10:36:54 +00:00
commit 628979f923
4 changed files with 24 additions and 40 deletions

View File

@ -31,25 +31,17 @@ public class BukkitDecodeHandler extends ByteToMessageDecoder {
throw CancelDecoderException.generate(null);
}
ByteBuf transformedBuf = null;
try {
if (info.shouldTransformPacket()) {
transformedBuf = ctx.alloc().buffer().writeBytes(bytebuf);
info.transformIncoming(transformedBuf, CancelDecoderException::generate);
}
if (info.shouldTransformPacket()) {
info.transformIncoming(bytebuf, CancelDecoderException::generate);
}
try {
list.addAll(PipelineUtil.callDecode(this.minecraftDecoder, ctx, transformedBuf == null ? bytebuf : transformedBuf));
} catch (InvocationTargetException e) {
if (e.getCause() instanceof Exception) {
throw (Exception) e.getCause();
} else if (e.getCause() instanceof Error) {
throw (Error) e.getCause();
}
}
} finally {
if (transformedBuf != null) {
transformedBuf.release();
try {
list.addAll(PipelineUtil.callDecode(this.minecraftDecoder, ctx, bytebuf));
} catch (InvocationTargetException e) {
if (e.getCause() instanceof Exception) {
throw (Exception) e.getCause();
} else if (e.getCause() instanceof Error) {
throw (Error) e.getCause();
}
}
}

View File

@ -72,7 +72,7 @@ public class BukkitInventoryQuickMoveProvider extends InventoryQuickMoveProvider
// http://wiki.vg/index.php?title=Protocol&oldid=13223#Click_Window
updateTask.addItem(windowId, slotId, actionId);
if (!registered && Via.getPlatform().isPluginEnabled()) {
Via.getPlatform().runSync(updateTask, 5L);
Via.getPlatform().runSync(updateTask);
}
return true;
}

View File

@ -17,12 +17,12 @@ public class DisplayLeaksSubCmd extends ViaSubCommand {
@Override
public boolean execute(ViaCommandSender sender, String[] args) {
if (ResourceLeakDetector.getLevel() != ResourceLeakDetector.Level.ADVANCED)
ResourceLeakDetector.setLevel(ResourceLeakDetector.Level.ADVANCED);
if (ResourceLeakDetector.getLevel() != ResourceLeakDetector.Level.PARANOID)
ResourceLeakDetector.setLevel(ResourceLeakDetector.Level.PARANOID);
else
ResourceLeakDetector.setLevel(ResourceLeakDetector.Level.DISABLED);
sendMessage(sender, "&6Leak detector is now %s", (ResourceLeakDetector.getLevel() == ResourceLeakDetector.Level.ADVANCED ? "&aenabled" : "&cdisabled"));
sendMessage(sender, "&6Leak detector is now %s", (ResourceLeakDetector.getLevel() == ResourceLeakDetector.Level.PARANOID ? "&aenabled" : "&cdisabled"));
return true;
}
}

View File

@ -28,25 +28,17 @@ public class SpongeDecodeHandler extends ByteToMessageDecoder {
throw CancelDecoderException.generate(null);
}
ByteBuf transformedBuf = null;
try {
if (info.shouldTransformPacket()) {
transformedBuf = ctx.alloc().buffer().writeBytes(bytebuf);
info.transformIncoming(transformedBuf, CancelDecoderException::generate);
}
if (info.shouldTransformPacket()) {
info.transformIncoming(bytebuf, CancelDecoderException::generate);
}
try {
list.addAll(PipelineUtil.callDecode(this.minecraftDecoder, ctx, transformedBuf == null ? bytebuf : transformedBuf));
} catch (InvocationTargetException e) {
if (e.getCause() instanceof Exception) {
throw (Exception) e.getCause();
} else if (e.getCause() instanceof Error) {
throw (Error) e.getCause();
}
}
} finally {
if (transformedBuf != null) {
transformedBuf.release();
try {
list.addAll(PipelineUtil.callDecode(this.minecraftDecoder, ctx, bytebuf));
} catch (InvocationTargetException e) {
if (e.getCause() instanceof Exception) {
throw (Exception) e.getCause();
} else if (e.getCause() instanceof Error) {
throw (Error) e.getCause();
}
}
}