Added Config option to disable MC Barrel Aging

issue #265
This commit is contained in:
Sn0wStorm
2020-04-13 12:01:41 +02:00
parent 8f7696cdb5
commit 2cd52955a0
12 changed files with 29 additions and 11 deletions
+4 -1
View File
@@ -19,6 +19,7 @@ public class MCBarrel {
public static final byte OAK = 2;
public static final String TAG = "Btime";
public static int maxBrews = 6;
public static boolean enableAging = true;
public static long mcBarrelTime; // Globally stored Barrel time. Difference between this and the time stored on each mc-barrel will give the barrel age time
public static List<MCBarrel> openBarrels = new ArrayList<>();
@@ -115,7 +116,9 @@ public class MCBarrel {
public static void onUpdate() {
mcBarrelTime++;
if (enableAging) {
mcBarrelTime++;
}
}
// Used to visually stop Players from placing more than 6 (configurable) brews in the MC Barrels.
+5 -1
View File
@@ -240,10 +240,14 @@ public class BConfig {
alwaysShowAlc = config.getBoolean("alwaysShowAlc", false);
enableEncode = config.getBoolean("enableEncode", false);
openEverywhere = config.getBoolean("openLargeBarrelEverywhere", false);
MCBarrel.maxBrews = config.getInt("maxBrewsInMCBarrels", 6);
useOffhandForCauldron = config.getBoolean("useOffhandForCauldron", false);
loadDataAsync = config.getBoolean("loadDataAsync", true);
if (P.use1_14) {
MCBarrel.maxBrews = config.getInt("maxBrewsInMCBarrels", 6);
MCBarrel.enableAging = config.getBoolean("ageInMCBarrels", true);
}
Brew.loadSeed(config, new File(P.p.getDataFolder(), "config.yml"));
if (!P.use1_13) {
@@ -177,6 +177,7 @@ public class InventoryListener implements Listener {
public void onInventoryClickMCBarrel(InventoryClickEvent event) {
if (!P.use1_14) return;
if (event.getInventory().getType() != InventoryType.BARREL) return;
if (!MCBarrel.enableAging) return;
Inventory inv = event.getInventory();
for (MCBarrel barrel : MCBarrel.openBarrels) {
@@ -227,6 +228,7 @@ public class InventoryListener implements Listener {
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onInventoryOpen(InventoryOpenEvent event) {
if (!P.use1_14) return;
if (!MCBarrel.enableAging) return;
/*Barrel x = null;
if (event.getInventory().getHolder() instanceof Barrel) {
@@ -311,7 +313,7 @@ public class InventoryListener implements Listener {
}
// Check for MC Barrel
if (event.getInventory().getType() == InventoryType.BARREL) {
if (MCBarrel.enableAging && event.getInventory().getType() == InventoryType.BARREL) {
Inventory inv = event.getInventory();
for (Iterator<MCBarrel> iter = MCBarrel.openBarrels.iterator(); iter.hasNext(); ) {
MCBarrel barrel = iter.next();