1
0
mirror of https://e.coding.net/circlecloud/QuickShop.git synced 2024-10-31 22:38:45 +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;
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<FakeItem> 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<FakeItem> 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<FakeItem> 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<FakeItem> 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) {
}
}
};