3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-10-03 08:41:05 +02:00

Merge pull request #4 from MylesIsCool/master

Merge from master
Dieser Commit ist enthalten in:
HugoDaBosss 2016-03-03 12:17:06 +01:00
Commit 5e34fda7e4
5 geänderte Dateien mit 36 neuen und 19 gelöschten Zeilen

10
ISSUE_TEMPLATE.md Normale Datei
Datei anzeigen

@ -0,0 +1,10 @@
### What version of ViaVersion are you using? Type /ver viaversion
### What version of Spigot are you using? Type /ver
### What plugins are you using? /plugins
### How does this error happen? login? using an item?
### Is there an error in the console? Use pastebin.com. Is there a kick message?

Datei anzeigen

@ -34,10 +34,16 @@ Contributors:
**Paulomart**
**gigosaurus**
**Chat: ** https://gitter.im/MylesIsCool/ViaVersion
We use it to collaborate and solve errors, sign in with github.
License:
--------
You may modify this work, all rights are still owned by myself excluding any files in the spacebase package as they belong to the respected contributors. Please credit the original author (myself) when forking etc. (or if it helped you understand the new protocol or netty!)
Thanks!
Thanks!

Datei anzeigen

@ -8,7 +8,6 @@ import us.myles.ViaVersion.ConnectionInfo;
import us.myles.ViaVersion.transformers.IncomingTransformer;
import us.myles.ViaVersion.util.PacketUtil;
import java.nio.channels.ClosedChannelException;
import java.util.List;
public class ViaDecodeHandler extends ByteToMessageDecoder {
@ -45,15 +44,10 @@ public class ViaDecodeHandler extends ByteToMessageDecoder {
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
if (!(cause.getCause().getCause() instanceof CancelException)
&& !(cause.getCause().getCause() instanceof ClosedChannelException)) {
if (!(cause.getCause() instanceof CancelException)
&& !(cause.getCause() instanceof ClosedChannelException)) {
if (!(cause instanceof CancelException)
&& !(cause instanceof ClosedChannelException)) {
if (cause instanceof Exception){
cause.printStackTrace();
}
if (!(cause.getCause().getCause() instanceof CancelException)) {
if (!(cause.getCause() instanceof CancelException)) {
if (!(cause instanceof CancelException)) {
super.exceptionCaught(ctx, cause);
}
}
}

Datei anzeigen

@ -72,14 +72,10 @@ public class ViaEncodeHandler extends MessageToByteEncoder {
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
if (!(cause.getCause().getCause() instanceof CancelException)
&& !(cause.getCause().getCause() instanceof ClosedChannelException)) {
if (!(cause.getCause() instanceof CancelException)
&& !(cause.getCause() instanceof ClosedChannelException)) {
if (!(cause instanceof CancelException)
&& !(cause instanceof ClosedChannelException)) {
if (cause instanceof Exception)
cause.printStackTrace();
if (!(cause.getCause().getCause() instanceof CancelException)) {
if (!(cause.getCause() instanceof CancelException)) {
if (!(cause instanceof CancelException)) {
super.exceptionCaught(ctx, cause);
}
}
}

Datei anzeigen

@ -2,10 +2,14 @@ package us.myles.ViaVersion.transformers;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import io.netty.buffer.ByteBuf;
import org.bukkit.entity.EntityType;
import org.json.simple.parser.JSONParser;
import org.spacehq.mc.protocol.data.game.chunk.Column;
import org.spacehq.mc.protocol.util.NetUtil;
import us.myles.ViaVersion.CancelException;
import us.myles.ViaVersion.ConnectionInfo;
import us.myles.ViaVersion.ViaVersionPlugin;
@ -492,6 +496,13 @@ public class OutgoingTransformer {
if (line.startsWith("\""))
line = "{\"text\":" + line + "}";
}
try {
new JSONParser().parse(line);
}
catch (org.json.simple.parser.ParseException e) {
System.out.println("Invalid JSON String: \"" + line + "\" Please report this issue to the ViaVersion Github!");
return "{\"text\":\"\"}";
}
return line;
}