3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-11-20 06:50:08 +01:00

Format some lines properly

Dieser Commit ist enthalten in:
Myles 2016-03-02 10:19:36 +00:00
Ursprung 8e6d76296d
Commit 114a7b6bd6
2 geänderte Dateien mit 19 neuen und 20 gelöschten Zeilen

Datei anzeigen

@ -1,10 +1,10 @@
package us.myles.ViaVersion.transformers; package us.myles.ViaVersion.transformers;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import us.myles.ViaVersion.CancelException;
import us.myles.ViaVersion.*; import us.myles.ViaVersion.ConnectionInfo;
import us.myles.ViaVersion.ViaVersionPlugin;
import us.myles.ViaVersion.packets.PacketType; import us.myles.ViaVersion.packets.PacketType;
import us.myles.ViaVersion.packets.State; import us.myles.ViaVersion.packets.State;
import us.myles.ViaVersion.util.PacketUtil; import us.myles.ViaVersion.util.PacketUtil;
@ -202,12 +202,12 @@ public class IncomingTransformer {
} }
if (packet == PacketType.PLAY_USE_ITEM) { if (packet == PacketType.PLAY_USE_ITEM) {
output.clear(); output.clear();
PacketUtil.writeVarInt(PacketType.PLAY_PLAYER_BLOCK_PLACEMENT.getPacketID(), output); PacketUtil.writeVarInt(PacketType.PLAY_PLAYER_BLOCK_PLACEMENT.getPacketID(), output);
// Simulate using item :) // Simulate using item :)
output.writeLong(-1L); output.writeLong(-1L);
output.writeByte(255); output.writeByte(255);
// write item in hand // write item in hand
ItemStack inHand = ViaVersionPlugin.getHandItem(info); ItemStack inHand = ViaVersionPlugin.getHandItem(info);
Object item = null; Object item = null;
try { try {
Method m = ReflectionUtil.obc("inventory.CraftItemStack").getDeclaredMethod("asNMSCopy", ItemStack.class); Method m = ReflectionUtil.obc("inventory.CraftItemStack").getDeclaredMethod("asNMSCopy", ItemStack.class);
@ -223,9 +223,9 @@ public class IncomingTransformer {
} }
PacketUtil.writeItem(item, output); PacketUtil.writeItem(item, output);
output.writeByte(-1); output.writeByte(-1);
output.writeByte(-1); output.writeByte(-1);
output.writeByte(-1); output.writeByte(-1);
return; return;
} }
output.writeBytes(input); output.writeBytes(input);

Datei anzeigen

@ -275,11 +275,10 @@ public class OutgoingTransformer {
output.writeInt(data); output.writeInt(data);
short vX = 0, vY = 0, vZ = 0; short vX = 0, vY = 0, vZ = 0;
if(data > 0) if (data > 0) {
{ vX = input.readShort();
vX = input.readShort(); vY = input.readShort();
vY = input.readShort(); vZ = input.readShort();
vZ = input.readShort();
} }
output.writeShort(vX); output.writeShort(vX);
output.writeShort(vY); output.writeShort(vY);
@ -381,7 +380,7 @@ public class OutgoingTransformer {
PacketUtil.writeString(fixJson(line), output); PacketUtil.writeString(fixJson(line), output);
} }
} }
if(packet == PacketType.PLAY_CHAT_MESSAGE) { if (packet == PacketType.PLAY_CHAT_MESSAGE) {
String chat = PacketUtil.readString(input); String chat = PacketUtil.readString(input);
PacketUtil.writeString(fixJson(chat), output); PacketUtil.writeString(fixJson(chat), output);