For Iaccidentally.

This commit is contained in:
GJ 2013-05-03 18:16:42 -04:00
parent 33610c8997
commit 7f0243b2df
3 changed files with 16 additions and 0 deletions

View File

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

View File

@ -1,5 +1,6 @@
package com.gmail.nossr50.listeners; package com.gmail.nossr50.listeners;
import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockState; import org.bukkit.block.BlockState;
import org.bukkit.block.Furnace; import org.bukkit.block.Furnace;
@ -21,6 +22,7 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.metadata.FixedMetadataValue; import org.bukkit.metadata.FixedMetadataValue;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.skills.smelting.SmeltingManager; import com.gmail.nossr50.skills.smelting.SmeltingManager;
import com.gmail.nossr50.util.ItemUtils; import com.gmail.nossr50.util.ItemUtils;
@ -118,6 +120,14 @@ public class InventoryListener implements Listener {
if (furnaceState instanceof Furnace) { if (furnaceState instanceof Furnace) {
ItemStack smelting = ((Furnace) furnaceState).getInventory().getSmelting(); ItemStack smelting = ((Furnace) furnaceState).getInventory().getSmelting();
if (Config.getInstance().getPotatoEnabled() && smelting.getType() == Material.POTATO_ITEM) {
if ((Config.getInstance().getPotatoChance() / 100.0) >= Misc.getRandom().nextDouble()) {
event.setCancelled(true);
furnaceState.getWorld().createExplosion(furnaceState.getLocation(), 4F, true);
return;
}
}
if (furnaceBlock.hasMetadata(mcMMO.furnaceMetadataKey) && smelting != null && ItemUtils.isSmeltable(smelting)) { if (furnaceBlock.hasMetadata(mcMMO.furnaceMetadataKey) && smelting != null && ItemUtils.isSmeltable(smelting)) {
// We can make this assumption because we (should) be the only ones using this exact metadata // We can make this assumption because we (should) be the only ones using this exact metadata
Player player = plugin.getServer().getPlayer(furnaceBlock.getMetadata(mcMMO.furnaceMetadataKey).get(0).asString()); Player player = plugin.getServer().getPlayer(furnaceBlock.getMetadata(mcMMO.furnaceMetadataKey).get(0).asString());

View File

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