Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class AnvilInputNMS {
private static final MethodHandle SET_PLAYER_ACTIVE_CONTAINER;
private static final MethodHandle ADD_CONTAINER_SLOT_LISTENER;
private static final MethodHandle INIT_MENU;
private static final MethodHandle GET_TOP_INVENTORY;

// FIELDS
private static final MethodHandle CONTAINER_CHECK_REACHABLE;
Expand Down Expand Up @@ -73,6 +74,8 @@ class AnvilInputNMS {
ADD_CONTAINER_SLOT_LISTENER = getMethod(
CONTAINER, "a", MethodType.methodType(void.class, getNMSClass("world.inventory.ICrafting")));
INIT_MENU = getMethod(ENTITY_PLAYER, "a", MethodType.methodType(void.class, CONTAINER));

GET_TOP_INVENTORY = getMethod(InventoryView.class, "getTopInventory", MethodType.methodType(Inventory.class));
} catch (Exception exception) {
throw new RuntimeException(
"Unsupported version for Anvil Input feature: " + ReflectionUtils.getVersionInformation(),
Expand All @@ -92,8 +95,7 @@ public static Inventory open(Player player, Object title, String initialInput) {
final Object anvilContainer = ANVIL_CONSTRUCTOR.invoke(windowId, GET_PLAYER_INVENTORY.invoke(entityPlayer));
CONTAINER_CHECK_REACHABLE.invoke(anvilContainer, false);

final AnvilInventory inventory = (AnvilInventory)
((InventoryView) InventoryUpdate.getBukkitView.invoke(anvilContainer)).getTopInventory();
final AnvilInventory inventory = (AnvilInventory) GET_TOP_INVENTORY.invoke(InventoryUpdate.getBukkitView.invoke(anvilContainer));

inventory.setMaximumRepairCost(0);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import me.devnatan.inventoryframework.feature.FeatureInstaller;
import me.devnatan.inventoryframework.internal.BukkitElementFactory;
import me.devnatan.inventoryframework.internal.PlatformUtils;
import me.devnatan.inventoryframework.runtime.InventoryFramework;
import me.devnatan.inventoryframework.runtime.thirdparty.Metrics;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
Expand All @@ -28,7 +27,7 @@ public class ViewFrame extends IFViewFrame<ViewFrame, View> {

private static final String BSTATS_SYSTEM_PROP = "inventory-framework.enable-bstats";
private static final int BSTATS_PROJECT_ID = 15518;
private static final String PLUGIN_FQN = InventoryFramework.class.getName();
private static final String PLUGIN_FQN = "me#devnatan#inventoryframework#runtime#InventoryFramework";

private static final String RELOCATION_MESSAGE =
"Inventory Framework is running as a shaded non-relocated library. It's extremely recommended that "
Expand Down Expand Up @@ -270,7 +269,7 @@ private void checkRelocationIssues() {
getOwner().getServer().getPluginManager().isPluginEnabled("InventoryFramework");
boolean isLibraryPresent = false;
try {
Class.forName(PLUGIN_FQN);
Class.forName(PLUGIN_FQN.replace('#', '.'));
isLibraryPresent = true;
} catch (ClassNotFoundException ignored) {
}
Expand Down
Loading