ENUM ALL THE THINGS!

This commit is contained in:
GJ 2012-02-25 02:49:53 -05:00
parent 19ea6707fe
commit 695d76dcf4
8 changed files with 358 additions and 127 deletions

View File

@ -71,6 +71,7 @@ public class mcBlockListener implements Listener
block = event.getBlock(); block = event.getBlock();
int id = block.getTypeId(); int id = block.getTypeId();
Material mat = block.getType();
//TNT placement checks - needed for Blast Mining //TNT placement checks - needed for Blast Mining
if(id == 46 && mcPermissions.getInstance().blastmining(player)) if(id == 46 && mcPermissions.getInstance().blastmining(player))
@ -80,22 +81,29 @@ public class mcBlockListener implements Listener
} }
//Check if the blocks placed should be monitored so they do not give out XP in the future //Check if the blocks placed should be monitored so they do not give out XP in the future
if(m.shouldBeWatched(block)) if(m.shouldBeWatched(mat))
{ {
//Only needed for blocks that use their block data (wood, pumpkins, etc.) //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 || id == 98) switch(mat){
case CACTUS:
case GLOWING_REDSTONE_ORE:
case JACK_O_LANTERN:
case LOG:
case PUMPKIN:
case REDSTONE_ORE:
case SUGAR_CANE_BLOCK:
case VINE:
plugin.misc.blockWatchList.add(block); plugin.misc.blockWatchList.add(block);
else break;
{ case BROWN_MUSHROOM:
//block.setData((byte) 5); //Change the byte case RED_MUSHROOM:
//The following is a method to get around a breakage in 1.1-R2 and onward case RED_ROSE:
//it should be removed as soon as functionality to change a block case YELLOW_FLOWER:
//in this event returns. case WATER_LILY:
if(id == 39 || id == 40 || id == 37 || id == 38 || id == 111 || id == 106) // ids of blocks that can be mined very quickly and need to be worked on fast plugin.fastChangeQueue.push(block);
plugin.fastChangeQueue.push(block); break;
else
plugin.changeQueue.push(block);
} }
plugin.changeQueue.push(block);
} }
if(id == LoadProperties.anvilID && LoadProperties.anvilmessages) if(id == LoadProperties.anvilID && LoadProperties.anvilmessages)
@ -187,7 +195,7 @@ public class mcBlockListener implements Listener
} }
//Change the byte back when broken //Change the byte back when broken
if(block.getData() == 5 && m.shouldBeWatched(block)) if(block.getData() == 5 && m.shouldBeWatched(block.getType()))
{ {
block.setData((byte) 0); block.setData((byte) 0);
if(plugin.misc.blockWatchList.contains(block)) if(plugin.misc.blockWatchList.contains(block))
@ -339,7 +347,7 @@ public class mcBlockListener implements Listener
{ {
Block blockFrom = event.getBlock(); Block blockFrom = event.getBlock();
Block blockTo = event.getToBlock(); Block blockTo = event.getToBlock();
if(m.shouldBeWatched(blockFrom) && blockFrom.getData() == (byte)5) if(m.shouldBeWatched(blockFrom.getType()) && blockFrom.getData() == (byte)5)
{ {
blockTo.setData((byte)5); blockTo.setData((byte)5);
} }

View File

@ -35,7 +35,6 @@ import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.EntityTameEvent; import org.bukkit.event.entity.EntityTameEvent;
import org.bukkit.event.entity.ExplosionPrimeEvent; import org.bukkit.event.entity.ExplosionPrimeEvent;
import org.bukkit.event.entity.FoodLevelChangeEvent; import org.bukkit.event.entity.FoodLevelChangeEvent;
import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.Combat; import com.gmail.nossr50.Combat;
import com.gmail.nossr50.Users; import com.gmail.nossr50.Users;
@ -345,13 +344,6 @@ public class mcEntityListener implements Listener
} }
} }
public boolean isBow(ItemStack is){
if (is.getTypeId() == 261){
return true;
} else {
return false;
}
}
public boolean isPlayer(Entity entity){ public boolean isPlayer(Entity entity){
if (entity instanceof Player) { if (entity instanceof Player) {
return true; return true;

View File

@ -23,6 +23,7 @@ import java.util.logging.Logger;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.*; import org.bukkit.entity.*;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@ -31,6 +32,7 @@ import com.gmail.nossr50.datatypes.PlayerProfile;
import com.gmail.nossr50.datatypes.SkillType; import com.gmail.nossr50.datatypes.SkillType;
import com.gmail.nossr50.events.FakeBlockBreakEvent; import com.gmail.nossr50.events.FakeBlockBreakEvent;
import com.gmail.nossr50.events.McMMOItemSpawnEvent; import com.gmail.nossr50.events.McMMOItemSpawnEvent;
import com.gmail.nossr50.skills.Repair;
public class m public class m
{ {
@ -52,13 +54,9 @@ public class m
public static int getInt(String string) public static int getInt(String string)
{ {
if(isInt(string)) if(isInt(string))
{
return Integer.parseInt(string); return Integer.parseInt(string);
}
else else
{
return 0; return 0;
}
} }
public static boolean isDouble(String string) public static boolean isDouble(String string)
@ -73,16 +71,51 @@ public class m
return true; return true;
} }
public static boolean shouldBeWatched(Block block) /**
* Checks to see if a block type awards XP.
*
* @param material Block type to check
* @return true if the block type awards XP, false otherwise
*/
public static boolean shouldBeWatched(Material material)
{ {
int id = block.getTypeId(); switch(material){
return shouldBeWatched(id); case BROWN_MUSHROOM:
} case CACTUS:
public static boolean shouldBeWatched(int id) { case CLAY:
return id == 2 || id == 3 || id == 12 || id == 13 || id == 82 || //Excavation case COAL_ORE:
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 case DIAMOND_ORE:
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 case DIRT:
id == LoadProperties.anvilID; //Anvil case ENDER_STONE:
case GLOWING_REDSTONE_ORE:
case GLOWSTONE:
case GOLD_ORE:
case GRASS:
case GRAVEL:
case IRON_ORE:
case JACK_O_LANTERN:
case LAPIS_ORE:
case LOG:
case MELON_BLOCK:
case MOSSY_COBBLESTONE:
case MYCEL:
case NETHERRACK:
case OBSIDIAN:
case PUMPKIN:
case RED_MUSHROOM:
case RED_ROSE:
case REDSTONE_ORE:
case SAND:
case SANDSTONE:
case SOUL_SAND:
case STONE:
case SUGAR_CANE_BLOCK:
case VINE:
case WATER_LILY:
case YELLOW_FLOWER:
return true;
}
return false;
} }
public static int getPowerLevel(Player player) public static int getPowerLevel(Player player)
@ -134,20 +167,19 @@ public class m
public static Integer getTier(Player player) public static Integer getTier(Player player)
{ {
int i = player.getItemInHand().getTypeId(); ItemStack is = player.getItemInHand();
if(i == 268 || i == 269 || i == 270 || i == 271 || i == 290){ if(Repair.isWoodTools(is))
return 1; //WOOD return 1;
} else if (i == 272 || i == 273 || i == 274 || i == 275 || i == 291){ if(Repair.isStoneTools(is))
return 2; //STONE return 2;
} else if (i == 256 || i == 257 || i == 258 || i == 267 || i == 292){ if(Repair.isIronTools(is))
return 3; //IRON return 3;
} else if (i == 283 || i == 284 || i == 285 || i == 286 || i == 294){ if(Repair.isGoldTools(is))
return 1; //GOLD return 1;
} else if (i == 276 || i == 277 || i == 278 || i == 279 || i == 293){ if(Repair.isDiamondTools(is))
return 4; //DIAMOND return 4;
} else {
return 1; //UNRECOGNIZED return 1;
}
} }
public static double getDistance(Location loca, Location locb) public static double getDistance(Location loca, Location locb)
@ -158,12 +190,32 @@ public class m
public static boolean abilityBlockCheck(Block block) public static boolean abilityBlockCheck(Block block)
{ {
int i = block.getTypeId(); switch(block.getType()){
if(i == 107 ||i == 117 || i == 116 || i == 96 || i == 68 || i == 355 || i == 26 || i == 323 || i == 25 || i == 54 || i == 69 || i == 92 || i == 77 || i == 58 || i == 61 || i == 62 || i == LoadProperties.anvilID || i == 71 || i == 64 || i == 84 || i == 324 || i == 330){ case BED_BLOCK:
case BREWING_STAND:
case BURNING_FURNACE:
case CAKE_BLOCK:
case CHEST:
case DISPENSER:
case ENCHANTMENT_TABLE:
case FENCE_GATE:
case FURNACE:
case IRON_DOOR_BLOCK:
case JUKEBOX:
case LEVER:
case NOTE_BLOCK:
case STONE_BUTTON:
case TRAP_DOOR:
case WALL_SIGN:
case WOODEN_DOOR:
case WORKBENCH:
return false; return false;
} else {
return true;
} }
if(block.getTypeId() == LoadProperties.anvilID)
return false;
return true;
} }
public static boolean isInt(String string) public static boolean isInt(String string)
@ -208,56 +260,130 @@ public class m
public static boolean isSwords(ItemStack is) public static boolean isSwords(ItemStack is)
{ {
int id = is.getTypeId(); switch(is.getType()){
return id == 268 || id == 267 || id == 272 || id == 283 || id == 276; case DIAMOND_SWORD:
case GOLD_SWORD:
case IRON_SWORD:
case STONE_SWORD:
case WOOD_SWORD:
return true;
}
return false;
} }
public static boolean isHoe(ItemStack is) public static boolean isHoe(ItemStack is)
{ {
int id = is.getTypeId(); switch(is.getType()){
return id == 290 || id == 291 || id == 292 || id == 293 || id == 294; case DIAMOND_HOE:
case GOLD_HOE:
case IRON_HOE:
case STONE_HOE:
case WOOD_HOE:
return true;
}
return false;
} }
public static boolean isShovel(ItemStack is) public static boolean isShovel(ItemStack is)
{ {
int id = is.getTypeId(); switch(is.getType()){
return id == 269 || id == 273 || id == 277 || id == 284 || id == 256; case DIAMOND_SPADE:
case GOLD_SPADE:
case IRON_SPADE:
case STONE_SPADE:
case WOOD_SPADE:
return true;
}
return false;
} }
public static boolean isAxes(ItemStack is) public static boolean isAxes(ItemStack is)
{ {
int id = is.getTypeId(); switch(is.getType()){
return id == 271 || id == 258 || id == 286 || id == 279 || id == 275; case DIAMOND_AXE:
case GOLD_AXE:
case IRON_AXE:
case STONE_AXE:
case WOOD_AXE:
return true;
}
return false;
} }
public static boolean isMiningPick(ItemStack is) public static boolean isMiningPick(ItemStack is)
{ {
int id = is.getTypeId(); switch(is.getType()){
return id == 270 || id == 274 || id == 285 || id == 257 || id == 278; case DIAMOND_PICKAXE:
case GOLD_PICKAXE:
case IRON_PICKAXE:
case STONE_PICKAXE:
case WOOD_PICKAXE:
return true;
}
return false;
} }
public static boolean isHelmet(ItemStack is) public static boolean isHelmet(ItemStack is)
{ {
int id = is.getTypeId(); switch(is.getType()){
return id == 298 || id == 306 || id == 310 || id == 314; case DIAMOND_HELMET:
case GOLD_HELMET:
case IRON_HELMET:
case LEATHER_HELMET:
return true;
}
return false;
} }
public static boolean isChestplate(ItemStack is) public static boolean isChestplate(ItemStack is)
{ {
int id = is.getTypeId(); switch(is.getType()){
return id == 299 || id == 307 || id == 311 || id == 315; case DIAMOND_CHESTPLATE:
case GOLD_CHESTPLATE:
case IRON_CHESTPLATE:
case LEATHER_CHESTPLATE:
return true;
}
return false;
} }
public static boolean isPants(ItemStack is) public static boolean isPants(ItemStack is)
{ {
int id = is.getTypeId(); switch(is.getType()){
return id == 300 || id == 308 || id == 312 || id == 316; case DIAMOND_LEGGINGS:
case GOLD_LEGGINGS:
case IRON_LEGGINGS:
case LEATHER_LEGGINGS:
return true;
}
return false;
} }
public static boolean isBoots(ItemStack is) public static boolean isBoots(ItemStack is)
{ {
int id = is.getTypeId(); switch(is.getType()){
return id == 301 || id == 305 || id == 313 || id == 317; case DIAMOND_BOOTS:
case GOLD_BOOTS:
case IRON_BOOTS:
case LEATHER_BOOTS:
return true;
}
return false;
}
public static boolean isOre(Block block)
{
switch (block.getType()) {
case COAL_ORE:
case DIAMOND_ORE:
case GLOWING_REDSTONE_ORE:
case GOLD_ORE:
case IRON_ORE:
case LAPIS_ORE:
case REDSTONE_ORE:
return true;
}
return false;
} }
public static void convertToMySQL() public static void convertToMySQL()

View File

@ -36,12 +36,6 @@ public class BlastMining{
int id = block.getTypeId(); int id = block.getTypeId();
ItemStack item = new ItemStack(id, 1); ItemStack item = new ItemStack(id, 1);
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;
}
switch (id){ switch (id){
//GLOWSTONE //GLOWSTONE
case 89: case 89:
@ -81,6 +75,9 @@ public class BlastMining{
item = new ItemStack(263, 1); item = new ItemStack(263, 1);
m.mcDropItem(loc, item); m.mcDropItem(loc, item);
break; break;
default:
m.mcDropItem(loc, item);
break;
} }
} }
@ -128,10 +125,9 @@ public class BlastMining{
while(iterator.hasNext()) while(iterator.hasNext())
{ {
Block temp = iterator.next(); Block temp = iterator.next();
int id = temp.getTypeId();
if(temp.getData() != 5 && !plugin.misc.blockWatchList.contains(temp)) if(temp.getData() != 5 && !plugin.misc.blockWatchList.contains(temp))
{ {
if(id == 14 || id == 15 || id == 16 || id == 21 || id == 56 || id == 73 || id == 74) if(m.isOre(temp))
ores.add(temp); ores.add(temp);
else else
debris.add(temp); debris.add(temp);

View File

@ -71,11 +71,22 @@ public class Excavation
} }
} }
public static boolean canBeGigaDrillBroken(Block block) public static boolean canBeGigaDrillBroken(Block block)
{ {
Material t = block.getType(); switch(block.getType()){
return t == Material.DIRT || t == Material.GRASS || t == Material.SAND || t == Material.GRAVEL || t == Material.CLAY || t == Material.MYCEL || t == Material.SOUL_SAND; case CLAY:
case DIRT:
case GRASS:
case GRAVEL:
case MYCEL:
case SAND:
case SOUL_SAND:
return true;
}
return false;
} }
public static void excavationProcCheck(Block block, Player player) public static void excavationProcCheck(Block block, Player player)
{ {
Material type = block.getType(); Material type = block.getType();

View File

@ -89,8 +89,25 @@ public class Herbalism
} }
public static Boolean canBeGreenTerra(Block block){ public static Boolean canBeGreenTerra(Block block){
int t = block.getTypeId(); switch(block.getType()){
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; case BROWN_MUSHROOM:
case CACTUS:
case COBBLESTONE:
case CROPS:
case DIRT:
case JACK_O_LANTERN:
case MELON_BLOCK:
case PUMPKIN:
case RED_MUSHROOM:
case RED_ROSE:
case SMOOTH_BRICK:
case SUGAR_CANE_BLOCK:
case VINE:
case WATER_LILY:
case YELLOW_FLOWER:
return true;
}
return false;
} }
public static void herbalismProcCheck(final Block block, Player player, BlockBreakEvent event, mcMMO plugin) public static void herbalismProcCheck(final Block block, Player player, BlockBreakEvent event, mcMMO plugin)
@ -112,8 +129,7 @@ public class Herbalism
//Wheat //Wheat
if(type == 59 && block.getData() == (byte) 0x7) if(type == 59 && block.getData() == (byte) 0x7)
{ {
mat = Material.getMaterial(296); is = new ItemStack(Material.WHEAT, 1);
is = new ItemStack(mat, 1, (byte)0, (byte)0);
PP.addXP(SkillType.HERBALISM, LoadProperties.mwheat, player); PP.addXP(SkillType.HERBALISM, LoadProperties.mwheat, player);
if(player != null) if(player != null)
@ -128,8 +144,7 @@ public class Herbalism
event.setCancelled(true); event.setCancelled(true);
m.mcDropItem(loc, is); m.mcDropItem(loc, is);
//DROP SOME SEEDS //DROP SOME SEEDS
mat = Material.SEEDS; is = new ItemStack(Material.SEEDS, 1);
is = new ItemStack(mat, 1, (byte)0, (byte)0);
m.mcDropItem(loc, is); m.mcDropItem(loc, is);
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
@ -158,8 +173,7 @@ public class Herbalism
//Nether Wart //Nether Wart
if(type == 115 && block.getData() == (byte) 0x3) if(type == 115 && block.getData() == (byte) 0x3)
{ {
mat = Material.getMaterial(372); is = new ItemStack(Material.NETHER_STALK, 1);
is = new ItemStack(mat, 1, (byte)0, (byte)0);
PP.addXP(SkillType.HERBALISM, LoadProperties.mnetherwart, player); PP.addXP(SkillType.HERBALISM, LoadProperties.mnetherwart, player);
if(player != null) if(player != null)
{ {
@ -200,7 +214,7 @@ public class Herbalism
{ {
if(materialArray[x] == Material.CACTUS) if(materialArray[x] == Material.CACTUS)
{ {
is = new ItemStack(Material.CACTUS, 1, (byte)0, (byte)0); is = new ItemStack(Material.CACTUS, 1);
if(byteArray[x] != (byte) 5) if(byteArray[x] != (byte) 5)
{ {
if(herbLevel > 1000 || (Math.random() * 1000 <= herbLevel)) if(herbLevel > 1000 || (Math.random() * 1000 <= herbLevel))
@ -238,7 +252,7 @@ public class Herbalism
{ {
if(materialArray[x] == Material.SUGAR_CANE_BLOCK) if(materialArray[x] == Material.SUGAR_CANE_BLOCK)
{ {
is = new ItemStack(Material.SUGAR_CANE, 1, (byte)0, (byte)0); is = new ItemStack(Material.SUGAR_CANE, 1);
//Check for being placed by the player //Check for being placed by the player
if(byteArray[x] != (byte) 5) if(byteArray[x] != (byte) 5)
{ {
@ -257,7 +271,7 @@ public class Herbalism
if((type == 91 || type == 86)) if((type == 91 || type == 86))
{ {
mat = Material.getMaterial(block.getTypeId()); mat = Material.getMaterial(block.getTypeId());
is = new ItemStack(mat, 1, (byte)0, (byte)0); is = new ItemStack(mat, 1);
if(player != null) if(player != null)
{ {
if(herbLevel > 1000 || (Math.random() * 1000 <= herbLevel)) if(herbLevel > 1000 || (Math.random() * 1000 <= herbLevel))
@ -270,8 +284,7 @@ public class Herbalism
//Melon //Melon
if(type == 103) if(type == 103)
{ {
mat = Material.getMaterial(360); is = new ItemStack(Material.MELON, 1);
is = new ItemStack(mat, 1, (byte)0, (byte)0);
if(player != null) if(player != null)
{ {
if(herbLevel > 1000 || (Math.random() * 1000 <= herbLevel)) if(herbLevel > 1000 || (Math.random() * 1000 <= herbLevel))
@ -286,7 +299,7 @@ public class Herbalism
if(type == 39 || type == 40) if(type == 39 || type == 40)
{ {
mat = Material.getMaterial(block.getTypeId()); mat = Material.getMaterial(block.getTypeId());
is = new ItemStack(mat, 1, (byte)0, (byte)0); is = new ItemStack(mat, 1);
if(player != null) if(player != null)
{ {
if(herbLevel > 1000 || (Math.random() * 1000 <= herbLevel)) if(herbLevel > 1000 || (Math.random() * 1000 <= herbLevel))
@ -299,7 +312,7 @@ public class Herbalism
//Flower //Flower
if(type == 37 || type == 38){ if(type == 37 || type == 38){
mat = Material.getMaterial(block.getTypeId()); mat = Material.getMaterial(block.getTypeId());
is = new ItemStack(mat, 1, (byte)0, (byte)0); is = new ItemStack(mat, 1);
if(player != null){ if(player != null){
if(herbLevel > 1000 || (Math.random() * 1000 <= herbLevel)) if(herbLevel > 1000 || (Math.random() * 1000 <= herbLevel))
m.mcDropItem(loc, is); m.mcDropItem(loc, is);
@ -309,8 +322,7 @@ public class Herbalism
//Lily Pads //Lily Pads
if(type == 111) if(type == 111)
{ {
mat = Material.getMaterial(block.getTypeId()); is = new ItemStack(Material.WATER_LILY, 1);
is = new ItemStack(mat, 1, (byte)0, (byte)0);
if(player != null){ if(player != null){
if(herbLevel > 1000 || (Math.random() * 1000 <= herbLevel)) if(herbLevel > 1000 || (Math.random() * 1000 <= herbLevel))
m.mcDropItem(loc, is); m.mcDropItem(loc, is);
@ -319,8 +331,7 @@ public class Herbalism
} }
//Vines //Vines
if(type == 106){ if(type == 106){
mat = Material.getMaterial(block.getTypeId()); is = new ItemStack(Material.VINE, 1, (byte)0, (byte)0);
is = new ItemStack(mat, 1, (byte)0, (byte)0);
if(player != null){ if(player != null){
if(herbLevel > 1000 || (Math.random() * 1000 <= herbLevel)) if(herbLevel > 1000 || (Math.random() * 1000 <= herbLevel))
m.mcDropItem(loc, is); m.mcDropItem(loc, is);

View File

@ -18,7 +18,6 @@ package com.gmail.nossr50.skills;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@ -73,14 +72,7 @@ public class Mining
{ {
Location loc = block.getLocation(); Location loc = block.getLocation();
int id = block.getTypeId(); int id = block.getTypeId();
Material mat = Material.getMaterial(id); ItemStack item = new ItemStack(id, 1);
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 && id != 112 && id != 121 && id != 48) {
m.mcDropItem(loc, item);
return;
}
//Drop natural block with Silk Touch //Drop natural block with Silk Touch
if(player.getItemInHand().containsEnchantment(Enchantment.SILK_TOUCH)){ if(player.getItemInHand().containsEnchantment(Enchantment.SILK_TOUCH)){
@ -91,18 +83,18 @@ public class Mining
switch (id){ switch (id){
//GLOWSTONE //GLOWSTONE
case 89: case 89:
item = new ItemStack(348, 1, (byte)0, damage); item = new ItemStack(348, 1);
m.mcDropItems(loc, item, 2); m.mcDropItems(loc, item, 2);
m.mcRandomDropItems(loc, item, 50, 2); m.mcRandomDropItems(loc, item, 50, 2);
break; break;
//REDSTONE //REDSTONE
case 73: case 73:
item = new ItemStack(331, 1, (byte)0, damage); item = new ItemStack(331, 1);
m.mcDropItems(loc, item, 4); m.mcDropItems(loc, item, 4);
m.mcRandomDropItem(loc, item, 50); m.mcRandomDropItem(loc, item, 50);
break; break;
case 74: case 74:
item = new ItemStack(331, 1, (byte)0, damage); item = new ItemStack(331, 1);
m.mcDropItems(loc, item, 4); m.mcDropItems(loc, item, 4);
m.mcRandomDropItem(loc, item, 50); m.mcRandomDropItem(loc, item, 50);
break; break;
@ -114,17 +106,20 @@ public class Mining
break; break;
//DIAMOND //DIAMOND
case 56: case 56:
item = new ItemStack(264, 1, (byte)0, damage); item = new ItemStack(264, 1);
m.mcDropItem(loc, item); m.mcDropItem(loc, item);
break; break;
//STONE //STONE
case 1: case 1:
item = new ItemStack(4, 1, (byte)0, damage); item = new ItemStack(4, 1);
m.mcDropItem(loc, item); m.mcDropItem(loc, item);
break; break;
//COAL //COAL
case 16: case 16:
item = new ItemStack(263, 1, (byte)0, damage); item = new ItemStack(263, 1);
m.mcDropItem(loc, item);
break;
default:
m.mcDropItem(loc, item); m.mcDropItem(loc, item);
break; break;
} }
@ -215,8 +210,24 @@ public class Mining
*/ */
public static Boolean canBeSuperBroken(Block block) public static Boolean canBeSuperBroken(Block block)
{ {
int id = block.getTypeId(); switch(block.getType()){
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; case COAL_ORE:
case DIAMOND_ORE:
case ENDER_STONE:
case GLOWING_REDSTONE_ORE:
case GLOWSTONE:
case GOLD_ORE:
case IRON_ORE:
case LAPIS_ORE:
case MOSSY_COBBLESTONE:
case NETHERRACK:
case OBSIDIAN:
case REDSTONE_ORE:
case SANDSTONE:
case STONE:
return true;
}
return false;
} }
public static void SuperBreakerBlockCheck(Player player, Block block, mcMMO plugin) public static void SuperBreakerBlockCheck(Player player, Block block, mcMMO plugin)

View File

@ -17,6 +17,7 @@
package com.gmail.nossr50.skills; package com.gmail.nossr50.skills;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -341,39 +342,114 @@ public class Repair {
public static boolean isArmor(ItemStack is){ public static boolean isArmor(ItemStack is){
return isLeatherArmor(is) || isGoldArmor(is) || isIronArmor(is) || isDiamondArmor(is); return isLeatherArmor(is) || isGoldArmor(is) || isIronArmor(is) || isDiamondArmor(is);
} }
public static boolean isLeatherArmor(ItemStack is){ public static boolean isLeatherArmor(ItemStack is){
return is.getTypeId() == 298 || is.getTypeId() == 299 || is.getTypeId() == 300 || is.getTypeId() == 301; switch(is.getType()){
case LEATHER_BOOTS:
case LEATHER_CHESTPLATE:
case LEATHER_HELMET:
case LEATHER_LEGGINGS:
return true;
}
return false;
} }
public static boolean isGoldArmor(ItemStack is){ public static boolean isGoldArmor(ItemStack is){
return is.getTypeId() == 314 || is.getTypeId() == 315 || is.getTypeId() == 316 || is.getTypeId() == 317; switch(is.getType()){
case GOLD_BOOTS:
case GOLD_CHESTPLATE:
case GOLD_HELMET:
case GOLD_LEGGINGS:
return true;
}
return false;
} }
public static boolean isIronArmor(ItemStack is){ public static boolean isIronArmor(ItemStack is){
return is.getTypeId() == 306 || is.getTypeId() == 307 || is.getTypeId() == 308 || is.getTypeId() == 309; switch(is.getType()){
case IRON_BOOTS:
case IRON_CHESTPLATE:
case IRON_HELMET:
case IRON_LEGGINGS:
return true;
}
return false;
} }
public static boolean isDiamondArmor(ItemStack is){ public static boolean isDiamondArmor(ItemStack is){
return is.getTypeId() == 310 || is.getTypeId() == 311 || is.getTypeId() == 312 || is.getTypeId() == 313; switch(is.getType()){
case DIAMOND_BOOTS:
case DIAMOND_CHESTPLATE:
case DIAMOND_HELMET:
case DIAMOND_LEGGINGS:
return true;
}
return false;
} }
public static boolean isTools(ItemStack is) public static boolean isTools(ItemStack is)
{ {
return isStoneTools(is) || isWoodTools(is) || isGoldTools(is) || isIronTools(is) || isDiamondTools(is) || isBow(is); return isStoneTools(is) || isWoodTools(is) || isGoldTools(is) || isIronTools(is) || isDiamondTools(is) || isBow(is);
} }
public static boolean isStoneTools(ItemStack is){ public static boolean isStoneTools(ItemStack is){
return is.getTypeId() == 272 || is.getTypeId() == 273 || is.getTypeId() == 274 || is.getTypeId() == 275 || is.getTypeId() == 291; switch(is.getType()){
case STONE_AXE:
case STONE_HOE:
case STONE_PICKAXE:
case STONE_SPADE:
case STONE_SWORD:
return true;
}
return false;
} }
public static boolean isWoodTools(ItemStack is){ public static boolean isWoodTools(ItemStack is){
return is.getTypeId() == 268 || is.getTypeId() == 269 || is.getTypeId() == 270 || is.getTypeId() == 271 || is.getTypeId() == 290; switch(is.getType()){
case WOOD_AXE:
case WOOD_HOE:
case WOOD_PICKAXE:
case WOOD_SPADE:
case WOOD_SWORD:
return true;
}
return false;
} }
public static boolean isGoldTools(ItemStack is){ public static boolean isGoldTools(ItemStack is){
return is.getTypeId() == 283 || is.getTypeId() == 285 || is.getTypeId() == 286 || is.getTypeId() == 284 || is.getTypeId() == 294; switch(is.getType()){
case GOLD_AXE:
case GOLD_HOE:
case GOLD_PICKAXE:
case GOLD_SPADE:
case GOLD_SWORD:
return true;
}
return false;
} }
public static boolean isIronTools(ItemStack is){ public static boolean isIronTools(ItemStack is){
return is.getTypeId() == 359 || is.getTypeId() == 256 || is.getTypeId() == 257 || is.getTypeId() == 258 || is.getTypeId() == 267 || is.getTypeId() == 292; switch(is.getType()){
case IRON_AXE:
case IRON_HOE:
case IRON_PICKAXE:
case IRON_SPADE:
case IRON_SWORD:
case SHEARS:
return true;
}
return false;
} }
public static boolean isDiamondTools(ItemStack is){ public static boolean isDiamondTools(ItemStack is){
return is.getTypeId() == 276 || is.getTypeId() == 277 || is.getTypeId() == 278 || is.getTypeId() == 279 || is.getTypeId() == 293; switch(is.getType()){
case DIAMOND_AXE:
case DIAMOND_HOE:
case DIAMOND_PICKAXE:
case DIAMOND_SPADE:
case DIAMOND_SWORD:
return true;
}
return false;
} }
public static boolean isBow(ItemStack is){ public static boolean isBow(ItemStack is){
return is.getTypeId() == 261; return is.getType() == Material.BOW;
} }
/** /**