Add option to prevent hopper transfers of bottles

This commit is contained in:
TfT_02 2014-04-27 15:03:07 +02:00
parent ce6892f2e6
commit 8eb6acd60f
4 changed files with 16 additions and 6 deletions

View File

@ -10,6 +10,7 @@ Key:
Version 1.5.01-dev
+ Added new feature to Herbalism. Instantly-regrown crops are protected from being broken for 1 second
+ Added option to config.yml to show the /mcstats scoreboard automatically after logging in
+ Added option to config.yml for Alchemy. Skills.Alchemy.Prevent_Hopper_Transfer_Bottles
+ Added support for `MATERIAL|data` format in treasures.yml
+ Added API to experience events to get XP gain reason
= Fixed bug where the Updater was running on the main thread.
@ -18,6 +19,7 @@ Version 1.5.01-dev
= Fixed bug where dodge would check the wrong player skill level
= Fixed bug which causes /party teleport to stop working
! Vanished players no longer get hit by AoE effects
! Changed Alchemy config option 'Prevent_Hopper_Transfer' renamed to 'Prevent_Hopper_Transfer_Ingredients'
Version 1.5.00
+ Added Podzol & Red Sand to Excavation

View File

@ -448,7 +448,8 @@ public class Config extends AutoUpdateConfigLoader {
/* Alchemy */
public boolean getEnabledForHoppers() { return config.getBoolean("Skills.Alchemy.Enabled_for_Hoppers", true); }
public boolean getPreventHopperTransfer() { return config.getBoolean("Skills.Alchemy.Prevent_Hopper_Transfer", false); }
public boolean getPreventHopperTransferIngredients() { return config.getBoolean("Skills.Alchemy.Prevent_Hopper_Transfer_Ingredients", false); }
public boolean getPreventHopperTransferBottles() { return config.getBoolean("Skills.Alchemy.Prevent_Hopper_Transfer_Bottles", false); }
/* Fishing */
public boolean getFishingDropsEnabled() { return config.getBoolean("Skills.Fishing.Drops_Enabled", true); }

View File

@ -51,7 +51,7 @@ public class InventoryListener implements Listener {
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onInventoryOpen(InventoryOpenEvent event) {
Block furnaceBlock = processInventoryOpenorCloseEvent(event.getInventory());
Block furnaceBlock = processInventoryOpenOrCloseEvent(event.getInventory());
if (furnaceBlock == null || furnaceBlock.hasMetadata(mcMMO.furnaceMetadataKey)) {
return;
@ -68,7 +68,7 @@ public class InventoryListener implements Listener {
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onInventoryClose(InventoryCloseEvent event) {
Block furnaceBlock = processInventoryOpenorCloseEvent(event.getInventory());
Block furnaceBlock = processInventoryOpenOrCloseEvent(event.getInventory());
if (furnaceBlock == null || furnaceBlock.hasMetadata(mcMMO.furnaceMetadataKey)) {
return;
@ -295,7 +295,12 @@ public class InventoryListener implements Listener {
ItemStack item = event.getItem();
if (Config.getInstance().getPreventHopperTransfer() && item.getType() != Material.POTION) {
if (Config.getInstance().getPreventHopperTransferIngredients() && item.getType() != Material.POTION) {
event.setCancelled(true);
return;
}
if (Config.getInstance().getPreventHopperTransferBottles() && item.getType() == Material.POTION) {
event.setCancelled(true);
return;
}
@ -327,7 +332,7 @@ public class InventoryListener implements Listener {
new PlayerUpdateInventoryTask((Player) whoClicked).runTaskLater(plugin, 0);
}
private Block processInventoryOpenorCloseEvent(Inventory inventory) {
private Block processInventoryOpenOrCloseEvent(Inventory inventory) {
if (!(inventory instanceof FurnaceInventory)) {
return null;
}

View File

@ -277,7 +277,9 @@ Skills:
# Allow Hoppers to transfer ingredients and brew Rank 1 Alchemy potions
Enabled_for_Hoppers: true
# Prevent Hoppers from transferring ingredients into Brewing Stands
Prevent_Hopper_Transfer: false
Prevent_Hopper_Transfer_Ingredients: false
# Prevent Hoppers from transferring bottles into Brewing Stands
Prevent_Hopper_Transfer_Bottles: false
Level_Cap: 0
Archery:
Enabled_For_PVP: true