fix hologram load error, classloader errors for missing hooks

This commit is contained in:
jascotty2 2019-09-04 08:06:46 -05:00
parent f73e54c4e2
commit 5afe6799fe
4 changed files with 11 additions and 8 deletions

View File

@ -55,9 +55,12 @@ public final class PluginHook <T extends Class> {
hooks.put(handler, this);
// Does this class have a plugin constructor?
try {
pluginConstructor = type.getDeclaredConstructor(Plugin.class);
pluginConstructor = handler.getDeclaredConstructor(Plugin.class);
} catch (NoSuchMethodException | SecurityException ex) {
// nope!
} catch (Throwable t) {
// (can also reach here if there is a class loader exception)
hooks.remove(handler);
}
}

View File

@ -2,7 +2,7 @@ package com.songoda.core.hooks.holograms;
import com.songoda.core.hooks.Hook;
import org.bukkit.Location;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.plugin.Plugin;
import java.util.Collections;
import java.util.List;
@ -13,9 +13,9 @@ public abstract class Holograms implements Hook {
protected double yOffset = 0.5;
protected double zOffset = 0.5;
protected final JavaPlugin plugin;
protected final Plugin plugin;
public Holograms(JavaPlugin plugin) {
public Holograms(Plugin plugin) {
this.plugin = plugin;
}

View File

@ -6,7 +6,7 @@ import com.sainttx.holograms.api.line.HologramLine;
import com.sainttx.holograms.api.line.TextLine;
import java.util.HashSet;
import org.bukkit.Location;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.plugin.Plugin;
import java.util.List;
import org.bukkit.Bukkit;
@ -16,7 +16,7 @@ public class HologramsHolograms extends Holograms {
HologramPlugin hologramPlugin;
HashSet<String> ourHolograms = new HashSet();
public HologramsHolograms(JavaPlugin plugin) {
public HologramsHolograms(Plugin plugin) {
super(plugin);
hologramPlugin = (HologramPlugin) Bukkit.getPluginManager().getPlugin("Holograms");
}

View File

@ -3,13 +3,13 @@ package com.songoda.core.hooks.holograms;
import com.gmail.filoghost.holographicdisplays.api.Hologram;
import com.gmail.filoghost.holographicdisplays.api.HologramsAPI;
import org.bukkit.Location;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.plugin.Plugin;
import java.util.List;
public class HolographicDisplaysHolograms extends Holograms {
public HolographicDisplaysHolograms(JavaPlugin plugin) {
public HolographicDisplaysHolograms(Plugin plugin) {
super(plugin);
}