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,6 +34,10 @@ Contributors:
**Paulomart** **Paulomart**
**gigosaurus** **gigosaurus**
**Chat: ** https://gitter.im/MylesIsCool/ViaVersion
We use it to collaborate and solve errors, sign in with github.
License: License:
-------- --------
@ -41,3 +45,5 @@ You may modify this work, all rights are still owned by myself excluding any fil
Thanks! Thanks!

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

@ -2,10 +2,14 @@ package us.myles.ViaVersion.transformers;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import org.bukkit.entity.EntityType; 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.data.game.chunk.Column;
import org.spacehq.mc.protocol.util.NetUtil; import org.spacehq.mc.protocol.util.NetUtil;
import us.myles.ViaVersion.CancelException; import us.myles.ViaVersion.CancelException;
import us.myles.ViaVersion.ConnectionInfo; import us.myles.ViaVersion.ConnectionInfo;
import us.myles.ViaVersion.ViaVersionPlugin; import us.myles.ViaVersion.ViaVersionPlugin;
@ -492,6 +496,13 @@ public class OutgoingTransformer {
if (line.startsWith("\"")) if (line.startsWith("\""))
line = "{\"text\":" + line + "}"; 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; return line;
} }