We don't need that potato.

This commit is contained in:
GJ 2013-06-12 15:15:56 -04:00
parent 28a78d820a
commit b15f1dde28
3 changed files with 5 additions and 23 deletions

View File

@ -46,9 +46,6 @@ public class Config extends AutoUpdateConfigLoader {
public boolean getVerboseLoggingEnabled() { return config.getBoolean("General.Verbose_Logging", false); }
public boolean getConfigOverwriteEnabled() { return config.getBoolean("General.Config_Update_Overwrite", true); }
public boolean getPotatoEnabled() { return config.getBoolean("General.Potato_Explosion_Enabled", false); }
public int getPotatoChance() { return config.getInt("General.Potato_Explosion_Chance", 1); }
public boolean getPartyDisplayNames() { return config.getBoolean("Commands.p.Use_Display_Names", true); }
public boolean getAdminDisplayNames() { return config.getBoolean("Commands.a.Use_Display_Names", true); }

View File

@ -2,7 +2,6 @@ package com.gmail.nossr50.listeners;
import java.util.List;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import org.bukkit.block.Furnace;
@ -23,7 +22,6 @@ import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.metadata.MetadataValue;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.runnables.PlayerUpdateInventoryTask;
import com.gmail.nossr50.skills.smelting.SmeltingManager;
@ -110,25 +108,15 @@ public class InventoryListener implements Listener {
return;
}
ItemStack smelting = ((Furnace) furnaceState).getInventory().getSmelting();
List<MetadataValue> metadata = furnaceBlock.getMetadata(mcMMO.furnaceMetadataKey);
if (smelting == null) {
if (metadata.isEmpty()) {
return;
}
Material smeltingType = smelting.getType();
ItemStack smelting = ((Furnace) furnaceState).getInventory().getSmelting();
if (Config.getInstance().getPotatoEnabled() && smeltingType == Material.POTATO_ITEM) {
if ((Config.getInstance().getPotatoChance() / 100.0) >= Misc.getRandom().nextDouble()) {
event.setCancelled(true);
furnaceState.getWorld().createExplosion(furnaceState.getLocation(), 4F, true);
return;
}
}
List<MetadataValue> metadata = furnaceBlock.getMetadata(mcMMO.furnaceMetadataKey);
if (metadata.isEmpty() || !ItemUtils.isSmeltable(smelting)) {
if (smelting == null || !ItemUtils.isSmeltable(smelting)) {
return;
}
@ -139,7 +127,7 @@ public class InventoryListener implements Listener {
return;
}
event.setResult(UserManager.getPlayer(player).getSmeltingManager().smeltProcessing(smeltingType, event.getResult()));
event.setResult(UserManager.getPlayer(player).getSmeltingManager().smeltProcessing(smelting.getType(), event.getResult()));
}
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)

View File

@ -26,9 +26,6 @@ General:
Verbose_Logging: false
# Should mcMMO over-write configs to update, or make new ones ending in .new?
Config_Update_Overwrite: true
# Enable potato easter egg?
Potato_Explosion_Enabled: false
Potato_Explosion_Chance: 1
Scoreboards:
# Should mcMMO use scoreboards for /inspect?