Remove deprecated reflection API usage

This commit is contained in:
Phoenix616 2022-10-13 14:14:20 +01:00
parent e99ae1eb1e
commit 93e2895645
No known key found for this signature in database
GPG Key ID: 40E2321E71738EB0
1 changed files with 3 additions and 2 deletions

View File

@ -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());
}
}