From 0ca57f479bff6fb4b7a37786c2cea03d6aaacbea Mon Sep 17 00:00:00 2001 From: gmcferrin Date: Wed, 1 Feb 2012 10:23:36 -0500 Subject: [PATCH] Added Nether Brick, End Stone, Moss Stone, and Stone Brick to Mining. --- .../gmail/nossr50/config/LoadProperties.java | 6 +- .../nossr50/listeners/mcBlockListener.java | 2 +- src/main/java/com/gmail/nossr50/m.java | 2 +- .../com/gmail/nossr50/skills/Herbalism.java | 6 +- .../java/com/gmail/nossr50/skills/Mining.java | 88 ++++++++++++++++--- 5 files changed, 82 insertions(+), 22 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/config/LoadProperties.java b/src/main/java/com/gmail/nossr50/config/LoadProperties.java index 78c3b7732..c3f72183a 100644 --- a/src/main/java/com/gmail/nossr50/config/LoadProperties.java +++ b/src/main/java/com/gmail/nossr50/config/LoadProperties.java @@ -66,7 +66,7 @@ public class LoadProperties { keepEnchantsRank3, keepEnchantsRank4, fishingDropChanceTier1, fishingDropChanceTier2, fishingDropChanceTier3, fishingDropChanceTier4, fishingDropChanceTier5, mnetherwart, - mvines, mlilypad; + mvines, mlilypad, mnetherbrick, mendstone, mmossstone, mstonebrick; public static double xpbackground_r, xpbackground_g, xpbackground_b, xpborder_r, xpborder_g, xpborder_b, fishing_r, fishing_g, @@ -259,6 +259,10 @@ public class LoadProperties { mcoal = readInteger("Experience.Mining.Coal", 100); mstone = readInteger("Experience.Mining.Stone", 30); msandstone = readInteger("Experience.Mining.Sandstone", 30); + mnetherbrick = readInteger("Experience.Mining.Nether_Brick", 30); + mendstone = readInteger("Experience.Mining.End_Stone", 150); + mmossstone = readInteger("Experience.Mining.Moss_Stone", 30); + mstonebrick = readInteger("Experience.Mining.Stone_Brick", 30); mfishing = readInteger("Experience.Fishing.Base", 800); diff --git a/src/main/java/com/gmail/nossr50/listeners/mcBlockListener.java b/src/main/java/com/gmail/nossr50/listeners/mcBlockListener.java index 583cbdd99..8c38a8c54 100644 --- a/src/main/java/com/gmail/nossr50/listeners/mcBlockListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/mcBlockListener.java @@ -78,7 +78,7 @@ public class mcBlockListener implements Listener int id = block.getTypeId(); //Only needed for blocks that use their block data (wood, pumpkins, etc.) - if (id == 17 || id == 73 || id == 74 || id == 81 || id == 83 || id == 86 || id == 91 || id == 106) + if (id == 17 || id == 73 || id == 74 || id == 81 || id == 83 || id == 86 || id == 91 || id == 106 || id == 98) plugin.misc.blockWatchList.add(block); else { //block.setData((byte) 5); //Change the byte diff --git a/src/main/java/com/gmail/nossr50/m.java b/src/main/java/com/gmail/nossr50/m.java index ac1e9fbfa..ac3eff9eb 100644 --- a/src/main/java/com/gmail/nossr50/m.java +++ b/src/main/java/com/gmail/nossr50/m.java @@ -93,7 +93,7 @@ public class m } public static boolean shouldBeWatched(int id) { return id == 2 || id == 3 || id == 12 || id == 13 || id == 82 || //Excavation - id == 1 || id == 14 || id == 15 || id == 16 || id == 21 || id == 24 || id == 49 || id == 56 || id == 73 || id == 74 || id == 87 || id == 89 || //Mining + id == 1 || id == 14 || id == 15 || id == 16 || id == 21 || id == 24 || id == 49 || id == 56 || id == 73 || id == 74 || id == 87 || id == 89 || id == 112 || id == 121 || id == 48 || id == 98 || //Mining id == 17 || id == 37 || id == 38 || id == 39 || id == 40 || id == 81 || id == 83 || id == 86 || id == 91 || id == 103 || id == 106 || id == 111 || //Woodcutting & Herbalism id == 42; //Anvil } diff --git a/src/main/java/com/gmail/nossr50/skills/Herbalism.java b/src/main/java/com/gmail/nossr50/skills/Herbalism.java index d1c00d1c5..e141dd81f 100644 --- a/src/main/java/com/gmail/nossr50/skills/Herbalism.java +++ b/src/main/java/com/gmail/nossr50/skills/Herbalism.java @@ -114,11 +114,7 @@ public class Herbalism public static Boolean canBeGreenTerra(Block block){ int t = block.getTypeId(); - if(t == 103 || t == 4 || t == 3 || t == 59 || t == 81 || t == 83 || t == 91 || t == 86 || t == 39 || t == 46 || t == 37 || t == 38){ - return true; - } else { - return false; - } + return t == 103 || t == 4 || t == 3 || t == 59 || t == 81 || t == 83 || t == 91 || t == 86 || t == 39 || t == 46 || t == 37 || t == 38; } public static boolean hasSeeds(Player player){ ItemStack[] inventory = player.getInventory().getContents(); diff --git a/src/main/java/com/gmail/nossr50/skills/Mining.java b/src/main/java/com/gmail/nossr50/skills/Mining.java index a4efad68b..eec8d651b 100644 --- a/src/main/java/com/gmail/nossr50/skills/Mining.java +++ b/src/main/java/com/gmail/nossr50/skills/Mining.java @@ -84,7 +84,7 @@ public class Mining byte damage = 0; ItemStack item = new ItemStack(mat, 1, (byte)0, damage); - if(id != 89 && id != 73 && id != 74 && id != 56 && id != 21 && id != 1 && id != 16) { + if(id != 89 && id != 73 && id != 74 && id != 56 && id != 21 && id != 1 && id != 16 && id != 112 && id != 121 && id != 48) { m.mcDropItem(loc, item); return; } @@ -222,6 +222,22 @@ public class Mining case 21: xp += LoadProperties.mlapis; break; + //NETHER BRICK + case 112: + xp += LoadProperties.mnetherbrick; + break; + //END STONE + case 121: + xp += LoadProperties.mendstone; + break; + //MOSS STONE + case 48: + xp += LoadProperties.mmossstone; + break; + //STONE BRICK + case 98: + xp += LoadProperties.mstonebrick; + break; } blockProcCheck(block, player); @@ -235,7 +251,7 @@ public class Mining public static Boolean canBeSuperBroken(Block block) { int id = block.getTypeId(); - return id == 1 || id == 14 || id == 15 || id == 16 || id == 21 || id == 24 || id == 49 || id == 56 || id == 73 || id == 74 || id == 87 || id == 89; + return id == 1 || id == 14 || id == 15 || id == 16 || id == 21 || id == 24 || id == 49 || id == 56 || id == 73 || id == 74 || id == 87 || id == 89 || id == 112 || id == 121 || id == 48 || id == 98; } public static void SuperBreakerBlockCheck(Player player, Block block, mcMMO plugin) @@ -258,7 +274,7 @@ public class Mining //STONE if(id == 1) { - if(!plugin.misc.blockWatchList.contains(block) && block.getData() != (byte) 5) + if(block.getData() != (byte) 5) { xp += LoadProperties.mstone; blockProcCheck(block, player); @@ -273,7 +289,7 @@ public class Mining //SANDSTONE else if(id == 24) { - if(!plugin.misc.blockWatchList.contains(block) && block.getData() != (byte) 5) + if(block.getData() != (byte) 5) { xp += LoadProperties.msandstone; blockProcCheck(block, player); @@ -286,7 +302,7 @@ public class Mining //NETHERRACK else if(id == 87) { - if(!plugin.misc.blockWatchList.contains(block)&& block.getData() != (byte) 5){ + if(block.getData() != (byte) 5){ xp += LoadProperties.mnetherrack; blockProcCheck(block, player); blockProcCheck(block, player); @@ -298,7 +314,7 @@ public class Mining //GLOWSTONE else if(id == 89) { - if(!plugin.misc.blockWatchList.contains(block)&& block.getData() != (byte) 5){ + if(block.getData() != (byte) 5){ xp += LoadProperties.mglowstone; blockProcCheck(block, player); blockProcCheck(block, player); @@ -312,7 +328,7 @@ public class Mining //COAL else if(id == 16) { - if(!plugin.misc.blockWatchList.contains(block)&& block.getData() != (byte) 5){ + if(block.getData() != (byte) 5){ xp += LoadProperties.mcoal; blockProcCheck(block, player); blockProcCheck(block, player); @@ -326,7 +342,7 @@ public class Mining //GOLD else if(id == 14 && m.getTier(player) >= 3) { - if(!plugin.misc.blockWatchList.contains(block)&& block.getData() != (byte) 5){ + if(block.getData() != (byte) 5){ xp += LoadProperties.mgold; blockProcCheck(block, player); blockProcCheck(block, player); @@ -338,7 +354,7 @@ public class Mining //OBSIDIAN else if(id == 49 && m.getTier(player) >= 4) { - if(!plugin.misc.blockWatchList.contains(block)&& block.getData() != (byte) 5){ + if(block.getData() != (byte) 5){ xp += LoadProperties.mobsidian; blockProcCheck(block, player); blockProcCheck(block, player); @@ -350,7 +366,7 @@ public class Mining //DIAMOND else if(id == 56 && m.getTier(player) >= 3) { - if(!plugin.misc.blockWatchList.contains(block)&& block.getData() != (byte) 5){ + if(block.getData() != (byte) 5){ xp += LoadProperties.mdiamond; blockProcCheck(block, player); blockProcCheck(block, player); @@ -364,7 +380,7 @@ public class Mining //IRON else if(id == 15 && m.getTier(player) >= 2) { - if(!plugin.misc.blockWatchList.contains(block)&& block.getData() != (byte) 5){ + if(block.getData() != (byte) 5){ xp += LoadProperties.miron; blockProcCheck(block, player); blockProcCheck(block, player); @@ -376,7 +392,7 @@ public class Mining //REDSTONE else if((id == 73 || id == 74) && m.getTier(player) >= 3) { - if(!plugin.misc.blockWatchList.contains(block)&& block.getData() != (byte) 5) + if(!plugin.misc.blockWatchList.contains(block)) { xp += LoadProperties.mredstone; blockProcCheck(block, player); @@ -395,7 +411,7 @@ public class Mining } //LAPIS else if(id == 21 && m.getTier(player) >= 3){ - if(!plugin.misc.blockWatchList.contains(block)&& block.getData() != (byte) 5){ + if(block.getData() != (byte) 5){ xp += LoadProperties.mlapis; blockProcCheck(block, player); blockProcCheck(block, player); @@ -417,8 +433,52 @@ public class Mining player.incrementStatistic(Statistic.MINE_BLOCK, block.getType()); block.setType(Material.AIR); } + //NETHER BRICK + else if(id == 112){ + if(block.getData() != (byte) 5){ + xp += LoadProperties.mnetherbrick; + blockProcCheck(block, player); + blockProcCheck(block, player); + } + m.mcDropItem(loc, item); + player.incrementStatistic(Statistic.MINE_BLOCK, block.getType()); + block.setType(Material.AIR); + } + //END STONE + else if(id == 121){ + if(block.getData() != (byte) 5){ + xp += LoadProperties.mendstone; + blockProcCheck(block, player); + blockProcCheck(block, player); + } + m.mcDropItem(loc, item); + player.incrementStatistic(Statistic.MINE_BLOCK, block.getType()); + block.setType(Material.AIR); + } + //MOSS STONE + else if(id == 48){ + if(block.getData() != (byte) 5){ + xp += LoadProperties.mmossstone; + blockProcCheck(block, player); + blockProcCheck(block, player); + } + m.mcDropItem(loc, item); + player.incrementStatistic(Statistic.MINE_BLOCK, block.getType()); + block.setType(Material.AIR); + } + //STONE BRICK + else if(id == 98){ + if(!plugin.misc.blockWatchList.contains(block)){ + xp += LoadProperties.mstonebrick; + blockProcCheck(block, player); + blockProcCheck(block, player); + } + m.mcDropItem(loc, item); + player.incrementStatistic(Statistic.MINE_BLOCK, block.getType()); + block.setType(Material.AIR); + } - if(block.getData() != (byte) 5) + if(!plugin.misc.blockWatchList.contains(block) && block.getData() != (byte) 5) PP.addXP(SkillType.MINING, xp, player); if(LoadProperties.spoutEnabled) SpoutStuff.playSoundForPlayer(SoundEffect.POP, player, block.getLocation());