diff --git a/ISSUE_TEMPLATE.md b/ISSUE_TEMPLATE.md new file mode 100644 index 000000000..1b785cc64 --- /dev/null +++ b/ISSUE_TEMPLATE.md @@ -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? + diff --git a/README.md b/README.md index 4bd878f48..d45e9ae53 100644 --- a/README.md +++ b/README.md @@ -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! \ No newline at end of file +Thanks! + + diff --git a/src/main/java/us/myles/ViaVersion/handlers/ViaDecodeHandler.java b/src/main/java/us/myles/ViaVersion/handlers/ViaDecodeHandler.java index ad39cd125..0a2d0f735 100644 --- a/src/main/java/us/myles/ViaVersion/handlers/ViaDecodeHandler.java +++ b/src/main/java/us/myles/ViaVersion/handlers/ViaDecodeHandler.java @@ -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); } } } diff --git a/src/main/java/us/myles/ViaVersion/handlers/ViaEncodeHandler.java b/src/main/java/us/myles/ViaVersion/handlers/ViaEncodeHandler.java index 4cc88c572..dac12dc59 100644 --- a/src/main/java/us/myles/ViaVersion/handlers/ViaEncodeHandler.java +++ b/src/main/java/us/myles/ViaVersion/handlers/ViaEncodeHandler.java @@ -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); } } } diff --git a/src/main/java/us/myles/ViaVersion/transformers/OutgoingTransformer.java b/src/main/java/us/myles/ViaVersion/transformers/OutgoingTransformer.java index 13679fc26..8957365f7 100644 --- a/src/main/java/us/myles/ViaVersion/transformers/OutgoingTransformer.java +++ b/src/main/java/us/myles/ViaVersion/transformers/OutgoingTransformer.java @@ -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; }