这是我要反射获取的类方法

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

private void updateMenu(Block b, BlockMenu inv, boolean force) {
String hasHolo = BlockStorage.getLocationInfo(b.getLocation(), "holo");
int stored = getStored(b);
String itemName = "";
String storedPercent = doubleRoundAndFade(stored / this.MAX_STORAGE * 100.0D);
String storedStacks = doubleRoundAndFade(stored / inv.getItemInSlot(31).getMaxStackSize());
if (inv.hasViewer() || force)
inv.replaceExistingItem(22, (ItemStack)new CustomItemStack(Material.LIME_STAINED_GLASS_PANE, "&6&e" + stored + " / " + this.MAX_STORAGE, new String[] { "&b" + storedStacks + " &8| &7" + storedPercent + "&7%" }));
ItemStack item = inv.getItemInSlot(31);
if (inv.getItemInSlot(31) != null)
itemName = ItemUtils.getItemName(item);
if (((Boolean)this.showHologram.getValue()).booleanValue() && (hasHolo == null || hasHolo.equals("true")))
updateHologram(b, itemName + " &9x" + stored + " &7(" + storedPercent + "&7%)");
if (stored == 0) {
inv.replaceExistingItem(31, (ItemStack)new CustomItemStack(Material.BARRIER, "&c, new String[0]));
if (((Boolean)this.showHologram.getValue()).booleanValue() && (hasHolo == null || hasHolo.equals("true")))
updateHologram(b, "&c);
}
}

反射代码:

1
2
3
4
5
6
7
8
9
10
11
12
...
try {
Method updateMenuMethod = clazz.getDeclaredMethod("updateMenu", Block.class, BlockMenu.class, Boolean.class);
updateMenuMethod.setAccessible(true);
updateMenuMethod.invoke(barrel,block,BlockStorage.getInventory(block),true);
} catch (NoSuchMethodException e) {
throw new RuntimeException(e);
} catch (InvocationTargetException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}

怎么看怎么没错是吧!但还是
WWMZ_PEDB``67ITQLYNVI.png
这是为什么呢,以为是依赖冲突,折腾了快一个小时
眼尖的应该已经看出来了,实际force类型是boolean,getDeclaredMethod却传了个Boolean
哎,宝贵的时间就是被这些该死的小问题浪费