From 6dae73e6b7af20ed30db9089a3f00bd262ed6179 Mon Sep 17 00:00:00 2001 From: 502647092 Date: Thu, 14 Apr 2016 13:43:25 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=B1=8F=E8=94=BD=E6=9C=AA=E5=A4=84?= =?UTF-8?q?=E7=90=86=E7=9A=84=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/maxgamer/QuickShop/Shop/FakeItem.java | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/main/java/org/maxgamer/QuickShop/Shop/FakeItem.java b/src/main/java/org/maxgamer/QuickShop/Shop/FakeItem.java index 48293d1..e4417e8 100644 --- a/src/main/java/org/maxgamer/QuickShop/Shop/FakeItem.java +++ b/src/main/java/org/maxgamer/QuickShop/Shop/FakeItem.java @@ -1,6 +1,5 @@ package org.maxgamer.QuickShop.Shop; -import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -63,42 +62,43 @@ public class FakeItem implements DisplayItem { final PacketAdapter chunkPacketListener = new PacketAdapter(plugin, PacketType.Play.Server.MAP_CHUNK) { @Override public void onPacketSending(final PacketEvent event) { - final PacketContainer packet = event.getPacket(); - final Player p = event.getPlayer(); - final int chunkX = packet.getIntegers().read(0); - final int chunkZ = packet.getIntegers().read(1); - final List fakesInChunk = fakes.get(getChunkIdentifyString(p.getWorld().getChunkAt(chunkX, chunkZ))); - if (fakesInChunk != null) { - try { + try { + final PacketContainer packet = event.getPacket(); + final Player p = event.getPlayer(); + final int chunkX = packet.getIntegers().read(0); + final int chunkZ = packet.getIntegers().read(1); + final List fakesInChunk = fakes.get(getChunkIdentifyString(p.getWorld().getChunkAt(chunkX, chunkZ))); + if (fakesInChunk != null) { for (final FakeItem fake : fakesInChunk) { ProtocolLibrary.getProtocolManager().sendServerPacket(p, fake.getSpawnPacket()); ProtocolLibrary.getProtocolManager().sendServerPacket(p, fake.getVelocityPacket()); ProtocolLibrary.getProtocolManager().sendServerPacket(p, fake.getMetadataPacket()); } - } catch (final InvocationTargetException e) { } + } catch (final Exception e) { } } }; final PacketAdapter chunkBulkPacketListener = new PacketAdapter(plugin, PacketType.Play.Server.MAP_CHUNK_BULK) { @Override public void onPacketSending(final PacketEvent event) { - final PacketContainer packet = event.getPacket(); - final Player p = event.getPlayer(); - final int[] chunksX = packet.getIntegerArrays().read(0); - final int[] chunksZ = packet.getIntegerArrays().read(1); - for (int i = 0; i < chunksX.length; i++) { - final List fakesInChunk = fakes.get(getChunkIdentifyString(p.getWorld().getChunkAt(chunksX[i], chunksZ[i]))); - if (fakesInChunk != null) { - try { + try { + final PacketContainer packet = event.getPacket(); + final Player p = event.getPlayer(); + final int[] chunksX = packet.getIntegerArrays().read(0); + final int[] chunksZ = packet.getIntegerArrays().read(1); + for (int i = 0; i < chunksX.length; i++) { + final List fakesInChunk = fakes.get(getChunkIdentifyString(p.getWorld().getChunkAt(chunksX[i], chunksZ[i]))); + if (fakesInChunk != null) { for (final FakeItem fake : fakesInChunk) { ProtocolLibrary.getProtocolManager().sendServerPacket(p, fake.getSpawnPacket()); ProtocolLibrary.getProtocolManager().sendServerPacket(p, fake.getVelocityPacket()); ProtocolLibrary.getProtocolManager().sendServerPacket(p, fake.getMetadataPacket()); } - } catch (final InvocationTargetException e) { + } } + } catch (final Exception e) { } } };