From c58f39c8b2e21fd13783821782ed2f30713ee819 Mon Sep 17 00:00:00 2001 From: Flowsqy <47575244+Flowsqy@users.noreply.github.com> Date: Thu, 30 Dec 2021 12:30:54 +0100 Subject: [PATCH] Handle error properly --- .../shopchest/nms/reflection/FakeArmorStandImpl.java | 5 +++-- .../shopchest/nms/reflection/FakeEntityImpl.java | 5 +++-- .../shopchest/nms/reflection/FakeItemImpl.java | 10 ++++++---- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/nms/reflection/src/main/java/de/epiceric/shopchest/nms/reflection/FakeArmorStandImpl.java b/nms/reflection/src/main/java/de/epiceric/shopchest/nms/reflection/FakeArmorStandImpl.java index e0cba98..b4838cc 100644 --- a/nms/reflection/src/main/java/de/epiceric/shopchest/nms/reflection/FakeArmorStandImpl.java +++ b/nms/reflection/src/main/java/de/epiceric/shopchest/nms/reflection/FakeArmorStandImpl.java @@ -25,8 +25,9 @@ public class FakeArmorStandImpl extends FakeEntityImpl implements FakeArmorStand .newInstance(entityId, dataWatcher, true), receiver); } } catch (ReflectiveOperationException e) { - // TODO Handle this properly - throw new RuntimeException(e); + debug.getLogger().severe("Could not set hologram data"); + debug.debug("Could not set armor stand data"); + debug.debug(e); } } diff --git a/nms/reflection/src/main/java/de/epiceric/shopchest/nms/reflection/FakeEntityImpl.java b/nms/reflection/src/main/java/de/epiceric/shopchest/nms/reflection/FakeEntityImpl.java index b2385c9..2efdde1 100644 --- a/nms/reflection/src/main/java/de/epiceric/shopchest/nms/reflection/FakeEntityImpl.java +++ b/nms/reflection/src/main/java/de/epiceric/shopchest/nms/reflection/FakeEntityImpl.java @@ -31,8 +31,9 @@ public abstract class FakeEntityImpl implements FakeEntity { ReflectionUtils.sendPacket(debug, packetPlayOutEntityDestroyClass.getConstructor(int[].class).newInstance((Object) new int[]{entityId}), receiver); } } catch (ReflectiveOperationException e){ - // TODO Handle this properly - throw new RuntimeException(e); + debug.getLogger().severe("Could not remove hologram"); + debug.debug("Could not remove hologram"); + debug.debug(e); } } } diff --git a/nms/reflection/src/main/java/de/epiceric/shopchest/nms/reflection/FakeItemImpl.java b/nms/reflection/src/main/java/de/epiceric/shopchest/nms/reflection/FakeItemImpl.java index f8712c9..0d46223 100644 --- a/nms/reflection/src/main/java/de/epiceric/shopchest/nms/reflection/FakeItemImpl.java +++ b/nms/reflection/src/main/java/de/epiceric/shopchest/nms/reflection/FakeItemImpl.java @@ -43,8 +43,9 @@ public class FakeItemImpl extends FakeEntityImpl implements FakeItem { ReflectionUtils.sendPacket(debug, packetPlayOutEntityMetadataClass.getConstructor(int.class, dataWatcherClass, boolean.class).newInstance(entityId, dataWatcher, true), receiver); } }catch (ReflectiveOperationException e){ - // TODO Handle this properly - throw new RuntimeException(e); + debug.getLogger().severe("Failed to send item's data!"); + debug.debug("Failed to send item's data!"); + debug.debug(e); } } @@ -62,8 +63,9 @@ public class FakeItemImpl extends FakeEntityImpl implements FakeItem { ReflectionUtils.sendPacket(debug, velocityPacket, receiver); } }catch (ReflectiveOperationException e){ - // TODO Handle this properly - throw new RuntimeException(e); + debug.getLogger().severe("Failed to reset item's velocity!"); + debug.debug("Failed to reset item's velocity!"); + debug.debug(e); } }