1
0
mirror of https://e.coding.net/circlecloud/QuickShop.git synced 2024-11-16 00:58:54 +00:00

fix: 屏蔽未处理的异常

This commit is contained in:
502647092 2016-04-14 13:43:25 +08:00
parent abe7fd3412
commit 6dae73e6b7

View File

@ -1,6 +1,5 @@
package org.maxgamer.QuickShop.Shop; package org.maxgamer.QuickShop.Shop;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -63,42 +62,43 @@ public class FakeItem implements DisplayItem {
final PacketAdapter chunkPacketListener = new PacketAdapter(plugin, PacketType.Play.Server.MAP_CHUNK) { final PacketAdapter chunkPacketListener = new PacketAdapter(plugin, PacketType.Play.Server.MAP_CHUNK) {
@Override @Override
public void onPacketSending(final PacketEvent event) { public void onPacketSending(final PacketEvent event) {
final PacketContainer packet = event.getPacket(); try {
final Player p = event.getPlayer(); final PacketContainer packet = event.getPacket();
final int chunkX = packet.getIntegers().read(0); final Player p = event.getPlayer();
final int chunkZ = packet.getIntegers().read(1); final int chunkX = packet.getIntegers().read(0);
final List<FakeItem> fakesInChunk = fakes.get(getChunkIdentifyString(p.getWorld().getChunkAt(chunkX, chunkZ))); final int chunkZ = packet.getIntegers().read(1);
if (fakesInChunk != null) { final List<FakeItem> fakesInChunk = fakes.get(getChunkIdentifyString(p.getWorld().getChunkAt(chunkX, chunkZ)));
try { if (fakesInChunk != null) {
for (final FakeItem fake : fakesInChunk) { for (final FakeItem fake : fakesInChunk) {
ProtocolLibrary.getProtocolManager().sendServerPacket(p, fake.getSpawnPacket()); ProtocolLibrary.getProtocolManager().sendServerPacket(p, fake.getSpawnPacket());
ProtocolLibrary.getProtocolManager().sendServerPacket(p, fake.getVelocityPacket()); ProtocolLibrary.getProtocolManager().sendServerPacket(p, fake.getVelocityPacket());
ProtocolLibrary.getProtocolManager().sendServerPacket(p, fake.getMetadataPacket()); 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) { final PacketAdapter chunkBulkPacketListener = new PacketAdapter(plugin, PacketType.Play.Server.MAP_CHUNK_BULK) {
@Override @Override
public void onPacketSending(final PacketEvent event) { public void onPacketSending(final PacketEvent event) {
final PacketContainer packet = event.getPacket(); try {
final Player p = event.getPlayer(); final PacketContainer packet = event.getPacket();
final int[] chunksX = packet.getIntegerArrays().read(0); final Player p = event.getPlayer();
final int[] chunksZ = packet.getIntegerArrays().read(1); final int[] chunksX = packet.getIntegerArrays().read(0);
for (int i = 0; i < chunksX.length; i++) { final int[] chunksZ = packet.getIntegerArrays().read(1);
final List<FakeItem> fakesInChunk = fakes.get(getChunkIdentifyString(p.getWorld().getChunkAt(chunksX[i], chunksZ[i]))); for (int i = 0; i < chunksX.length; i++) {
if (fakesInChunk != null) { final List<FakeItem> fakesInChunk = fakes.get(getChunkIdentifyString(p.getWorld().getChunkAt(chunksX[i], chunksZ[i])));
try { if (fakesInChunk != null) {
for (final FakeItem fake : fakesInChunk) { for (final FakeItem fake : fakesInChunk) {
ProtocolLibrary.getProtocolManager().sendServerPacket(p, fake.getSpawnPacket()); ProtocolLibrary.getProtocolManager().sendServerPacket(p, fake.getSpawnPacket());
ProtocolLibrary.getProtocolManager().sendServerPacket(p, fake.getVelocityPacket()); ProtocolLibrary.getProtocolManager().sendServerPacket(p, fake.getVelocityPacket());
ProtocolLibrary.getProtocolManager().sendServerPacket(p, fake.getMetadataPacket()); ProtocolLibrary.getProtocolManager().sendServerPacket(p, fake.getMetadataPacket());
} }
} catch (final InvocationTargetException e) {
} }
} }
} catch (final Exception e) {
} }
} }
}; };