Optimised AnvilGUI integration
This commit is contained in:
@@ -4,18 +4,24 @@ import com.willfp.ecoenchants.EcoEnchantsPlugin;
|
||||
import com.willfp.ecoenchants.integrations.anvilgui.AnvilGUIIntegration;
|
||||
|
||||
public class AnvilGUIImpl implements AnvilGUIIntegration {
|
||||
private static Class<?> ANVIL_GUI_CLASS = null;
|
||||
|
||||
@Override
|
||||
public boolean isInstance(Object object) {
|
||||
try {
|
||||
return object.getClass().equals(Class.forName("net.wesjd.anvilgui.version.Wrapper" + EcoEnchantsPlugin.NMS_VERSION.substring(1) + "$AnvilContainer"));
|
||||
} catch (ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
assert ANVIL_GUI_CLASS != null;
|
||||
return object.getClass().equals(ANVIL_GUI_CLASS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPluginName() {
|
||||
return "AnvilGUI";
|
||||
}
|
||||
|
||||
static {
|
||||
try {
|
||||
ANVIL_GUI_CLASS = Class.forName("net.wesjd.anvilgui.version.Wrapper" + EcoEnchantsPlugin.NMS_VERSION.substring(1) + "$AnvilContainer");
|
||||
} catch (ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user