mirror of
https://github.com/exituser/Brewery.git
synced 2026-09-17 06:38:56 +00:00
Fix LogBlock integration
This commit is contained in:
@@ -29,10 +29,10 @@ public class LogBlockBarrel {
|
|||||||
private static Method queueChestAccess;
|
private static Method queueChestAccess;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
if (P.use1_13) {
|
if (!P.use1_13) {
|
||||||
try {
|
try {
|
||||||
rawData = BukkitUtils.class.getDeclaredMethod("rawData", ItemStack.class);
|
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) {
|
} 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("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.");
|
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);
|
final ItemStack[] diff = compareInventories(items, after);
|
||||||
for (final ItemStack item : diff) {
|
for (final ItemStack item : diff) {
|
||||||
if (P.use1_13) {
|
if (!P.use1_13) {
|
||||||
try {
|
try {
|
||||||
queueChestAccess.invoke(consumer, player.getName(), loc, LegacyUtil.getBlockTypeIdAt(loc), (short) item.getType().getId(), (short) item.getAmount(), (short) rawData.invoke(null, item));
|
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) {
|
} catch(IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
|
||||||
@@ -101,7 +101,7 @@ public class LogBlockBarrel {
|
|||||||
if (!isLogging(spigotLoc.getWorld(), Logging.CHESTACCESS)) return;
|
if (!isLogging(spigotLoc.getWorld(), Logging.CHESTACCESS)) return;
|
||||||
final ItemStack[] items = compressInventory(contents);
|
final ItemStack[] items = compressInventory(contents);
|
||||||
for (final ItemStack item : items) {
|
for (final ItemStack item : items) {
|
||||||
if (P.use1_13) {
|
if (!P.use1_13) {
|
||||||
try {
|
try {
|
||||||
queueChestAccess.invoke(consumer, playerName, spigotLoc, LegacyUtil.getBlockTypeIdAt(spigotLoc), (short) item.getType().getId(), (short) (item.getAmount() * -1), rawData.invoke(null, item));
|
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) {
|
} catch(IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user