From 93e2895645fe5b0c8c79fe73d41425ad5681c1e8 Mon Sep 17 00:00:00 2001 From: Phoenix616 Date: Thu, 13 Oct 2022 14:14:20 +0100 Subject: [PATCH] Remove deprecated reflection API usage --- .../Acrobot/ChestShop/Listeners/Block/Break/SignBreak.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/Acrobot/ChestShop/Listeners/Block/Break/SignBreak.java b/src/main/java/com/Acrobot/ChestShop/Listeners/Block/Break/SignBreak.java index c919e7c..80442df 100644 --- a/src/main/java/com/Acrobot/ChestShop/Listeners/Block/Break/SignBreak.java +++ b/src/main/java/com/Acrobot/ChestShop/Listeners/Block/Break/SignBreak.java @@ -24,6 +24,7 @@ import org.bukkit.event.entity.EntityChangeBlockEvent; import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.metadata.FixedMetadataValue; +import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.Collections; import java.util.LinkedList; @@ -44,9 +45,9 @@ public class SignBreak implements Listener { public SignBreak() { try { Class.forName("com.destroystokyo.paper.event.block.BlockDestroyEvent"); - ChestShop.getPlugin().registerEvent((Listener) Class.forName("com.Acrobot.ChestShop.Listeners.Block.Break.Attached.PaperBlockDestroy").newInstance()); + ChestShop.getPlugin().registerEvent((Listener) Class.forName("com.Acrobot.ChestShop.Listeners.Block.Break.Attached.PaperBlockDestroy").getDeclaredConstructor().newInstance()); ChestShop.getBukkitLogger().info("Using Paper's BlockDestroyEvent instead of the BlockPhysicsEvent!"); - } catch (ClassNotFoundException | IllegalAccessException | InstantiationException e) { + } catch (ClassNotFoundException | IllegalAccessException | InstantiationException | NoSuchMethodException | InvocationTargetException e) { ChestShop.getPlugin().registerEvent(new PhysicsBreak()); } }