Fix LogBlock integration

This commit is contained in:
Daniel Saukel 2018-09-21 15:05:50 +02:00
parent 221adfa7bb
commit cc8d142ad9

View File

@ -29,10 +29,10 @@ public class LogBlockBarrel {
private static Method queueChestAccess;
static {
if (P.use1_13) {
if (!P.use1_13) {
try {
rawData = BukkitUtils.class.getDeclaredMethod("rawData", ItemStack.class);
queueChestAccess = Consumer.class.getDeclaredMethod("queueChestAccess", String.class, Location.class, int.class, short.class, short.class);
queueChestAccess = Consumer.class.getDeclaredMethod("queueChestAccess", String.class, Location.class, int.class, short.class, short.class, short.class);
} catch (NoSuchMethodException e) {
P.p.errorLog("Failed to hook into LogBlock to log barrels. Logging barrel contents is not going to work.");
P.p.errorLog("Brewery was tested with version 1.12 to 1.13.1 of LogBlock.");
@ -59,7 +59,7 @@ public class LogBlockBarrel {
}
final ItemStack[] diff = compareInventories(items, after);
for (final ItemStack item : diff) {
if (P.use1_13) {
if (!P.use1_13) {
try {
queueChestAccess.invoke(consumer, player.getName(), loc, LegacyUtil.getBlockTypeIdAt(loc), (short) item.getType().getId(), (short) item.getAmount(), (short) rawData.invoke(null, item));
} catch(IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
@ -101,7 +101,7 @@ public class LogBlockBarrel {
if (!isLogging(spigotLoc.getWorld(), Logging.CHESTACCESS)) return;
final ItemStack[] items = compressInventory(contents);
for (final ItemStack item : items) {
if (P.use1_13) {
if (!P.use1_13) {
try {
queueChestAccess.invoke(consumer, playerName, spigotLoc, LegacyUtil.getBlockTypeIdAt(spigotLoc), (short) item.getType().getId(), (short) (item.getAmount() * -1), rawData.invoke(null, item));
} catch(IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {