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

@ -35,12 +35,6 @@ public class BlastMining{
{
int id = block.getTypeId();
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){
//GLOWSTONE
@ -81,6 +75,9 @@ public class BlastMining{
item = new ItemStack(263, 1);
m.mcDropItem(loc, item);
break;
default:
m.mcDropItem(loc, item);
break;
}
}
@ -128,10 +125,9 @@ public class BlastMining{
while(iterator.hasNext())
{
Block temp = iterator.next();
int id = temp.getTypeId();
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);
else
debris.add(temp);

View File

@ -71,11 +71,22 @@ public class Excavation
}
}
public static boolean canBeGigaDrillBroken(Block block)
{
Material t = 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;
switch(block.getType()){
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)
{
Material type = block.getType();

View File

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

View File

@ -18,7 +18,6 @@ package com.gmail.nossr50.skills;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@ -73,14 +72,7 @@ public class Mining
{
Location loc = block.getLocation();
int id = block.getTypeId();
Material mat = Material.getMaterial(id);
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;
}
ItemStack item = new ItemStack(id, 1);
//Drop natural block with Silk Touch
if(player.getItemInHand().containsEnchantment(Enchantment.SILK_TOUCH)){
@ -91,18 +83,18 @@ public class Mining
switch (id){
//GLOWSTONE
case 89:
item = new ItemStack(348, 1, (byte)0, damage);
item = new ItemStack(348, 1);
m.mcDropItems(loc, item, 2);
m.mcRandomDropItems(loc, item, 50, 2);
break;
//REDSTONE
case 73:
item = new ItemStack(331, 1, (byte)0, damage);
item = new ItemStack(331, 1);
m.mcDropItems(loc, item, 4);
m.mcRandomDropItem(loc, item, 50);
break;
case 74:
item = new ItemStack(331, 1, (byte)0, damage);
item = new ItemStack(331, 1);
m.mcDropItems(loc, item, 4);
m.mcRandomDropItem(loc, item, 50);
break;
@ -114,17 +106,20 @@ public class Mining
break;
//DIAMOND
case 56:
item = new ItemStack(264, 1, (byte)0, damage);
item = new ItemStack(264, 1);
m.mcDropItem(loc, item);
break;
//STONE
case 1:
item = new ItemStack(4, 1, (byte)0, damage);
item = new ItemStack(4, 1);
m.mcDropItem(loc, item);
break;
//COAL
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);
break;
}
@ -215,8 +210,24 @@ 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 || id == 112 || id == 121 || id == 48 || id == 98;
switch(block.getType()){
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)

View File

@ -17,6 +17,7 @@
package com.gmail.nossr50.skills;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
@ -341,39 +342,114 @@ public class Repair {
public static boolean isArmor(ItemStack is){
return isLeatherArmor(is) || isGoldArmor(is) || isIronArmor(is) || isDiamondArmor(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){
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){
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){
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)
{
return isStoneTools(is) || isWoodTools(is) || isGoldTools(is) || isIronTools(is) || isDiamondTools(is) || isBow(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){
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){
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){
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){
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){
return is.getTypeId() == 261;
return is.getType() == Material.BOW;
}
/**